Skip to content

Commit 66c3a89

Browse files
committed
template as property
1 parent 714405f commit 66c3a89

File tree

2 files changed

+15
-20
lines changed

2 files changed

+15
-20
lines changed

services/static-webserver/client/source/class/osparc/dashboard/ResourceDetails.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,17 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
7575
});
7676
break;
7777
case "function": {
78-
// use function's underlying template info to fetch services metadata
79-
// osparc.store.Templates.fetchTemplate(resourceData["uuid"]);
80-
osparc.store.Services.getStudyServicesMetadata(latestResourceData)
81-
.finally(() => {
82-
this.__resourceModel = new osparc.data.model.Function(latestResourceData);
83-
this.__resourceModel["resourceType"] = resourceData["resourceType"];
84-
this.__resourceData["services"] = resourceData["services"];
85-
this.__addPages();
78+
osparc.store.Templates.fetchTemplate(resourceData["templateId"])
79+
.then(templateData => {
80+
osparc.store.Services.getStudyServicesMetadata(templateData)
81+
.finally(() => {
82+
this.__resourceModel = new osparc.data.model.Function(latestResourceData);
83+
this.__resourceModel["resourceType"] = resourceData["resourceType"];
84+
const template = new osparc.data.model.Study(templateData);
85+
this.__resourceModel.setTemplate(template);
86+
this.__resourceData["services"] = resourceData["services"];
87+
this.__addPages();
88+
});
8689
});
8790
break;
8891
}

services/static-webserver/client/source/class/osparc/data/model/Function.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ qx.Class.define("osparc.data.model.Function", {
4040
creationDate: functionData.creationDate ? new Date(functionData.creationDate) : this.getCreationDate(),
4141
lastChangeDate: functionData.lastChangeDate ? new Date(functionData.lastChangeDate) : this.getLastChangeDate(),
4242
thumbnail: functionData.thumbnail || this.getThumbnail(),
43-
workbenchData: functionData.workbench || this.getWorkbenchData(),
44-
functionUIData: functionData.ui || this.getFunctionUIData(),
4543
});
4644
},
4745

@@ -123,16 +121,10 @@ qx.Class.define("osparc.data.model.Function", {
123121
init: null
124122
},
125123

126-
workbenchData: {
127-
check: "Object",
128-
nullable: false,
129-
init: {},
130-
},
131-
132-
functionUIData: {
133-
check: "Object",
134-
nullable: false,
135-
init: {},
124+
template: {
125+
check: "osparc.data.model.Study",
126+
nullable: true,
127+
init: null,
136128
},
137129
},
138130

0 commit comments

Comments
 (0)