Skip to content

Commit

Permalink
Enable automatic exclusion of non-required dependencies in the Publis…
Browse files Browse the repository at this point in the history
…hing Wizard #6415
  • Loading branch information
edloidas authored and alansemenov committed Jun 22, 2023
1 parent 6f9eb15 commit 034b43b
Show file tree
Hide file tree
Showing 15 changed files with 339 additions and 62 deletions.
6 changes: 4 additions & 2 deletions modules/app/src/main/resources/services/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ function handleGet() {
const context = contextLib.get();
const branch = context.branch;
const allowContentUpdate = app.config['publishingWizard.allowContentUpdate'] !== 'false';
const excludeDependencies = app.config['publishingWizard.excludeDependencies'] === 'true' || false;
const allowPathTransliteration = app.config['contentWizard.allowPathTransliteration'] !== 'false';
const enableCollaboration = app.config['contentWizard.enableCollaboration'] !== 'false';
const hideDefaultProject = app.config['settings.hideDefaultProject'] !== 'false';
Expand All @@ -17,14 +18,15 @@ function handleGet() {
contentType: 'application/json',
body: {
allowContentUpdate,
excludeDependencies,
allowPathTransliteration,
adminUrl: admin.getBaseUri(),
assetsUri: portal.assetUrl({
path: ''
}),
toolUri: admin.getToolUrl(
app.name,
'main'
app.name,
'main'
),
appId: app.name,
appVersion: app.version,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ export abstract class BasePublishDialog
this.lockControls();
}

setKeepDependencies(keepDependencies: boolean): void {
this.publishProcessor.setKeepDependencies(keepDependencies);
}

getButtonRow(): DropdownButtonRow {
return super.getButtonRow() as DropdownButtonRow;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import {ModalDialog} from '@enonic/lib-admin-ui/ui/dialog/ModalDialog';
import {IssueDetailsDialog} from './view/IssueDetailsDialog';
import {IssueListDialog} from './view/IssueListDialog';
import {Issue} from './Issue';
import {CreateIssueDialog} from './view/CreateIssueDialog';
import {GetIssueRequest} from './resource/GetIssueRequest';
import {ContentPublishPromptEvent} from '../browse/ContentPublishPromptEvent';
import {ContentSummaryAndCompareStatus} from '../content/ContentSummaryAndCompareStatus';
import {ContentPublishDialog} from '../publish/ContentPublishDialog';
import {ContentPublishPromptEvent} from '../browse/ContentPublishPromptEvent';
import {IssueServerEventsHandler} from './event/IssueServerEventsHandler';
import {RequestContentPublishDialog} from '../publish/RequestContentPublishDialog';
import {IssueServerEventsHandler} from './event/IssueServerEventsHandler';
import {Issue} from './Issue';
import {GetIssueRequest} from './resource/GetIssueRequest';
import {CreateIssueDialog} from './view/CreateIssueDialog';
import {IssueDetailsDialog} from './view/IssueDetailsDialog';
import {IssueListDialog} from './view/IssueListDialog';

export class IssueDialogsManager {

Expand Down Expand Up @@ -56,6 +56,7 @@ export class IssueDialogsManager {
if (this.detailsDialog.isOpen()) {
this.detailsDialog.getEl().focus();
}
this.publishDialog.setKeepDependencies(false);
this.publishDialog.unClosed(this.publishDialogCloseHandler);
this.detailsDialog.onClosed(this.detailsDialogCloseHandler);
IssueServerEventsHandler.getInstance().unIssueUpdated(this.issueUpdateHandler);
Expand Down Expand Up @@ -142,6 +143,7 @@ export class IssueDialogsManager {
ContentPublishPromptEvent.on(() => {
if (this.detailsDialog.isOpen()) {
this.detailsDialog.unClosed(this.detailsDialogCloseHandler);
this.publishDialog.setKeepDependencies(true);
this.publishDialog.onCloseButtonClicked(this.publishDialogBeforeClosedHandler);
this.publishDialog.onClosed(this.publishDialogCloseHandler);
this.issue = this.detailsDialog.getIssue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export class IssueDetailsDialog

this.initActions();

this.publishProcessor = new PublishProcessor(this.getItemList(), this.getDependantList());
this.publishProcessor = new PublishProcessor(this.getItemList(), this.getDependantList(), true);
this.publishProcessor.setIgnoreSilent(true);

this.commentTextArea = new IssueCommentTextArea();
Expand Down Expand Up @@ -813,7 +813,7 @@ export class IssueDetailsDialog

private initItemListTogglers(itemList: PublishDialogItemList): boolean {
return itemList.getItemViews().reduce((wasAnyIncluded, itemView) => {
const isIncluded = itemView.toggleIncludeChildren(this.areChildrenIncludedInIssue(itemView.getContentId()));
const isIncluded = itemView.toggleIncludeChildren(this.areChildrenIncludedInIssue(itemView.getContentId())); //
return isIncluded || wasAnyIncluded;
}, false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class PublishDialogItemList
return !!this.config.allowOnlyItemRemoval || this.getItemCount() > 1;
}

public setExcludeChildrenIds(ids: ContentId[]) {
setExcludeChildrenIds(ids: ContentId[]) {
this.excludeChildrenIds = ids;

this.getItemViews().forEach(itemView => {
Expand All @@ -103,17 +103,21 @@ export class PublishDialogItemList
this.debounceNotifyListChanged();
}

public getExcludeChildrenIds(): ContentId[] {
getExcludeChildrenIds(): ContentId[] {
return this.excludeChildrenIds.slice();
}

public clearExcludeChildrenIds() {
clearExcludeChildrenIds() {
this.excludeChildrenIds = [];
}

getIncludeChildrenIds(): ContentId[] {
return this.getItemsIds().filter(id => !ArrayHelper.contains(this.excludeChildrenIds, id));
}

removeItemsByIds(contentIds: ContentId[]) {
contentIds.forEach((id: ContentId) => {
const item: ContentSummaryAndCompareStatus = this.getItem(id.toString());
const item: ContentSummaryAndCompareStatus = this.getItem(id.toString());

if (item) {
this.removeItem(item, true);
Expand Down
Loading

0 comments on commit 034b43b

Please sign in to comment.