Skip to content

Commit 3c85620

Browse files
authored
🎨 [Frontend] Search across all Workspaces and Folders (#6470)
1 parent 3bfe2be commit 3c85620

File tree

15 files changed

+201
-226
lines changed

15 files changed

+201
-226
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ qx.Class.define("osparc.dashboard.ContextBreadcrumbs", {
5252
__rebuild: function() {
5353
this._removeAll();
5454

55+
if (this.getCurrentWorkspaceId() === -2) {
56+
return;
57+
}
58+
5559
if (this.getCurrentFolderId()) {
5660
const currentFolder = osparc.store.Folders.getInstance().getFolder(this.getCurrentFolderId());
5761
this.__createUpstreamButtons(currentFolder);

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,10 @@ qx.Class.define("osparc.dashboard.FolderButtonBase", {
112112
},
113113

114114
_shouldApplyFilter: function(data) {
115-
console.log("_shouldApplyFilter", data);
116115
return false;
117116
},
118117

119118
_shouldReactToFilter: function(data) {
120-
console.log("_shouldReactToFilter", data);
121119
return false;
122120
}
123121
},

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {
4242
const mainLayoutWithSideSpacers = new qx.ui.container.Composite(new qx.ui.layout.HBox(spacing))
4343
this._addToMainLayout(mainLayoutWithSideSpacers);
4444

45-
this.__leftFilters = new qx.ui.container.Composite(new qx.ui.layout.VBox(10)).set({
45+
this.__leftFilters = new qx.ui.container.Composite(new qx.ui.layout.VBox(15)).set({
4646
width: leftColumnWidth
4747
});
4848
mainLayoutWithSideSpacers.add(this.__leftFilters);
4949

50-
this.__centerLayout = new qx.ui.container.Composite(new qx.ui.layout.VBox(10));
50+
this.__centerLayout = new qx.ui.container.Composite(new qx.ui.layout.VBox(15));
5151
mainLayoutWithSideSpacers.add(this.__centerLayout);
5252

53-
const rightColum = new qx.ui.container.Composite(new qx.ui.layout.VBox(10));
53+
const rightColum = new qx.ui.container.Composite(new qx.ui.layout.VBox());
5454
mainLayoutWithSideSpacers.add(rightColum, {
5555
flex: 1
5656
});
@@ -236,6 +236,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {
236236
});
237237
const textField = searchBarFilter.getChildControl("text-field");
238238
osparc.utils.Utils.setIdToWidget(textField, "searchBarFilter-textField-"+this._resourceType);
239+
239240
this._addToLayout(searchBarFilter);
240241
},
241242

@@ -356,6 +357,15 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {
356357
radioGroup.add(btn);
357358
});
358359

360+
if (this._resourceType === "study") {
361+
const viewMode = osparc.utils.Utils.localCache.getLocalStorageItem("studiesViewMode");
362+
if (viewMode) {
363+
if (viewMode === "list") {
364+
radioGroup.setSelection([listBtn]);
365+
}
366+
}
367+
}
368+
359369
this._toolbar.add(viewModeLayout);
360370
},
361371

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

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
3232
this.__resourcesList = [];
3333
this.__groupedContainersList = [];
3434

35-
const containerHeader = this.__containerHeader = new osparc.dashboard.ContextBreadcrumbs();
36-
this._add(containerHeader);
37-
containerHeader.setVisibility(osparc.utils.DisabledPlugins.isFoldersEnabled() ? "visible" : "excluded");
38-
3935

4036
const workspacesContainer = this.__workspacesContainer = new osparc.dashboard.ToggleButtonContainer();
4137
workspacesContainer.setVisibility(osparc.utils.DisabledPlugins.isFoldersEnabled() ? "visible" : "excluded");
@@ -64,7 +60,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
6460
init: "grid",
6561
nullable: false,
6662
event: "changeMode",
67-
apply: "reloadCards"
63+
apply: "__reloadCards"
6864
},
6965

7066
groupBy: {
@@ -117,8 +113,6 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
117113
__workspacesList: null,
118114
__resourcesList: null,
119115
__groupedContainersList: null,
120-
__foldersLayout: null,
121-
__containerHeader: null,
122116
__foldersContainer: null,
123117
__workspacesContainer: null,
124118
__nonGroupedContainer: null,
@@ -163,10 +157,6 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
163157
}
164158
},
165159

166-
getContainerHeader: function() {
167-
return this.__containerHeader;
168-
},
169-
170160
getFlatList: function() {
171161
return this.__nonGroupedContainer;
172162
},
@@ -233,7 +223,10 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
233223
position: "bottom-right"
234224
});
235225
card.setMenu(menu);
236-
card.subscribeToFilterGroup("searchBarFilter");
226+
if (resourceData.type !== "study") {
227+
// the backend will do the projects:search
228+
card.subscribeToFilterGroup("searchBarFilter");
229+
}
237230

238231
[
239232
"updateStudy",
@@ -284,6 +277,10 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
284277
this._removeAll();
285278
},
286279

280+
__reloadCards: function(mode) {
281+
this.reloadCards();
282+
},
283+
287284
__addFoldersContainer: function() {
288285
// add foldersContainer dynamically
289286
[
@@ -356,7 +353,6 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
356353

357354
reloadWorkspaces: function() {
358355
this.__cleanAll();
359-
this._add(this.__containerHeader);
360356
this._add(this.__workspacesContainer);
361357
let workspacesCards = [];
362358
this.__workspacesList.forEach(workspaceData => workspacesCards.push(this.__workspaceToCard(workspaceData)));
@@ -375,7 +371,6 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
375371

376372
__createWorkspaceCard: function(workspace) {
377373
const card = new osparc.dashboard.WorkspaceButtonItem(workspace);
378-
card.subscribeToFilterGroup("searchBarFilter");
379374
[
380375
"workspaceSelected",
381376
"workspaceUpdated",
@@ -411,7 +406,6 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
411406

412407
__createFolderCard: function(folder) {
413408
const card = new osparc.dashboard.FolderButtonItem(folder);
414-
card.subscribeToFilterGroup("searchBarFilter");
415409
[
416410
"folderSelected",
417411
"folderUpdated",

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,11 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
159159
this.__openResource();
160160
}
161161
})
162-
.catch(() => this.__openButton.setFetching(false));
162+
.catch(err => {
163+
console.error(err);
164+
osparc.FlashMessenger.logAs(err.message, "ERROR");
165+
this.__openButton.setFetching(false);
166+
});
163167
},
164168

165169
__confirmUpdate: function() {

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,6 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", {
285285
});
286286
},
287287

288-
resetSharedWithActiveFilter: function() {
289-
this.__removeChips("shared-with");
290-
this.__filter();
291-
},
292288

293289
setSharedWithActiveFilter: function(optionId, optionLabel) {
294290
this.__removeChips("shared-with");
@@ -353,9 +349,13 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", {
353349
}
354350
},
355351

356-
__resetFilters: function() {
352+
resetFilters: function() {
357353
this.__removeChips();
358354
this.getChildControl("text-field").resetValue();
355+
},
356+
357+
__resetFilters: function() {
358+
this.resetFilters();
359359
this.__filter();
360360
},
361361

0 commit comments

Comments
 (0)