From ba881e9690df733cd69410f76922bb76f07a5df2 Mon Sep 17 00:00:00 2001 From: Odei Maiz <33152403+odeimaiz@users.noreply.github.com> Date: Thu, 21 Nov 2024 17:08:56 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20[Frontend]=20Sort=20folders=20al?= =?UTF-8?q?phabetically=20(#6794)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../class/osparc/dashboard/WorkspacesAndFoldersTree.js | 8 +++++++- .../client/source/class/osparc/study/StudyOptions.js | 9 +++++++-- .../client/source/class/osparc/utils/Utils.js | 7 +++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTree.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTree.js index e8914ca6166..533c90c4643 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTree.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTree.js @@ -228,6 +228,9 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTree", { const sharedWorkspaceModel = this.__getModel(-1, null); sharedWorkspaceModel.getChildren().append(workspaceModel); + sharedWorkspaceModel.getChildren().sort(((a, b) => { + return a.getLabel().localeCompare(b.getLabel()); + })); // load next level too this.__populateFolder(workspaceModel, workspace.getWorkspaceId(), null); @@ -262,7 +265,10 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTree", { const folderModel = qx.data.marshal.Json.createModel(folderData, true); this.__models.push(folderModel); folder.bind("name", folderModel, "label"); - parentModel.getChildren().push(folderModel); + parentModel.getChildren().append(folderModel); + parentModel.getChildren().sort(((a, b) => { + return a.getLabel().localeCompare(b.getLabel()); + })); return folderModel; }, diff --git a/services/static-webserver/client/source/class/osparc/study/StudyOptions.js b/services/static-webserver/client/source/class/osparc/study/StudyOptions.js index 0ceef6fde4e..70576fa6c79 100644 --- a/services/static-webserver/client/source/class/osparc/study/StudyOptions.js +++ b/services/static-webserver/client/source/class/osparc/study/StudyOptions.js @@ -232,7 +232,6 @@ qx.Class.define("osparc.study.StudyOptions", { center: true, enabled: false, }); - osparc.utils.Utils.setIdToWidget(control, "openWithResources"); this.getChildControl("buttons-layout").addAt(control, 1); break; } @@ -284,7 +283,13 @@ qx.Class.define("osparc.study.StudyOptions", { __evaluateOpenButton: function() { const hasTitle = Boolean(this.getChildControl("title-field").getValue()); const walletSelected = Boolean(this.getChildControl("wallet-selector").getSelection().length); - this.getChildControl("open-button").setEnabled(hasTitle && walletSelected); + const openButton = this.getChildControl("open-button"); + openButton.setEnabled(hasTitle && walletSelected); + if (hasTitle && walletSelected) { + osparc.utils.Utils.setIdToWidget(openButton, "openWithResources"); + } else { + osparc.utils.Utils.removeIdAttribute(openButton); + } }, __buildLayout: function() { diff --git a/services/static-webserver/client/source/class/osparc/utils/Utils.js b/services/static-webserver/client/source/class/osparc/utils/Utils.js index b095d95eee2..b5140e3713a 100644 --- a/services/static-webserver/client/source/class/osparc/utils/Utils.js +++ b/services/static-webserver/client/source/class/osparc/utils/Utils.js @@ -1034,6 +1034,13 @@ qx.Class.define("osparc.utils.Utils", { return null; }, + removeIdAttribute: qWidget => { + if (qWidget.getContentElement && qWidget.getContentElement()) { + return qWidget.getContentElement().removeAttribute("osparc-test-id"); + } + return null; + }, + setKeyToWidget: (qWidget, id) => { if (qWidget.getContentElement && qWidget.getContentElement()) { qWidget.getContentElement().setAttribute("osparc-test-key", id);