From 08021e75cc6de7d665cfb7452d39c01949630a1a Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Thu, 24 Oct 2024 11:54:23 +0200 Subject: [PATCH 01/19] rename header --- .../class/osparc/dashboard/StudyBrowser.js | 53 ++++++++++++------- ...rkspaceHeader.js => StudyBrowserHeader.js} | 2 +- 2 files changed, 36 insertions(+), 19 deletions(-) rename services/static-webserver/client/source/class/osparc/dashboard/{WorkspaceHeader.js => StudyBrowserHeader.js} (99%) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js index bc22291e7bca..de825764045e 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -49,6 +49,13 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }, properties: { + currentContext: { + check: ["studiesAndFolders", "workspaces", "search", "bin"], + nullable: false, + init: "studiesAndFolders", + event: "changeCurrentContext" + }, + currentWorkspaceId: { check: "Number", nullable: true, @@ -101,7 +108,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { members: { __dontShowTutorial: null, - __workspaceHeader: null, + __header: null, __workspacesList: null, __foldersList: null, @@ -177,7 +184,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { if (osparc.utils.DisabledPlugins.isFoldersEnabled()) { const folderId = this.getCurrentFolderId(); const workspaceId = this.getCurrentWorkspaceId(); - if (workspaceId === -1 || workspaceId === -2) { + if (this.getCurrentContext() !== "studiesAndFolders") { return; } this.__setFoldersToList([]); @@ -412,7 +419,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { __addNewFolderButton: function() { const currentWorkspaceId = this.getCurrentWorkspaceId(); if (currentWorkspaceId) { - if (currentWorkspaceId === -1 || currentWorkspaceId === -2) { + if (this.getCurrentContext() !== "studiesAndFolders") { return; } const currentWorkspace = osparc.store.Workspaces.getInstance().getWorkspace(this.getCurrentWorkspaceId()); @@ -697,11 +704,11 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }, __addNewStudyButtons: function() { + if (this.getCurrentContext() !== "studiesAndFolders") { + return; + } const currentWorkspaceId = this.getCurrentWorkspaceId(); if (currentWorkspaceId) { - if (currentWorkspaceId === -2) { - return; - } const currentWorkspace = osparc.store.Workspaces.getInstance().getWorkspace(currentWorkspaceId); if (currentWorkspace && !currentWorkspace.getMyAccessRights()["write"]) { // If user can't write in workspace, do not show plus buttons @@ -827,8 +834,8 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { this._createSearchBar(); if (osparc.utils.DisabledPlugins.isFoldersEnabled()) { - const workspaceHeader = this.__workspaceHeader = new osparc.dashboard.WorkspaceHeader(); - this._addToLayout(workspaceHeader); + const header = this.__header = new osparc.dashboard.StudyBrowserHeader(); + this._addToLayout(header); } this._createResourcesLayout(); @@ -900,7 +907,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { __connectContexts: function() { if (osparc.utils.DisabledPlugins.isFoldersEnabled()) { - const workspaceHeader = this.__workspaceHeader; + const workspaceHeader = this.__header; workspaceHeader.addListener("contextChanged", () => { const workspaceId = workspaceHeader.getCurrentWorkspaceId(); const folderId = workspaceHeader.getCurrentFolderId(); @@ -940,31 +947,41 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { this.resetSelection(); this.setMultiSelection(false); + let currentContext = null; + switch (workspaceId) { + case -2: + currentContext = "search"; + break; + case -1: + currentContext = "workspaces"; + break; + default: + currentContext = "studiesAndFolders"; + break; + } this.set({ + currentContext, currentWorkspaceId: workspaceId, currentFolderId: folderId, }); this.invalidateStudies(); this._resourcesContainer.setResourcesToList([]); - if (workspaceId === -2) { - // Search result: no folders, just studies + if (currentContext === "search") { this.__setFoldersToList([]); this.__reloadStudies(); - } else if (workspaceId === -1) { - // Workspaces + } else if (currentContext === "workspaces") { this._searchBarFilter.resetFilters(); this.__reloadWorkspaces(); - } else { - // Actual workspace + } else if (currentContext === "studiesAndFolders") { this._searchBarFilter.resetFilters(); this.__reloadFolders(); this.__reloadStudies(); } - // notify workspaceHeader - const workspaceHeader = this.__workspaceHeader; - workspaceHeader.set({ + // notify header + const header = this.__header; + header.set({ currentWorkspaceId: workspaceId, currentFolderId: folderId, }); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceHeader.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js similarity index 99% rename from services/static-webserver/client/source/class/osparc/dashboard/WorkspaceHeader.js rename to services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js index 819a8bf07bb3..4ee9dd1b4c41 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceHeader.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js @@ -20,7 +20,7 @@ * */ -qx.Class.define("osparc.dashboard.WorkspaceHeader", { +qx.Class.define("osparc.dashboard.StudyBrowserHeader", { extend: qx.ui.core.Widget, construct: function() { From 0439637ab74c377eaca3d6916c861f3e1865eec3 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Thu, 24 Oct 2024 12:33:57 +0200 Subject: [PATCH 02/19] currentContext prop in header --- .../class/osparc/dashboard/StudyBrowser.js | 24 ++++++++++--------- .../osparc/dashboard/StudyBrowserHeader.js | 7 ++++++ 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js index de825764045e..e397d509a55e 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -936,17 +936,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { __changeContext: function(workspaceId, folderId) { if (osparc.utils.DisabledPlugins.isFoldersEnabled()) { - if ( - workspaceId !== -2 && // reload studies for a new search - workspaceId === this.getCurrentWorkspaceId() && - folderId === this.getCurrentFolderId() - ) { - // didn't really change - return; - } - - this.resetSelection(); - this.setMultiSelection(false); let currentContext = null; switch (workspaceId) { case -2: @@ -959,6 +948,18 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { currentContext = "studiesAndFolders"; break; } + + if ( + currentContext !== "search" && // reload studies for a new search + workspaceId === this.getCurrentWorkspaceId() && + folderId === this.getCurrentFolderId() + ) { + // didn't really change + return; + } + + this.resetSelection(); + this.setMultiSelection(false); this.set({ currentContext, currentWorkspaceId: workspaceId, @@ -982,6 +983,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { // notify header const header = this.__header; header.set({ + currentContext, currentWorkspaceId: workspaceId, currentFolderId: folderId, }); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js index 4ee9dd1b4c41..8e9136dfaaf5 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js @@ -48,6 +48,13 @@ qx.Class.define("osparc.dashboard.StudyBrowserHeader", { }, properties: { + currentContext: { + check: ["studiesAndFolders", "workspaces", "search", "bin"], + nullable: false, + init: "studiesAndFolders", + event: "changeCurrentContext" + }, + currentWorkspaceId: { check: "Number", nullable: true, From a61bd97ae1b182d76b6941a114d72023eeb30c6c Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Thu, 24 Oct 2024 13:00:14 +0200 Subject: [PATCH 03/19] use currentContext --- .../class/osparc/dashboard/StudyBrowserHeader.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js index 8e9136dfaaf5..fa34dd064bd0 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js @@ -52,7 +52,8 @@ qx.Class.define("osparc.dashboard.StudyBrowserHeader", { check: ["studiesAndFolders", "workspaces", "search", "bin"], nullable: false, init: "studiesAndFolders", - event: "changeCurrentContext" + event: "changeCurrentContext", + apply: "__buildLayout" }, currentWorkspaceId: { @@ -183,7 +184,7 @@ qx.Class.define("osparc.dashboard.StudyBrowserHeader", { return control || this.base(arguments, id); }, - __buildLayout: function(workspaceId) { + __buildLayout: function() { this.getChildControl("icon"); const title = this.getChildControl("workspace-title"); this.getChildControl("breadcrumbs"); @@ -191,19 +192,21 @@ qx.Class.define("osparc.dashboard.StudyBrowserHeader", { this.resetAccessRights(); this.resetMyAccessRights(); - if (workspaceId === -2) { + const currentContext = this.getCurrentContext(); + if (currentContext === "search") { this.__setIcon("@FontAwesome5Solid/search/24"); title.set({ value: this.tr("Search results"), cursor: "auto", }); - } else if (workspaceId === -1) { + } else if (currentContext === "workspaces") { this.__setIcon(osparc.store.Workspaces.iconPath(32)); title.set({ value: this.tr("Shared Workspaces"), cursor: "auto", }) - } else { + } else if (currentContext === "studiesAndFolders") { + const workspaceId = this.getCurrentWorkspaceId(); title.set({ cursor: "pointer" }); @@ -339,7 +342,7 @@ qx.Class.define("osparc.dashboard.StudyBrowserHeader", { const win = osparc.ui.window.Window.popUpInWindow(permissionsView, title, 300, 200); permissionsView.addListener("workspaceUpdated", () => { win.close(); - this.__buildLayout(this.getCurrentWorkspaceId()); + this.__buildLayout(); }, this); }, From f47ac8f14ee16c67ca0d9bec486e3d5a5dfca631 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Thu, 24 Oct 2024 13:02:28 +0200 Subject: [PATCH 04/19] minor --- .../client/source/class/osparc/dashboard/StudyBrowser.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js index e397d509a55e..35b205619494 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -907,10 +907,10 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { __connectContexts: function() { if (osparc.utils.DisabledPlugins.isFoldersEnabled()) { - const workspaceHeader = this.__header; - workspaceHeader.addListener("contextChanged", () => { - const workspaceId = workspaceHeader.getCurrentWorkspaceId(); - const folderId = workspaceHeader.getCurrentFolderId(); + const header = this.__header; + header.addListener("contextChanged", () => { + const workspaceId = header.getCurrentWorkspaceId(); + const folderId = header.getCurrentFolderId(); this.__changeContext(workspaceId, folderId); }, this); From 8f1f52494020a6551c2466d36c9596bcb09d42a9 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Thu, 24 Oct 2024 13:03:11 +0200 Subject: [PATCH 05/19] "locationChanged" --- .../source/class/osparc/dashboard/ContextBreadcrumbs.js | 4 ++-- .../client/source/class/osparc/dashboard/StudyBrowser.js | 2 +- .../source/class/osparc/dashboard/StudyBrowserHeader.js | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ContextBreadcrumbs.js b/services/static-webserver/client/source/class/osparc/dashboard/ContextBreadcrumbs.js index f31ad07941cf..0e29f60fdb82 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ContextBreadcrumbs.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ContextBreadcrumbs.js @@ -27,7 +27,7 @@ qx.Class.define("osparc.dashboard.ContextBreadcrumbs", { }, events: { - "contextChanged": "qx.event.type.Data", + "locationChanged": "qx.event.type.Data", }, properties: { @@ -94,7 +94,7 @@ qx.Class.define("osparc.dashboard.ContextBreadcrumbs", { currentWorkspaceId: workspaceId, currentFolderId: folderId, }); - this.fireDataEvent("contextChanged", { + this.fireDataEvent("locationChanged", { workspaceId, folderId, }); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js index 35b205619494..8cf6c2a65e5d 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -908,7 +908,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { __connectContexts: function() { if (osparc.utils.DisabledPlugins.isFoldersEnabled()) { const header = this.__header; - header.addListener("contextChanged", () => { + header.addListener("locationChanged", () => { const workspaceId = header.getCurrentWorkspaceId(); const folderId = header.getCurrentFolderId(); this.__changeContext(workspaceId, folderId); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js index fa34dd064bd0..fa7ed0f7e3d5 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js @@ -42,7 +42,7 @@ qx.Class.define("osparc.dashboard.StudyBrowserHeader", { }, events: { - "contextChanged": "qx.event.type.Data", + "locationChanged": "qx.event.type.Data", "workspaceUpdated": "qx.event.type.Data", "deleteWorkspaceRequested": "qx.event.type.Data" }, @@ -121,8 +121,8 @@ qx.Class.define("osparc.dashboard.StudyBrowserHeader", { this.bind("currentFolderId", control, "currentFolderId"); control.bind("currentWorkspaceId", this, "currentWorkspaceId"); control.bind("currentFolderId", this, "currentFolderId"); - control.addListener("contextChanged", e => { - this.fireDataEvent("contextChanged", e.getData()) + control.addListener("locationChanged", e => { + this.fireDataEvent("locationChanged", e.getData()) }); this._add(control); break; @@ -213,7 +213,7 @@ qx.Class.define("osparc.dashboard.StudyBrowserHeader", { title.addListener("tap", () => { const folderId = null; this.setCurrentFolderId(folderId); - this.fireDataEvent("contextChanged", { + this.fireDataEvent("locationChanged", { workspaceId, folderId, }); From 842fabece405499b8ee80049b00faf58055583ee Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Thu, 24 Oct 2024 13:08:33 +0200 Subject: [PATCH 06/19] more renaming --- .../client/source/class/osparc/dashboard/StudyBrowser.js | 2 +- .../source/class/osparc/dashboard/WorkspacesAndFoldersTree.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js index 8cf6c2a65e5d..96268121e1f7 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -915,7 +915,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }, this); const workspacesAndFoldersTree = this._resourceFilter.getWorkspacesAndFoldersTree(); - workspacesAndFoldersTree.addListener("contextChanged", e => { + workspacesAndFoldersTree.addListener("locationChanged", e => { const context = e.getData(); const workspaceId = context["workspaceId"]; const folderId = context["folderId"]; diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTree.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTree.js index 46382726935f..dc1b6a94a65d 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTree.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTree.js @@ -83,7 +83,7 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTree", { const item = selection.getItem(0); const workspaceId = item.getWorkspaceId(); const folderId = item.getFolderId(); - this.fireDataEvent("contextChanged", { + this.fireDataEvent("locationChanged", { workspaceId, folderId, }); @@ -93,7 +93,7 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTree", { events: { "openChanged": "qx.event.type.Event", - "contextChanged": "qx.event.type.Data", + "locationChanged": "qx.event.type.Data", }, properties: { From a8d50e689658972e2584a478345fa187a7cab1d6 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Thu, 24 Oct 2024 13:29:42 +0200 Subject: [PATCH 07/19] Trash context --- .../class/osparc/dashboard/ResourceFilter.js | 27 +++++++++-- .../class/osparc/dashboard/StudyBrowser.js | 45 ++++++++----------- .../osparc/dashboard/StudyBrowserHeader.js | 8 +++- 3 files changed, 48 insertions(+), 32 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.js index 18464aa37550..89d85e6384a0 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.js @@ -29,11 +29,12 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { this.__tagButtons = []; this.__serviceTypeButtons = []; - this._setLayout(new qx.ui.layout.VBox(30)); + this._setLayout(new qx.ui.layout.VBox(20)); this.__buildLayout(); }, events: { + "trashContext": "qx.event.type.Event", "changeSharedWith": "qx.event.type.Data", "changeSelectedTags": "qx.event.type.Data", "changeServiceType": "qx.event.type.Data" @@ -42,6 +43,7 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { members: { __resourceType: null, __workspacesAndFoldersTree: null, + __trashButton: null, __sharedWithButtons: null, __tagButtons: null, __serviceTypeButtons: null, @@ -49,6 +51,7 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { __buildLayout: function() { if (this.__resourceType === "study" && osparc.utils.DisabledPlugins.isFoldersEnabled()) { this._add(this.__createWorkspacesAndFoldersTree()); + this._add(this.__createTrashBin()); } else { this._add(this.__createSharedWithFilterLayout()); } @@ -62,15 +65,14 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { } }, - /* WORKSPACES AND FOLDERS */ __createWorkspacesAndFoldersTree: function() { const workspacesAndFoldersTree = this.__workspacesAndFoldersTree = new osparc.dashboard.WorkspacesAndFoldersTree(); // Height needs to be calculated manually to make it flexible workspacesAndFoldersTree.set({ - minHeight: 100, + minHeight: 60, maxHeight: 400, - height: 100, + height: 60, }); workspacesAndFoldersTree.addListener("openChanged", () => { const rowConfig = workspacesAndFoldersTree.getPane().getRowConfig(); @@ -85,6 +87,23 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { }, /* /WORKSPACES AND FOLDERS */ + /* TRASH BIN */ + __createTrashBin: function() { + const trashButton = this.__trashButton = new qx.ui.toolbar.RadioButton().set({ + appearance: "filter-toggle-button", + label: this.tr("Trash"), + icon: "@FontAwesome5Solid/trash/18", + }); + trashButton.addListener("changeValue", e => { + const trashEnabled = e.getData(); + if (trashEnabled) { + this.fireEvent("trashContext"); + } + }); + return trashButton; + }, + /* /TRASH BIN */ + /* SHARED WITH */ __createSharedWithFilterLayout: function() { const sharedWithLayout = new qx.ui.container.Composite(new qx.ui.layout.VBox(5)); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js index 96268121e1f7..5bd63932440d 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -50,7 +50,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { properties: { currentContext: { - check: ["studiesAndFolders", "workspaces", "search", "bin"], + check: ["studiesAndFolders", "workspaces", "search", "trash"], nullable: false, init: "studiesAndFolders", event: "changeCurrentContext" @@ -389,7 +389,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }, _workspaceSelected: function(workspaceId) { - this.__changeContext(workspaceId, null); + this.__changeContext("studiesAndWorkspaces", workspaceId, null); }, _workspaceUpdated: function() { @@ -449,7 +449,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }, _folderSelected: function(folderId) { - this.__changeContext(this.getCurrentWorkspaceId(), folderId); + this.__changeContext("studiesAndWorkspaces", this.getCurrentWorkspaceId(), folderId); }, _folderUpdated: function() { @@ -911,7 +911,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { header.addListener("locationChanged", () => { const workspaceId = header.getCurrentWorkspaceId(); const folderId = header.getCurrentFolderId(); - this.__changeContext(workspaceId, folderId); + this.__changeContext("studiesAndWorkspaces", workspaceId, folderId); }, this); const workspacesAndFoldersTree = this._resourceFilter.getWorkspacesAndFoldersTree(); @@ -919,38 +919,29 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { const context = e.getData(); const workspaceId = context["workspaceId"]; const folderId = context["folderId"]; - this.__changeContext(workspaceId, folderId); + this.__changeContext("studiesAndWorkspaces", workspaceId, folderId); }, this); + this._resourceFilter.addListener("trashContext", () => { + this.__changeContext("trash"); + }); + this._searchBarFilter.addListener("filterChanged", e => { const filterData = e.getData(); if (filterData.text) { - this.__changeContext(-2, null); + this.__changeContext("search"); } else { // Back to My Workspace - this.__changeContext(null, null); + this.__changeContext("studiesAndWorkspaces", null, null); } }); } }, - __changeContext: function(workspaceId, folderId) { + __changeContext: function(context, workspaceId, folderId) { if (osparc.utils.DisabledPlugins.isFoldersEnabled()) { - let currentContext = null; - switch (workspaceId) { - case -2: - currentContext = "search"; - break; - case -1: - currentContext = "workspaces"; - break; - default: - currentContext = "studiesAndFolders"; - break; - } - if ( - currentContext !== "search" && // reload studies for a new search + context !== "search" && // reload studies for a new search workspaceId === this.getCurrentWorkspaceId() && folderId === this.getCurrentFolderId() ) { @@ -961,20 +952,20 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { this.resetSelection(); this.setMultiSelection(false); this.set({ - currentContext, + currentContext: context, currentWorkspaceId: workspaceId, currentFolderId: folderId, }); this.invalidateStudies(); this._resourcesContainer.setResourcesToList([]); - if (currentContext === "search") { + if (context === "search") { this.__setFoldersToList([]); this.__reloadStudies(); - } else if (currentContext === "workspaces") { + } else if (context === "workspaces") { this._searchBarFilter.resetFilters(); this.__reloadWorkspaces(); - } else if (currentContext === "studiesAndFolders") { + } else if (context === "studiesAndFolders") { this._searchBarFilter.resetFilters(); this.__reloadFolders(); this.__reloadStudies(); @@ -983,7 +974,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { // notify header const header = this.__header; header.set({ - currentContext, + currentContext: context, currentWorkspaceId: workspaceId, currentFolderId: folderId, }); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js index fa7ed0f7e3d5..e775ff929d3d 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js @@ -49,7 +49,7 @@ qx.Class.define("osparc.dashboard.StudyBrowserHeader", { properties: { currentContext: { - check: ["studiesAndFolders", "workspaces", "search", "bin"], + check: ["studiesAndFolders", "workspaces", "search", "trash"], nullable: false, init: "studiesAndFolders", event: "changeCurrentContext", @@ -199,6 +199,12 @@ qx.Class.define("osparc.dashboard.StudyBrowserHeader", { value: this.tr("Search results"), cursor: "auto", }); + } else if (currentContext === "trash") { + this.__setIcon("@FontAwesome5Solid/trash/24"); + title.set({ + value: this.tr("asdfasdfasdfasfd"), + cursor: "auto", + }); } else if (currentContext === "workspaces") { this.__setIcon(osparc.store.Workspaces.iconPath(32)); title.set({ From ba6bb24176c52addbdda18c76b1171a3d244f6d1 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Thu, 24 Oct 2024 13:37:16 +0200 Subject: [PATCH 08/19] minor --- .../source/class/osparc/dashboard/StudyBrowser.js | 12 ++++++------ .../class/osparc/dashboard/StudyBrowserHeader.js | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js index 5bd63932440d..09d7931e7592 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -389,7 +389,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }, _workspaceSelected: function(workspaceId) { - this.__changeContext("studiesAndWorkspaces", workspaceId, null); + this.__changeContext("studiesAndFolders", workspaceId, null); }, _workspaceUpdated: function() { @@ -449,7 +449,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }, _folderSelected: function(folderId) { - this.__changeContext("studiesAndWorkspaces", this.getCurrentWorkspaceId(), folderId); + this.__changeContext("studiesAndFolders", this.getCurrentWorkspaceId(), folderId); }, _folderUpdated: function() { @@ -911,7 +911,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { header.addListener("locationChanged", () => { const workspaceId = header.getCurrentWorkspaceId(); const folderId = header.getCurrentFolderId(); - this.__changeContext("studiesAndWorkspaces", workspaceId, folderId); + this.__changeContext("studiesAndFolders", workspaceId, folderId); }, this); const workspacesAndFoldersTree = this._resourceFilter.getWorkspacesAndFoldersTree(); @@ -919,7 +919,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { const context = e.getData(); const workspaceId = context["workspaceId"]; const folderId = context["folderId"]; - this.__changeContext("studiesAndWorkspaces", workspaceId, folderId); + this.__changeContext("studiesAndFolders", workspaceId, folderId); }, this); this._resourceFilter.addListener("trashContext", () => { @@ -932,13 +932,13 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { this.__changeContext("search"); } else { // Back to My Workspace - this.__changeContext("studiesAndWorkspaces", null, null); + this.__changeContext("studiesAndFolders", null, null); } }); } }, - __changeContext: function(context, workspaceId, folderId) { + __changeContext: function(context, workspaceId = null, folderId = null) { if (osparc.utils.DisabledPlugins.isFoldersEnabled()) { if ( context !== "search" && // reload studies for a new search diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js index e775ff929d3d..ff9ebb658043 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js @@ -202,7 +202,7 @@ qx.Class.define("osparc.dashboard.StudyBrowserHeader", { } else if (currentContext === "trash") { this.__setIcon("@FontAwesome5Solid/trash/24"); title.set({ - value: this.tr("asdfasdfasdfasfd"), + value: this.tr("Trash: Items in the bin will be permanently deleted after 30 days."), cursor: "auto", }); } else if (currentContext === "workspaces") { From 916c496016e4e1132fc1e9eec988055d0868c21a Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Thu, 24 Oct 2024 13:51:18 +0200 Subject: [PATCH 09/19] trash default to false --- .../source/class/osparc/dashboard/ResourceFilter.js | 1 + .../client/source/class/osparc/dashboard/StudyBrowser.js | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.js index 89d85e6384a0..71f172f3d3aa 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.js @@ -90,6 +90,7 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { /* TRASH BIN */ __createTrashBin: function() { const trashButton = this.__trashButton = new qx.ui.toolbar.RadioButton().set({ + value: false, appearance: "filter-toggle-button", label: this.tr("Trash"), icon: "@FontAwesome5Solid/trash/18", diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js index 09d7931e7592..a7916d6337d0 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -918,8 +918,12 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { workspacesAndFoldersTree.addListener("locationChanged", e => { const context = e.getData(); const workspaceId = context["workspaceId"]; - const folderId = context["folderId"]; - this.__changeContext("studiesAndFolders", workspaceId, folderId); + if (workspaceId === -1) { + this.__changeContext("workspaces"); + } else { + const folderId = context["folderId"]; + this.__changeContext("studiesAndFolders", workspaceId, folderId); + } }, this); this._resourceFilter.addListener("trashContext", () => { From 458329864e122cdefed3bc169e245646acc26894 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Thu, 24 Oct 2024 13:59:52 +0200 Subject: [PATCH 10/19] unused --- .../osparc/dashboard/ContextBreadcrumbs.js | 47 ++++--------------- 1 file changed, 9 insertions(+), 38 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ContextBreadcrumbs.js b/services/static-webserver/client/source/class/osparc/dashboard/ContextBreadcrumbs.js index 0e29f60fdb82..bb86d639e12c 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ContextBreadcrumbs.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ContextBreadcrumbs.js @@ -73,12 +73,12 @@ qx.Class.define("osparc.dashboard.ContextBreadcrumbs", { if (parentFolder) { this._addAt(this.__createArrow(), 0); const upstreamButton = this.__createFolderButton(parentFolder); - this._addAt(upstreamButton, 0); + if (upstreamButton) { + this._addAt(upstreamButton, 0); + } this.__createUpstreamButtons(parentFolder); } else { this._addAt(this.__createArrow(), 0); - const homeButton = this.__createFolderButton(); - this._addAt(homeButton, 0); } } }, @@ -100,33 +100,9 @@ qx.Class.define("osparc.dashboard.ContextBreadcrumbs", { }); }, - __createRootButton: function() { - const workspaceId = this.getCurrentWorkspaceId(); - let rootButton = null; - if (workspaceId) { - if (workspaceId === -1) { - rootButton = new qx.ui.form.Button(this.tr("Shared Workspaces"), osparc.store.Workspaces.iconPath()); - } else { - const workspace = osparc.store.Workspaces.getInstance().getWorkspace(workspaceId); - rootButton = new qx.ui.form.Button(workspace.getName(), osparc.store.Workspaces.iconPath()).set({ - maxWidth: 200 - }); - workspace.bind("name", rootButton, "label"); - } - } else { - rootButton = new qx.ui.form.Button(this.tr("My Workspace"), "@FontAwesome5Solid/home/14"); - } - rootButton.addListener("execute", () => { - const folderId = null; - this.__changeFolder(folderId); - }); - return rootButton; - }, - __createFolderButton: function(folder) { - let folderButton = null; if (folder) { - folderButton = new qx.ui.form.Button(folder.getName()).set({ + const folderButton = new qx.ui.form.Button(folder.getName()).set({ maxWidth: 200 }); folder.bind("name", folderButton, "label"); @@ -134,19 +110,14 @@ qx.Class.define("osparc.dashboard.ContextBreadcrumbs", { const folderId = folder ? folder.getFolderId() : null; this.__changeFolder(folderId); }, this); - } else { - folderButton = this.__createRootButton(); - // Do not show root folder folderButton.set({ - visibility: "excluded" + backgroundColor: "transparent", + textColor: "text", + gap: 5 }); + return folderButton; } - folderButton.set({ - backgroundColor: "transparent", - textColor: "text", - gap: 5 - }); - return folderButton; + return null; }, __createArrow: function() { From 54710a10346fda512e43f58cd87dc99a4e1c59eb Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Thu, 24 Oct 2024 14:00:43 +0200 Subject: [PATCH 11/19] currentContext prop in ContextBreadcrumbs --- .../class/osparc/dashboard/ContextBreadcrumbs.js | 10 +++++++++- .../class/osparc/dashboard/StudyBrowserHeader.js | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ContextBreadcrumbs.js b/services/static-webserver/client/source/class/osparc/dashboard/ContextBreadcrumbs.js index bb86d639e12c..c84e6cf8a514 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ContextBreadcrumbs.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ContextBreadcrumbs.js @@ -31,6 +31,14 @@ qx.Class.define("osparc.dashboard.ContextBreadcrumbs", { }, properties: { + currentContext: { + check: ["studiesAndFolders", "workspaces", "search", "trash"], + nullable: false, + init: "studiesAndFolders", + event: "changeCurrentContext", + apply: "__rebuild" + }, + currentWorkspaceId: { check: "Number", nullable: true, @@ -52,7 +60,7 @@ qx.Class.define("osparc.dashboard.ContextBreadcrumbs", { __rebuild: function() { this._removeAll(); - if (this.getCurrentWorkspaceId() === -2) { + if (this.getCurrentContext() !== "studiesAndFolders") { return; } diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js index ff9ebb658043..9ab022a2f1ca 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js @@ -119,6 +119,7 @@ qx.Class.define("osparc.dashboard.StudyBrowserHeader", { control = new osparc.dashboard.ContextBreadcrumbs(); this.bind("currentWorkspaceId", control, "currentWorkspaceId"); this.bind("currentFolderId", control, "currentFolderId"); + this.bind("currentContext", control, "currentContext"); control.bind("currentWorkspaceId", this, "currentWorkspaceId"); control.bind("currentFolderId", this, "currentFolderId"); control.addListener("locationChanged", e => { From b5e88f163d695769dd7e26221ee17ec869e469f8 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Thu, 24 Oct 2024 14:05:12 +0200 Subject: [PATCH 12/19] bad merge --- .../client/source/class/osparc/dashboard/StudyBrowser.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js index 9d9150730283..3981df1c89de 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -182,7 +182,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { !osparc.auth.Manager.getInstance().isLoggedIn() || !osparc.utils.DisabledPlugins.isFoldersEnabled() || this.getCurrentContext() !== "studiesAndFolders" || - this.__loadingFolders || + this.__loadingFolders ) { return; } @@ -191,7 +191,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { const folderId = this.getCurrentFolderId(); this.__loadingFolders = true; this.__setFoldersToList([]); - const folderId = this.getCurrentFolderId(); osparc.store.Folders.getInstance().fetchFolders(folderId, workspaceId, this.getOrderBy()) .then(folders => { this.__setFoldersToList(folders); From 8cec162853d3e0bee5b01567c9ce71a2ae6c64cf Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Thu, 24 Oct 2024 14:07:44 +0200 Subject: [PATCH 13/19] SelectStudies button --- .../client/source/class/osparc/dashboard/StudyBrowser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js index 3981df1c89de..31b00f8ec3e7 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -1143,8 +1143,8 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { })) }); this.bind("multiSelection", selectButton, "value"); - this.bind("currentWorkspaceId", selectButton, "visibility", { - converter: currentWorkspaceId => [-2, -1].includes(currentWorkspaceId) ? "excluded" : "visible" + this.bind("currentContext", selectButton, "visibility", { + converter: currentContext => currentContext === "studiesAndFolders" ? "excluded" : "visible" }); return selectButton; }, From 39e6a50bc2599a9a7589ef8793fefa1512745d4e Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Thu, 24 Oct 2024 14:11:50 +0200 Subject: [PATCH 14/19] minor --- .../client/source/class/osparc/dashboard/StudyBrowser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js index 31b00f8ec3e7..c7ab79c7388f 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -1144,7 +1144,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }); this.bind("multiSelection", selectButton, "value"); this.bind("currentContext", selectButton, "visibility", { - converter: currentContext => currentContext === "studiesAndFolders" ? "excluded" : "visible" + converter: currentContext => currentContext === "studiesAndFolders" ? "visible" : "excluded" }); return selectButton; }, From 7b37517706a894d786e7df8437a0850d5e34ff70 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Thu, 24 Oct 2024 14:18:11 +0200 Subject: [PATCH 15/19] more context checks --- .../source/class/osparc/dashboard/StudyBrowser.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js index c7ab79c7388f..1e336b60d8b5 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -200,10 +200,9 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }, __reloadStudies: function() { - const workspaceId = this.getCurrentWorkspaceId(); if ( !osparc.auth.Manager.getInstance().isLoggedIn() || - workspaceId === -1 || // listing workspaces + this.getCurrentContext() === "workspaces" || this._loadingResourcesBtn.isFetching() ) { return; @@ -953,6 +952,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { if (osparc.utils.DisabledPlugins.isFoldersEnabled()) { if ( context !== "search" && // reload studies for a new search + context === this.getCurrentContext() && workspaceId === this.getCurrentWorkspaceId() && folderId === this.getCurrentFolderId() ) { @@ -960,14 +960,14 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { return; } - this._loadingResourcesBtn.setFetching(false); - this.resetSelection(); - this.setMultiSelection(false); this.set({ currentContext: context, currentWorkspaceId: workspaceId, currentFolderId: folderId, }); + this._loadingResourcesBtn.setFetching(false); + this.resetSelection(); + this.setMultiSelection(false); this.invalidateStudies(); this._resourcesContainer.setResourcesToList([]); From 99b4f4ba7f1d0fd0e8c48f6c8bc866c919c3752d Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Thu, 24 Oct 2024 14:22:55 +0200 Subject: [PATCH 16/19] PROJECTS_TRASH_RETENTION_DAYS --- .../class/osparc/dashboard/StudyBrowserHeader.js | 3 ++- .../client/source/class/osparc/store/StaticInfo.js | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js index 9ab022a2f1ca..8520642a6e39 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js @@ -202,8 +202,9 @@ qx.Class.define("osparc.dashboard.StudyBrowserHeader", { }); } else if (currentContext === "trash") { this.__setIcon("@FontAwesome5Solid/trash/24"); + const trashDays = osparc.store.StaticInfo.getInstance().getTrashRetentionDays(); title.set({ - value: this.tr("Trash: Items in the bin will be permanently deleted after 30 days."), + value: this.tr(`Trash: Items in the bin will be permanently deleted after ${trashDays} days.`), cursor: "auto", }); } else if (currentContext === "workspaces") { diff --git a/services/static-webserver/client/source/class/osparc/store/StaticInfo.js b/services/static-webserver/client/source/class/osparc/store/StaticInfo.js index 1681a801cf48..92642490e2dd 100644 --- a/services/static-webserver/client/source/class/osparc/store/StaticInfo.js +++ b/services/static-webserver/client/source/class/osparc/store/StaticInfo.js @@ -69,6 +69,16 @@ qx.Class.define("osparc.store.StaticInfo", { return null; }, + getTrashRetentionDays: function() { + const staticKey = "webserverProjects"; + const wsStaticData = this.getValue(staticKey); + const key = "PROJECTS_TRASH_RETENTION_DAYS"; + if (key in wsStaticData) { + return wsStaticData[key]; + } + return null; + }, + getAccountDeletionRetentionDays: function() { const staticKey = "webserverLogin"; const wsStaticData = this.getValue(staticKey); From 34e535bade9bbd82dc0e542856d26d707670a662 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Thu, 24 Oct 2024 14:38:44 +0200 Subject: [PATCH 17/19] pass context --- .../source/class/osparc/dashboard/StudyBrowser.js | 2 +- .../osparc/dashboard/WorkspacesAndFoldersTree.js | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js index 1e336b60d8b5..fa994198c431 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -997,7 +997,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { currentWorkspaceId: workspaceId, currentFolderId: folderId, }); - workspacesAndFoldersTree.contextChanged(workspaceId, folderId); + workspacesAndFoldersTree.contextChanged(context); } }, diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTree.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTree.js index dc1b6a94a65d..93f1125049e6 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTree.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTree.js @@ -288,17 +288,18 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTree", { } }, - contextChanged: function() { - const workspaceId = this.getCurrentWorkspaceId(); - const folderId = this.getCurrentFolderId(); - + contextChanged: function(context) { const selection = this.getSelection(); if (selection) { selection.removeAll(); } - const contextModel = this.__getModel(workspaceId, folderId); - if (contextModel) { - selection.push(contextModel); + if (context === "studiesAndFolders" || context === "workspaces") { + const workspaceId = context === "workspaces" ? -1 : this.getCurrentWorkspaceId(); + const folderId = this.getCurrentFolderId(); + const locationModel = this.__getModel(workspaceId, folderId); + if (locationModel) { + selection.push(locationModel); + } } }, } From 139d61e1820dd8b98ed4d2096d65224d5ca24e77 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Thu, 24 Oct 2024 14:51:13 +0200 Subject: [PATCH 18/19] defaults --- .../client/source/class/osparc/dashboard/StudyBrowserHeader.js | 2 +- .../client/source/class/osparc/store/StaticInfo.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js index 8520642a6e39..3f1dc17b5a95 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js @@ -201,7 +201,7 @@ qx.Class.define("osparc.dashboard.StudyBrowserHeader", { cursor: "auto", }); } else if (currentContext === "trash") { - this.__setIcon("@FontAwesome5Solid/trash/24"); + this.__setIcon("@FontAwesome5Solid/trash/20"); const trashDays = osparc.store.StaticInfo.getInstance().getTrashRetentionDays(); title.set({ value: this.tr(`Trash: Items in the bin will be permanently deleted after ${trashDays} days.`), diff --git a/services/static-webserver/client/source/class/osparc/store/StaticInfo.js b/services/static-webserver/client/source/class/osparc/store/StaticInfo.js index 92642490e2dd..2ac96fd58b06 100644 --- a/services/static-webserver/client/source/class/osparc/store/StaticInfo.js +++ b/services/static-webserver/client/source/class/osparc/store/StaticInfo.js @@ -76,7 +76,7 @@ qx.Class.define("osparc.store.StaticInfo", { if (key in wsStaticData) { return wsStaticData[key]; } - return null; + return "unknown"; }, getAccountDeletionRetentionDays: function() { From 06ad0731574dd6b615d529e2e3d83f1dd2798c17 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Thu, 24 Oct 2024 14:56:07 +0200 Subject: [PATCH 19/19] remove trash related code --- .../osparc/dashboard/ContextBreadcrumbs.js | 2 +- .../class/osparc/dashboard/ResourceFilter.js | 21 ------------------- .../class/osparc/dashboard/StudyBrowser.js | 6 +----- .../osparc/dashboard/StudyBrowserHeader.js | 9 +------- .../source/class/osparc/store/StaticInfo.js | 10 --------- 5 files changed, 3 insertions(+), 45 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ContextBreadcrumbs.js b/services/static-webserver/client/source/class/osparc/dashboard/ContextBreadcrumbs.js index c84e6cf8a514..dba858ffad8f 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ContextBreadcrumbs.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ContextBreadcrumbs.js @@ -32,7 +32,7 @@ qx.Class.define("osparc.dashboard.ContextBreadcrumbs", { properties: { currentContext: { - check: ["studiesAndFolders", "workspaces", "search", "trash"], + check: ["studiesAndFolders", "workspaces", "search"], nullable: false, init: "studiesAndFolders", event: "changeCurrentContext", diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.js index 71f172f3d3aa..92d0b1dc1b37 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.js @@ -34,7 +34,6 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { }, events: { - "trashContext": "qx.event.type.Event", "changeSharedWith": "qx.event.type.Data", "changeSelectedTags": "qx.event.type.Data", "changeServiceType": "qx.event.type.Data" @@ -43,7 +42,6 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { members: { __resourceType: null, __workspacesAndFoldersTree: null, - __trashButton: null, __sharedWithButtons: null, __tagButtons: null, __serviceTypeButtons: null, @@ -51,7 +49,6 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { __buildLayout: function() { if (this.__resourceType === "study" && osparc.utils.DisabledPlugins.isFoldersEnabled()) { this._add(this.__createWorkspacesAndFoldersTree()); - this._add(this.__createTrashBin()); } else { this._add(this.__createSharedWithFilterLayout()); } @@ -87,24 +84,6 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { }, /* /WORKSPACES AND FOLDERS */ - /* TRASH BIN */ - __createTrashBin: function() { - const trashButton = this.__trashButton = new qx.ui.toolbar.RadioButton().set({ - value: false, - appearance: "filter-toggle-button", - label: this.tr("Trash"), - icon: "@FontAwesome5Solid/trash/18", - }); - trashButton.addListener("changeValue", e => { - const trashEnabled = e.getData(); - if (trashEnabled) { - this.fireEvent("trashContext"); - } - }); - return trashButton; - }, - /* /TRASH BIN */ - /* SHARED WITH */ __createSharedWithFilterLayout: function() { const sharedWithLayout = new qx.ui.container.Composite(new qx.ui.layout.VBox(5)); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js index fa994198c431..0b43298c9235 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -50,7 +50,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { properties: { currentContext: { - check: ["studiesAndFolders", "workspaces", "search", "trash"], + check: ["studiesAndFolders", "workspaces", "search"], nullable: false, init: "studiesAndFolders", event: "changeCurrentContext" @@ -932,10 +932,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { } }, this); - this._resourceFilter.addListener("trashContext", () => { - this.__changeContext("trash"); - }); - this._searchBarFilter.addListener("filterChanged", e => { const filterData = e.getData(); if (filterData.text) { diff --git a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js index 3f1dc17b5a95..54235a08c45b 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowserHeader.js @@ -49,7 +49,7 @@ qx.Class.define("osparc.dashboard.StudyBrowserHeader", { properties: { currentContext: { - check: ["studiesAndFolders", "workspaces", "search", "trash"], + check: ["studiesAndFolders", "workspaces", "search"], nullable: false, init: "studiesAndFolders", event: "changeCurrentContext", @@ -200,13 +200,6 @@ qx.Class.define("osparc.dashboard.StudyBrowserHeader", { value: this.tr("Search results"), cursor: "auto", }); - } else if (currentContext === "trash") { - this.__setIcon("@FontAwesome5Solid/trash/20"); - const trashDays = osparc.store.StaticInfo.getInstance().getTrashRetentionDays(); - title.set({ - value: this.tr(`Trash: Items in the bin will be permanently deleted after ${trashDays} days.`), - cursor: "auto", - }); } else if (currentContext === "workspaces") { this.__setIcon(osparc.store.Workspaces.iconPath(32)); title.set({ diff --git a/services/static-webserver/client/source/class/osparc/store/StaticInfo.js b/services/static-webserver/client/source/class/osparc/store/StaticInfo.js index 2ac96fd58b06..1681a801cf48 100644 --- a/services/static-webserver/client/source/class/osparc/store/StaticInfo.js +++ b/services/static-webserver/client/source/class/osparc/store/StaticInfo.js @@ -69,16 +69,6 @@ qx.Class.define("osparc.store.StaticInfo", { return null; }, - getTrashRetentionDays: function() { - const staticKey = "webserverProjects"; - const wsStaticData = this.getValue(staticKey); - const key = "PROJECTS_TRASH_RETENTION_DAYS"; - if (key in wsStaticData) { - return wsStaticData[key]; - } - return "unknown"; - }, - getAccountDeletionRetentionDays: function() { const staticKey = "webserverLogin"; const wsStaticData = this.getValue(staticKey);