Skip to content

Commit a7fe71c

Browse files
committed
pb-hypertool
1 parent 9020af2 commit a7fe71c

File tree

3 files changed

+37
-14
lines changed

3 files changed

+37
-14
lines changed

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

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ qx.Class.define("osparc.dashboard.AppBrowser", {
3434

3535
members: {
3636
__sortBy: null,
37-
__hypertools: null,
3837

3938
// overridden
4039
initResources: function() {
@@ -50,7 +49,6 @@ qx.Class.define("osparc.dashboard.AppBrowser", {
5049
])
5150
.then(resps => {
5251
const services = resps[0];
53-
const hypertools = resps[1];
5452
// Show "Contact Us" message if services.length === 0
5553
// Most probably is a product-stranger user (it can also be that the catalog is down)
5654
if (Object.keys(services).length === 0) {
@@ -63,8 +61,6 @@ qx.Class.define("osparc.dashboard.AppBrowser", {
6361
osparc.FlashMessenger.getInstance().logAs(msg, "WARNING");
6462
}
6563

66-
console.log("hypertools", hypertools);
67-
this.__hypertools = hypertools;
6864
this.getChildControl("resources-layout");
6965
this.reloadResources();
7066
this._hideLoadingPage();
@@ -73,13 +69,32 @@ qx.Class.define("osparc.dashboard.AppBrowser", {
7369

7470
reloadResources: function() {
7571
this.__loadServices();
72+
this.__loadHypertools();
7673
},
7774

7875
__loadServices: function() {
7976
const excludeFrontend = true;
8077
const excludeDeprecated = true
8178
osparc.store.Services.getServicesLatestList(excludeFrontend, excludeDeprecated)
82-
.then(servicesList => this.__setServicesToList(servicesList.filter(service => service !== null)));
79+
.then(servicesList => {
80+
servicesList.forEach(service => service["resourceType"] = "service");
81+
this._resourcesList.push(...servicesList.filter(service => service !== null));
82+
this.__sortAndReload();
83+
});
84+
},
85+
86+
__loadHypertools: function() {
87+
osparc.store.Templates.getTemplatesHypertools()
88+
.then(hypertoolsList => {
89+
hypertoolsList.forEach(hypertool => hypertool["resourceType"] = "hypertool");
90+
this._resourcesList.push(...hypertoolsList.filter(hypertool => hypertool !== null));
91+
this.__sortAndReload();
92+
});
93+
},
94+
95+
__sortAndReload: function() {
96+
osparc.service.Utils.sortObjectsBasedOn(this._resourcesList, this.__sortBy);
97+
this._reloadCards();
8398
},
8499

85100
_updateServiceData: function(serviceData) {
@@ -92,13 +107,6 @@ qx.Class.define("osparc.dashboard.AppBrowser", {
92107
}
93108
},
94109

95-
__setServicesToList: function(servicesList) {
96-
servicesList.forEach(service => service["resourceType"] = "service");
97-
osparc.service.Utils.sortObjectsBasedOn(servicesList, this.__sortBy);
98-
this._resourcesList = servicesList;
99-
this._reloadCards();
100-
},
101-
102110
_reloadCards: function() {
103111
this._resourcesContainer.setResourcesToList(this._resourcesList);
104112
const cards = this._resourcesContainer.reloadCards("services");
@@ -141,7 +149,7 @@ qx.Class.define("osparc.dashboard.AppBrowser", {
141149
});
142150
containerSortButtons.addListener("sortBy", e => {
143151
this.__sortBy = e.getData();
144-
this.__setServicesToList(this._resourcesList);
152+
this.__sortAndReload();
145153
}, this);
146154
this._toolbar.add(containerSortButtons);
147155
},

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,12 @@ qx.Class.define("osparc.dashboard.CardBase", {
315315
},
316316

317317
resourceType: {
318-
check: ["study", "template", "service"],
318+
check: [
319+
"study",
320+
"template",
321+
"service",
322+
"hypertool",
323+
],
319324
init: true,
320325
nullable: true,
321326
event: "changeResourceType"

services/static-webserver/client/source/class/osparc/theme/Appearance.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,16 @@ qx.Theme.define("osparc.theme.Appearance", {
125125
}
126126
},
127127

128+
"pb-hypertool": {
129+
include: "pb-listitem",
130+
style: function(states) {
131+
const style = {
132+
backgroundColor: "pb-template"
133+
};
134+
return style;
135+
}
136+
},
137+
128138
"pb-dynamic": {
129139
include: "pb-listitem",
130140
style: function(states) {

0 commit comments

Comments
 (0)