Skip to content

Commit 83e8f15

Browse files
committed
functionData
1 parent e38ef8b commit 83e8f15

File tree

3 files changed

+55
-23
lines changed

3 files changed

+55
-23
lines changed

services/static-webserver/client/source/class/osparc/node/ParameterEditor.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,9 @@ qx.Class.define("osparc.node.ParameterEditor", {
2929
},
3030

3131
statics: {
32-
getParameterOutputTypeFromMD: function(metadata) {
33-
let type = metadata["outputs"]["out_1"]["type"];
34-
if (type === "ref_contentSchema") {
35-
type = metadata["outputs"]["out_1"]["contentSchema"]["type"];
36-
}
37-
return type;
38-
},
39-
4032
getParameterOutputType: function(node) {
4133
const metadata = node.getMetaData();
42-
return this.self().getParameterOutputTypeFromMD(metadata);
34+
return osparc.service.Utils.getParameterType(metadata);
4335
},
4436

4537
setParameterOutputValue: function(node, val) {

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,22 @@ qx.Class.define("osparc.service.Utils", {
240240
}
241241
});
242242
return services;
243-
}
243+
},
244+
245+
getParameterType: function(metadata) {
246+
let type = metadata["outputs"]["out_1"]["type"];
247+
if (type === "ref_contentSchema") {
248+
type = metadata["outputs"]["out_1"]["contentSchema"]["type"];
249+
}
250+
return type;
251+
},
252+
253+
getProbeType: function(metadata) {
254+
let type = metadata["inputs"]["in_1"]["type"];
255+
if (type === "ref_contentSchema") {
256+
type = metadata["inputs"]["in_1"]["contentSchema"]["type"];
257+
}
258+
return type;
259+
},
244260
}
245261
});

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

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -110,28 +110,52 @@ qx.Class.define("osparc.study.CreateFunction", {
110110
"input_schema": {
111111
"schema_dict": {
112112
"type": "object",
113-
"properties": {
114-
"input1": {
115-
"type": "integer" // InputTypes: TypeAlias = FileID | float | int | bool | str | list
116-
}
117-
}
113+
"properties": {}
118114
}
119115
},
120116
"output_schema": {
121117
"schema_dict": {
122118
"type": "object",
123-
"properties": {
124-
"output1": {
125-
"type": "integer" // OutputTypes: TypeAlias = FileID | float | int | bool | str | list
126-
}
127-
}
119+
"properties": {}
128120
}
129121
},
130-
"default_inputs": {
131-
"input1": 5
132-
},
122+
"default_inputs": {},
133123
};
134124

125+
const filePickers = osparc.study.Utils.extractFilePickers(templateData["workbench"]);
126+
filePickers.forEach(filePicker => {
127+
const fpName = filePicker["name"];
128+
functionData["input_schema"]["schema_dict"]["properties"][fpName] = {
129+
"type": "FileID",
130+
};
131+
functionData["default_inputs"][fpName] = "asdfasdf";
132+
});
133+
134+
const parameters = osparc.study.Utils.extractParameters(templateData["workbench"]);
135+
parameters.forEach(parameter => {
136+
const parameterName = parameter["name"];
137+
const parameterMetadata = osparc.store.Services.getMetadata(parameter["key"], parameter["version"]);
138+
if (parameterMetadata) {
139+
functionData["input_schema"]["schema_dict"]["properties"][parameterName] = {
140+
"type": osparc.service.Utils.getParameterType(parameterMetadata),
141+
};
142+
}
143+
functionData["default_inputs"][parameterName] = parameter["outputs"]["out_1"];
144+
});
145+
146+
const probes = osparc.study.Utils.extractProbes(templateData["workbench"]);
147+
probes.forEach(probe => {
148+
const probeName = probe["name"];
149+
const probeMetadata = osparc.store.Services.getMetadata(probe["key"], probe["version"]);
150+
if (probeMetadata) {
151+
functionData["output_schema"]["schema_dict"]["properties"][probeName] = {
152+
"type": osparc.service.Utils.getProbeType(probeMetadata),
153+
};
154+
}
155+
});
156+
157+
console.log("functionData", functionData);
158+
135159
const params = {
136160
data: functionData,
137161
};

0 commit comments

Comments
 (0)