Skip to content

Commit e862d3f

Browse files
committed
tooltipOnDisabledButton
1 parent 92794e2 commit e862d3f

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

services/static-webserver/client/source/class/osparc/dashboard/ResourceDetails.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
967967
const title = this.tr("Create Function");
968968
const page = new osparc.dashboard.resources.pages.BasePage(title, iconSrc, id);
969969
page.setEnabled(isPotentialFunction);
970-
page.getChildControl("button").setToolTipText(osparc.study.CreateFunction.CREATE_FUNCTION_TEXT);
970+
osparc.utils.Utils.toolTipTextOnDisabledWidget(page.getChildControl("button"), osparc.study.CreateFunction.CREATE_FUNCTION_TEXT);
971971
const createFunction = new osparc.study.CreateFunction(this.__resourceData);
972972
const createFunctionButton = createFunction.getCreateFunctionButton();
973973
osparc.utils.Utils.setIdToWidget(createFunctionButton, "create_function_page_btn");

services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -939,11 +939,9 @@ qx.Class.define("osparc.form.renderer.PropForm", {
939939
converter: label => label + ": " + fromPortLabel
940940
});
941941

942-
// Hack: Show tooltip if element is disabled
943942
const addToolTip = () => {
944-
ctrlLink.getContentElement().removeAttribute("title");
945943
const toolTipText = fromNode.getLabel() + ":\n" + fromPortLabel;
946-
ctrlLink.getContentElement().setAttribute("title", toolTipText);
944+
osparc.utils.Utils.toolTipTextOnDisabledWidget(ctrlLink, toolTipText);
947945
};
948946
fromNode.addListener("changeLabel", () => addToolTip());
949947
addToolTip();

services/static-webserver/client/source/class/osparc/study/CreateFunction.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ qx.Class.define("osparc.study.CreateFunction", {
3535
statics: {
3636
CREATE_FUNCTION_TEXT: qx.locale.Manager.tr(`
3737
In order to Create a Function, the pipeline needs:
38-
<br>- at least one parameter and one probe (numbers)
39-
<br>- at least one computational app
40-
<br>- no dynamic apps
38+
- at least one parameter and one probe (numbers)
39+
- at least one computational app
40+
- no dynamic apps
4141
`),
4242

4343
isPotentialFunction: function(workbench) {

services/static-webserver/client/source/class/osparc/utils/Utils.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ qx.Class.define("osparc.utils.Utils", {
9191

9292
FLOATING_Z_INDEX: 1000001 + 1,
9393

94+
toolTipTextOnDisabledWidget: function(widget, toolTipText) {
95+
if (widget && widget.getContentElement()) {
96+
const el = widget.getContentElement();
97+
el.removeAttribute("title");
98+
el.setAttribute("title", toolTipText);
99+
}
100+
},
101+
94102
errorsToForm: function(form, errors) {
95103
const items = form.getItems();
96104
// reset validity

0 commit comments

Comments
 (0)