Skip to content

Commit

Permalink
🎨 [Frontend] Search across all Workspaces and Folders (#6470)
Browse files Browse the repository at this point in the history
  • Loading branch information
odeimaiz authored Oct 15, 2024
1 parent 3bfe2be commit 3c85620
Show file tree
Hide file tree
Showing 15 changed files with 201 additions and 226 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ qx.Class.define("osparc.dashboard.ContextBreadcrumbs", {
__rebuild: function() {
this._removeAll();

if (this.getCurrentWorkspaceId() === -2) {
return;
}

if (this.getCurrentFolderId()) {
const currentFolder = osparc.store.Folders.getInstance().getFolder(this.getCurrentFolderId());
this.__createUpstreamButtons(currentFolder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,10 @@ qx.Class.define("osparc.dashboard.FolderButtonBase", {
},

_shouldApplyFilter: function(data) {
console.log("_shouldApplyFilter", data);
return false;
},

_shouldReactToFilter: function(data) {
console.log("_shouldReactToFilter", data);
return false;
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {
const mainLayoutWithSideSpacers = new qx.ui.container.Composite(new qx.ui.layout.HBox(spacing))
this._addToMainLayout(mainLayoutWithSideSpacers);

this.__leftFilters = new qx.ui.container.Composite(new qx.ui.layout.VBox(10)).set({
this.__leftFilters = new qx.ui.container.Composite(new qx.ui.layout.VBox(15)).set({
width: leftColumnWidth
});
mainLayoutWithSideSpacers.add(this.__leftFilters);

this.__centerLayout = new qx.ui.container.Composite(new qx.ui.layout.VBox(10));
this.__centerLayout = new qx.ui.container.Composite(new qx.ui.layout.VBox(15));
mainLayoutWithSideSpacers.add(this.__centerLayout);

const rightColum = new qx.ui.container.Composite(new qx.ui.layout.VBox(10));
const rightColum = new qx.ui.container.Composite(new qx.ui.layout.VBox());
mainLayoutWithSideSpacers.add(rightColum, {
flex: 1
});
Expand Down Expand Up @@ -236,6 +236,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {
});
const textField = searchBarFilter.getChildControl("text-field");
osparc.utils.Utils.setIdToWidget(textField, "searchBarFilter-textField-"+this._resourceType);

this._addToLayout(searchBarFilter);
},

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

if (this._resourceType === "study") {
const viewMode = osparc.utils.Utils.localCache.getLocalStorageItem("studiesViewMode");
if (viewMode) {
if (viewMode === "list") {
radioGroup.setSelection([listBtn]);
}
}
}

this._toolbar.add(viewModeLayout);
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
this.__resourcesList = [];
this.__groupedContainersList = [];

const containerHeader = this.__containerHeader = new osparc.dashboard.ContextBreadcrumbs();
this._add(containerHeader);
containerHeader.setVisibility(osparc.utils.DisabledPlugins.isFoldersEnabled() ? "visible" : "excluded");


const workspacesContainer = this.__workspacesContainer = new osparc.dashboard.ToggleButtonContainer();
workspacesContainer.setVisibility(osparc.utils.DisabledPlugins.isFoldersEnabled() ? "visible" : "excluded");
Expand Down Expand Up @@ -64,7 +60,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
init: "grid",
nullable: false,
event: "changeMode",
apply: "reloadCards"
apply: "__reloadCards"
},

groupBy: {
Expand Down Expand Up @@ -117,8 +113,6 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
__workspacesList: null,
__resourcesList: null,
__groupedContainersList: null,
__foldersLayout: null,
__containerHeader: null,
__foldersContainer: null,
__workspacesContainer: null,
__nonGroupedContainer: null,
Expand Down Expand Up @@ -163,10 +157,6 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
}
},

getContainerHeader: function() {
return this.__containerHeader;
},

getFlatList: function() {
return this.__nonGroupedContainer;
},
Expand Down Expand Up @@ -233,7 +223,10 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
position: "bottom-right"
});
card.setMenu(menu);
card.subscribeToFilterGroup("searchBarFilter");
if (resourceData.type !== "study") {
// the backend will do the projects:search
card.subscribeToFilterGroup("searchBarFilter");
}

[
"updateStudy",
Expand Down Expand Up @@ -284,6 +277,10 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
this._removeAll();
},

__reloadCards: function(mode) {
this.reloadCards();
},

__addFoldersContainer: function() {
// add foldersContainer dynamically
[
Expand Down Expand Up @@ -356,7 +353,6 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {

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

__createWorkspaceCard: function(workspace) {
const card = new osparc.dashboard.WorkspaceButtonItem(workspace);
card.subscribeToFilterGroup("searchBarFilter");
[
"workspaceSelected",
"workspaceUpdated",
Expand Down Expand Up @@ -411,7 +406,6 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {

__createFolderCard: function(folder) {
const card = new osparc.dashboard.FolderButtonItem(folder);
card.subscribeToFilterGroup("searchBarFilter");
[
"folderSelected",
"folderUpdated",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,11 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
this.__openResource();
}
})
.catch(() => this.__openButton.setFetching(false));
.catch(err => {
console.error(err);
osparc.FlashMessenger.logAs(err.message, "ERROR");
this.__openButton.setFetching(false);
});
},

__confirmUpdate: function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,6 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", {
});
},

resetSharedWithActiveFilter: function() {
this.__removeChips("shared-with");
this.__filter();
},

setSharedWithActiveFilter: function(optionId, optionLabel) {
this.__removeChips("shared-with");
Expand Down Expand Up @@ -353,9 +349,13 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", {
}
},

__resetFilters: function() {
resetFilters: function() {
this.__removeChips();
this.getChildControl("text-field").resetValue();
},

__resetFilters: function() {
this.resetFilters();
this.__filter();
},

Expand Down
Loading

0 comments on commit 3c85620

Please sign in to comment.