From 78d85df2a5f09790a56d9aa08b602f3c13a790bb Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 5 Sep 2025 13:47:28 +0200 Subject: [PATCH 01/12] refactor --- .../osparc/dashboard/ResourceBrowserFilter.js | 56 ++++++++++++------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js index 54857e7db2d7..255b4cd4b9c0 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js @@ -57,8 +57,35 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", { __tagButtons: null, __appTypeButtons: null, + _createChildControlImpl: function(id) { + let control; + switch (id) { + case "filters-spacer": + control = new qx.ui.core.Spacer(10, 10); + this._add(control); + break; + case "shared-with-layout": + control = this.__createSharedWithFilterLayout(); + this._add(control); + break; + case "app-type-layout": + control = this.__createAppTypeFilterLayout(); + this._add(control); + break; + case "tags-layout": { + control = this.__createTagsFilterLayout(); + const scrollView = new qx.ui.container.Scroll(); + scrollView.add(control); + this._add(scrollView, { + flex: 1 + }); + break; + } + } + return control || null; + }, + __buildLayout: function() { - const filtersSpacer = new qx.ui.core.Spacer(10, 10); switch (this.__resourceType) { case "study": { this._add(this.__createWorkspacesAndFoldersTree()); @@ -72,28 +99,19 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", { this._add(this.__createFunctions()); } this._add(this.__createTrashBin()); - this._add(filtersSpacer); - const scrollView = new qx.ui.container.Scroll(); - scrollView.add(this.__createTagsFilterLayout()); - this._add(scrollView, { - flex: 1 - }); + this.getChildControl("filters-spacer"); + this.getChildControl("tags-layout"); break; } - case "template": { - this._add(filtersSpacer); - this._add(this.__createSharedWithFilterLayout()); - const scrollView = new qx.ui.container.Scroll(); - scrollView.add(this.__createTagsFilterLayout()); - this._add(scrollView, { - flex: 1 - }); + case "template": + this.getChildControl("filters-spacer"); + this.getChildControl("shared-with-layout"); + this.getChildControl("tags-layout"); break; - } case "service": - this._add(filtersSpacer); - this._add(this.__createSharedWithFilterLayout()); - this._add(this.__createAppTypeFilterLayout()); + this.getChildControl("filters-spacer"); + this.getChildControl("shared-with-layout"); + this.getChildControl("app-type-layout"); break; } }, From 810e9417ca0c12c6492c89fb81be098770eaefea Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 5 Sep 2025 14:22:26 +0200 Subject: [PATCH 02/12] autoConnectPorts --- .../source/class/osparc/data/model/Node.js | 38 +++++++++++++------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/data/model/Node.js b/services/static-webserver/client/source/class/osparc/data/model/Node.js index d5ea36cf93fc..ce0d98d11b21 100644 --- a/services/static-webserver/client/source/class/osparc/data/model/Node.js +++ b/services/static-webserver/client/source/class/osparc/data/model/Node.js @@ -868,21 +868,35 @@ qx.Class.define("osparc.data.model.Node", { return; } - // create automatic port connections - let autoConnections = 0; - const outPorts = node1.getOutputs(); - const inPorts = node2.getInputs(); - for (const outPort in outPorts) { - for (const inPort in inPorts) { - if (await node2.addPortLink(inPort, node1.getNodeId(), outPort)) { - autoConnections++; - break; + const autoConnectPorts = async () => { + // create automatic port connections + let autoConnections = 0; + const outPorts = node1.getOutputs(); + const inPorts = node2.getInputs(); + for (const outPort in outPorts) { + for (const inPort in inPorts) { + if (await node2.addPortLink(inPort, node1.getNodeId(), outPort)) { + autoConnections++; + break; + } } } + if (autoConnections) { + const flashMessenger = osparc.FlashMessenger.getInstance(); + flashMessenger.logAs(autoConnections + this.tr(" ports auto connected"), "INFO"); + } } - if (autoConnections) { - const flashMessenger = osparc.FlashMessenger.getInstance(); - flashMessenger.logAs(autoConnections + this.tr(" ports auto connected"), "INFO"); + if (node1.getMetadata() && node2.getMetadata()) { + autoConnectPorts(); + } else { + // wait for both metadata to be loaded + const onMetadataChanged = () => { + if (node1.getMetadata() && node2.getMetadata()) { + autoConnectPorts(); + } + }; + node1.addListenerOnce("changeMetadata", onMetadataChanged, this); + node2.addListenerOnce("changeMetadata", onMetadataChanged, this); } }, From 5dd52bee94c28677f031f615c4d7ab79ed8dbca8 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 5 Sep 2025 14:26:41 +0200 Subject: [PATCH 03/12] tags filter only for templates --- .../class/osparc/dashboard/ResourceBrowserBase.js | 13 ++++++++----- .../class/osparc/dashboard/ResourceBrowserFilter.js | 6 +++++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js index bd718b59ddf2..0fddfeb5fef6 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js @@ -319,9 +319,12 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { this._addToLayout(resourcesContainer); }, - _groupByChanged: function(groupBy) { + __groupByChanged: function(groupBy) { this._resourcesContainer.setGroupBy(groupBy); this._reloadCards(); + if (this._resourceFilter) { + this._resourceFilter.groupByChanged(groupBy); + } }, __viewModeChanged: function(viewMode) { @@ -348,14 +351,14 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { const dontGroup = new qx.ui.menu.RadioButton(this.tr("None")); osparc.utils.Utils.setIdToWidget(dontGroup, "groupByNone"); - dontGroup.addListener("execute", () => this._groupByChanged(null)); + dontGroup.addListener("execute", () => this.__groupByChanged(null)); groupByMenu.add(dontGroup); groupOptions.add(dontGroup); if (this._resourceType === "template") { const groupByTag = new qx.ui.menu.RadioButton(this.tr("Tags")); - groupByTag.addListener("execute", () => this._groupByChanged("tags")); + groupByTag.addListener("execute", () => this.__groupByChanged("tags")); groupByMenu.add(groupByTag); groupOptions.add(groupByTag); if ( @@ -367,7 +370,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { } } else if (this._resourceType === "service" && osparc.product.Utils.groupServices()) { const groupByFeatured = new qx.ui.menu.RadioButton(this.tr("Featured")); - groupByFeatured.addListener("execute", () => this._groupByChanged("groupedServices")); + groupByFeatured.addListener("execute", () => this.__groupByChanged("groupedServices")); groupByMenu.add(groupByFeatured); groupOptions.add(groupByFeatured); groupByFeatured.execute(); @@ -375,7 +378,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { } const groupByShared = new qx.ui.menu.RadioButton(this.tr("Shared with")); - groupByShared.addListener("execute", () => this._groupByChanged("shared")); + groupByShared.addListener("execute", () => this.__groupByChanged("shared")); groupByMenu.add(groupByShared); groupOptions.add(groupByShared); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js index 255b4cd4b9c0..b8c4669684fd 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js @@ -100,7 +100,6 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", { } this._add(this.__createTrashBin()); this.getChildControl("filters-spacer"); - this.getChildControl("tags-layout"); break; } case "template": @@ -449,6 +448,11 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", { tagsLayout.getChildren().forEach(item => item.setPaddingLeft(10)); // align them with the context } }, + + groupByChanged: function(groupBy) { + const isTemplate = this.__resourceType === "template"; + this.getChildControl("tags-layout").setVisibility(isTemplate && groupBy === "tags" ? "visible" : "excluded"); + }, /* /TAGS */ /* SERVICE TYPE */ From 8b7053d3edf01090e12dcb50cdcc981c5d691312 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 5 Sep 2025 14:48:08 +0200 Subject: [PATCH 04/12] refactor --- .../source/class/osparc/dashboard/ResourceBrowserBase.js | 6 ++++-- .../source/class/osparc/dashboard/ResourceBrowserFilter.js | 5 ----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js index 0fddfeb5fef6..1c5cea156cdc 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js @@ -322,8 +322,10 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { __groupByChanged: function(groupBy) { this._resourcesContainer.setGroupBy(groupBy); this._reloadCards(); - if (this._resourceFilter) { - this._resourceFilter.groupByChanged(groupBy); + + const isTemplate = this._resourceType === "template";; + if (this._resourceFilter && isTemplate) { + this._resourceFilter.getChildControl("tags-layout").setVisibility(isTemplate && groupBy === "tags" ? "visible" : "excluded"); } }, diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js index b8c4669684fd..866c07b4bf0c 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js @@ -448,11 +448,6 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", { tagsLayout.getChildren().forEach(item => item.setPaddingLeft(10)); // align them with the context } }, - - groupByChanged: function(groupBy) { - const isTemplate = this.__resourceType === "template"; - this.getChildControl("tags-layout").setVisibility(isTemplate && groupBy === "tags" ? "visible" : "excluded"); - }, /* /TAGS */ /* SERVICE TYPE */ From 9eb732a20c76a3a166b111b593f690be421c48cd Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 5 Sep 2025 14:50:15 +0200 Subject: [PATCH 05/12] refactor --- .../class/osparc/dashboard/ResourceBrowserBase.js | 15 +++++---------- .../class/osparc/dashboard/TutorialBrowser.js | 9 +++++++++ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js index 1c5cea156cdc..bd718b59ddf2 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js @@ -319,14 +319,9 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { this._addToLayout(resourcesContainer); }, - __groupByChanged: function(groupBy) { + _groupByChanged: function(groupBy) { this._resourcesContainer.setGroupBy(groupBy); this._reloadCards(); - - const isTemplate = this._resourceType === "template";; - if (this._resourceFilter && isTemplate) { - this._resourceFilter.getChildControl("tags-layout").setVisibility(isTemplate && groupBy === "tags" ? "visible" : "excluded"); - } }, __viewModeChanged: function(viewMode) { @@ -353,14 +348,14 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { const dontGroup = new qx.ui.menu.RadioButton(this.tr("None")); osparc.utils.Utils.setIdToWidget(dontGroup, "groupByNone"); - dontGroup.addListener("execute", () => this.__groupByChanged(null)); + dontGroup.addListener("execute", () => this._groupByChanged(null)); groupByMenu.add(dontGroup); groupOptions.add(dontGroup); if (this._resourceType === "template") { const groupByTag = new qx.ui.menu.RadioButton(this.tr("Tags")); - groupByTag.addListener("execute", () => this.__groupByChanged("tags")); + groupByTag.addListener("execute", () => this._groupByChanged("tags")); groupByMenu.add(groupByTag); groupOptions.add(groupByTag); if ( @@ -372,7 +367,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { } } else if (this._resourceType === "service" && osparc.product.Utils.groupServices()) { const groupByFeatured = new qx.ui.menu.RadioButton(this.tr("Featured")); - groupByFeatured.addListener("execute", () => this.__groupByChanged("groupedServices")); + groupByFeatured.addListener("execute", () => this._groupByChanged("groupedServices")); groupByMenu.add(groupByFeatured); groupOptions.add(groupByFeatured); groupByFeatured.execute(); @@ -380,7 +375,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { } const groupByShared = new qx.ui.menu.RadioButton(this.tr("Shared with")); - groupByShared.addListener("execute", () => this.__groupByChanged("shared")); + groupByShared.addListener("execute", () => this._groupByChanged("shared")); groupByMenu.add(groupByShared); groupOptions.add(groupByShared); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/TutorialBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/TutorialBrowser.js index d54097606b5a..1561bff2ac96 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/TutorialBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/TutorialBrowser.js @@ -118,6 +118,15 @@ qx.Class.define("osparc.dashboard.TutorialBrowser", { osparc.filter.UIFilterController.dispatch("searchBarFilter"); }, + // overridden + _groupByChanged: function(groupBy) { + this.base(arguments, groupBy); + + if (this._resourceFilter) { + this._resourceFilter.getChildControl("tags-layout").setVisibility(groupBy === "tags" ? "visible" : "excluded"); + } + }, + __itemClicked: function(card) { if (!card.getBlocked()) { const templateData = this.__getTemplateData(card.getUuid()); From 0b8ea9d47827d4a19d52e697135c0afea40017ba Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 5 Sep 2025 14:57:51 +0200 Subject: [PATCH 06/12] minor --- .../source/class/osparc/dashboard/ResourceBrowserFilter.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js index 866c07b4bf0c..eed6ee3019ef 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js @@ -386,7 +386,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", { }, __populateTags: function(tagsLayout, selectedTagIds) { - const maxTags = 5; + const maxTags = 10; this.__tagButtons = []; tagsLayout.removeAll(); osparc.store.Tags.getInstance().getTags().forEach((tag, idx) => { @@ -443,6 +443,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", { myAccountWindow.openTags(); }); tagsLayout.add(editTagsButton); + editTagsButton.exclude(); // excluded for now, they will be used as categories if (this.__resourceType === "study") { tagsLayout.getChildren().forEach(item => item.setPaddingLeft(10)); // align them with the context From 542073c4307cd585cc5d9c74ac9978460e2a144b Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 5 Sep 2025 15:08:54 +0200 Subject: [PATCH 07/12] refactor and "Existing tags" --- .../osparc/dashboard/ResourceBrowserFilter.js | 14 ++++++-------- .../class/osparc/dashboard/TutorialBrowser.js | 9 +++++++++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js index eed6ee3019ef..8f73ce945c5e 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js @@ -106,6 +106,8 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", { this.getChildControl("filters-spacer"); this.getChildControl("shared-with-layout"); this.getChildControl("tags-layout"); + this.__populateTags(); + osparc.store.Tags.getInstance().addListener("tagsChanged", () => this.__populateTags(), this); break; case "service": this.getChildControl("filters-spacer"); @@ -371,12 +373,6 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", { __createTagsFilterLayout: function() { const tagsLayout = new qx.ui.container.Composite(new qx.ui.layout.VBox(2)); osparc.utils.Utils.setIdToWidget(tagsLayout, this.__resourceType + "-tagsFilter"); - - this.__populateTags(tagsLayout, []); - osparc.store.Tags.getInstance().addListener("tagsChanged", () => { - this.__populateTags(tagsLayout, this.__getSelectedTagIds()); - }, this); - return tagsLayout; }, @@ -385,10 +381,12 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", { return selectedTagIds; }, - __populateTags: function(tagsLayout, selectedTagIds) { + __populateTags: function() { + const selectedTagIds = this.__getSelectedTagIds(); + const tagsLayout = this.getChildControl("tags-layout"); + tagsLayout.removeAll(); const maxTags = 10; this.__tagButtons = []; - tagsLayout.removeAll(); osparc.store.Tags.getInstance().getTags().forEach((tag, idx) => { const button = new qx.ui.form.ToggleButton(null, "@FontAwesome5Solid/tag/16"); button.id = tag.getTagId(); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/TutorialBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/TutorialBrowser.js index 1561bff2ac96..9608d0e16ef4 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/TutorialBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/TutorialBrowser.js @@ -124,6 +124,15 @@ qx.Class.define("osparc.dashboard.TutorialBrowser", { if (this._resourceFilter) { this._resourceFilter.getChildControl("tags-layout").setVisibility(groupBy === "tags" ? "visible" : "excluded"); + + if (groupBy === "tags") { + const existingTags = new Set(); + this._resourcesList.forEach(template => { + (template["tags"] || []).forEach(tagId => existingTags.add(tagId)); + }); + console.log("Existing tags", existingTags); + // this._resourceFilter.setSelectedTagIds(Array.from(existingTags)); + } } }, From 1adad291b22167a2132c197fb0390d3b29617c37 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 5 Sep 2025 15:13:47 +0200 Subject: [PATCH 08/12] showPresentTags --- .../source/class/osparc/dashboard/TutorialBrowser.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/TutorialBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/TutorialBrowser.js index 9608d0e16ef4..24ea553dfb1f 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/TutorialBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/TutorialBrowser.js @@ -126,12 +126,11 @@ qx.Class.define("osparc.dashboard.TutorialBrowser", { this._resourceFilter.getChildControl("tags-layout").setVisibility(groupBy === "tags" ? "visible" : "excluded"); if (groupBy === "tags") { - const existingTags = new Set(); + const presentTags = new Set(); this._resourcesList.forEach(template => { - (template["tags"] || []).forEach(tagId => existingTags.add(tagId)); + (template["tags"] || []).forEach(tagId => presentTags.add(tagId)); }); - console.log("Existing tags", existingTags); - // this._resourceFilter.setSelectedTagIds(Array.from(existingTags)); + this._resourceFilter.showPresentTags(Array.from(presentTags)); } } }, From ad2b20f01d10fdb037a4bd270c07c5694f13307c Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 5 Sep 2025 15:16:38 +0200 Subject: [PATCH 09/12] presentTagIds --- .../class/osparc/dashboard/ResourceBrowserFilter.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js index 8f73ce945c5e..401349bf575c 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js @@ -381,13 +381,16 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", { return selectedTagIds; }, - __populateTags: function() { + __populateTags: function(presentTagIds = []) { const selectedTagIds = this.__getSelectedTagIds(); const tagsLayout = this.getChildControl("tags-layout"); tagsLayout.removeAll(); const maxTags = 10; this.__tagButtons = []; - osparc.store.Tags.getInstance().getTags().forEach((tag, idx) => { + osparc.store.Tags.getInstance().getTags().forEach(tag => { + if (!presentTagIds.includes(tag.getTagId())) { + return; + } const button = new qx.ui.form.ToggleButton(null, "@FontAwesome5Solid/tag/16"); button.id = tag.getTagId(); tag.bind("name", button, "label"); @@ -406,7 +409,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", { this.fireDataEvent("changeSelectedTags", selection); }, this); - button.setVisibility(idx >= maxTags ? "excluded" : "visible"); + button.setVisibility(this.__tagButtons.length >= maxTags ? "excluded" : "visible"); this.__tagButtons.push(button); }); @@ -447,6 +450,10 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", { tagsLayout.getChildren().forEach(item => item.setPaddingLeft(10)); // align them with the context } }, + + showPresentTags: function(presentTagIds) { + this.__populateTags(presentTagIds); + }, /* /TAGS */ /* SERVICE TYPE */ From 23da092fa7241c3f2b0f4bc437121e508d7c8e10 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 5 Sep 2025 15:26:57 +0200 Subject: [PATCH 10/12] refactor --- .../osparc/dashboard/ResourceBrowserFilter.js | 8 +------ .../class/osparc/dashboard/TutorialBrowser.js | 22 ++++++++++++------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js index 401349bf575c..a30176213503 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js @@ -106,8 +106,6 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", { this.getChildControl("filters-spacer"); this.getChildControl("shared-with-layout"); this.getChildControl("tags-layout"); - this.__populateTags(); - osparc.store.Tags.getInstance().addListener("tagsChanged", () => this.__populateTags(), this); break; case "service": this.getChildControl("filters-spacer"); @@ -381,7 +379,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", { return selectedTagIds; }, - __populateTags: function(presentTagIds = []) { + populateTags: function(presentTagIds = []) { const selectedTagIds = this.__getSelectedTagIds(); const tagsLayout = this.getChildControl("tags-layout"); tagsLayout.removeAll(); @@ -450,10 +448,6 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", { tagsLayout.getChildren().forEach(item => item.setPaddingLeft(10)); // align them with the context } }, - - showPresentTags: function(presentTagIds) { - this.__populateTags(presentTagIds); - }, /* /TAGS */ /* SERVICE TYPE */ diff --git a/services/static-webserver/client/source/class/osparc/dashboard/TutorialBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/TutorialBrowser.js index 24ea553dfb1f..43a15eaf17c4 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/TutorialBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/TutorialBrowser.js @@ -116,6 +116,18 @@ qx.Class.define("osparc.dashboard.TutorialBrowser", { }); this.__evaluateUpdateAllButton(); osparc.filter.UIFilterController.dispatch("searchBarFilter"); + + this.__populateTags(); + }, + + __populateTags: function() { + if (this._resourceFilter) { + const presentTags = new Set(); + this._resourcesList.forEach(template => { + (template["tags"] || []).forEach(tagId => presentTags.add(tagId)); + }); + this._resourceFilter.populateTags(Array.from(presentTags)); + } }, // overridden @@ -124,14 +136,6 @@ qx.Class.define("osparc.dashboard.TutorialBrowser", { if (this._resourceFilter) { this._resourceFilter.getChildControl("tags-layout").setVisibility(groupBy === "tags" ? "visible" : "excluded"); - - if (groupBy === "tags") { - const presentTags = new Set(); - this._resourcesList.forEach(template => { - (template["tags"] || []).forEach(tagId => presentTags.add(tagId)); - }); - this._resourceFilter.showPresentTags(Array.from(presentTags)); - } } }, @@ -160,6 +164,8 @@ qx.Class.define("osparc.dashboard.TutorialBrowser", { this._addViewModeButton(); this._addResourceFilter(); + this.__populateTags(); + osparc.store.Tags.getInstance().addListener("tagsChanged", () => this.__populateTags(), this); this._resourcesContainer.addListener("changeVisibility", () => this.__evaluateUpdateAllButton()); From 6349a318f02696b31f4935b7fc1c338a176a197d Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 5 Sep 2025 16:22:28 +0200 Subject: [PATCH 11/12] minor --- .../source/class/osparc/dashboard/ResourceBrowserFilter.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js index a30176213503..9f1d9528cd2e 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserFilter.js @@ -385,8 +385,9 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", { tagsLayout.removeAll(); const maxTags = 10; this.__tagButtons = []; - osparc.store.Tags.getInstance().getTags().forEach(tag => { - if (!presentTagIds.includes(tag.getTagId())) { + presentTagIds.forEach(tagId => { + const tag = osparc.store.Tags.getInstance().getTag(tagId); + if (!tag) { return; } const button = new qx.ui.form.ToggleButton(null, "@FontAwesome5Solid/tag/16"); From fdcc20d98e9a7aaa0960b38e1797443184c96c73 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 5 Sep 2025 17:05:12 +0200 Subject: [PATCH 12/12] minor fix --- .../class/osparc/desktop/organizations/MembersList.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/desktop/organizations/MembersList.js b/services/static-webserver/client/source/class/osparc/desktop/organizations/MembersList.js index a155551492cc..9321319958ad 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/organizations/MembersList.js +++ b/services/static-webserver/client/source/class/osparc/desktop/organizations/MembersList.js @@ -328,8 +328,10 @@ qx.Class.define("osparc.desktop.organizations.MembersList", { const readAccessRole = osparc.data.Roles.ORG["read"]; const newAccessRights = readAccessRole.accessRights; + const orgId = this.__currentOrg.getGroupId(); + const userId = "id" in listedMember ? listedMember["id"] : listedMember["key"]; const groupsStore = osparc.store.Groups.getInstance(); - groupsStore.patchMember(this.__currentOrg.getGroupId(), listedMember["id"], newAccessRights) + groupsStore.patchAccessRights(orgId, userId, newAccessRights) .then(() => { osparc.FlashMessenger.logAs(this.tr(`Successfully promoted to ${readAccessRole.label}`)); this.__reloadOrgMembers(); @@ -348,7 +350,7 @@ qx.Class.define("osparc.desktop.organizations.MembersList", { const noReadAccessRole = osparc.data.Roles.ORG["noRead"]; const newAccessRights = noReadAccessRole.accessRights; const orgId = this.__currentOrg.getGroupId(); - const userId = "id" in listedMember ? listedMember["id"] : listedMember["key"] + const userId = "id" in listedMember ? listedMember["id"] : listedMember["key"]; const groupsStore = osparc.store.Groups.getInstance(); groupsStore.patchAccessRights(orgId, userId, newAccessRights) .then(() => {