Skip to content

Commit 4f165f3

Browse files
committed
Changes to create function frontend
1 parent db30f3d commit 4f165f3

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

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

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ qx.Class.define("osparc.study.CreateFunction", {
2222
/**
2323
* @param studyData {Object} Object containing part or the entire serialized Study Data
2424
*/
25-
construct: function(studyData) {
25+
construct: function (studyData) {
2626
this.base(arguments);
2727

2828
this._setLayout(new qx.ui.layout.VBox(20));
@@ -33,7 +33,7 @@ qx.Class.define("osparc.study.CreateFunction", {
3333
},
3434

3535
statics: {
36-
typeToFunctionType: function(type) {
36+
typeToFunctionType: function (type) {
3737
switch (type) {
3838
case "number":
3939
return "float"
@@ -43,25 +43,27 @@ qx.Class.define("osparc.study.CreateFunction", {
4343
return type;
4444
},
4545

46-
createFunctionData: function(projectData, name, description, exposedInputs, exposedOutputs) {
46+
createFunctionData: function (projectData, name, description, exposedInputs, exposedOutputs) {
4747
const functionData = {
48-
"project_id": projectData["uuid"],
48+
"projectId": projectData["uuid"],
4949
"name": name,
5050
"description": description,
51-
"function_class": "project",
52-
"input_schema": {
51+
"function_class": "PROJECT",
52+
"inputSchema": {
53+
"schema_class": "application/schema+json",
5354
"schema_dict": {
5455
"type": "object",
5556
"properties": {}
5657
}
5758
},
58-
"output_schema": {
59+
"outputSchema": {
60+
"schema_class": "application/schema+json",
5961
"schema_dict": {
6062
"type": "object",
6163
"properties": {}
6264
}
6365
},
64-
"default_inputs": {},
66+
"defaultInputs": {},
6567
};
6668

6769
const parameters = osparc.study.Utils.extractFunctionableParameters(projectData["workbench"]);
@@ -71,11 +73,11 @@ qx.Class.define("osparc.study.CreateFunction", {
7173
const parameterMetadata = osparc.store.Services.getMetadata(parameter["key"], parameter["version"]);
7274
if (parameterMetadata) {
7375
const type = osparc.service.Utils.getParameterType(parameterMetadata);
74-
functionData["input_schema"]["schema_dict"]["properties"][parameterLabel] = {
76+
functionData["inputSchema"]["schema_dict"]["properties"][parameterLabel] = {
7577
"type": this.self().typeToFunctionType(type),
7678
};
7779
}
78-
functionData["default_inputs"][parameterLabel] = osparc.service.Utils.getParameterValue(parameter);
80+
functionData["defaultInputs"][parameterLabel] = osparc.service.Utils.getParameterValue(parameter);
7981
}
8082
});
8183

@@ -86,7 +88,7 @@ qx.Class.define("osparc.study.CreateFunction", {
8688
const probeMetadata = osparc.store.Services.getMetadata(probe["key"], probe["version"]);
8789
if (probeMetadata) {
8890
const type = osparc.service.Utils.getProbeType(probeMetadata);
89-
functionData["output_schema"]["schema_dict"]["properties"][probeLabel] = {
91+
functionData["outputSchema"]["schema_dict"]["properties"][probeLabel] = {
9092
"type": this.self().typeToFunctionType(type),
9193
};
9294
}
@@ -102,7 +104,7 @@ qx.Class.define("osparc.study.CreateFunction", {
102104
__form: null,
103105
__createFunctionBtn: null,
104106

105-
__buildLayout: function() {
107+
__buildLayout: function () {
106108
const form = this.__form = new qx.ui.form.Form();
107109
this._add(new qx.ui.form.renderer.Single(form));
108110

@@ -281,7 +283,7 @@ qx.Class.define("osparc.study.CreateFunction", {
281283
}, this);
282284
},
283285

284-
__createFunction: function(exposedInputs, exposedOutputs) {
286+
__createFunction: function (exposedInputs, exposedOutputs) {
285287
this.__createFunctionBtn.setFetching(true);
286288

287289
// first publish it as a template
@@ -309,7 +311,7 @@ qx.Class.define("osparc.study.CreateFunction", {
309311
});
310312
},
311313

312-
__doCreateFunction: function(templateData, exposedInputs, exposedOutputs) {
314+
__doCreateFunction: function (templateData, exposedInputs, exposedOutputs) {
313315
const nameField = this.__form.getItem("name");
314316
const descriptionField = this.__form.getItem("description");
315317

@@ -325,7 +327,7 @@ qx.Class.define("osparc.study.CreateFunction", {
325327
.finally(() => this.__createFunctionBtn.setFetching(false));
326328
},
327329

328-
getCreateFunctionButton: function() {
330+
getCreateFunctionButton: function () {
329331
return this.__createFunctionBtn;
330332
}
331333
}

0 commit comments

Comments
 (0)