Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ qx.Class.define("osparc.data.Resources", {
},
postToTemplate: {
method: "POST",
url: statics.API + "/projects?from_study={study_id}&as_template=true&copy_data={copy_data}"
url: statics.API + "/projects?from_study={study_id}&as_template=true&copy_data={copy_data}&hidden={hidden}"
},
open: {
method: "POST",
Expand Down Expand Up @@ -303,6 +303,10 @@ qx.Class.define("osparc.data.Resources", {
method: "POST",
url: statics.API + "/projects/{studyId}/workspaces/{workspaceId}:move"
},
updateMetadata: {
method: "PATCH",
url: statics.API + "/projects/{studyId}/metadata"
},
}
},
"conversations": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ qx.Class.define("osparc.desktop.MainPage", {
const params = {
url: {
"study_id": studyId,
"copy_data": copyData
"copy_data": copyData,
"hidden": false,
},
};
const options = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,12 @@ qx.Class.define("osparc.study.CreateFunction", {
__createFunction: function(exposedInputs, exposedOutputs) {
this.__createFunctionBtn.setFetching(true);

// first publish it as a template
// first publish it as a hidden template
const params = {
url: {
"study_id": this.__studyData["uuid"],
"copy_data": true,
"hidden": true,
},
};
const options = {
Expand All @@ -298,7 +299,8 @@ qx.Class.define("osparc.study.CreateFunction", {
.then(task => {
task.addListener("resultReceived", e => {
const templateData = e.getData();
this.__doCreateFunction(templateData, exposedInputs, exposedOutputs);
this.__updateTemplateMetadata(templateData);
this.__registerFunction(templateData, exposedInputs, exposedOutputs);
});
})
.catch(err => {
Expand All @@ -307,13 +309,27 @@ qx.Class.define("osparc.study.CreateFunction", {
});
},

__doCreateFunction: function(templateData, exposedInputs, exposedOutputs) {
__updateTemplateMetadata: function(templateData) {
const patchData = {
"custom" : {
"hidden": "Base template for function",
}
};
const params = {
url: {
"studyId": templateData["uuid"],
},
data: patchData
};
osparc.data.Resources.fetch("studies", "updateMetadata", params)
.catch(err => console.error(err));
},

__registerFunction: function(templateData, exposedInputs, exposedOutputs) {
const nameField = this.__form.getItem("name");
const descriptionField = this.__form.getItem("description");

const functionData = this.self().createFunctionData(templateData, nameField.getValue(), descriptionField.getValue(), exposedInputs, exposedOutputs);
console.log("functionData", functionData);

const params = {
data: functionData,
};
Expand Down
Loading