Skip to content

Commit 92794e2

Browse files
committed
CREATE_FUNCTION_TEXT
1 parent ddeb2e9 commit 92794e2

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -960,14 +960,14 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
960960
return;
961961
}
962962

963-
if (!osparc.study.CreateFunction.isPotentialFunction(this.__resourceData["workbench"])) {
964-
return;
965-
}
963+
const isPotentialFunction = osparc.study.CreateFunction.isPotentialFunction(this.__resourceData["workbench"]);
966964

967965
const id = "CreateFunction";
968966
const iconSrc = "@MaterialIcons/functions/24";
969967
const title = this.tr("Create Function");
970968
const page = new osparc.dashboard.resources.pages.BasePage(title, iconSrc, id);
969+
page.setEnabled(isPotentialFunction);
970+
page.getChildControl("button").setToolTipText(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/study/CreateFunction.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@ qx.Class.define("osparc.study.CreateFunction", {
3333
},
3434

3535
statics: {
36-
isPotentialFunction: function(workbench) {
37-
// in order to create a function, the pipeline needs:
38-
// - at least one parameter AND one probe
39-
// - for now, only float types are allowed
40-
// - at least one computational service
41-
// - no dynamic services
36+
CREATE_FUNCTION_TEXT: qx.locale.Manager.tr(`
37+
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
41+
`),
4242

43+
isPotentialFunction: function(workbench) {
4344
// const filePickers = osparc.study.Utils.extractFilePickers(workbench);
4445
// const parameters = osparc.study.Utils.extractParameters(workbench);
4546
// const probes = osparc.study.Utils.extractProbes(workbench);
@@ -50,15 +51,15 @@ qx.Class.define("osparc.study.CreateFunction", {
5051
const computationals = osparc.study.Utils.extractComputationalServices(workbench);
5152
const dynamics = osparc.study.Utils.extractDynamicServices(workbench);
5253

53-
return (
54+
return Boolean(
5455
(parameters.length && probes.length) &&
5556
computationals.length > 0 &&
5657
dynamics.length === 0
5758
);
5859
},
5960

6061
checkExposedInputsOutputs: function(exposedInputs, exposedOutputs) {
61-
return Object.values(exposedInputs).some(exposedInputValue => exposedInputValue) && Object.values(exposedOutputs).some(exposedOutputValue => exposedOutputValue);
62+
return Boolean(Object.values(exposedInputs).some(exposedInputValue => exposedInputValue) && Object.values(exposedOutputs).some(exposedOutputValue => exposedOutputValue));
6263
},
6364
},
6465

0 commit comments

Comments
 (0)