Skip to content

Commit ba881e9

Browse files
authored
🎨 [Frontend] Sort folders alphabetically (#6794)
1 parent b93ccbf commit ba881e9

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTree", {
228228

229229
const sharedWorkspaceModel = this.__getModel(-1, null);
230230
sharedWorkspaceModel.getChildren().append(workspaceModel);
231+
sharedWorkspaceModel.getChildren().sort(((a, b) => {
232+
return a.getLabel().localeCompare(b.getLabel());
233+
}));
231234

232235
// load next level too
233236
this.__populateFolder(workspaceModel, workspace.getWorkspaceId(), null);
@@ -262,7 +265,10 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTree", {
262265
const folderModel = qx.data.marshal.Json.createModel(folderData, true);
263266
this.__models.push(folderModel);
264267
folder.bind("name", folderModel, "label");
265-
parentModel.getChildren().push(folderModel);
268+
parentModel.getChildren().append(folderModel);
269+
parentModel.getChildren().sort(((a, b) => {
270+
return a.getLabel().localeCompare(b.getLabel());
271+
}));
266272
return folderModel;
267273
},
268274

services/static-webserver/client/source/class/osparc/study/StudyOptions.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ qx.Class.define("osparc.study.StudyOptions", {
232232
center: true,
233233
enabled: false,
234234
});
235-
osparc.utils.Utils.setIdToWidget(control, "openWithResources");
236235
this.getChildControl("buttons-layout").addAt(control, 1);
237236
break;
238237
}
@@ -284,7 +283,13 @@ qx.Class.define("osparc.study.StudyOptions", {
284283
__evaluateOpenButton: function() {
285284
const hasTitle = Boolean(this.getChildControl("title-field").getValue());
286285
const walletSelected = Boolean(this.getChildControl("wallet-selector").getSelection().length);
287-
this.getChildControl("open-button").setEnabled(hasTitle && walletSelected);
286+
const openButton = this.getChildControl("open-button");
287+
openButton.setEnabled(hasTitle && walletSelected);
288+
if (hasTitle && walletSelected) {
289+
osparc.utils.Utils.setIdToWidget(openButton, "openWithResources");
290+
} else {
291+
osparc.utils.Utils.removeIdAttribute(openButton);
292+
}
288293
},
289294

290295
__buildLayout: function() {

services/static-webserver/client/source/class/osparc/utils/Utils.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,6 +1034,13 @@ qx.Class.define("osparc.utils.Utils", {
10341034
return null;
10351035
},
10361036

1037+
removeIdAttribute: qWidget => {
1038+
if (qWidget.getContentElement && qWidget.getContentElement()) {
1039+
return qWidget.getContentElement().removeAttribute("osparc-test-id");
1040+
}
1041+
return null;
1042+
},
1043+
10371044
setKeyToWidget: (qWidget, id) => {
10381045
if (qWidget.getContentElement && qWidget.getContentElement()) {
10391046
qWidget.getContentElement().setAttribute("osparc-test-key", id);

0 commit comments

Comments
 (0)