Skip to content

Commit 4b869f2

Browse files
committed
generate functionData
1 parent 83e8f15 commit 4b869f2

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,17 @@ qx.Class.define("osparc.service.Utils", {
250250
return type;
251251
},
252252

253+
getParameterValue: function(parameterData) {
254+
if (
255+
parameterData &&
256+
parameterData["outputs"] &&
257+
parameterData["outputs"]["out_1"]
258+
) {
259+
return parameterData["outputs"]["out_1"];
260+
}
261+
return null;
262+
},
263+
253264
getProbeType: function(metadata) {
254265
let type = metadata["inputs"]["in_1"]["type"];
255266
if (type === "ref_contentSchema") {

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,31 +124,32 @@ qx.Class.define("osparc.study.CreateFunction", {
124124

125125
const filePickers = osparc.study.Utils.extractFilePickers(templateData["workbench"]);
126126
filePickers.forEach(filePicker => {
127-
const fpName = filePicker["name"];
128-
functionData["input_schema"]["schema_dict"]["properties"][fpName] = {
127+
const fpLabel = filePicker["label"];
128+
functionData["input_schema"]["schema_dict"]["properties"][fpLabel] = {
129129
"type": "FileID",
130130
};
131-
functionData["default_inputs"][fpName] = "asdfasdf";
131+
const outputValue = osparc.file.FilePicker.getOutput(filePicker);
132+
functionData["default_inputs"][fpLabel] = outputValue && outputValue["path"] ? outputValue["path"] : null;
132133
});
133134

134135
const parameters = osparc.study.Utils.extractParameters(templateData["workbench"]);
135136
parameters.forEach(parameter => {
136-
const parameterName = parameter["name"];
137+
const parameterLabel = parameter["label"];
137138
const parameterMetadata = osparc.store.Services.getMetadata(parameter["key"], parameter["version"]);
138139
if (parameterMetadata) {
139-
functionData["input_schema"]["schema_dict"]["properties"][parameterName] = {
140+
functionData["input_schema"]["schema_dict"]["properties"][parameterLabel] = {
140141
"type": osparc.service.Utils.getParameterType(parameterMetadata),
141142
};
142143
}
143-
functionData["default_inputs"][parameterName] = parameter["outputs"]["out_1"];
144+
functionData["default_inputs"][parameterLabel] = osparc.service.Utils.getParameterValue(parameter);
144145
});
145146

146147
const probes = osparc.study.Utils.extractProbes(templateData["workbench"]);
147148
probes.forEach(probe => {
148-
const probeName = probe["name"];
149+
const probeLabel = probe["label"];
149150
const probeMetadata = osparc.store.Services.getMetadata(probe["key"], probe["version"]);
150151
if (probeMetadata) {
151-
functionData["output_schema"]["schema_dict"]["properties"][probeName] = {
152+
functionData["output_schema"]["schema_dict"]["properties"][probeLabel] = {
152153
"type": osparc.service.Utils.getProbeType(probeMetadata),
153154
};
154155
}

0 commit comments

Comments
 (0)