Skip to content

Commit e2d4696

Browse files
Merge branch 'master' into fix-decimal-serialization
2 parents b8ed53b + 81e5b8e commit e2d4696

File tree

20 files changed

+328
-266
lines changed

20 files changed

+328
-266
lines changed

services/static-webserver/client/source/class/osparc/Application.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -209,17 +209,10 @@ qx.Class.define("osparc.Application", {
209209
},
210210

211211
__updateTabName: function() {
212-
const platformName = osparc.store.StaticInfo.getInstance().getPlatformName();
213-
if (osparc.utils.Utils.isInZ43()) {
214-
document.title += " Z43";
215-
}
216-
if (platformName) {
217-
document.title += ` (${platformName})`;
218-
}
212+
const newName = osparc.utils.Utils.composeTabName();
213+
osparc.utils.Utils.updateTabName(newName);
219214
},
220215

221-
222-
223216
__setDeviceSpecificIcons: function() {
224217
const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
225218
const isAndroid = /android/i.test(navigator.userAgent);

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: 100 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,7 @@ 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" ||
171-
this.getCurrentContext() === "search" || // not yet implemented for workspaces
172170
this.__loadingWorkspaces
173171
) {
174172
return;
@@ -179,7 +177,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
179177
case "search": {
180178
const filterData = this._searchBarFilter.getFilterData();
181179
const text = filterData.text ? encodeURIComponent(filterData.text) : "";
182-
request = osparc.store.Workspaces.getInstance().searchWorkspaces(text);
180+
request = osparc.store.Workspaces.getInstance().searchWorkspaces(text, this.getOrderBy());
183181
break;
184182
}
185183
case "workspaces": {
@@ -212,7 +210,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
212210
__reloadFolders: function() {
213211
if (
214212
!osparc.auth.Manager.getInstance().isLoggedIn() ||
215-
!osparc.utils.DisabledPlugins.isFoldersEnabled() ||
216213
this.getCurrentContext() === "workspaces" ||
217214
this.__loadingFolders
218215
) {
@@ -991,11 +988,9 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
991988
_createLayout: function() {
992989
this._createSearchBar();
993990

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-
}
991+
const header = this.__header = new osparc.dashboard.StudyBrowserHeader();
992+
this.__header.addListener("emptyTrashRequested", () => this.__emptyTrash(), this);
993+
this._addToLayout(header);
999994

1000995
this._createResourcesLayout("studiesList");
1001996

@@ -1069,112 +1064,108 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
10691064
},
10701065

10711066
__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);
1067+
const header = this.__header;
1068+
header.addListener("locationChanged", () => {
1069+
const workspaceId = header.getCurrentWorkspaceId();
1070+
const folderId = header.getCurrentFolderId();
1071+
this._changeContext("studiesAndFolders", workspaceId, folderId);
1072+
}, this);
10791073

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);
1074+
const workspacesAndFoldersTree = this._resourceFilter.getWorkspacesAndFoldersTree();
1075+
workspacesAndFoldersTree.addListener("locationChanged", e => {
1076+
const context = e.getData();
1077+
const workspaceId = context["workspaceId"];
1078+
if (workspaceId === -1) {
1079+
this._changeContext("workspaces");
1080+
} else {
1081+
const folderId = context["folderId"];
1082+
this._changeContext("studiesAndFolders", workspaceId, folderId);
1083+
}
1084+
}, this);
10911085

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

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-
}
1090+
this._searchBarFilter.addListener("filterChanged", e => {
1091+
const filterData = e.getData();
1092+
if (filterData.text) {
1093+
this._changeContext("search");
1094+
} else {
1095+
const workspaceId = this.getCurrentWorkspaceId();
1096+
const folderId = this.getCurrentFolderId();
1097+
this._changeContext("studiesAndFolders", workspaceId, folderId);
1098+
}
1099+
});
11071100
},
11081101

11091102
_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);
1103+
if (
1104+
context !== "search" && // reload studies for a new search
1105+
context === this.getCurrentContext() &&
1106+
workspaceId === this.getCurrentWorkspaceId() &&
1107+
folderId === this.getCurrentFolderId()
1108+
) {
1109+
// didn't really change
1110+
return;
1111+
}
11291112

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-
}
1113+
osparc.store.Store.getInstance().setStudyBrowserContext(context);
1114+
this.set({
1115+
currentContext: context,
1116+
currentWorkspaceId: workspaceId,
1117+
currentFolderId: folderId,
1118+
});
1119+
this.resetSelection();
1120+
this.setMultiSelection(false);
11671121

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

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

11801171
__addSortByButton: function() {
@@ -1560,13 +1551,11 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
15601551
menu.add(billingsSettingsButton);
15611552
}
15621553

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

1566-
const moveToButton = this.__getMoveStudyToMenuButton(studyData);
1567-
if (moveToButton) {
1568-
menu.add(moveToButton);
1569-
}
1556+
const moveToButton = this.__getMoveStudyToMenuButton(studyData);
1557+
if (moveToButton) {
1558+
menu.add(moveToButton);
15701559
}
15711560

15721561
if (deleteAccess) {

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

Lines changed: 2 additions & 2 deletions
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",
@@ -368,7 +368,7 @@ qx.Class.define("osparc.data.Resources", {
368368
getPageSearch: {
369369
useCache: false,
370370
method: "GET",
371-
url: statics.API + "/workspaces:search?offset={offset}&limit={limit}&text={text}&order_by={orderBy}"
371+
url: statics.API + "/workspaces?offset={offset}&limit={limit}&filters={filters}&order_by={orderBy}"
372372
},
373373
getPageTrashed: {
374374
useCache: false,

0 commit comments

Comments
 (0)