Skip to content

Commit e95dfb9

Browse files
committed
updateFunctionData
1 parent 06c0cda commit e95dfb9

File tree

5 files changed

+31
-2
lines changed

5 files changed

+31
-2
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
4141
"updateStudy": "qx.event.type.Data",
4242
"updateTemplate": "qx.event.type.Data",
4343
"updateTutorial": "qx.event.type.Data",
44+
"updateFunction": "qx.event.type.Data",
4445
"updateService": "qx.event.type.Data",
4546
"updateHypertool": "qx.event.type.Data",
4647
"publishTemplate": "qx.event.type.Data",
@@ -1051,6 +1052,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
10511052
"updateStudy",
10521053
"updateTemplate",
10531054
"updateTutorial",
1055+
"updateFunction",
10541056
"updateService",
10551057
"updateHypertool",
10561058
].forEach(ev => {

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {
282282
resourcesContainer.addListener("updateStudy", e => this._updateStudyData(e.getData()));
283283
resourcesContainer.addListener("updateTemplate", e => this._updateTemplateData(e.getData()));
284284
resourcesContainer.addListener("updateTutorial", e => this._updateTutorialData(e.getData()));
285+
resourcesContainer.addListener("updateFunction", e => this._updateFunctionData(e.getData()));
285286
resourcesContainer.addListener("updateService", e => this._updateServiceData(e.getData()));
286287
resourcesContainer.addListener("updateHypertool", e => this._updateHypertoolData(e.getData()));
287288
resourcesContainer.addListener("publishTemplate", e => this.fireDataEvent("publishTemplate", e.getData()));
@@ -692,7 +693,11 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {
692693
}
693694
},
694695

695-
updateTutorialData: function(tutorialData) {
696+
_updateTutorialData: function(tutorialData) {
697+
throw new Error("Abstract method called!");
698+
},
699+
700+
_updateFunctionData: function(functionData) {
696701
throw new Error("Abstract method called!");
697702
},
698703

@@ -926,6 +931,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {
926931
resourceDetails.addListener("updateStudy", e => this._updateStudyData(e.getData()));
927932
resourceDetails.addListener("updateTemplate", e => this._updateTemplateData(e.getData()));
928933
resourceDetails.addListener("updateTutorial", e => this._updateTutorialData(e.getData()));
934+
resourceDetails.addListener("updateFunction", e => this._updateFunctionData(e.getData()));
929935
resourceDetails.addListener("updateService", e => this._updateServiceData(e.getData()));
930936
resourceDetails.addListener("updateHypertool", e => this._updateHypertoolData(e.getData()));
931937
resourceDetails.addListener("publishTemplate", e => {

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
7676
"updateStudy": "qx.event.type.Data",
7777
"updateTemplate": "qx.event.type.Data",
7878
"updateTutorial": "qx.event.type.Data",
79+
"updateFunction": "qx.event.type.Data",
7980
"updateService": "qx.event.type.Data",
8081
"updateHypertool": "qx.event.type.Data",
8182
"publishTemplate": "qx.event.type.Data",
@@ -300,6 +301,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
300301
"updateStudy",
301302
"updateTemplate",
302303
"updateTutorial",
304+
"updateFunction",
303305
"updateService",
304306
"updateHypertool",
305307
"publishTemplate",

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ 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"]);
7880
osparc.store.Services.getStudyServicesMetadata(latestResourceData)
7981
.finally(() => {
8082
this.__resourceModel = new osparc.data.model.Function(latestResourceData);
@@ -105,6 +107,7 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
105107
"updateStudy": "qx.event.type.Data",
106108
"updateTemplate": "qx.event.type.Data",
107109
"updateTutorial": "qx.event.type.Data",
110+
"updateFunction": "qx.event.type.Data",
108111
"updateService": "qx.event.type.Data",
109112
"updateHypertool": "qx.event.type.Data",
110113
"publishTemplate": "qx.event.type.Data",
@@ -440,6 +443,9 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
440443
case "tutorial":
441444
this.fireDataEvent("updateTutorial", updatedData);
442445
break;
446+
case "function":
447+
this.fireDataEvent("updateFunction", updatedData);
448+
break;
443449
case "hypertool":
444450
this.fireDataEvent("updateHypertool", updatedData);
445451
break;
@@ -477,7 +483,6 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
477483
const updatedData = e.getData();
478484
this.__fireUpdateEvent(resourceData, updatedData);
479485
});
480-
infoCard.addListener("openTags", () => this.openTags());
481486
} else {
482487
infoCard = new osparc.info.StudyLarge(resourceModel, false);
483488
infoCard.addListener("updateStudy", e => {

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,6 +1648,20 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
16481648
this.base(arguments, templateData);
16491649
},
16501650

1651+
_updateFunctionData: function(functionData) {
1652+
functionData["resourceType"] = "function";
1653+
1654+
const index = this._resourcesList.findIndex(study => study["uuid"] === studyData["uuid"]);
1655+
if (index === -1) {
1656+
// add it in first position, most likely it's a new study
1657+
this._resourcesList.unshift(functionData);
1658+
} else {
1659+
this._resourcesList[index] = functionData;
1660+
}
1661+
// it will render the studies in the right order
1662+
this._reloadCards();
1663+
},
1664+
16511665
__removeFromStudyList: function(studyId) {
16521666
const idx = this._resourcesList.findIndex(study => study["uuid"] === studyId);
16531667
if (idx > -1) {

0 commit comments

Comments
 (0)