Skip to content

Commit 9eb732a

Browse files
committed
refactor
1 parent 8b7053d commit 9eb732a

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

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

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -319,14 +319,9 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {
319319
this._addToLayout(resourcesContainer);
320320
},
321321

322-
__groupByChanged: function(groupBy) {
322+
_groupByChanged: function(groupBy) {
323323
this._resourcesContainer.setGroupBy(groupBy);
324324
this._reloadCards();
325-
326-
const isTemplate = this._resourceType === "template";;
327-
if (this._resourceFilter && isTemplate) {
328-
this._resourceFilter.getChildControl("tags-layout").setVisibility(isTemplate && groupBy === "tags" ? "visible" : "excluded");
329-
}
330325
},
331326

332327
__viewModeChanged: function(viewMode) {
@@ -353,14 +348,14 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {
353348

354349
const dontGroup = new qx.ui.menu.RadioButton(this.tr("None"));
355350
osparc.utils.Utils.setIdToWidget(dontGroup, "groupByNone");
356-
dontGroup.addListener("execute", () => this.__groupByChanged(null));
351+
dontGroup.addListener("execute", () => this._groupByChanged(null));
357352

358353
groupByMenu.add(dontGroup);
359354
groupOptions.add(dontGroup);
360355

361356
if (this._resourceType === "template") {
362357
const groupByTag = new qx.ui.menu.RadioButton(this.tr("Tags"));
363-
groupByTag.addListener("execute", () => this.__groupByChanged("tags"));
358+
groupByTag.addListener("execute", () => this._groupByChanged("tags"));
364359
groupByMenu.add(groupByTag);
365360
groupOptions.add(groupByTag);
366361
if (
@@ -372,15 +367,15 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {
372367
}
373368
} else if (this._resourceType === "service" && osparc.product.Utils.groupServices()) {
374369
const groupByFeatured = new qx.ui.menu.RadioButton(this.tr("Featured"));
375-
groupByFeatured.addListener("execute", () => this.__groupByChanged("groupedServices"));
370+
groupByFeatured.addListener("execute", () => this._groupByChanged("groupedServices"));
376371
groupByMenu.add(groupByFeatured);
377372
groupOptions.add(groupByFeatured);
378373
groupByFeatured.execute();
379374
groupByButton.exclude(); // don't let users change the grouping
380375
}
381376

382377
const groupByShared = new qx.ui.menu.RadioButton(this.tr("Shared with"));
383-
groupByShared.addListener("execute", () => this.__groupByChanged("shared"));
378+
groupByShared.addListener("execute", () => this._groupByChanged("shared"));
384379
groupByMenu.add(groupByShared);
385380
groupOptions.add(groupByShared);
386381

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,15 @@ qx.Class.define("osparc.dashboard.TutorialBrowser", {
118118
osparc.filter.UIFilterController.dispatch("searchBarFilter");
119119
},
120120

121+
// overridden
122+
_groupByChanged: function(groupBy) {
123+
this.base(arguments, groupBy);
124+
125+
if (this._resourceFilter) {
126+
this._resourceFilter.getChildControl("tags-layout").setVisibility(groupBy === "tags" ? "visible" : "excluded");
127+
}
128+
},
129+
121130
__itemClicked: function(card) {
122131
if (!card.getBlocked()) {
123132
const templateData = this.__getTemplateData(card.getUuid());

0 commit comments

Comments
 (0)