Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
this.__getConversationsPage,
this.__getPermissionsPage,
this.__getSaveAsTemplatePage,
this.__getCreateFunctionsPage,
this.__getTagsPage,
this.__getQualityPage,
this.__getClassifiersPage,
Expand Down Expand Up @@ -688,7 +689,7 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {

const id = "ServicesUpdate";
const title = this.tr("Services Updates");
const iconSrc = "@MaterialIcons/update/22";
const iconSrc = "@MaterialIcons/update/24";
const page = this.__servicesUpdatePage = new osparc.dashboard.resources.pages.BasePage(title, iconSrc, id);
this.__addOpenButton(page);

Expand Down Expand Up @@ -801,6 +802,29 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
return page;
}
return null;
},

__getCreateFunctionsPage: function() {
if (!osparc.utils.Resources.isStudy(this.__resourceData)) {
return null;
}

if (!osparc.study.Utils.canCreateFunction(this.__resourceData["workbench"])) {
return null;
}

const id = "CreateFunction";
const iconSrc = "@MaterialIcons/functions/24";
const title = this.tr("Create Function");
const page = new osparc.dashboard.resources.pages.BasePage(title, iconSrc, id);
const createFunction = new osparc.study.CreateFunction(this.__resourceData);
const createFunctionButton = createFunction.getCreateFunctionButton();
osparc.dashboard.resources.pages.BasePage.decorateHeaderButton(createFunctionButton);
const toolbar = this.self().createToolbar();
toolbar.add(createFunctionButton);
page.addToHeader(toolbar);
page.addToContent(createFunction);
return page;
}
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,18 @@ qx.Class.define("osparc.data.Resources", {
}
}
},
/*
* FUNCTIONS
*/
"functions": {
useCache: false,
endpoints: {
getPage: {
method: "POST",
url: statics.API + "/functions"
}
}
},
/*
* TASKS
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ qx.Class.define("osparc.form.renderer.PropForm", {
const supportedTypes = [];
const paramsMD = osparc.store.Services.getParametersMetadata();
paramsMD.forEach(paramMD => {
supportedTypes.push(osparc.node.ParameterEditor.getParameterOutputTypeFromMD(paramMD));
supportedTypes.push(osparc.service.Utils.getParameterType(paramMD));
});
return supportedTypes.includes(field.type);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,9 @@ qx.Class.define("osparc.node.ParameterEditor", {
},

statics: {
getParameterOutputTypeFromMD: function(metadata) {
let type = metadata["outputs"]["out_1"]["type"];
if (type === "ref_contentSchema") {
type = metadata["outputs"]["out_1"]["contentSchema"]["type"];
}
return type;
},

getParameterOutputType: function(node) {
const metadata = node.getMetaData();
return this.self().getParameterOutputTypeFromMD(metadata);
return osparc.service.Utils.getParameterType(metadata);
},

setParameterOutputValue: function(node, val) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,33 @@ qx.Class.define("osparc.service.Utils", {
}
});
return services;
}
},

getParameterType: function(metadata) {
let type = metadata["outputs"]["out_1"]["type"];
if (type === "ref_contentSchema") {
type = metadata["outputs"]["out_1"]["contentSchema"]["type"];
}
return type;
},

getParameterValue: function(parameterData) {
if (
parameterData &&
parameterData["outputs"] &&
parameterData["outputs"]["out_1"]
) {
return parameterData["outputs"]["out_1"];
}
return null;
},

getProbeType: function(metadata) {
let type = metadata["inputs"]["in_1"]["type"];
if (type === "ref_contentSchema") {
type = metadata["inputs"]["in_1"]["contentSchema"]["type"];
}
return type;
},
}
});
Loading
Loading