Skip to content

Commit

Permalink
🎨 [Frontend] Sort folders alphabetically (ITISFoundation#6794)
Browse files Browse the repository at this point in the history
  • Loading branch information
odeimaiz authored Nov 21, 2024
1 parent b93ccbf commit ba881e9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ba881e9

Please sign in to comment.