Skip to content

Commit c04ff70

Browse files
committed
group by categories
1 parent 9414da5 commit c04ff70

File tree

2 files changed

+36
-38
lines changed

2 files changed

+36
-38
lines changed

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

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ qx.Class.define("osparc.dashboard.NewPlusMenu", {
169169
__addCategories: function(categories) {
170170
categories.forEach(category => {
171171
const categoryHeader = this.self().createHeader(category["title"], null, category["description"]);
172-
categoryHeader.categoryId = category["id"];
172+
categoryHeader["categoryId"] = category["id"];
173173
this.__categoryHeaders.push(categoryHeader);
174174
this.add(categoryHeader);
175175
});
@@ -181,35 +181,33 @@ qx.Class.define("osparc.dashboard.NewPlusMenu", {
181181
osparc.utils.Utils.setIdToWidget(menuButton, templateData.idToWidget);
182182

183183
if (templateData.showDisabled) {
184-
if (templateData.showDisabled) {
185-
menuButton.set({
186-
enabled: false,
187-
toolTipText: templateData.description,
184+
menuButton.set({
185+
enabled: false,
186+
toolTipText: templateData.description,
187+
});
188+
} else {
189+
const templateFound = templates.find(t => t.name === templateData.expectedTemplateLabel);
190+
if (templateFound) {
191+
if (menuButton.getIcon() === null && templateFound["thumbnail"]) {
192+
menuButton.setIcon(templateFound["thumbnail"]);
193+
}
194+
menuButton.addListener("tap", () => {
195+
this.fireDataEvent("newStudyFromTemplateClicked", {
196+
templateData: templateFound,
197+
newStudyLabel: templateData.newStudyLabel,
198+
});
188199
});
189200
}
190-
let idx = null;
191-
if (templateData.category) {
192-
idx = this.__getLastIdxFromCategory(templateData.category);
193-
}
194-
if (idx) {
195-
this.addAt(menuButton, idx+1);
196-
} else {
197-
this.add(menuButton);
198-
}
199-
return;
200201
}
201202

202-
const templateFound = templates.find(t => t.name === templateData.expectedTemplateLabel);
203-
if (templateFound) {
204-
if (menuButton.getIcon() === null && templateFound["thumbnail"]) {
205-
menuButton.setIcon(templateFound["thumbnail"]);
206-
}
207-
menuButton.addListener("tap", () => {
208-
this.fireDataEvent("newStudyFromTemplateClicked", {
209-
templateData: templateFound,
210-
newStudyLabel: templateData.newStudyLabel,
211-
});
212-
});
203+
let idx = null;
204+
if (templateData.category) {
205+
idx = this.__getLastIdxFromCategory(templateData.category);
206+
}
207+
if (idx) {
208+
menuButton["categoryId"] = templateData.category;
209+
this.addAt(menuButton, idx+1);
210+
} else {
213211
this.add(menuButton);
214212
}
215213
},

services/static-webserver/client/source/resource/osparc/new_studies.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
{
22
"tis": {
3+
"categories": [{
4+
"id": "precomputed",
5+
"title": "Precomputed"
6+
}, {
7+
"id": "personalized",
8+
"title": "Personalized",
9+
"description": "In the process, TIP will launch simulations on AWS.<br>The associated resource costs will be deduced from your Credits."
10+
}],
311
"linkedResource": "templates",
412
"resources": [{
513
"expectedTemplateLabel": "TI Planning Tool",
@@ -46,17 +54,17 @@
4654
"category": "personalized",
4755
"idToWidget": "personalizationNewPMTIPlanButton",
4856
"billable": true
49-
}],
57+
}]
58+
},
59+
"tiplite": {
5060
"categories": [{
5161
"id": "precomputed",
5262
"title": "Precomputed"
5363
}, {
5464
"id": "personalized",
5565
"title": "Personalized",
5666
"description": "In the process, TIP will launch simulations on AWS.<br>The associated resource costs will be deduced from your Credits."
57-
}]
58-
},
59-
"tiplite": {
67+
}],
6068
"linkedResource": "templates",
6169
"resources": [{
6270
"expectedTemplateLabel": "TI Planning Tool",
@@ -108,14 +116,6 @@
108116
"category": "personalized",
109117
"idToWidget": "personalizationNewPMTIPlanButton",
110118
"billable": true
111-
}],
112-
"categories": [{
113-
"id": "precomputed",
114-
"title": "Precomputed"
115-
}, {
116-
"id": "personalized",
117-
"title": "Personalized",
118-
"description": "In the process, TIP will launch simulations on AWS.<br>The associated resource costs will be deduced from your Credits."
119119
}]
120120
},
121121
"s4l": {

0 commit comments

Comments
 (0)