Skip to content

Commit

Permalink
#2088 Title actions should not be displayed after form (#2098)
Browse files Browse the repository at this point in the history
Signed-off-by: Carita Ou <[email protected]>
  • Loading branch information
caritaou authored Aug 9, 2024
1 parent d08f359 commit 5ddb617
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
14 changes: 9 additions & 5 deletions canvas_modules/common-canvas/src/common-properties/form/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { Size } from "../constants/form-constants";
import { CONTAINER_TYPE } from "../constants/constants";

export default class Form {
constructor(componentId, label, labelEditable, help, editorSize, pixelWidth, uiItems, buttons, data, conditions, resources, icon, heading, title) {
constructor(componentId, label, labelEditable, help, editorSize, pixelWidth, uiItems, buttons, data, conditions, resources, icon, heading, title, titleUiItems) {
this.componentId = componentId;
this.label = label;
this.labelEditable = labelEditable;
Expand All @@ -41,6 +41,9 @@ export default class Form {
if (title) {
this.title = title;
}
if (titleUiItems?.length > 0) {
this.titleUiItems = titleUiItems;
}
}

/**
Expand All @@ -61,9 +64,9 @@ export default class Form {
tabs.push(makePrimaryTab(propDef, group, l10nProvider, containerType));
}
}
let titleActions = [];
let titleUiItems = [];
if (propDef.titleMetadata && propDef.actionMetadata) {
titleActions = makeActions(null, propDef.actionMetadata, propDef.titleMetadata.Title, null, l10nProvider);
titleUiItems = makeActions(null, propDef.actionMetadata, propDef.titleMetadata.Title, null, l10nProvider);
}

const currentParameters = propertyOf(paramDef)("current_parameters");
Expand All @@ -80,14 +83,15 @@ export default class Form {
propDef.help,
propDef.editorSizeHint(editorSizeDefault),
propDef.pixelWidth,
[UIItem.makePrimaryTabs(tabs)].concat(titleActions),
[UIItem.makePrimaryTabs(tabs)],
_defaultButtons(),
data,
translateMessages(conditions, l10nProvider),
resources,
propDef.icon,
l10nProvider.l10nResource(propDef.heading),
propDef.titleMetadata
propDef.titleMetadata,
titleUiItems
);
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ export default class PropertiesController {
this._parseUiConditions();
// should be done before running any validations
const controls = [];
UiConditionsParser.parseControls(controls, this.actions, this.form);
UiConditionsParser.parseControls(controls, this.actions, this.form); // parse form uiItems
UiConditionsParser.parseControls(null, this.actions, { uiItems: this.form.titleUiItems }); // parse title_info uiItems
this.saveControls(controls); // saves controls without the subcontrols
this._parseSummaryControls(controls);
this.parsePanelTree();
Expand Down

0 comments on commit 5ddb617

Please sign in to comment.