Skip to content

Commit ac9aa7c

Browse files
authored
🎨 [Frontend] Hypertools in menu (ITISFoundation#7570)
1 parent 268259f commit ac9aa7c

File tree

2 files changed

+29
-12
lines changed

2 files changed

+29
-12
lines changed

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

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ qx.Class.define("osparc.dashboard.NewPlusMenu", {
161161
__addItems: function() {
162162
this.__addUIConfigItems();
163163
if (osparc.store.StaticInfo.getInstance().isDevFeaturesEnabled()) {
164+
this.__addHypertools();
164165
this.__addOtherTabsAccess();
165166
}
166167
this.getChildControl("new-folder");
@@ -187,6 +188,31 @@ qx.Class.define("osparc.dashboard.NewPlusMenu", {
187188
}
188189
},
189190

191+
__addHypertools: function() {
192+
const hypertools = osparc.store.Templates.getInstance().getTemplatesByType(osparc.data.model.StudyUI.HYPERTOOL_TYPE);
193+
if (hypertools.length) {
194+
const hypertoolsMenuButton = this.self().createMenuButton("@FontAwesome5Solid/star/16", this.tr("Hypertools"));
195+
this.addAt(hypertoolsMenuButton, this.__itemIdx);
196+
this.__itemIdx++;
197+
198+
const hypertoolsMenu = new qx.ui.menu.Menu().set({
199+
appearance: "menu-wider",
200+
});
201+
hypertoolsMenuButton.setMenu(hypertoolsMenu);
202+
203+
hypertools.forEach(templateData => {
204+
const hypertoolButton = this.self().createMenuButton(templateData["icon"], templateData["name"]);
205+
hypertoolButton.addListener("tap", () => {
206+
this.fireDataEvent("newStudyFromTemplateClicked", {
207+
templateData,
208+
newStudyLabel: templateData["name"],
209+
});
210+
});
211+
hypertoolsMenu.add(hypertoolButton);
212+
});
213+
}
214+
},
215+
190216
__addOtherTabsAccess: function() {
191217
const moreMenuButton = this.self().createMenuButton("@FontAwesome5Solid/star/16", this.tr("More"));
192218
this.addAt(moreMenuButton, this.__itemIdx);
@@ -195,30 +221,21 @@ qx.Class.define("osparc.dashboard.NewPlusMenu", {
195221
const moreMenu = new qx.ui.menu.Menu().set({
196222
appearance: "menu-wider",
197223
});
224+
moreMenuButton.setMenu(moreMenu);
198225

199226
const permissions = osparc.data.Permissions.getInstance();
200227
if (permissions.canDo("dashboard.templates.read")) {
201228
const templatesButton = this.self().createMenuButton("@FontAwesome5Solid/copy/16", this.tr("Tutorials..."));
202229
templatesButton.addListener("execute", () => this.fireDataEvent("changeTab", "templatesTab"), this);
203230
moreMenu.add(templatesButton);
204-
205-
const hypertoolsButton = this.self().createMenuButton("@FontAwesome5Solid/copy/16", this.tr("Hypertools..."));
206-
hypertoolsButton.addListener("execute", () => this.fireDataEvent("changeTab", "hypertoolsTab"), this);
207-
const hypertools = osparc.store.Templates.getInstance().getTemplatesByType(osparc.data.model.StudyUI.HYPERTOOL_TYPE);
208-
if (hypertools.length) {
209-
moreMenu.add(hypertoolsButton);
210-
}
211231
}
212232

213233
if (permissions.canDo("dashboard.services.read")) {
214234
const servicesButton = this.self().createMenuButton("@FontAwesome5Solid/cog/16", this.tr("Services..."));
215235
servicesButton.addListener("execute", () => this.fireDataEvent("changeTab", "servicesTab"), this);
216236
moreMenu.add(servicesButton);
217237
}
218-
219238
moreMenuButton.setVisibility(moreMenu.getChildren().length ? "visible" : "excluded");
220-
221-
moreMenuButton.setMenu(moreMenu);
222239
},
223240

224241
__getLastIdxFromCategory: function(categoryId) {

‎services/static-webserver/client/source/resource/osparc/ui_config.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
"newStudyLabel": "Segmentation"
117117
}, {
118118
"resourceType": "study",
119-
"title": "Empty Pipeline",
119+
"title": "Pipeline",
120120
"newStudyLabel": "New Pipeline",
121121
"idToWidget": "emptyStudyBtn"
122122
}]
@@ -142,7 +142,7 @@
142142
"newStudyLabel": "Segmentation"
143143
}, {
144144
"resourceType": "study",
145-
"title": "Empty Pipeline",
145+
"title": "Pipeline",
146146
"newStudyLabel": "New Pipeline",
147147
"idToWidget": "emptyStudyBtn"
148148
}]

0 commit comments

Comments
 (0)