Skip to content

Commit

Permalink
elyra-ai#2088 Render actions in title outside of groups
Browse files Browse the repository at this point in the history
Signed-off-by: Carita Ou <[email protected]>
  • Loading branch information
caritaou committed Aug 8, 2024
1 parent b57c7cf commit 25f5a70
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ describe("Title editor actions", () => {
expect(buttons.length).to.equal(2);

expect(buttons[0].textContent).to.equal("Increment");
expect(buttons[1].textContent).to.equal("Decrement");
expect(buttons[1].textContent).to.equal("Run");

fireEvent.click(buttons[0]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
"title_info": {
"action_refs": [
"increment",
"decrement"
"run_action"
]
},
"parameter_info": [
Expand Down Expand Up @@ -716,6 +716,14 @@
"width": 25
}
}
},
{
"id": "run_action",
"label": {
"resource_key": "run_action"
},
"control": "button",
"data": {}
}
],
"group_info": [
Expand Down Expand Up @@ -918,7 +926,6 @@
"disable_image_text"
]
}

]
},
{
Expand Down Expand Up @@ -1010,8 +1017,6 @@
}
}
}


],
"dataset_metadata": [
{
Expand Down Expand Up @@ -1085,13 +1090,14 @@
"resources": {
"increment": "Increment",
"decrement": "Decrement",
"run_action": "Run",
"dm-update": "Add Field",
"winter": "Winter",
"summer": "Summer",
"fall": "Fall",
"spring": "Spring",
"moon": "Moon",
"meteor": "Meteor",
"winter": "Winter",
"summer": "Summer",
"fall": "Fall",
"spring": "Spring",
"moon": "Moon",
"meteor": "Meteor",
"weather.action.panel.label": "Weather action panel label",
"weather.action.panel.desc": "Weather action panel description"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 Elyra Authors
* Copyright 2017-2024 Elyra Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -856,5 +856,5 @@ function _parameterValueDescription(parameter, l10nProvider) {


export {
makePrimaryTab, _makeControl as makeControl
makePrimaryTab, _makeControl as makeControl, _makeActions as makeActions
};
10 changes: 7 additions & 3 deletions canvas_modules/common-canvas/src/common-properties/form/Form.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2023 Elyra Authors
* Copyright 2017-2024 Elyra Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,7 +16,7 @@

import { PropertyDef } from "./PropertyDef";
import { propertyOf } from "lodash";
import { makePrimaryTab } from "./EditorForm";
import { makePrimaryTab, makeActions } from "./EditorForm";
import { UIItem } from "./UIItem";
import { L10nProvider } from "../util/L10nProvider";
import { translateMessages } from "./Conditions";
Expand Down Expand Up @@ -61,6 +61,10 @@ export default class Form {
tabs.push(makePrimaryTab(propDef, group, l10nProvider, containerType));
}
}
let titleActions = [];
if (propDef.titleMetadata && propDef.actionMetadata) {
titleActions = makeActions(null, propDef.actionMetadata, propDef.titleMetadata.Title, null, l10nProvider);
}

const currentParameters = propertyOf(paramDef)("current_parameters");
const data = {
Expand All @@ -76,7 +80,7 @@ export default class Form {
propDef.help,
propDef.editorSizeHint(editorSizeDefault),
propDef.pixelWidth,
[UIItem.makePrimaryTabs(tabs)],
[UIItem.makePrimaryTabs(tabs)].concat(titleActions),
_defaultButtons(),
data,
translateMessages(conditions, l10nProvider),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
"title_info": {
"action_refs": [
"increment",
"decrement"
"run_action"
]
},
"parameter_info": [
Expand Down Expand Up @@ -716,6 +716,14 @@
"width": 25
}
}
},
{
"id": "run_action",
"label": {
"resource_key": "run_action"
},
"control": "button",
"data": {}
}
],
"group_info": [
Expand Down Expand Up @@ -918,7 +926,6 @@
"disable_image_text"
]
}

]
},
{
Expand Down Expand Up @@ -1010,8 +1017,6 @@
}
}
}


],
"dataset_metadata": [
{
Expand Down Expand Up @@ -1085,13 +1090,14 @@
"resources": {
"increment": "Increment",
"decrement": "Decrement",
"run_action": "Run",
"dm-update": "Add Field",
"winter": "Winter",
"summer": "Summer",
"fall": "Fall",
"spring": "Spring",
"moon": "Moon",
"meteor": "Meteor",
"winter": "Winter",
"summer": "Summer",
"fall": "Fall",
"spring": "Spring",
"moon": "Moon",
"meteor": "Meteor",
"weather.action.panel.label": "Weather action panel label",
"weather.action.panel.desc": "Weather action panel description"
}
Expand Down

0 comments on commit 25f5a70

Please sign in to comment.