Skip to content

Commit 74dd164

Browse files
authored
🐛🎨 [Frontend] Various bug fixes: new tag from Study, Checkpoint viewer, Leave study message (#6878)
1 parent 81c8ea0 commit 74dd164

File tree

16 files changed

+281
-251
lines changed

16 files changed

+281
-251
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
3535
if (resourceType === "study") {
3636
const workspacesContainer = this.__workspacesContainer = new osparc.dashboard.ToggleButtonContainer();
3737
this._add(workspacesContainer);
38-
workspacesContainer.setVisibility(osparc.utils.DisabledPlugins.isFoldersEnabled() ? "visible" : "excluded");
3938

4039
const foldersContainer = this.__foldersContainer = new osparc.dashboard.ToggleButtonContainer();
4140
this._add(foldersContainer);
42-
foldersContainer.setVisibility(osparc.utils.DisabledPlugins.isFoldersEnabled() ? "visible" : "excluded");
4341
}
4442

4543
const nonGroupedContainer = this.__nonGroupedContainer = this.__createFlatList();

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

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ qx.Class.define("osparc.dashboard.ResourceFilter", {
4949
__serviceTypeButtons: null,
5050

5151
__buildLayout: function() {
52-
if (this.__resourceType === "study" && osparc.utils.DisabledPlugins.isFoldersEnabled()) {
52+
if (this.__resourceType === "study") {
5353
this._add(this.__createWorkspacesAndFoldersTree());
5454
this._add(this.__createTrashBin());
5555
} else {
@@ -104,7 +104,8 @@ qx.Class.define("osparc.dashboard.ResourceFilter", {
104104
value: false,
105105
appearance: "filter-toggle-button",
106106
label: this.tr("Trash"),
107-
icon: "@FontAwesome5Solid/trash/18",
107+
icon: "@FontAwesome5Solid/trash/16",
108+
paddingLeft: 10, // align it with the context
108109
});
109110
trashButton.addListener("changeValue", e => {
110111
const trashEnabled = e.getData();
@@ -221,11 +222,11 @@ qx.Class.define("osparc.dashboard.ResourceFilter", {
221222

222223
/* TAGS */
223224
__createTagsFilterLayout: function() {
224-
const layout = new qx.ui.container.Composite(new qx.ui.layout.VBox(5));
225+
const layout = new qx.ui.container.Composite(new qx.ui.layout.VBox(2));
225226
osparc.utils.Utils.setIdToWidget(layout, this.__resourceType + "-tagsFilter");
226227

227228
this.__populateTags(layout, []);
228-
osparc.store.Store.getInstance().addListener("changeTags", () => {
229+
osparc.store.Tags.getInstance().addListener("tagsChanged", () => {
229230
this.__populateTags(layout, this.__getSelectedTagIds());
230231
}, this);
231232

@@ -242,7 +243,7 @@ qx.Class.define("osparc.dashboard.ResourceFilter", {
242243
this.__tagButtons = [];
243244
layout.removeAll();
244245
osparc.store.Tags.getInstance().getTags().forEach((tag, idx) => {
245-
const button = new qx.ui.form.ToggleButton(null, "@FontAwesome5Solid/tag/18");
246+
const button = new qx.ui.form.ToggleButton(null, "@FontAwesome5Solid/tag/16");
246247
button.id = tag.getTagId();
247248
tag.bind("name", button, "label");
248249
tag.bind("color", button.getChildControl("icon"), "textColor");
@@ -266,7 +267,7 @@ qx.Class.define("osparc.dashboard.ResourceFilter", {
266267

267268

268269
if (this.__tagButtons.length > maxTags) {
269-
const showAllButton = new qx.ui.form.Button(this.tr("All Tags..."), "@FontAwesome5Solid/tags/20");
270+
const showAllButton = new qx.ui.form.Button(this.tr("All Tags..."), "@FontAwesome5Solid/tags/16");
270271
showAllButton.set({
271272
appearance: "filter-toggle-button"
272273
});
@@ -284,6 +285,20 @@ qx.Class.define("osparc.dashboard.ResourceFilter", {
284285
});
285286
layout.add(showAllButton);
286287
}
288+
289+
const editTagsButton = new qx.ui.form.Button(this.tr("Edit Tags..."), "@FontAwesome5Solid/pencil-alt/14");
290+
editTagsButton.set({
291+
appearance: "filter-toggle-button"
292+
});
293+
editTagsButton.addListener("execute", () => {
294+
const preferencesWindow = osparc.desktop.preferences.PreferencesWindow.openWindow();
295+
preferencesWindow.openTags();
296+
});
297+
layout.add(editTagsButton);
298+
299+
if (this.__resourceType === "study") {
300+
layout.getChildren().forEach(item => item.setPaddingLeft(10)); // align them with the context
301+
}
287302
},
288303
/* /TAGS */
289304

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,8 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", {
242242

243243
__addClassifiers: function(menuButton) {
244244
const classifiers = osparc.store.Store.getInstance().getClassifiers();
245-
menuButton.setVisibility(classifiers.length ? "visible" : "excluded");
246-
if (classifiers.length) {
245+
menuButton.setVisibility(classifiers && classifiers.length ? "visible" : "excluded");
246+
if (classifiers && classifiers.length) {
247247
const classifiersMenu = new qx.ui.menu.Menu();
248248
classifiers.forEach(classifier => {
249249
const classifierButton = new qx.ui.menu.Button(classifier.display_name);

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

Lines changed: 99 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
166166
__reloadWorkspaces: function() {
167167
if (
168168
!osparc.auth.Manager.getInstance().isLoggedIn() ||
169-
!osparc.utils.DisabledPlugins.isFoldersEnabled() ||
170169
this.getCurrentContext() === "studiesAndFolders" ||
171170
this.getCurrentContext() === "search" || // not yet implemented for workspaces
172171
this.__loadingWorkspaces
@@ -212,7 +211,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
212211
__reloadFolders: function() {
213212
if (
214213
!osparc.auth.Manager.getInstance().isLoggedIn() ||
215-
!osparc.utils.DisabledPlugins.isFoldersEnabled() ||
216214
this.getCurrentContext() === "workspaces" ||
217215
this.__loadingFolders
218216
) {
@@ -991,11 +989,9 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
991989
_createLayout: function() {
992990
this._createSearchBar();
993991

994-
if (osparc.utils.DisabledPlugins.isFoldersEnabled()) {
995-
const header = this.__header = new osparc.dashboard.StudyBrowserHeader();
996-
this.__header.addListener("emptyTrashRequested", () => this.__emptyTrash(), this);
997-
this._addToLayout(header);
998-
}
992+
const header = this.__header = new osparc.dashboard.StudyBrowserHeader();
993+
this.__header.addListener("emptyTrashRequested", () => this.__emptyTrash(), this);
994+
this._addToLayout(header);
999995

1000996
this._createResourcesLayout("studiesList");
1001997

@@ -1069,112 +1065,108 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
10691065
},
10701066

10711067
__connectContexts: function() {
1072-
if (osparc.utils.DisabledPlugins.isFoldersEnabled()) {
1073-
const header = this.__header;
1074-
header.addListener("locationChanged", () => {
1075-
const workspaceId = header.getCurrentWorkspaceId();
1076-
const folderId = header.getCurrentFolderId();
1077-
this._changeContext("studiesAndFolders", workspaceId, folderId);
1078-
}, this);
1068+
const header = this.__header;
1069+
header.addListener("locationChanged", () => {
1070+
const workspaceId = header.getCurrentWorkspaceId();
1071+
const folderId = header.getCurrentFolderId();
1072+
this._changeContext("studiesAndFolders", workspaceId, folderId);
1073+
}, this);
10791074

1080-
const workspacesAndFoldersTree = this._resourceFilter.getWorkspacesAndFoldersTree();
1081-
workspacesAndFoldersTree.addListener("locationChanged", e => {
1082-
const context = e.getData();
1083-
const workspaceId = context["workspaceId"];
1084-
if (workspaceId === -1) {
1085-
this._changeContext("workspaces");
1086-
} else {
1087-
const folderId = context["folderId"];
1088-
this._changeContext("studiesAndFolders", workspaceId, folderId);
1089-
}
1090-
}, this);
1075+
const workspacesAndFoldersTree = this._resourceFilter.getWorkspacesAndFoldersTree();
1076+
workspacesAndFoldersTree.addListener("locationChanged", e => {
1077+
const context = e.getData();
1078+
const workspaceId = context["workspaceId"];
1079+
if (workspaceId === -1) {
1080+
this._changeContext("workspaces");
1081+
} else {
1082+
const folderId = context["folderId"];
1083+
this._changeContext("studiesAndFolders", workspaceId, folderId);
1084+
}
1085+
}, this);
10911086

1092-
this._resourceFilter.addListener("trashContext", () => {
1093-
this._changeContext("trash");
1094-
});
1087+
this._resourceFilter.addListener("trashContext", () => {
1088+
this._changeContext("trash");
1089+
});
10951090

1096-
this._searchBarFilter.addListener("filterChanged", e => {
1097-
const filterData = e.getData();
1098-
if (filterData.text) {
1099-
this._changeContext("search");
1100-
} else {
1101-
const workspaceId = this.getCurrentWorkspaceId();
1102-
const folderId = this.getCurrentFolderId();
1103-
this._changeContext("studiesAndFolders", workspaceId, folderId);
1104-
}
1105-
});
1106-
}
1091+
this._searchBarFilter.addListener("filterChanged", e => {
1092+
const filterData = e.getData();
1093+
if (filterData.text) {
1094+
this._changeContext("search");
1095+
} else {
1096+
const workspaceId = this.getCurrentWorkspaceId();
1097+
const folderId = this.getCurrentFolderId();
1098+
this._changeContext("studiesAndFolders", workspaceId, folderId);
1099+
}
1100+
});
11071101
},
11081102

11091103
_changeContext: function(context, workspaceId = null, folderId = null) {
1110-
if (osparc.utils.DisabledPlugins.isFoldersEnabled()) {
1111-
if (
1112-
context !== "search" && // reload studies for a new search
1113-
context === this.getCurrentContext() &&
1114-
workspaceId === this.getCurrentWorkspaceId() &&
1115-
folderId === this.getCurrentFolderId()
1116-
) {
1117-
// didn't really change
1118-
return;
1119-
}
1120-
1121-
osparc.store.Store.getInstance().setStudyBrowserContext(context);
1122-
this.set({
1123-
currentContext: context,
1124-
currentWorkspaceId: workspaceId,
1125-
currentFolderId: folderId,
1126-
});
1127-
this.resetSelection();
1128-
this.setMultiSelection(false);
1104+
if (
1105+
context !== "search" && // reload studies for a new search
1106+
context === this.getCurrentContext() &&
1107+
workspaceId === this.getCurrentWorkspaceId() &&
1108+
folderId === this.getCurrentFolderId()
1109+
) {
1110+
// didn't really change
1111+
return;
1112+
}
11291113

1130-
// reset lists
1131-
this.__setWorkspacesToList([]);
1132-
this.__setFoldersToList([]);
1133-
this._resourcesList = [];
1134-
this._resourcesContainer.setResourcesToList(this._resourcesList);
1135-
this._resourcesContainer.reloadCards("studies");
1136-
1137-
this._toolbar.show();
1138-
switch (this.getCurrentContext()) {
1139-
case "studiesAndFolders":
1140-
this._searchBarFilter.resetFilters();
1141-
this.__reloadFolders();
1142-
this._loadingResourcesBtn.setFetching(false);
1143-
this.invalidateStudies();
1144-
this.__reloadStudies();
1145-
break;
1146-
case "workspaces":
1147-
this._toolbar.exclude();
1148-
this._searchBarFilter.resetFilters();
1149-
this.__reloadWorkspaces();
1150-
break;
1151-
case "search":
1152-
this.__reloadWorkspaces();
1153-
this.__reloadFolders();
1154-
this._loadingResourcesBtn.setFetching(false);
1155-
this.invalidateStudies();
1156-
this.__reloadStudies();
1157-
break;
1158-
case "trash":
1159-
this._searchBarFilter.resetFilters();
1160-
this.__reloadWorkspaces();
1161-
this.__reloadFolders();
1162-
this._loadingResourcesBtn.setFetching(false);
1163-
this.invalidateStudies();
1164-
this.__reloadStudies();
1165-
break;
1166-
}
1114+
osparc.store.Store.getInstance().setStudyBrowserContext(context);
1115+
this.set({
1116+
currentContext: context,
1117+
currentWorkspaceId: workspaceId,
1118+
currentFolderId: folderId,
1119+
});
1120+
this.resetSelection();
1121+
this.setMultiSelection(false);
11671122

1168-
// notify header
1169-
const header = this.__header;
1170-
header.set({
1171-
currentWorkspaceId: workspaceId,
1172-
currentFolderId: folderId,
1173-
});
1123+
// reset lists
1124+
this.__setWorkspacesToList([]);
1125+
this.__setFoldersToList([]);
1126+
this._resourcesList = [];
1127+
this._resourcesContainer.setResourcesToList(this._resourcesList);
1128+
this._resourcesContainer.reloadCards("studies");
11741129

1175-
// notify Filters on the left
1176-
this._resourceFilter.contextChanged(context, workspaceId, folderId);
1130+
this._toolbar.show();
1131+
switch (this.getCurrentContext()) {
1132+
case "studiesAndFolders":
1133+
this._searchBarFilter.resetFilters();
1134+
this.__reloadFolders();
1135+
this._loadingResourcesBtn.setFetching(false);
1136+
this.invalidateStudies();
1137+
this.__reloadStudies();
1138+
break;
1139+
case "workspaces":
1140+
this._toolbar.exclude();
1141+
this._searchBarFilter.resetFilters();
1142+
this.__reloadWorkspaces();
1143+
break;
1144+
case "search":
1145+
this.__reloadWorkspaces();
1146+
this.__reloadFolders();
1147+
this._loadingResourcesBtn.setFetching(false);
1148+
this.invalidateStudies();
1149+
this.__reloadStudies();
1150+
break;
1151+
case "trash":
1152+
this._searchBarFilter.resetFilters();
1153+
this.__reloadWorkspaces();
1154+
this.__reloadFolders();
1155+
this._loadingResourcesBtn.setFetching(false);
1156+
this.invalidateStudies();
1157+
this.__reloadStudies();
1158+
break;
11771159
}
1160+
1161+
// notify header
1162+
const header = this.__header;
1163+
header.set({
1164+
currentWorkspaceId: workspaceId,
1165+
currentFolderId: folderId,
1166+
});
1167+
1168+
// notify Filters on the left
1169+
this._resourceFilter.contextChanged(context, workspaceId, folderId);
11781170
},
11791171

11801172
__addSortByButton: function() {
@@ -1560,13 +1552,11 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
15601552
menu.add(billingsSettingsButton);
15611553
}
15621554

1563-
if (writeAccess && osparc.utils.DisabledPlugins.isFoldersEnabled()) {
1564-
menu.addSeparator();
1555+
menu.addSeparator();
15651556

1566-
const moveToButton = this.__getMoveStudyToMenuButton(studyData);
1567-
if (moveToButton) {
1568-
menu.add(moveToButton);
1569-
}
1557+
const moveToButton = this.__getMoveStudyToMenuButton(studyData);
1558+
if (moveToButton) {
1559+
menu.add(moveToButton);
15701560
}
15711561

15721562
if (deleteAccess) {

services/static-webserver/client/source/class/osparc/data/Resources.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ qx.Class.define("osparc.data.Resources", {
343343
},
344344
moveToWorkspace: {
345345
method: "POST",
346-
url: statics.API + "/folders/{folderId}/folders/{workspaceId}:move"
346+
url: statics.API + "/folders/{folderId}/workspaces/{workspaceId}:move"
347347
},
348348
trash: {
349349
method: "POST",

0 commit comments

Comments
 (0)