From 929ad65225b3e09bced6f5ca770ba5469af0f82a Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 08:47:53 +0200 Subject: [PATCH 01/59] move file --- .../client/source/class/osparc/dashboard/Dashboard.js | 2 +- .../source/class/osparc/dashboard/ResourceDetails.js | 2 +- .../source/class/osparc/dashboard/ServiceBrowser.js | 2 +- .../source/class/osparc/dashboard/StudyBrowser.js | 4 ++-- .../client/source/class/osparc/data/Resources.js | 2 +- .../client/source/class/osparc/data/model/Node.js | 2 +- .../client/source/class/osparc/data/model/Study.js | 2 +- .../client/source/class/osparc/data/model/Workbench.js | 4 ++-- .../class/osparc/desktop/organizations/ServicesList.js | 2 +- .../source/class/osparc/editor/ThumbnailSuggestions.js | 2 +- .../client/source/class/osparc/info/MergedLarge.js | 2 +- .../client/source/class/osparc/info/ServiceLarge.js | 4 ++-- .../source/class/osparc/metadata/ClassifiersEditor.js | 2 +- .../source/class/osparc/metadata/QualityEditor.js | 2 +- .../source/class/osparc/metadata/ServicesInStudy.js | 6 +++--- .../class/osparc/metadata/ServicesInStudyBootOpts.js | 4 ++-- .../class/osparc/metadata/ServicesInStudyUpdate.js | 4 ++-- .../client/source/class/osparc/pricing/ServicesList.js | 4 ++-- .../source/class/osparc/service/ServiceListItem.js | 2 +- .../client/source/class/osparc/service/Utils.js | 10 +++++----- .../source/class/osparc/share/CollaboratorsService.js | 6 +++--- .../source/class/osparc/share/ShareePermissions.js | 2 +- .../osparc/{service/Store.js => store/Services.js} | 2 +- .../client/source/class/osparc/study/Utils.js | 8 ++++---- .../source/class/osparc/workbench/ServiceCatalog.js | 4 ++-- 25 files changed, 43 insertions(+), 43 deletions(-) rename services/static-webserver/client/source/class/osparc/{service/Store.js => store/Services.js} (99%) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/Dashboard.js b/services/static-webserver/client/source/class/osparc/dashboard/Dashboard.js index 82ccea53e3d..effe47c25c4 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/Dashboard.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/Dashboard.js @@ -167,7 +167,7 @@ qx.Class.define("osparc.dashboard.Dashboard", { const preResourcePromises = []; const store = osparc.store.Store.getInstance(); preResourcePromises.push(store.getAllGroupsAndMembers()); - preResourcePromises.push(osparc.service.Store.getServicesLatest(false)); + preResourcePromises.push(osparc.store.Services.getServicesLatest(false)); if (permissions.canDo("study.tag")) { preResourcePromises.push(osparc.data.Resources.get("tags")); } diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceDetails.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceDetails.js index 17d249b146b..7a32749e1b5 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceDetails.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceDetails.js @@ -257,7 +257,7 @@ qx.Class.define("osparc.dashboard.ResourceDetails", { if (selection.length) { const serviceVersion = selection[0].version; if (serviceVersion !== this.__resourceData["version"]) { - osparc.service.Store.getService(this.__resourceData["key"], serviceVersion) + osparc.store.Services.getService(this.__resourceData["key"], serviceVersion) .then(serviceData => { serviceData["resourceType"] = "service"; this.__resourceData = serviceData; diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ServiceBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/ServiceBrowser.js index 207b81956fc..ebfdc693bb6 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ServiceBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ServiceBrowser.js @@ -58,7 +58,7 @@ qx.Class.define("osparc.dashboard.ServiceBrowser", { }, __loadServices: function() { - osparc.service.Store.getServicesLatest() + osparc.store.Services.getServicesLatest() .then(servicesLatest => { const servicesList = []; Object.keys(servicesLatest).forEach(key => { 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 2e174d99229..ea5d69a472e 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -186,7 +186,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { if (nStudies === 0) { const promises = [ osparc.store.Store.getInstance().getTemplates(), - osparc.service.Store.getServicesLatest(), + osparc.store.Services.getServicesLatest(), ]; if (osparc.utils.DisabledPlugins.isFoldersEnabled()) { promises.push(osparc.store.Folders.getInstance().fetchFolders()); @@ -671,7 +671,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { // scale to latest compatible const latestVersion = versions[0]; const latestCompatible = osparc.service.Utils.getLatestCompatible(key, latestVersion); - osparc.service.Store.getService(latestCompatible["key"], latestCompatible["version"]) + osparc.store.Services.getService(latestCompatible["key"], latestCompatible["version"]) .then(latestMetadata => { const title = newButtonInfo.title + " " + osparc.service.Utils.extractVersionDisplay(latestMetadata); const desc = newButtonInfo.description; diff --git a/services/static-webserver/client/source/class/osparc/data/Resources.js b/services/static-webserver/client/source/class/osparc/data/Resources.js index 44ea7b20671..2b09478dc10 100644 --- a/services/static-webserver/client/source/class/osparc/data/Resources.js +++ b/services/static-webserver/client/source/class/osparc/data/Resources.js @@ -470,7 +470,7 @@ qx.Class.define("osparc.data.Resources", { * SERVICES V2 (web-api >=0.42.0) */ "servicesV2": { - useCache: false, // handled in osparc.service.Store + useCache: false, // handled in osparc.store.Services idField: ["key", "version"], endpoints: { get: { diff --git a/services/static-webserver/client/source/class/osparc/data/model/Node.js b/services/static-webserver/client/source/class/osparc/data/model/Node.js index a6cf28b8af3..6373d8835ca 100644 --- a/services/static-webserver/client/source/class/osparc/data/model/Node.js +++ b/services/static-webserver/client/source/class/osparc/data/model/Node.js @@ -382,7 +382,7 @@ qx.Class.define("osparc.data.model.Node", { __applyNewMetaData: function(newV, oldV) { if (oldV !== null) { - const metadata = osparc.service.Store.getMetadata(this.getKey(), this.getVersion()); + const metadata = osparc.store.Services.getMetadata(this.getKey(), this.getVersion()); if (metadata) { this.__metaData = metadata; } diff --git a/services/static-webserver/client/source/class/osparc/data/model/Study.js b/services/static-webserver/client/source/class/osparc/data/model/Study.js index 6c16d1a9851..8fd40a67a28 100644 --- a/services/static-webserver/client/source/class/osparc/data/model/Study.js +++ b/services/static-webserver/client/source/class/osparc/data/model/Study.js @@ -299,7 +299,7 @@ qx.Class.define("osparc.data.model.Study", { let nCompNodes = 0; let overallProgress = 0; Object.values(nodes).forEach(node => { - const metadata = osparc.service.Store.getMetadata(node["key"], node["version"]); + const metadata = osparc.store.Services.getMetadata(node["key"], node["version"]); if (metadata && osparc.data.model.Node.isComputational(metadata)) { const progress = "progress" in node ? node["progress"] : 0; overallProgress += progress; diff --git a/services/static-webserver/client/source/class/osparc/data/model/Workbench.js b/services/static-webserver/client/source/class/osparc/data/model/Workbench.js index 1110d55b736..3120a22f7f1 100644 --- a/services/static-webserver/client/source/class/osparc/data/model/Workbench.js +++ b/services/static-webserver/client/source/class/osparc/data/model/Workbench.js @@ -295,7 +295,7 @@ qx.Class.define("osparc.data.model.Workbench", { }; try { - const metadata = await osparc.service.Store.getService(key, version); + const metadata = await osparc.store.Services.getService(key, version); const resp = await osparc.data.Resources.fetch("studies", "addNode", params); const nodeId = resp["node_id"]; @@ -679,7 +679,7 @@ qx.Class.define("osparc.data.model.Workbench", { const metadataPromises = []; nodeIds.forEach(nodeId => { const nodeData = workbenchData[nodeId]; - metadataPromises.push(osparc.service.Store.getService(nodeData.key, nodeData.version)); + metadataPromises.push(osparc.store.Services.getService(nodeData.key, nodeData.version)); }); return Promise.all(metadataPromises) diff --git a/services/static-webserver/client/source/class/osparc/desktop/organizations/ServicesList.js b/services/static-webserver/client/source/class/osparc/desktop/organizations/ServicesList.js index d6655889ed7..6a212375312 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/organizations/ServicesList.js +++ b/services/static-webserver/client/source/class/osparc/desktop/organizations/ServicesList.js @@ -115,7 +115,7 @@ qx.Class.define("osparc.desktop.organizations.ServicesList", { } const gid = orgModel.getGid(); - osparc.service.Store.getServicesLatest() + osparc.store.Services.getServicesLatest() .then(servicesLatest => { const orgServices = []; Object.keys(servicesLatest).forEach(key => { diff --git a/services/static-webserver/client/source/class/osparc/editor/ThumbnailSuggestions.js b/services/static-webserver/client/source/class/osparc/editor/ThumbnailSuggestions.js index ff496032568..ba361f12f46 100644 --- a/services/static-webserver/client/source/class/osparc/editor/ThumbnailSuggestions.js +++ b/services/static-webserver/client/source/class/osparc/editor/ThumbnailSuggestions.js @@ -138,7 +138,7 @@ qx.Class.define("osparc.editor.ThumbnailSuggestions", { } const promises = []; - queryParams.forEach(qP => promises.push(osparc.service.Store.getService(qP.key, qP.version))); + queryParams.forEach(qP => promises.push(osparc.store.Services.getService(qP.key, qP.version))); return Promise.all(promises) .then(values => { const suggestions = new Set([]); diff --git a/services/static-webserver/client/source/class/osparc/info/MergedLarge.js b/services/static-webserver/client/source/class/osparc/info/MergedLarge.js index cefe7e01c9a..d85ffef353d 100644 --- a/services/static-webserver/client/source/class/osparc/info/MergedLarge.js +++ b/services/static-webserver/client/source/class/osparc/info/MergedLarge.js @@ -325,7 +325,7 @@ qx.Class.define("osparc.info.MergedLarge", { }; promise = osparc.data.Resources.get("nodesInStudyResources", params); } else { - promise = osparc.service.Store.getResources(this.getNode().getKey(), this.getNode().getVersion()) + promise = osparc.store.Services.getResources(this.getNode().getKey(), this.getNode().getVersion()) } promise .then(serviceResources => { diff --git a/services/static-webserver/client/source/class/osparc/info/ServiceLarge.js b/services/static-webserver/client/source/class/osparc/info/ServiceLarge.js index efdccc3ad7d..9eb0bddf435 100644 --- a/services/static-webserver/client/source/class/osparc/info/ServiceLarge.js +++ b/services/static-webserver/client/source/class/osparc/info/ServiceLarge.js @@ -360,7 +360,7 @@ qx.Class.define("osparc.info.ServiceLarge", { }; promise = osparc.data.Resources.get("nodesInStudyResources", params); } else { - promise = osparc.service.Store.getResources(this.getService()["key"], this.getService()["version"]) + promise = osparc.store.Services.getResources(this.getService()["key"], this.getService()["version"]) } promise .then(serviceResources => { @@ -474,7 +474,7 @@ qx.Class.define("osparc.info.ServiceLarge", { __patchService: function(key, value) { const serviceDataCopy = osparc.utils.Utils.deepCloneObject(this.getService()); - osparc.service.Store.patchServiceData(serviceDataCopy, key, value) + osparc.store.Services.patchServiceData(serviceDataCopy, key, value) .then(() => { this.setService(serviceDataCopy); this.fireDataEvent("updateService", this.getService()); diff --git a/services/static-webserver/client/source/class/osparc/metadata/ClassifiersEditor.js b/services/static-webserver/client/source/class/osparc/metadata/ClassifiersEditor.js index ee9c7328b46..3f66e39d7ec 100644 --- a/services/static-webserver/client/source/class/osparc/metadata/ClassifiersEditor.js +++ b/services/static-webserver/client/source/class/osparc/metadata/ClassifiersEditor.js @@ -158,7 +158,7 @@ qx.Class.define("osparc.metadata.ClassifiersEditor", { }); } else { const serviceDataCopy = osparc.utils.Utils.deepCloneObject(this.__resourceData); - osparc.service.Store.patchServiceData(serviceDataCopy, "classifiers", newClassifiers) + osparc.store.Services.patchServiceData(serviceDataCopy, "classifiers", newClassifiers) .then(() => { osparc.FlashMessenger.getInstance().logAs(this.tr("Classifiers successfully edited")); saveBtn.setFetching(false); diff --git a/services/static-webserver/client/source/class/osparc/metadata/QualityEditor.js b/services/static-webserver/client/source/class/osparc/metadata/QualityEditor.js index 5ac435dcea7..1b1000e5d68 100644 --- a/services/static-webserver/client/source/class/osparc/metadata/QualityEditor.js +++ b/services/static-webserver/client/source/class/osparc/metadata/QualityEditor.js @@ -457,7 +457,7 @@ qx.Class.define("osparc.metadata.QualityEditor", { btn.setFetching(true); if (osparc.utils.Resources.isService(this.__resourceData)) { const serviceDataCopy = osparc.utils.Utils.deepCloneObject(this.__resourceData); - osparc.service.Store.patchServiceData(serviceDataCopy, "quality", newQuality) + osparc.store.Services.patchServiceData(serviceDataCopy, "quality", newQuality) .then(() => { this.__initResourceData(serviceDataCopy); this.fireDataEvent("updateQuality", serviceDataCopy); diff --git a/services/static-webserver/client/source/class/osparc/metadata/ServicesInStudy.js b/services/static-webserver/client/source/class/osparc/metadata/ServicesInStudy.js index 03802472180..9f1dbe17600 100644 --- a/services/static-webserver/client/source/class/osparc/metadata/ServicesInStudy.js +++ b/services/static-webserver/client/source/class/osparc/metadata/ServicesInStudy.js @@ -45,7 +45,7 @@ qx.Class.define("osparc.metadata.ServicesInStudy", { const servicesInStudy = osparc.study.Utils.extractServices(this._studyData["workbench"]); if (servicesInStudy.length) { const promises = []; - servicesInStudy.forEach(srv => promises.push(osparc.service.Store.getService(srv.key, srv.version))); + servicesInStudy.forEach(srv => promises.push(osparc.store.Services.getService(srv.key, srv.version))); Promise.all(promises) .then(() => this._populateLayout()); } else { @@ -137,7 +137,7 @@ qx.Class.define("osparc.metadata.ServicesInStudy", { const infoButton = new qx.ui.form.Button(null, "@MaterialIcons/info_outline/14"); infoButton.addListener("execute", () => { - const metadata = osparc.service.Store.getMetadata(node["key"], node["version"]); + const metadata = osparc.store.Services.getMetadata(node["key"], node["version"]); if (metadata === null) { osparc.FlashMessenger.logAs(this.tr("Service information could not be retrieved"), "WARNING"); return; @@ -167,7 +167,7 @@ qx.Class.define("osparc.metadata.ServicesInStudy", { }); this.__grid.setRowHeight(i, 24); - const nodeMetadata = osparc.service.Store.getMetadata(node["key"], node["version"]); + const nodeMetadata = osparc.store.Services.getMetadata(node["key"], node["version"]); if (nodeMetadata === null) { osparc.FlashMessenger.logAs(this.tr("Some service information could not be retrieved"), "WARNING"); break; diff --git a/services/static-webserver/client/source/class/osparc/metadata/ServicesInStudyBootOpts.js b/services/static-webserver/client/source/class/osparc/metadata/ServicesInStudyBootOpts.js index 5f3802d1267..72ad2d4530e 100644 --- a/services/static-webserver/client/source/class/osparc/metadata/ServicesInStudyBootOpts.js +++ b/services/static-webserver/client/source/class/osparc/metadata/ServicesInStudyBootOpts.js @@ -25,7 +25,7 @@ qx.Class.define("osparc.metadata.ServicesInStudyBootOpts", { if ("workbench" in studyData) { for (const nodeId in studyData["workbench"]) { const node = studyData["workbench"][nodeId]; - const metadata = osparc.service.Store.getMetadata(node["key"], node["version"]); + const metadata = osparc.store.Services.getMetadata(node["key"], node["version"]); if (metadata && osparc.data.model.Node.hasBootModes(metadata)) { return true; } @@ -74,7 +74,7 @@ qx.Class.define("osparc.metadata.ServicesInStudyBootOpts", { for (const nodeId in workbench) { i++; const node = workbench[nodeId]; - const nodeMetadata = osparc.service.Store.getMetadata(node["key"], node["version"]); + const nodeMetadata = osparc.store.Services.getMetadata(node["key"], node["version"]); if (nodeMetadata === null) { osparc.FlashMessenger.logAs(this.tr("Some service information could not be retrieved"), "WARNING"); break; diff --git a/services/static-webserver/client/source/class/osparc/metadata/ServicesInStudyUpdate.js b/services/static-webserver/client/source/class/osparc/metadata/ServicesInStudyUpdate.js index 3ab2f4b87a1..bbd9685bfec 100644 --- a/services/static-webserver/client/source/class/osparc/metadata/ServicesInStudyUpdate.js +++ b/services/static-webserver/client/source/class/osparc/metadata/ServicesInStudyUpdate.js @@ -205,7 +205,7 @@ qx.Class.define("osparc.metadata.ServicesInStudyUpdate", { for (const nodeId in workbench) { i++; const node = workbench[nodeId]; - const metadata = osparc.service.Store.getMetadata(node["key"], node["version"]); + const metadata = osparc.store.Services.getMetadata(node["key"], node["version"]); const currentVersionLabel = new qx.ui.basic.Label(osparc.service.Utils.extractVersionDisplay(metadata)).set({ font: "text-14" }); @@ -221,7 +221,7 @@ qx.Class.define("osparc.metadata.ServicesInStudyUpdate", { const latestCompatible = osparc.service.Utils.getLatestCompatible(node["key"], node["version"]); if (latestCompatible) { // updatable - osparc.service.Store.getService(latestCompatible["key"], latestCompatible["version"]) + osparc.store.Services.getService(latestCompatible["key"], latestCompatible["version"]) .then(latestMetadata => { let label = osparc.service.Utils.extractVersionDisplay(latestMetadata) if (node["key"] !== latestMetadata["key"]) { diff --git a/services/static-webserver/client/source/class/osparc/pricing/ServicesList.js b/services/static-webserver/client/source/class/osparc/pricing/ServicesList.js index f3b5c60949b..eb215da3c76 100644 --- a/services/static-webserver/client/source/class/osparc/pricing/ServicesList.js +++ b/services/static-webserver/client/source/class/osparc/pricing/ServicesList.js @@ -83,7 +83,7 @@ qx.Class.define("osparc.pricing.ServicesList", { services.forEach(service => { const key = service["serviceKey"]; const version = service["serviceVersion"]; - metadataPromises.push(osparc.service.Store.getService(key, version)); + metadataPromises.push(osparc.store.Services.getService(key, version)); }); Promise.all(metadataPromises) .catch(err => console.error(err)) @@ -92,7 +92,7 @@ qx.Class.define("osparc.pricing.ServicesList", { services.forEach(service => { const key = service["serviceKey"]; const version = service["serviceVersion"]; - const serviceMetadata = osparc.service.Store.getMetadata(key, version); + const serviceMetadata = osparc.store.Services.getMetadata(key, version); if (serviceMetadata) { sList.push(new osparc.data.model.Service(serviceMetadata)); } diff --git a/services/static-webserver/client/source/class/osparc/service/ServiceListItem.js b/services/static-webserver/client/source/class/osparc/service/ServiceListItem.js index 543e3d0b11a..059dd840170 100644 --- a/services/static-webserver/client/source/class/osparc/service/ServiceListItem.js +++ b/services/static-webserver/client/source/class/osparc/service/ServiceListItem.js @@ -158,7 +158,7 @@ qx.Class.define("osparc.service.ServiceListItem", { if (version === this.self().LATEST) { version = this.__versionsBox.getChildrenContainer().getSelectables()[1].version; } - osparc.service.Store.getService(key, version) + osparc.store.Services.getService(key, version) .then(serviceMetadata => { const serviceDetails = new osparc.info.ServiceLarge(serviceMetadata); const title = this.tr("Service information"); diff --git a/services/static-webserver/client/source/class/osparc/service/Utils.js b/services/static-webserver/client/source/class/osparc/service/Utils.js index 38ce2b31905..c1436ea4f29 100644 --- a/services/static-webserver/client/source/class/osparc/service/Utils.js +++ b/services/static-webserver/client/source/class/osparc/service/Utils.js @@ -133,7 +133,7 @@ qx.Class.define("osparc.service.Utils", { }, getVersions: function(key, filterDeprecated = true) { - const services = osparc.service.Store.servicesCached; + const services = osparc.store.Services.servicesCached; let versions = []; if (key in services) { const serviceVersions = services[key]; @@ -152,7 +152,7 @@ qx.Class.define("osparc.service.Utils", { }, getLatest: function(key) { - const services = osparc.service.Store.servicesCached; + const services = osparc.store.Services.servicesCached; if (key in services) { const versions = this.getVersions(key, true); if (versions.length) { @@ -163,7 +163,7 @@ qx.Class.define("osparc.service.Utils", { }, getLatestCompatible: function(key, version) { - const services = osparc.service.Store.servicesCached; + const services = osparc.store.Services.servicesCached; if (key in services && version in services[key]) { const serviceMD = services[key][version]; if (serviceMD["compatibility"] && serviceMD["compatibility"]["canUpdateTo"]) { @@ -183,7 +183,7 @@ qx.Class.define("osparc.service.Utils", { }, getVersionDisplay: function(key, version) { - const services = osparc.service.Store.servicesCached; + const services = osparc.store.Services.servicesCached; if (key in services && version in services[key]) { return this.extractVersionDisplay(services[key][version]); } @@ -195,7 +195,7 @@ qx.Class.define("osparc.service.Utils", { }, getReleasedDate: function(key, version) { - const services = osparc.service.Store.servicesCached; + const services = osparc.store.Services.servicesCached; if ( key in services && version in services[key] && diff --git a/services/static-webserver/client/source/class/osparc/share/CollaboratorsService.js b/services/static-webserver/client/source/class/osparc/share/CollaboratorsService.js index 7379a512b9b..4f540ebb211 100644 --- a/services/static-webserver/client/source/class/osparc/share/CollaboratorsService.js +++ b/services/static-webserver/client/source/class/osparc/share/CollaboratorsService.js @@ -90,7 +90,7 @@ qx.Class.define("osparc.share.CollaboratorsService", { gids.forEach(gid => { newAccessRights[gid] = this.self().getCollaboratorAccessRight(); }); - osparc.service.Store.patchServiceData(this._serializedDataCopy, "accessRights", newAccessRights) + osparc.store.Services.patchServiceData(this._serializedDataCopy, "accessRights", newAccessRights) .then(() => { this.fireDataEvent("updateAccessRights", this._serializedDataCopy); let text = this.tr("Editor(s) successfully added."); @@ -119,7 +119,7 @@ qx.Class.define("osparc.share.CollaboratorsService", { return; } - osparc.service.Store.patchServiceData(this._serializedDataCopy, "accessRights", this._serializedDataCopy["accessRights"]) + osparc.store.Services.patchServiceData(this._serializedDataCopy, "accessRights", this._serializedDataCopy["accessRights"]) .then(() => { this.fireDataEvent("updateAccessRights", this._serializedDataCopy); osparc.FlashMessenger.getInstance().logAs(this.tr("Member successfully removed")); @@ -139,7 +139,7 @@ qx.Class.define("osparc.share.CollaboratorsService", { __make: function(collaboratorGId, newAccessRights, successMsg, failureMsg, item) { item.setEnabled(false); this._serializedDataCopy["accessRights"][collaboratorGId] = newAccessRights; - osparc.service.Store.patchServiceData(this._serializedDataCopy, "accessRights", this._serializedDataCopy["accessRights"]) + osparc.store.Services.patchServiceData(this._serializedDataCopy, "accessRights", this._serializedDataCopy["accessRights"]) .then(() => { this.fireDataEvent("updateAccessRights", this._serializedDataCopy); osparc.FlashMessenger.getInstance().logAs(successMsg); diff --git a/services/static-webserver/client/source/class/osparc/share/ShareePermissions.js b/services/static-webserver/client/source/class/osparc/share/ShareePermissions.js index 4df66b06ca6..c0c4a4c6b89 100644 --- a/services/static-webserver/client/source/class/osparc/share/ShareePermissions.js +++ b/services/static-webserver/client/source/class/osparc/share/ShareePermissions.js @@ -51,7 +51,7 @@ qx.Class.define("osparc.share.ShareePermissions", { const label = new qx.ui.basic.Label(); hBox.add(infoButton); hBox.add(label); - osparc.service.Store.getService(inaccessibleService.key, inaccessibleService.version) + osparc.store.Services.getService(inaccessibleService.key, inaccessibleService.version) .then(metadata => { label.setValue(metadata["name"] + " : " + metadata["version"]) infoButton.addListener("execute", () => { diff --git a/services/static-webserver/client/source/class/osparc/service/Store.js b/services/static-webserver/client/source/class/osparc/store/Services.js similarity index 99% rename from services/static-webserver/client/source/class/osparc/service/Store.js rename to services/static-webserver/client/source/class/osparc/store/Services.js index 8158eb836bc..1fb2c1b0959 100644 --- a/services/static-webserver/client/source/class/osparc/service/Store.js +++ b/services/static-webserver/client/source/class/osparc/store/Services.js @@ -15,7 +15,7 @@ ************************************************************************ */ -qx.Class.define("osparc.service.Store", { +qx.Class.define("osparc.store.Services", { type: "static", statics: { diff --git a/services/static-webserver/client/source/class/osparc/study/Utils.js b/services/static-webserver/client/source/class/osparc/study/Utils.js index a1f4fc76f31..3855cf01f96 100644 --- a/services/static-webserver/client/source/class/osparc/study/Utils.js +++ b/services/static-webserver/client/source/class/osparc/study/Utils.js @@ -35,7 +35,7 @@ qx.Class.define("osparc.study.Utils", { }, getInaccessibleServices: function(workbench) { - const allServices = osparc.service.Store.servicesCached; + const allServices = osparc.store.Services.servicesCached; const unaccessibleServices = []; const wbServices = new Set(this.extractServices(workbench)); wbServices.forEach(srv => { @@ -70,7 +70,7 @@ qx.Class.define("osparc.study.Utils", { }, isWorkbenchRetired: function(workbench) { - const allServices = osparc.service.Store.servicesCached; + const allServices = osparc.store.Services.servicesCached; const services = new Set(this.extractServices(workbench)); const isRetired = Array.from(services).some(srv => { if (srv.key in allServices && srv.version in allServices[srv.key]) { @@ -88,7 +88,7 @@ qx.Class.define("osparc.study.Utils", { }, isWorkbenchDeprecated: function(workbench) { - const allServices = osparc.service.Store.servicesCached; + const allServices = osparc.store.Services.servicesCached; const services = new Set(this.extractServices(workbench)); const isRetired = Array.from(services).some(srv => { if (srv.key in allServices && srv.version in allServices[srv.key]) { @@ -107,7 +107,7 @@ qx.Class.define("osparc.study.Utils", { createStudyFromService: function(key, version, existingStudies, newStudyLabel) { return new Promise((resolve, reject) => { - osparc.service.Store.getService(key, version) + osparc.store.Services.getService(key, version) .then(metadata => { const newUuid = osparc.utils.Utils.uuidV4(); const minStudyData = osparc.data.model.Study.createMyNewStudyObject(); diff --git a/services/static-webserver/client/source/class/osparc/workbench/ServiceCatalog.js b/services/static-webserver/client/source/class/osparc/workbench/ServiceCatalog.js index 1684b780fc6..a1b4db10cb1 100644 --- a/services/static-webserver/client/source/class/osparc/workbench/ServiceCatalog.js +++ b/services/static-webserver/client/source/class/osparc/workbench/ServiceCatalog.js @@ -197,7 +197,7 @@ qx.Class.define("osparc.workbench.ServiceCatalog", { __populateList: function() { this.__servicesLatest = []; - osparc.service.Store.getServicesLatest() + osparc.store.Services.getServicesLatest() .then(servicesLatest => { Object.keys(servicesLatest).forEach(key => { this.__servicesLatest.push(servicesLatest[key]); @@ -293,7 +293,7 @@ qx.Class.define("osparc.workbench.ServiceCatalog", { if (version == this.self(arguments).LATEST.toString()) { version = this.__versionsBox.getChildrenContainer().getSelectables()[1].version; } - const serviceMetadata = await osparc.service.Store.getService(key, version); + const serviceMetadata = await osparc.store.Services.getService(key, version); return serviceMetadata; }, From 8ad12600fa19d96996325e6e8f96acd7349027c0 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 09:34:24 +0200 Subject: [PATCH 02/59] Workspaces --- .../source/class/osparc/store/Workspaces.js | 194 ++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 services/static-webserver/client/source/class/osparc/store/Workspaces.js diff --git a/services/static-webserver/client/source/class/osparc/store/Workspaces.js b/services/static-webserver/client/source/class/osparc/store/Workspaces.js new file mode 100644 index 00000000000..71a418b1d5b --- /dev/null +++ b/services/static-webserver/client/source/class/osparc/store/Workspaces.js @@ -0,0 +1,194 @@ +/* ************************************************************************ + + osparc - the simcore frontend + + https://osparc.io + + Copyright: + 2024 IT'IS Foundation, https://itis.swiss + + License: + MIT: https://opensource.org/licenses/MIT + + Authors: + * Odei Maiz (odeimaiz) + +************************************************************************ */ + +qx.Class.define("osparc.store.Workspaces", { + type: "static", + + construct: function() { + this.base(arguments); + + this.foldersCached = []; + }, + + members: { + foldersCached: null, + + fetchFolders: function(folderId = null) { + if (osparc.auth.Data.getInstance().isGuest()) { + return new Promise(resolve => { + resolve([]); + }); + } + + const params = { + "url": { + folderId + } + }; + return osparc.data.Resources.getInstance().getAllPages("folders", params) + .then(foldersData => { + const folders = []; + foldersData.forEach(folderData => { + const folder = new osparc.data.model.Folder(folderData); + this.__addToCache(folder); + folders.push(folder); + }); + return folders; + }); + }, + + postFolder: function(name, description, parentId = null) { + const newFolderData = { + parentFolderId: parentId, + name: name, + description: description || "", + }; + const params = { + data: newFolderData + }; + return osparc.data.Resources.getInstance().fetch("folders", "post", params) + .then(folderData => { + const newFolder = new osparc.data.model.Folder(folderData); + this.__addToCache(newFolder); + return newFolder; + }); + }, + + deleteFolder: function(folderId) { + return new Promise((resolve, reject) => { + const params = { + "url": { + folderId + } + }; + osparc.data.Resources.getInstance().fetch("folders", "delete", params) + .then(() => { + if (this.__deleteFromCache(folderId)) { + resolve(); + } else { + reject(); + } + }) + .catch(err => reject(err)); + }); + }, + + putFolder: function(folderId, updateData) { + return new Promise((resolve, reject) => { + const params = { + "url": { + folderId + }, + data: updateData + }; + osparc.data.Resources.getInstance().fetch("folders", "update", params) + .then(() => { + const folder = this.getFolder(folderId); + Object.keys(updateData).forEach(propKey => { + const upKey = qx.lang.String.firstUp(propKey); + const setter = "set" + upKey; + if (folder && setter in folder) { + folder[setter](updateData[propKey]); + } + }); + folder.setLastModified(new Date()); + this.__deleteFromCache(folderId); + this.__addToCache(folder); + resolve(); + }) + .catch(err => reject(err)); + }); + }, + + addCollaborators: function(folderId, newCollaborators) { + return new Promise((resolve, reject) => { + const folder = this.getFolder(folderId); + if (folder) { + const accessRights = folder.getAccessRights(); + const newAccessRights = Object.assign(accessRights, newCollaborators); + folder.set({ + accessRights: newAccessRights, + lastModified: new Date() + }) + resolve(); + } else { + reject(); + } + }); + }, + + removeCollaborator: function(folderId, gid) { + return new Promise((resolve, reject) => { + const folder = this.getFolder(folderId); + if (folder) { + const accessRights = folder.getAccessRights(); + delete accessRights[gid]; + folder.set({ + accessRights: accessRights, + lastModified: new Date() + }) + resolve(); + } else { + reject(); + } + }); + }, + + updateCollaborator: function(folderId, gid, newPermissions) { + return new Promise((resolve, reject) => { + const folder = this.getFolder(folderId); + if (folder) { + const accessRights = folder.getAccessRights(); + if (gid in accessRights) { + accessRights[gid] = newPermissions; + folder.set({ + accessRights: accessRights, + lastModified: new Date() + }) + resolve(); + return; + } + } + reject(); + }); + }, + + getFolders: function(parentId = null) { + return this.foldersCached.filter(f => f.getParentId() === parentId); + }, + + getFolder: function(folderId = null) { + return this.foldersCached.find(f => f.getFolderId() === folderId); + }, + + __addToCache: function(folder) { + const found = this.foldersCached.find(f => f.getFolderId() === folder.getFolderId()); + if (!found) { + this.foldersCached.unshift(folder); + } + }, + + __deleteFromCache: function(folderId) { + const idx = this.foldersCached.findIndex(f => f.getFolderId() === folderId); + if (idx > -1) { + this.foldersCached.splice(idx, 1); + return true; + } + return false; + } + } +}); From e6c00d14a29a2a01b5b63e73f35c979ba27d420c Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 09:46:04 +0200 Subject: [PATCH 03/59] Workspace model --- .../class/osparc/data/model/Workspace.js | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 services/static-webserver/client/source/class/osparc/data/model/Workspace.js diff --git a/services/static-webserver/client/source/class/osparc/data/model/Workspace.js b/services/static-webserver/client/source/class/osparc/data/model/Workspace.js new file mode 100644 index 00000000000..5578f52a509 --- /dev/null +++ b/services/static-webserver/client/source/class/osparc/data/model/Workspace.js @@ -0,0 +1,121 @@ +/* ************************************************************************ + + osparc - the simcore frontend + + https://osparc.io + + Copyright: + 2024 IT'IS Foundation, https://itis.swiss + + License: + MIT: https://opensource.org/licenses/MIT + + Authors: + * Odei Maiz (odeimaiz) + +************************************************************************ */ + +/** + * Class that stores Workspace data. + */ + +qx.Class.define("osparc.data.model.Workspace", { + extend: qx.core.Object, + + /** + * @param workspaceData {Object} Object containing the serialized Workspace Data + */ + construct: function(workspaceData) { + this.base(arguments); + + this.set({ + workspaceId: workspaceData.workspaceId, + name: workspaceData.name, + description: workspaceData.description, + thumbnail: workspaceData.thumbnail, + myAccessRights: workspaceData.myAccessRights, + accessRights: workspaceData.accessRights, + createdAt: new Date(workspaceData.createdAt), + lastModified: new Date(workspaceData.modifiedAt), + }); + }, + + properties: { + workspaceId: { + check: "Number", + nullable: false, + init: null, + event: "changeId" + }, + + name: { + check: "String", + nullable: false, + init: null, + event: "changeName" + }, + + description: { + check: "String", + nullable: true, + init: null, + event: "changeDescription" + }, + + thumbnail: { + check: "String", + nullable: true, + init: null, + event: "changeThumbnail" + }, + + myAccessRights: { + check: "Object", + nullable: false, + init: null, + event: "changeMyAccessRights" + }, + + accessRights: { + check: "Object", + nullable: false, + init: null, + event: "changeAccessRights" + }, + + createdAt: { + check: "Date", + nullable: true, + init: null, + event: "changeCreatedAt" + }, + + lastModified: { + check: "Date", + nullable: true, + init: null, + event: "changeLastModified" + } + }, + + statics: { + putWorkspace: function(workspaceId, propKey, value) { + return osparc.store.Workspaces.putWorkspace(workspaceId, propKey, value); + }, + + getProperties: function() { + return Object.keys(qx.util.PropertyUtil.getProperties(osparc.data.model.Workspace)); + } + }, + + members: { + serialize: function() { + const jsonObject = {}; + const propertyKeys = this.self().getProperties(); + propertyKeys.forEach(key => { + jsonObject[key] = this.get(key); + }); + return jsonObject; + } + } +}); From f2ccfb9434caffd32c799ecbcac82737b90e90c2 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 09:46:13 +0200 Subject: [PATCH 04/59] minor --- .../client/source/class/osparc/data/model/Folder.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/static-webserver/client/source/class/osparc/data/model/Folder.js b/services/static-webserver/client/source/class/osparc/data/model/Folder.js index 9b8f7bcc630..a3e1eb7ca90 100644 --- a/services/static-webserver/client/source/class/osparc/data/model/Folder.js +++ b/services/static-webserver/client/source/class/osparc/data/model/Folder.js @@ -16,7 +16,7 @@ ************************************************************************ */ /** - * Class that stores Service data. + * Class that stores Folder data. */ qx.Class.define("osparc.data.model.Folder", { From 378086cb0ee79fa0feece0a1650648a446180243 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 09:51:35 +0200 Subject: [PATCH 05/59] fake data --- .../source/class/osparc/store/Workspaces.js | 211 ++++++++++++------ 1 file changed, 147 insertions(+), 64 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/store/Workspaces.js b/services/static-webserver/client/source/class/osparc/store/Workspaces.js index 71a418b1d5b..d71b7e0987c 100644 --- a/services/static-webserver/client/source/class/osparc/store/Workspaces.js +++ b/services/static-webserver/client/source/class/osparc/store/Workspaces.js @@ -18,16 +18,99 @@ qx.Class.define("osparc.store.Workspaces", { type: "static", - construct: function() { - this.base(arguments); + statics: { + workspacesCached: [], - this.foldersCached = []; - }, + FAKE_WORKSPACES: [{ + workspaceId: 1, + name: "Workspace 1", + description: "Workspace 1 desc", + thumbnail: "", + myAccessRights: { + read: true, + write: true, + delete: true, + }, + accessRights: { + 3: { + read: true, + write: true, + delete: true, + }, + 5: { + read: true, + write: true, + delete: false, + }, + 9: { + read: true, + write: false, + delete: false, + }, + }, + createdAt: "2024-03-04 15:59:51.579217", + lastModified: "2024-03-05 15:18:21.515403", + }, { + workspaceId: 2, + name: "Workspace 2", + description: "Workspace 2 desc", + thumbnail: "", + myAccessRights: { + read: true, + write: true, + delete: false, + }, + accessRights: { + 3: { + read: true, + write: true, + delete: false, + }, + 5: { + read: true, + write: true, + delete: true, + }, + 9: { + read: true, + write: false, + delete: false, + }, + }, + createdAt: "2024-03-05 15:18:21.515403", + lastModified: "2024-04-24 12:03:05.15249", + }, { + workspaceId: 3, + name: "Workspace 3", + description: "Workspace 3 desc", + thumbnail: "", + myAccessRights: { + read: true, + write: false, + delete: false, + }, + accessRights: { + 3: { + read: true, + write: false, + delete: false, + }, + 5: { + read: true, + write: true, + delete: false, + }, + 9: { + read: true, + write: true, + delete: true, + }, + }, + createdAt: "2024-04-24 12:03:05.15249", + lastModified: "2024-06-21 13:00:40.33769", + }], - members: { - foldersCached: null, - - fetchFolders: function(folderId = null) { + fetchWorkspaces: function(workspaceId = null) { if (osparc.auth.Data.getInstance().isGuest()) { return new Promise(resolve => { resolve([]); @@ -36,48 +119,48 @@ qx.Class.define("osparc.store.Workspaces", { const params = { "url": { - folderId + workspaceId } }; - return osparc.data.Resources.getInstance().getAllPages("folders", params) - .then(foldersData => { - const folders = []; - foldersData.forEach(folderData => { - const folder = new osparc.data.model.Folder(folderData); - this.__addToCache(folder); - folders.push(folder); + return osparc.data.Resources.getInstance().getAllPages("workspaces", params) + .then(workspacesData => { + const workspaces = []; + workspacesData.forEach(workspaceData => { + const workspace = new osparc.data.model.Workspace(workspaceData); + this.__addToCache(workspace); + workspaces.push(workspace); }); - return folders; + return workspaces; }); }, - postFolder: function(name, description, parentId = null) { - const newFolderData = { - parentFolderId: parentId, + postWorkspace: function(name, description, parentId = null) { + const newWorkspaceData = { + parentWorkspaceId: parentId, name: name, description: description || "", }; const params = { - data: newFolderData + data: newWorkspaceData }; - return osparc.data.Resources.getInstance().fetch("folders", "post", params) - .then(folderData => { - const newFolder = new osparc.data.model.Folder(folderData); - this.__addToCache(newFolder); - return newFolder; + return osparc.data.Resources.getInstance().fetch("workspaces", "post", params) + .then(workspaceData => { + const newWorkspace = new osparc.data.model.Workspace(workspaceData); + this.__addToCache(newWorkspace); + return newWorkspace; }); }, - deleteFolder: function(folderId) { + deleteWorkspace: function(workspaceId) { return new Promise((resolve, reject) => { const params = { "url": { - folderId + workspaceId } }; - osparc.data.Resources.getInstance().fetch("folders", "delete", params) + osparc.data.Resources.getInstance().fetch("workspaces", "delete", params) .then(() => { - if (this.__deleteFromCache(folderId)) { + if (this.__deleteFromCache(workspaceId)) { resolve(); } else { reject(); @@ -87,40 +170,40 @@ qx.Class.define("osparc.store.Workspaces", { }); }, - putFolder: function(folderId, updateData) { + putWorkspace: function(workspaceId, updateData) { return new Promise((resolve, reject) => { const params = { "url": { - folderId + workspaceId }, data: updateData }; - osparc.data.Resources.getInstance().fetch("folders", "update", params) + osparc.data.Resources.getInstance().fetch("workspaces", "update", params) .then(() => { - const folder = this.getFolder(folderId); + const workspace = this.getWorkspace(workspaceId); Object.keys(updateData).forEach(propKey => { const upKey = qx.lang.String.firstUp(propKey); const setter = "set" + upKey; - if (folder && setter in folder) { - folder[setter](updateData[propKey]); + if (workspace && setter in workspace) { + workspace[setter](updateData[propKey]); } }); - folder.setLastModified(new Date()); - this.__deleteFromCache(folderId); - this.__addToCache(folder); + workspace.setLastModified(new Date()); + this.__deleteFromCache(workspaceId); + this.__addToCache(workspace); resolve(); }) .catch(err => reject(err)); }); }, - addCollaborators: function(folderId, newCollaborators) { + addCollaborators: function(workspaceId, newCollaborators) { return new Promise((resolve, reject) => { - const folder = this.getFolder(folderId); - if (folder) { - const accessRights = folder.getAccessRights(); + const workspace = this.getWorkspace(workspaceId); + if (workspace) { + const accessRights = workspace.getAccessRights(); const newAccessRights = Object.assign(accessRights, newCollaborators); - folder.set({ + workspace.set({ accessRights: newAccessRights, lastModified: new Date() }) @@ -131,13 +214,13 @@ qx.Class.define("osparc.store.Workspaces", { }); }, - removeCollaborator: function(folderId, gid) { + removeCollaborator: function(workspaceId, gid) { return new Promise((resolve, reject) => { - const folder = this.getFolder(folderId); - if (folder) { - const accessRights = folder.getAccessRights(); + const workspace = this.getWorkspace(workspaceId); + if (workspace) { + const accessRights = workspace.getAccessRights(); delete accessRights[gid]; - folder.set({ + workspace.set({ accessRights: accessRights, lastModified: new Date() }) @@ -148,14 +231,14 @@ qx.Class.define("osparc.store.Workspaces", { }); }, - updateCollaborator: function(folderId, gid, newPermissions) { + updateCollaborator: function(workspaceId, gid, newPermissions) { return new Promise((resolve, reject) => { - const folder = this.getFolder(folderId); - if (folder) { - const accessRights = folder.getAccessRights(); + const workspace = this.getWorkspace(workspaceId); + if (workspace) { + const accessRights = workspace.getAccessRights(); if (gid in accessRights) { accessRights[gid] = newPermissions; - folder.set({ + workspace.set({ accessRights: accessRights, lastModified: new Date() }) @@ -167,25 +250,25 @@ qx.Class.define("osparc.store.Workspaces", { }); }, - getFolders: function(parentId = null) { - return this.foldersCached.filter(f => f.getParentId() === parentId); + getWorkspaces: function(parentId = null) { + return this.workspacesCached.filter(f => f.getParentId() === parentId); }, - getFolder: function(folderId = null) { - return this.foldersCached.find(f => f.getFolderId() === folderId); + getWorkspace: function(workspaceId = null) { + return this.workspacesCached.find(f => f.getWorkspaceId() === workspaceId); }, - __addToCache: function(folder) { - const found = this.foldersCached.find(f => f.getFolderId() === folder.getFolderId()); + __addToCache: function(workspace) { + const found = this.workspacesCached.find(f => f.getWorkspaceId() === workspace.getWorkspaceId()); if (!found) { - this.foldersCached.unshift(folder); + this.workspacesCached.unshift(workspace); } }, - __deleteFromCache: function(folderId) { - const idx = this.foldersCached.findIndex(f => f.getFolderId() === folderId); + __deleteFromCache: function(workspaceId) { + const idx = this.workspacesCached.findIndex(f => f.getWorkspaceId() === workspaceId); if (idx > -1) { - this.foldersCached.splice(idx, 1); + this.workspacesCached.splice(idx, 1); return true; } return false; From b85d3cd055dc367a3de58128001f88fa2e58fc53 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 09:54:26 +0200 Subject: [PATCH 06/59] fetch fake Workspaces --- .../client/source/class/osparc/store/Workspaces.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/services/static-webserver/client/source/class/osparc/store/Workspaces.js b/services/static-webserver/client/source/class/osparc/store/Workspaces.js index d71b7e0987c..10a611a8867 100644 --- a/services/static-webserver/client/source/class/osparc/store/Workspaces.js +++ b/services/static-webserver/client/source/class/osparc/store/Workspaces.js @@ -117,6 +117,7 @@ qx.Class.define("osparc.store.Workspaces", { }); } + /* const params = { "url": { workspaceId @@ -132,6 +133,17 @@ qx.Class.define("osparc.store.Workspaces", { }); return workspaces; }); + */ + + return new Promise(resolve => { + const workspaces = []; + this.self().FAKE_WORKSPACES.forEach(workspaceData => { + const workspace = new osparc.data.model.Workspace(workspaceData); + this.__addToCache(workspace); + workspaces.push(workspace); + }); + resolve(workspaces); + }); }, postWorkspace: function(name, description, parentId = null) { From e46878da466b2ffdcddcd80e07ef9285d5e8db15 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 10:23:31 +0200 Subject: [PATCH 07/59] My workspace --- .../source/class/osparc/dashboard/FolderHeader.js | 15 ++++++++++++++- .../source/class/osparc/store/Workspaces.js | 3 +++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/FolderHeader.js b/services/static-webserver/client/source/class/osparc/dashboard/FolderHeader.js index bd4582fd0fc..5e4e1293e7e 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderHeader.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderHeader.js @@ -36,6 +36,14 @@ qx.Class.define("osparc.dashboard.FolderHeader", { }, properties: { + currentWorkspaceId: { + check: "Number", + nullable: true, + init: null, + event: "changeCurrentFolderId", + apply: "__applyCurrentFolderId" + }, + currentFolderId: { check: "Number", nullable: true, @@ -115,7 +123,12 @@ qx.Class.define("osparc.dashboard.FolderHeader", { if (folder) { folderButton = new qx.ui.form.Button(folder.getName(), "@FontAwesome5Solid/folder/14"); } else { - folderButton = new qx.ui.form.Button(this.tr("Home"), "@FontAwesome5Solid/home/14"); + const workspaceId = this.getCurrentWorkspaceId(); + if (workspaceId) { + folderButton = new qx.ui.form.Button(workspaceId, osparc.store.Workspaces.ICON); + } else { + folderButton = new qx.ui.form.Button(this.tr("My Workspace"), "@FontAwesome5Solid/home/14"); + } } folderButton.addListener("execute", () => this.fireDataEvent("changeCurrentFolderId", folder ? folder.getFolderId() : null), this); folderButton.set({ diff --git a/services/static-webserver/client/source/class/osparc/store/Workspaces.js b/services/static-webserver/client/source/class/osparc/store/Workspaces.js index 10a611a8867..2e4de434ee9 100644 --- a/services/static-webserver/client/source/class/osparc/store/Workspaces.js +++ b/services/static-webserver/client/source/class/osparc/store/Workspaces.js @@ -21,6 +21,9 @@ qx.Class.define("osparc.store.Workspaces", { statics: { workspacesCached: [], + ICON: "@FontAwesome5Solid/paw/14", + // project-diagram + FAKE_WORKSPACES: [{ workspaceId: 1, name: "Workspace 1", From ed043609f60486ce848504521738e3b5366e780d Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 10:27:04 +0200 Subject: [PATCH 08/59] currentWorkspaceId --- .../class/osparc/dashboard/StudyBrowser.js | 48 +++++++++++++------ 1 file changed, 34 insertions(+), 14 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 ea5d69a472e..e1158179ff8 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,14 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }, properties: { + currentWorkspaceId: { + check: "Number", + nullable: true, + init: null, + event: "changeCurrentWorkspaceId", + apply: "__applyCurrentWorkspaceId" + }, + currentFolderId: { check: "Number", nullable: true, @@ -369,6 +377,31 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { osparc.filter.UIFilterController.dispatch("searchBarFilter"); }, + __applyCurrentWorkspaceId: function() { + if (osparc.utils.DisabledPlugins.isFoldersEnabled()) { + this._resourcesContainer.setResourcesToList([]); + this._resourcesList = []; + this.invalidateStudies(); + + this.__reloadResources(); + } + }, + + // FOLDERS + __applyCurrentFolderId: function(currentFolderId) { + if (osparc.utils.DisabledPlugins.isFoldersEnabled()) { + osparc.store.Folders.getInstance().fetchFolders(currentFolderId) + .then(() => { + this._resourcesContainer.setResourcesToList([]); + this._resourcesList = []; + this.invalidateStudies(); + + this.__reloadResources(); + }) + .catch(console.error); + } + }, + __reloadFolderCards: function() { this._resourcesContainer.setFoldersToList(this.__foldersList); this._resourcesContainer.reloadFolders(); @@ -392,20 +425,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { this.setCurrentFolderId(folderId); }, - __applyCurrentFolderId: function(currentFolderId) { - if (osparc.utils.DisabledPlugins.isFoldersEnabled()) { - osparc.store.Folders.getInstance().fetchFolders(currentFolderId) - .then(() => { - this._resourcesContainer.setResourcesToList([]); - this._resourcesList = []; - this.invalidateStudies(); - - this.__reloadResources(); - }) - .catch(console.error); - } - }, - _folderUpdated: function() { this.__reloadFolders(); }, @@ -415,6 +434,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { .then(() => this.__reloadFolders()) .catch(err => console.error(err)); }, + // FOLDERS __configureCards: function(cards) { cards.forEach(card => { From e3ad433647499b8e5a3d0c21e5a17457f6046922 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 10:54:12 +0200 Subject: [PATCH 09/59] workspace buttons --- .../class/osparc/dashboard/FolderHeader.js | 2 +- .../osparc/dashboard/ResourceBrowserBase.js | 6 ++ .../class/osparc/dashboard/ResourceFilter.js | 62 +++++++++++++++++-- .../source/class/osparc/store/Workspaces.js | 6 +- 4 files changed, 69 insertions(+), 7 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/FolderHeader.js b/services/static-webserver/client/source/class/osparc/dashboard/FolderHeader.js index 5e4e1293e7e..8e3be84d503 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderHeader.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderHeader.js @@ -125,7 +125,7 @@ qx.Class.define("osparc.dashboard.FolderHeader", { } else { const workspaceId = this.getCurrentWorkspaceId(); if (workspaceId) { - folderButton = new qx.ui.form.Button(workspaceId, osparc.store.Workspaces.ICON); + folderButton = new qx.ui.form.Button(workspaceId, osparc.store.Workspaces.iconPath()); } else { folderButton = new qx.ui.form.Button(this.tr("My Workspace"), "@FontAwesome5Solid/home/14"); } diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js index 95986f1e293..203a589dae2 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js @@ -360,6 +360,12 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { this._searchBarFilter.setSharedWithActiveFilter(sharedWith.id, sharedWith.label); }, this); + resourceFilter.addListener("changeWorkspace", e => { + const workspaceId = e.getData(); + console.log("changeWorkspace", workspaceId); + this.setCurrentWorkspaceId(workspaceId); + }, this); + resourceFilter.addListener("changeSelectedTags", e => { const selectedTagIds = e.getData(); this._searchBarFilter.setTagsActiveFilter(selectedTagIds); 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 a325cec6123..39a02c0ae6a 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.js @@ -35,6 +35,7 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { events: { "changeSharedWith": "qx.event.type.Data", + "changeWorkspace": "qx.event.type.Data", "changeSelectedTags": "qx.event.type.Data", "changeServiceType": "qx.event.type.Data" }, @@ -47,10 +48,13 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { __buildLayout: function() { const layout = new qx.ui.container.Composite(new qx.ui.layout.VBox(40)); + layout.add(this.__createSharedWithFilterLayout()); + if (this.__resourceType !== "service") { layout.add(this.__createTagsFilterLayout()); } + if (this.__resourceType === "service") { layout.add(this.__createServiceTypeFilterLayout()); } @@ -74,11 +78,23 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { if (this.__resourceType === "study" && option.id === "shared-with-everyone") { return; } - const button = new qx.ui.toolbar.RadioButton(option.label, option.icon); - button.id = option.id; - button.set({ - appearance: "filter-toggle-button" + const button = new qx.ui.toolbar.RadioButton().set({ + appearance: "filter-toggle-button", + label: option.label, + icon: option.icon, }); + if (this.__resourceType === "study") { + if (option.id === "show-all") { + button.set({ + label: this.tr("My Workspace") + }); + } else { + button.set({ + marginLeft: 15 + }); + } + } + button.id = option.id; layout.add(button); radioGroup.add(button); @@ -93,10 +109,48 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { this.__sharedWithButtons.push(button); }); + if (this.__resourceType === "study") { + this.__addWorkspaceButtons(layout, radioGroup); + } + return layout; }, /* /SHARED WITH */ + /* WORKSPACES */ + __addWorkspaceButtons: function(layout, radioGroup) { + layout.add(new qx.ui.core.Spacer()); + const workspacesButton = new qx.ui.toolbar.RadioButton(this.tr("Shared Workspaces"), osparc.store.Workspaces.iconPath(20)); + workspacesButton.set({ + appearance: "filter-toggle-button" + }); + layout.add(workspacesButton); + radioGroup.add(workspacesButton); + this.fireDataEvent("changeWorkspace", { + id: -1 + }); + + osparc.store.Workspaces.fetchWorkspaces() + .then(workspaces => { + workspaces.forEach(workspace => { + const workspaceButton = new qx.ui.toolbar.RadioButton(workspace.getName(), osparc.store.Workspaces.iconPath(20)); + workspaceButton.set({ + appearance: "filter-toggle-button", + marginLeft: 15, + }); + layout.add(workspaceButton); + radioGroup.add(workspaceButton); + workspaceButton.addListener("execute", () => { + this.fireDataEvent("changeWorkspace", { + id: workspace.getWorkspaceId() + }); + }, this); + }); + }) + .catch(console.error); + }, + /* /WORKSPACES */ + /* TAGS */ __createTagsFilterLayout: function() { const layout = new qx.ui.container.Composite(new qx.ui.layout.VBox(5)); diff --git a/services/static-webserver/client/source/class/osparc/store/Workspaces.js b/services/static-webserver/client/source/class/osparc/store/Workspaces.js index 2e4de434ee9..3eb3e0e4ef6 100644 --- a/services/static-webserver/client/source/class/osparc/store/Workspaces.js +++ b/services/static-webserver/client/source/class/osparc/store/Workspaces.js @@ -21,8 +21,10 @@ qx.Class.define("osparc.store.Workspaces", { statics: { workspacesCached: [], - ICON: "@FontAwesome5Solid/paw/14", - // project-diagram + iconPath: function(iconsSize = 14) { + // @FontAwesome5Solid/project-diagram/ + return "@FontAwesome5Solid/paw/"+iconsSize + }, FAKE_WORKSPACES: [{ workspaceId: 1, From e9df51fe7d1b0081bd0bf84aa06f88ded9f95d77 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 10:55:56 +0200 Subject: [PATCH 10/59] minor --- .../client/source/class/osparc/dashboard/ResourceFilter.js | 6 ++++-- 1 file changed, 4 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 39a02c0ae6a..92ecf0943b2 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.js @@ -126,8 +126,10 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { }); layout.add(workspacesButton); radioGroup.add(workspacesButton); - this.fireDataEvent("changeWorkspace", { - id: -1 + workspacesButton.addListener("execute", () => { + this.fireDataEvent("changeWorkspace", { + id: -1 + }); }); osparc.store.Workspaces.fetchWorkspaces() From 5a1b8c2aa4c03d18e75ab4b55ddf31c128e0dcfc Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 11:00:43 +0200 Subject: [PATCH 11/59] minor --- .../source/class/osparc/dashboard/ResourceBrowserBase.js | 1 - .../source/class/osparc/dashboard/ResourceFilter.js | 8 ++------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js index 203a589dae2..0511042d84d 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js @@ -362,7 +362,6 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { resourceFilter.addListener("changeWorkspace", e => { const workspaceId = e.getData(); - console.log("changeWorkspace", workspaceId); this.setCurrentWorkspaceId(workspaceId); }, this); 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 92ecf0943b2..c6c0720b603 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.js @@ -127,9 +127,7 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { layout.add(workspacesButton); radioGroup.add(workspacesButton); workspacesButton.addListener("execute", () => { - this.fireDataEvent("changeWorkspace", { - id: -1 - }); + this.fireDataEvent("changeWorkspace", -1); }); osparc.store.Workspaces.fetchWorkspaces() @@ -143,9 +141,7 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { layout.add(workspaceButton); radioGroup.add(workspaceButton); workspaceButton.addListener("execute", () => { - this.fireDataEvent("changeWorkspace", { - id: workspace.getWorkspaceId() - }); + this.fireDataEvent("changeWorkspace", workspace.getWorkspaceId()); }, this); }); }) From ee66c1f9d0c8a3c952afc6672a7cfaf1ed214297 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 11:39:32 +0200 Subject: [PATCH 12/59] minor --- .../client/source/class/osparc/dashboard/ResourceFilter.js | 4 ++-- .../client/source/class/osparc/store/Workspaces.js | 3 +-- 2 files changed, 3 insertions(+), 4 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 c6c0720b603..aa4aa6266bf 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.js @@ -120,7 +120,7 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { /* WORKSPACES */ __addWorkspaceButtons: function(layout, radioGroup) { layout.add(new qx.ui.core.Spacer()); - const workspacesButton = new qx.ui.toolbar.RadioButton(this.tr("Shared Workspaces"), osparc.store.Workspaces.iconPath(20)); + const workspacesButton = new qx.ui.toolbar.RadioButton(this.tr("Shared Workspaces"), osparc.store.Workspaces.iconPath(22)); workspacesButton.set({ appearance: "filter-toggle-button" }); @@ -133,7 +133,7 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { osparc.store.Workspaces.fetchWorkspaces() .then(workspaces => { workspaces.forEach(workspace => { - const workspaceButton = new qx.ui.toolbar.RadioButton(workspace.getName(), osparc.store.Workspaces.iconPath(20)); + const workspaceButton = new qx.ui.toolbar.RadioButton(workspace.getName(), osparc.store.Workspaces.iconPath(22)); workspaceButton.set({ appearance: "filter-toggle-button", marginLeft: 15, diff --git a/services/static-webserver/client/source/class/osparc/store/Workspaces.js b/services/static-webserver/client/source/class/osparc/store/Workspaces.js index 3eb3e0e4ef6..bcb044824fc 100644 --- a/services/static-webserver/client/source/class/osparc/store/Workspaces.js +++ b/services/static-webserver/client/source/class/osparc/store/Workspaces.js @@ -22,8 +22,7 @@ qx.Class.define("osparc.store.Workspaces", { workspacesCached: [], iconPath: function(iconsSize = 14) { - // @FontAwesome5Solid/project-diagram/ - return "@FontAwesome5Solid/paw/"+iconsSize + return "@MaterialIcons/folder_shared/"+iconsSize }, FAKE_WORKSPACES: [{ From a28ad0bfe951a292cbc48ad89032b225c145d91d Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 11:52:00 +0200 Subject: [PATCH 13/59] remove sharing folder features --- .../osparc/dashboard/FolderButtonItem.js | 133 ++++++------------ 1 file changed, 44 insertions(+), 89 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js index b3c1bec4da6..d6a0d76769d 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderButtonItem.js @@ -79,18 +79,6 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { apply: "__applyDescription" }, - myAccessRights: { - check: "Object", - nullable: true, - apply: "__applyMyAccessRights" - }, - - accessRights: { - check: "Object", - nullable: true, - apply: "__applyAccessRights" - }, - lastModified: { check: "Date", nullable: true, @@ -103,7 +91,8 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { let control; switch (id) { case "icon": { - control = new osparc.dashboard.FolderWithSharedIcon().set({ + control = new qx.ui.basic.Image().set({ + source: "@FontAwesome5Solid/folder/26", anonymous: true, height: 40, padding: 5 @@ -155,9 +144,9 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { folder.bind("parentId", this, "parentFolderId"); folder.bind("name", this, "title"); folder.bind("description", this, "description"); - folder.bind("accessRights", this, "accessRights"); folder.bind("lastModified", this, "lastModified"); - folder.bind("myAccessRights", this, "myAccessRights"); + + this.__addMenuButton(); }, __applyTitle: function(value) { @@ -177,73 +166,51 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { } }, - __applyMyAccessRights: function(value) { - if (value && value["delete"]) { - const menuButton = this.getChildControl("menu-button"); - menuButton.setVisibility("visible"); + __addMenuButton: function() { + const menuButton = this.getChildControl("menu-button"); + menuButton.setVisibility("visible"); - const menu = new qx.ui.menu.Menu().set({ - position: "bottom-right" - }); + const menu = new qx.ui.menu.Menu().set({ + position: "bottom-right" + }); - const editButton = new qx.ui.menu.Button(this.tr("Rename..."), "@FontAwesome5Solid/pencil-alt/12"); - editButton.addListener("execute", () => { - const folder = this.getFolder(); - const newFolder = false; - const folderEditor = new osparc.editor.FolderEditor(newFolder).set({ - label: folder.getName(), - description: folder.getDescription() - }); - const title = this.tr("Edit Folder"); - const win = osparc.ui.window.Window.popUpInWindow(folderEditor, title, 300, 200); - folderEditor.addListener("updateFolder", () => { - const newName = folderEditor.getLabel(); - const newDescription = folderEditor.getDescription(); - const updateData = { - "name": newName, - "description": newDescription - }; - osparc.data.model.Folder.putFolder(this.getFolderId(), updateData) - .then(() => { - folder.set({ - name: newName, - description: newDescription - }); - this.fireDataEvent("folderUpdated", folder.getFolderId()); - }) - .catch(err => console.error(err)); - win.close(); - }); - folderEditor.addListener("cancel", () => win.close()); + const editButton = new qx.ui.menu.Button(this.tr("Rename..."), "@FontAwesome5Solid/pencil-alt/12"); + editButton.addListener("execute", () => { + const folder = this.getFolder(); + const newFolder = false; + const folderEditor = new osparc.editor.FolderEditor(newFolder).set({ + label: folder.getName(), + description: folder.getDescription() }); - menu.add(editButton); - - const shareButton = new qx.ui.menu.Button(this.tr("Share..."), "@FontAwesome5Solid/share-alt/12"); - shareButton.addListener("execute", () => this.__openShareWith(), this); - menu.add(shareButton); - - menu.addSeparator(); - - const deleteButton = new qx.ui.menu.Button(this.tr("Delete"), "@FontAwesome5Solid/trash/12"); - deleteButton.addListener("execute", () => this.__deleteStudyRequested(), this); - menu.add(deleteButton); + const title = this.tr("Edit Folder"); + const win = osparc.ui.window.Window.popUpInWindow(folderEditor, title, 300, 200); + folderEditor.addListener("updateFolder", () => { + const newName = folderEditor.getLabel(); + const newDescription = folderEditor.getDescription(); + const updateData = { + "name": newName, + "description": newDescription + }; + osparc.data.model.Folder.putFolder(this.getFolderId(), updateData) + .then(() => { + folder.set({ + name: newName, + description: newDescription + }); + this.fireDataEvent("folderUpdated", folder.getFolderId()); + }) + .catch(err => console.error(err)); + win.close(); + }); + folderEditor.addListener("cancel", () => win.close()); + }); + menu.add(editButton); - menuButton.setMenu(menu); - } - }, + const deleteButton = new qx.ui.menu.Button(this.tr("Delete"), "@FontAwesome5Solid/trash/12"); + deleteButton.addListener("execute", () => this.__deleteStudyRequested(), this); + menu.add(deleteButton); - __applyAccessRights: function(value) { - if (value && Object.keys(value).length) { - const shareIcon = this.getChildControl("icon").getChildControl("shared-icon"); - // if it's not shared don't show the share icon - shareIcon.addListener("changeSource", e => { - const newSource = e.getData(); - shareIcon.set({ - visibility: newSource.includes(osparc.dashboard.CardBase.SHARE_ICON) ? "hidden" : "visible" - }); - }); - osparc.dashboard.CardBase.populateShareIcon(shareIcon, value); - } + menuButton.setMenu(menu); }, __updateTooltip: function() { @@ -260,18 +227,6 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", { this.setValue(false); }, - __openShareWith: function() { - const disableShare = true; - if (disableShare) { - osparc.FlashMessenger.getInstance().logAs(this.tr("Not yet implemented"), "WARNING"); - } else { - const title = this.tr("Share Folder"); - const permissionsView = new osparc.share.CollaboratorsFolder(this.getFolder()); - osparc.ui.window.Window.popUpInWindow(permissionsView, title); - permissionsView.addListener("updateAccessRights", () => this.__applyAccessRights(this.getFolder().getAccessRights()), this); - } - }, - __deleteStudyRequested: function() { const msg = this.tr("Are you sure you want to delete") + " " + this.getTitle() + "?"; const confirmationWin = new osparc.ui.window.Confirmation(msg).set({ From ed39aeaed2fc5adf4d49024ac1ee55347ea4f034 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 11:59:49 +0200 Subject: [PATCH 14/59] remove folder sharing --- .../class/osparc/dashboard/FolderHeader.js | 26 ------------------- .../client/source/class/osparc/data/Roles.js | 8 +++--- .../class/osparc/share/Collaborators.js | 8 +++--- 3 files changed, 8 insertions(+), 34 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/FolderHeader.js b/services/static-webserver/client/source/class/osparc/dashboard/FolderHeader.js index 8e3be84d503..9d420937bea 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderHeader.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderHeader.js @@ -63,22 +63,12 @@ qx.Class.define("osparc.dashboard.FolderHeader", { })); this._addAt(control, 0, {flex: 1}); break; - case "permissions-info": { - control = new qx.ui.container.Composite(new qx.ui.layout.HBox().set({ - alignY: "middle" - })).set({ - paddingRight: 14 - }); - this._addAt(control, 1); - break; - } } return control || this.base(arguments, id); }, __applyCurrentFolderId: function() { this.__buildBreadcrumbs(); - this.__populatePermissions(); }, __buildBreadcrumbs: function() { @@ -141,22 +131,6 @@ qx.Class.define("osparc.dashboard.FolderHeader", { __createArrow: function() { return new qx.ui.basic.Label("/"); - }, - - __populatePermissions: function() { - const permissionsLayout = this.getChildControl("permissions-info"); - permissionsLayout.removeAll(); - - if (this.getCurrentFolderId()) { - const currentFolder = osparc.store.Folders.getInstance().getFolder(this.getCurrentFolderId()); - const ar = currentFolder.getMyAccessRights(); - const permissions = ar["read"] + ar["write"] + ar["delete"]; - const roleTitle = new qx.ui.basic.Label().set({ - value: osparc.data.Roles.FOLDERS[permissions].label - }); - permissionsLayout.add(roleTitle); - permissionsLayout.add(osparc.data.Roles.createRolesFolderInfo(false)); - } } } }); diff --git a/services/static-webserver/client/source/class/osparc/data/Roles.js b/services/static-webserver/client/source/class/osparc/data/Roles.js index 5d5a1d7c017..658a3ffbd56 100644 --- a/services/static-webserver/client/source/class/osparc/data/Roles.js +++ b/services/static-webserver/client/source/class/osparc/data/Roles.js @@ -135,7 +135,7 @@ qx.Class.define("osparc.data.Roles", { } }, - FOLDERS: { + WORKSPACE: { 1: { id: "read", label: qx.locale.Manager.tr("Viewer"), @@ -158,7 +158,7 @@ qx.Class.define("osparc.data.Roles", { label: qx.locale.Manager.tr("Owner"), longLabel: qx.locale.Manager.tr("Owner: Read/Write/Delete access"), canDo: [ - qx.locale.Manager.tr("- can rename folder"), + qx.locale.Manager.tr("- can rename workspace"), qx.locale.Manager.tr("- can share it"), qx.locale.Manager.tr("- can delete it") ] @@ -208,7 +208,7 @@ qx.Class.define("osparc.data.Roles", { return this.__createIntoFromRoles(osparc.data.Roles.WALLET); }, - createRolesStudyInfo: function() { + createRolesWorkspaceInfo: function() { return this.__createIntoFromRoles(osparc.data.Roles.STUDY); }, @@ -217,7 +217,7 @@ qx.Class.define("osparc.data.Roles", { }, createRolesFolderInfo: function(showWording = true) { - return this.__createIntoFromRoles(osparc.data.Roles.FOLDERS, showWording); + return this.__createIntoFromRoles(osparc.data.Roles.WORKSPACE, showWording); } } }); diff --git a/services/static-webserver/client/source/class/osparc/share/Collaborators.js b/services/static-webserver/client/source/class/osparc/share/Collaborators.js index 47163863b82..217b53df2b5 100644 --- a/services/static-webserver/client/source/class/osparc/share/Collaborators.js +++ b/services/static-webserver/client/source/class/osparc/share/Collaborators.js @@ -199,8 +199,8 @@ qx.Class.define("osparc.share.Collaborators", { case "service": fullOptions = osparc.service.Utils.canIWrite(this._serializedDataCopy["accessRights"]); break; - case "folder": - fullOptions = osparc.share.CollaboratorsFolder.canIDelete(this._serializedDataCopy["myAccessRights"]); + case "workspace": + fullOptions = osparc.share.CollaboratorsWorkspace.canIDelete(this._serializedDataCopy["myAccessRights"]); break; } return fullOptions; @@ -212,11 +212,11 @@ qx.Class.define("osparc.share.Collaborators", { case "service": rolesLayout = osparc.data.Roles.createRolesServicesInfo(); break; - case "folder": + case "workspace": rolesLayout = osparc.data.Roles.createRolesFolderInfo(); break; default: - rolesLayout = osparc.data.Roles.createRolesStudyInfo(); + rolesLayout = osparc.data.Roles.createRolesWorkspaceInfo(); break; } return rolesLayout; From d2f768dc8b7049f95743f71683cdbcb6ff4b620e Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 11:59:58 +0200 Subject: [PATCH 15/59] Workspace items --- .../osparc/dashboard/WorkspaceButtonBase.js | 123 ++++++++ .../osparc/dashboard/WorkspaceButtonItem.js | 286 ++++++++++++++++++ .../osparc/dashboard/WrokspaceButtonNew.js | 98 ++++++ ...orsFolder.js => CollaboratorsWorkspace.js} | 28 +- 4 files changed, 521 insertions(+), 14 deletions(-) create mode 100644 services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js create mode 100644 services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js create mode 100644 services/static-webserver/client/source/class/osparc/dashboard/WrokspaceButtonNew.js rename services/static-webserver/client/source/class/osparc/share/{CollaboratorsFolder.js => CollaboratorsWorkspace.js} (84%) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js new file mode 100644 index 00000000000..3b72a5700b9 --- /dev/null +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js @@ -0,0 +1,123 @@ +/* ************************************************************************ + + osparc - the simcore frontend + + https://osparc.io + + Copyright: + 2024 IT'IS Foundation, https://itis.swiss + + License: + MIT: https://opensource.org/licenses/MIT + + Authors: + * Odei Maiz (odeimaiz) + +************************************************************************ */ + +qx.Class.define("osparc.dashboard.WorkspaceButtonBase", { + extend: qx.ui.form.ToggleButton, + implement: [qx.ui.form.IModel, osparc.filter.IFilterable], + include: [qx.ui.form.MModelProperty, osparc.filter.MFilterable], + type: "abstract", + + construct: function() { + this.base(arguments); + + this.set({ + width: osparc.dashboard.GridButtonBase.ITEM_WIDTH, + minHeight: this.self().HEIGHT, + padding: 5, + alignY: "middle" + }); + + const gridLayout = new qx.ui.layout.Grid(); + gridLayout.setSpacing(this.self().SPACING); + gridLayout.setColumnFlex(this.self().POS.TITLE.column, 1); + gridLayout.setColumnAlign(this.self().POS.ICON.column, "center", "middle"); + gridLayout.setColumnAlign(this.self().POS.TITLE.column, "left", "middle"); + this._setLayout(gridLayout); + + this.addListener("pointerover", this.__onPointerOver, this); + this.addListener("pointerout", this.__onPointerOut, this); + }, + + properties: { + cardKey: { + check: "String", + nullable: true + }, + + resourceType: { + check: ["workspace"], + init: "workspace", + nullable: false + } + }, + + statics: { + HEIGHT: 50, + SPACING: 5, + POS: { + ICON: { + column: 0, + row: 0, + rowSpan: 2 + }, + TITLE: { + column: 1, + row: 0 + }, + SUBTITLE: { + column: 1, + row: 1 + }, + MENU: { + column: 2, + row: 0, + rowSpan: 2 + } + } + }, + + members: { // eslint-disable-line qx-rules/no-refs-in-members + // overridden + _forwardStates: { + focused : true, + hovered : true, + selected : true, + dragover : true + }, + + __onPointerOver: function() { + this.addState("hovered"); + }, + + __onPointerOut : function() { + this.removeState("hovered"); + }, + + _filter: function() { + this.exclude(); + }, + + _unfilter: function() { + this.show(); + }, + + _shouldApplyFilter: function(data) { + console.log("_shouldApplyFilter", data); + return false; + }, + + _shouldReactToFilter: function(data) { + console.log("_shouldReactToFilter", data); + return false; + } + }, + + destruct: function() { + this.removeListener("pointerover", this.__onPointerOver, this); + this.removeListener("pointerout", this.__onPointerOut, this); + } +}); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js new file mode 100644 index 00000000000..c545af0f233 --- /dev/null +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js @@ -0,0 +1,286 @@ +/* ************************************************************************ + + osparc - the simcore frontend + + https://osparc.io + + Copyright: + 2024 IT'IS Foundation, https://itis.swiss + + License: + MIT: https://opensource.org/licenses/MIT + + Authors: + * Odei Maiz (odeimaiz) + +************************************************************************ */ + +/** + * Widget used for displaying a Workspace in the Study Browser + * + */ + +qx.Class.define("osparc.dashboard.WorkspaceButtonItem", { + extend: osparc.dashboard.WorkspaceButtonBase, + + /** + * @param workspace {osparc.data.model.Workspace} + */ + construct: function(workspace) { + this.base(arguments); + + this.set({ + appearance: "pb-study" + }); + + this.addListener("changeValue", e => this.__itemSelected(e.getData()), this); + + this.setPriority(osparc.dashboard.CardBase.CARD_PRIORITY.ITEM); + + this.set({ + workspace: workspace + }); + }, + + events: { + "workspaceSelected": "qx.event.type.Data", + "workspaceUpdated": "qx.event.type.Data", + "deleteWorkspaceRequested": "qx.event.type.Data" + }, + + properties: { + workspace: { + check: "osparc.data.model.Workspace", + nullable: false, + init: null, + apply: "__applyWorkspace" + }, + + workspaceId: { + check: "Number", + nullable: false + }, + + parentWorkspaceId: { + check: "Number", + nullable: true, + init: true + }, + + title: { + check: "String", + nullable: true, + apply: "__applyTitle" + }, + + description: { + check: "String", + nullable: true, + apply: "__applyDescription" + }, + + myAccessRights: { + check: "Object", + nullable: true, + apply: "__applyMyAccessRights" + }, + + accessRights: { + check: "Object", + nullable: true, + apply: "__applyAccessRights" + }, + + lastModified: { + check: "Date", + nullable: true, + apply: "__applyLastModified" + } + }, + + members: { + _createChildControlImpl: function(id) { + let control; + switch (id) { + case "icon": { + control = new osparc.dashboard.WorkspaceWithSharedIcon().set({ + anonymous: true, + height: 40, + padding: 5 + }); + this._add(control, osparc.dashboard.WorkspaceButtonBase.POS.ICON); + break; + } + case "title": + control = new qx.ui.basic.Label().set({ + anonymous: true, + font: "text-14", + rich: true, + }); + this._add(control, osparc.dashboard.WorkspaceButtonBase.POS.TITLE); + break; + case "last-modified": + control = new qx.ui.basic.Label().set({ + anonymous: true, + font: "text-12", + }); + this._add(control, osparc.dashboard.WorkspaceButtonBase.POS.SUBTITLE); + break; + case "menu-button": { + control = new qx.ui.form.MenuButton().set({ + appearance: "form-button-outlined", + padding: [0, 8], + maxWidth: osparc.dashboard.ListButtonItem.MENU_BTN_DIMENSIONS, + maxHeight: osparc.dashboard.ListButtonItem.MENU_BTN_DIMENSIONS, + icon: "@FontAwesome5Solid/ellipsis-v/14", + focusable: false + }); + // make it circular + control.getContentElement().setStyles({ + "border-radius": `${osparc.dashboard.ListButtonItem.MENU_BTN_DIMENSIONS / 2}px` + }); + this._add(control, osparc.dashboard.WorkspaceButtonBase.POS.MENU); + break; + } + } + return control || this.base(arguments, id); + }, + + __applyWorkspace: function(workspace) { + this.getChildControl("icon"); + this.set({ + cardKey: "workspace-" + workspace.getWorkspaceId() + }); + workspace.bind("workspaceId", this, "workspaceId"); + workspace.bind("parentId", this, "parentWorkspaceId"); + workspace.bind("name", this, "title"); + workspace.bind("description", this, "description"); + workspace.bind("accessRights", this, "accessRights"); + workspace.bind("lastModified", this, "lastModified"); + workspace.bind("myAccessRights", this, "myAccessRights"); + }, + + __applyTitle: function(value) { + const label = this.getChildControl("title"); + label.setValue(value); + this.__updateTooltip(); + }, + + __applyDescription: function() { + this.__updateTooltip(); + }, + + __applyLastModified: function(value) { + if (value) { + const label = this.getChildControl("last-modified"); + label.setValue(osparc.utils.Utils.formatDateAndTime(value)); + } + }, + + __applyMyAccessRights: function(value) { + if (value && value["delete"]) { + const menuButton = this.getChildControl("menu-button"); + menuButton.setVisibility("visible"); + + const menu = new qx.ui.menu.Menu().set({ + position: "bottom-right" + }); + + const editButton = new qx.ui.menu.Button(this.tr("Rename..."), "@FontAwesome5Solid/pencil-alt/12"); + editButton.addListener("execute", () => { + const workspace = this.getWorkspace(); + const newWorkspace = false; + const workspaceEditor = new osparc.editor.WorkspaceEditor(newWorkspace).set({ + label: workspace.getName(), + description: workspace.getDescription() + }); + const title = this.tr("Edit Workspace"); + const win = osparc.ui.window.Window.popUpInWindow(workspaceEditor, title, 300, 200); + workspaceEditor.addListener("updateWorkspace", () => { + const newName = workspaceEditor.getLabel(); + const newDescription = workspaceEditor.getDescription(); + const updateData = { + "name": newName, + "description": newDescription + }; + osparc.data.model.Workspace.putWorkspace(this.getWorkspaceId(), updateData) + .then(() => { + workspace.set({ + name: newName, + description: newDescription + }); + this.fireDataEvent("workspaceUpdated", workspace.getWorkspaceId()); + }) + .catch(err => console.error(err)); + win.close(); + }); + workspaceEditor.addListener("cancel", () => win.close()); + }); + menu.add(editButton); + + menu.addSeparator(); + + const deleteButton = new qx.ui.menu.Button(this.tr("Delete"), "@FontAwesome5Solid/trash/12"); + deleteButton.addListener("execute", () => this.__deleteStudyRequested(), this); + menu.add(deleteButton); + + menuButton.setMenu(menu); + } + }, + + __applyAccessRights: function(value) { + if (value && Object.keys(value).length) { + const shareIcon = this.getChildControl("icon").getChildControl("shared-icon"); + // if it's not shared don't show the share icon + shareIcon.addListener("changeSource", e => { + const newSource = e.getData(); + shareIcon.set({ + visibility: newSource.includes(osparc.dashboard.CardBase.SHARE_ICON) ? "hidden" : "visible" + }); + }); + osparc.dashboard.CardBase.populateShareIcon(shareIcon, value); + } + }, + + __updateTooltip: function() { + const toolTipText = this.getTitle() + (this.getDescription() ? "
" + this.getDescription() : ""); + this.set({ + toolTipText + }) + }, + + __itemSelected: function(newVal) { + if (newVal) { + this.fireDataEvent("workspaceSelected", this.getWorkspaceId()); + } + this.setValue(false); + }, + + __openShareWith: function() { + const disableShare = true; + if (disableShare) { + osparc.FlashMessenger.getInstance().logAs(this.tr("Not yet implemented"), "WARNING"); + } else { + const title = this.tr("Share Workspace"); + const permissionsView = new osparc.share.CollaboratorsWorkspace(this.getWorkspace()); + osparc.ui.window.Window.popUpInWindow(permissionsView, title); + permissionsView.addListener("updateAccessRights", () => this.__applyAccessRights(this.getWorkspace().getAccessRights()), this); + } + }, + + __deleteStudyRequested: function() { + const msg = this.tr("Are you sure you want to delete") + " " + this.getTitle() + "?"; + const confirmationWin = new osparc.ui.window.Confirmation(msg).set({ + confirmText: this.tr("Delete"), + confirmAction: "delete" + }); + confirmationWin.center(); + confirmationWin.open(); + confirmationWin.addListener("close", () => { + if (confirmationWin.getConfirmed()) { + this.fireDataEvent("deleteWorkspaceRequested", this.getWorkspaceId()); + } + }, this); + } + } +}); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WrokspaceButtonNew.js b/services/static-webserver/client/source/class/osparc/dashboard/WrokspaceButtonNew.js new file mode 100644 index 00000000000..62f47117e82 --- /dev/null +++ b/services/static-webserver/client/source/class/osparc/dashboard/WrokspaceButtonNew.js @@ -0,0 +1,98 @@ +/* ************************************************************************ + + osparc - the simcore frontend + + https://osparc.io + + Copyright: + 2024 IT'IS Foundation, https://itis.swiss + + License: + MIT: https://opensource.org/licenses/MIT + + Authors: + * Odei Maiz (odeimaiz) + +************************************************************************ */ + +/** + * Widget used for displaying a New Workspace in the Study Browser + * + */ + +qx.Class.define("osparc.dashboard.WorkspaceButtonNew", { + extend: osparc.dashboard.WorkspaceButtonBase, + + construct: function() { + this.base(arguments); + + this.set({ + appearance: "pb-new" + }); + + this.addListener("changeValue", e => this.__itemSelected(e.getData()), this); + + this.setPriority(osparc.dashboard.CardBase.CARD_PRIORITY.NEW); + + this.__buildLayout(); + }, + + events: { + "createWorkspace": "qx.event.type.Data" + }, + + members: { + _createChildControlImpl: function(id) { + let control; + switch (id) { + case "icon": { + control = new qx.ui.basic.Image().set({ + source: osparc.dashboard.CardBase.NEW_ICON + "26", + anonymous: true, + height: 40, + padding: 5 + }); + this._add(control, osparc.dashboard.WorkspaceButtonBase.POS.ICON); + break; + } + case "title": + control = new qx.ui.basic.Label(this.tr("New workspace")).set({ + anonymous: true, + font: "text-14", + rich: true, + }); + this._add(control, { + ...osparc.dashboard.WorkspaceButtonBase.POS.TITLE, + ...{rowSpan: 2} + }); + break; + } + return control || this.base(arguments, id); + }, + + __buildLayout: function() { + this.getChildControl("icon"); + this.getChildControl("title"); + }, + + __itemSelected: function(newVal) { + if (newVal) { + const newWorkspace = true; + const workspaceEditor = new osparc.editor.WorkspaceEditor(newWorkspace); + const title = this.tr("New Workspace"); + const win = osparc.ui.window.Window.popUpInWindow(workspaceEditor, title, 300, 200); + workspaceEditor.addListener("createWorkspace", () => { + const name = workspaceEditor.getLabel(); + const description = workspaceEditor.getDescription(); + this.fireDataEvent("createWorkspace", { + name, + description + }); + win.close(); + }); + workspaceEditor.addListener("cancel", () => win.close()); + } + this.setValue(false); + } + } +}); diff --git a/services/static-webserver/client/source/class/osparc/share/CollaboratorsFolder.js b/services/static-webserver/client/source/class/osparc/share/CollaboratorsWorkspace.js similarity index 84% rename from services/static-webserver/client/source/class/osparc/share/CollaboratorsFolder.js rename to services/static-webserver/client/source/class/osparc/share/CollaboratorsWorkspace.js index d68df6a9dde..a492de677db 100644 --- a/services/static-webserver/client/source/class/osparc/share/CollaboratorsFolder.js +++ b/services/static-webserver/client/source/class/osparc/share/CollaboratorsWorkspace.js @@ -16,18 +16,18 @@ ************************************************************************ */ -qx.Class.define("osparc.share.CollaboratorsFolder", { +qx.Class.define("osparc.share.CollaboratorsWorkspace", { extend: osparc.share.Collaborators, /** - * @param folder {osparc.data.model.Folder} + * @param workspace {osparc.data.model.Workspace} */ - construct: function(folder) { - this.__folder = folder; - this._resourceType = "folder"; + construct: function(workspace) { + this.__workspace = workspace; + this._resourceType = "workspace"; - const folderDataCopy = folder.serialize(); - this.base(arguments, folderDataCopy, []); + const workspaceDataCopy = workspace.serialize(); + this.base(arguments, workspaceDataCopy, []); }, statics: { @@ -61,7 +61,7 @@ qx.Class.define("osparc.share.CollaboratorsFolder", { }, members: { - __folder: null, + __workspace: null, _addEditors: function(gids) { if (gids.length === 0) { @@ -70,9 +70,9 @@ qx.Class.define("osparc.share.CollaboratorsFolder", { const newCollaborators = {}; gids.forEach(gid => newCollaborators[gid] = this.self().getCollaboratorAccessRight()); - osparc.store.Folders.getInstance().addCollaborators(this.__folder.getFolderId(), newCollaborators) + osparc.store.Workspaces.getInstance().addCollaborators(this.__workspace.getWorkspaceId(), newCollaborators) .then(() => { - this.fireDataEvent("updateAccessRights", this.__folder.serialize()); + this.fireDataEvent("updateAccessRights", this.__workspace.serialize()); const text = this.tr("User(s) successfully added."); osparc.FlashMessenger.getInstance().logAs(text); this._reloadCollaboratorsList(); @@ -88,9 +88,9 @@ qx.Class.define("osparc.share.CollaboratorsFolder", { item.setEnabled(false); } - osparc.store.Folders.getInstance().removeCollaborator(this.__folder.getFolderId(), collaborator["gid"]) + osparc.store.Workspaces.getInstance().removeCollaborator(this.__workspace.getWorkspaceId(), collaborator["gid"]) .then(() => { - this.fireDataEvent("updateAccessRights", this.__folder.serialize()); + this.fireDataEvent("updateAccessRights", this.__workspace.serialize()); osparc.FlashMessenger.getInstance().logAs(this.tr("Member successfully removed")); this._reloadCollaboratorsList(); }) @@ -108,9 +108,9 @@ qx.Class.define("osparc.share.CollaboratorsFolder", { __make: function(collaboratorGId, newAccessRights, successMsg, failureMsg, item) { item.setEnabled(false); - osparc.store.Folders.getInstance().updateCollaborator(this.__folder.getFolderId(), collaboratorGId, newAccessRights) + osparc.store.Workspaces.getInstance().updateCollaborator(this.__workspace.getWorkspaceId(), collaboratorGId, newAccessRights) .then(() => { - this.fireDataEvent("updateAccessRights", this.__folder.serialize()); + this.fireDataEvent("updateAccessRights", this.__workspace.serialize()); osparc.FlashMessenger.getInstance().logAs(successMsg); this._reloadCollaboratorsList(); }) From 4550b7932fc774af946201f2b16aff0b09772778 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 12:43:36 +0200 Subject: [PATCH 16/59] load workspaces --- .../dashboard/ResourceContainerManager.js | 72 ++++++++++++++----- .../class/osparc/dashboard/StudyBrowser.js | 61 +++++++++++++--- .../osparc/dashboard/WorkspaceButtonBase.js | 6 ++ 3 files changed, 112 insertions(+), 27 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js index 01b4f7f861d..3a5162c70e3 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js @@ -238,17 +238,6 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { return card; }, - __createFolderCard: function(folder) { - const card = new osparc.dashboard.FolderButtonItem(folder); - card.subscribeToFilterGroup("searchBarFilter"); - [ - "folderSelected", - "folderUpdated", - "deleteFolderRequested", - ].forEach(eName => card.addListener(eName, e => this.fireDataEvent(eName, e.getData()))); - return card; - }, - setResourcesToList: function(resourcesList) { this.__resourcesList = resourcesList; }, @@ -309,6 +298,43 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { return newCards; }, + // WORKSPACES + setWorkspacesToList: function(workspacesList) { + this.__workspacesList = workspacesList; + }, + + reloadWorkspaces: function() { + if (this.__workspacesContainer) { + this.__workspacesContainer.removeAll(); + } + let workspacesCards = []; + this.__workspacesList.forEach(workspaceData => workspacesCards.push(this.__workspaceToCard(workspaceData))); + return workspacesCards; + }, + + addNewWorkspaceCard: function(newWorkspaceCard) { + this.__workspacesContainer.addAt(newWorkspaceCard, 0); + }, + + __workspaceToCard: function(workspaceData) { + const card = this.__createWorkspaceCard(workspaceData); + this.__foldersContainer.add(card); + return card; + }, + + __createWorkspaceCard: function(workspace) { + const card = new osparc.dashboard.WorkspaceButtonItem(workspace); + card.subscribeToFilterGroup("searchBarFilter"); + [ + "workspaceSelected", + "workspaceUpdated", + "deleteWorkspaceRequested", + ].forEach(eName => card.addListener(eName, e => this.fireDataEvent(eName, e.getData()))); + return card; + }, + // /WORKSPACES + + // FOLDERS setFoldersToList: function(foldersList) { this.__foldersList = foldersList; }, @@ -326,6 +352,24 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { this.__foldersContainer.addAt(newFolderCard, 0); }, + __folderToCard: function(folderData) { + const card = this.__createFolderCard(folderData); + this.__foldersContainer.add(card); + return card; + }, + + __createFolderCard: function(folder) { + const card = new osparc.dashboard.FolderButtonItem(folder); + card.subscribeToFilterGroup("searchBarFilter"); + [ + "folderSelected", + "folderUpdated", + "deleteFolderRequested", + ].forEach(eName => card.addListener(eName, e => this.fireDataEvent(eName, e.getData()))); + return card; + }, + // /FOLDERS + __moveNoGroupToLast: function() { const idx = this.__groupedContainersLayout.getChildren().findIndex(grpContainer => grpContainer === this.__getGroupContainer("no-group")); if (idx > -1) { @@ -417,12 +461,6 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { this.self().sortListByPriority(this.__nonGroupedContainer); } return cardsCreated; - }, - - __folderToCard: function(folderData) { - const card = this.__createFolderCard(folderData); - this.__foldersContainer.add(card); - return card; } } }); 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 e1158179ff8..c1f39e83369 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -149,13 +149,13 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { reloadResources: function() { if (osparc.data.Permissions.getInstance().canDo("studies.user.read")) { - this.__reloadResources(); + this.__reloadFoldersAndStudies(); } else { this.__resetStudiesList(); } }, - __reloadResources: function() { + __reloadFoldersAndStudies: function() { this.__reloadFolders(); this.__reloadStudies(); }, @@ -164,6 +164,13 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { this.__reloadFilteredStudies(); }, + __reloadWorkspaces: function() { + osparc.store.Workspaces.fetchWorkspaces() + .then(workspaces => { + this.__setWorkspacesToList(workspaces); + }); + }, + __reloadFolders: function() { const folders = osparc.store.Folders.getInstance().getFolders(this.getCurrentFolderId()) this.__setFoldersToList(folders); @@ -324,6 +331,12 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }); }, + __setWorkspacesToList: function(workspaces) { + this.__foldersList = workspaces; + workspaces.forEach(workspace => workspace["resourceType"] = "workspace"); + this.__reloadWorkspaceCards(); + }, + __setFoldersToList: function(folders) { this.__foldersList = folders; folders.forEach(folder => folder["resourceType"] = "folder"); @@ -377,16 +390,44 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { osparc.filter.UIFilterController.dispatch("searchBarFilter"); }, - __applyCurrentWorkspaceId: function() { + __applyCurrentWorkspaceId: function(workspaceId) { if (osparc.utils.DisabledPlugins.isFoldersEnabled()) { - this._resourcesContainer.setResourcesToList([]); - this._resourcesList = []; - this.invalidateStudies(); + if (workspaceId === -1) { + this._resourcesContainer.setResourcesToList([]); + this._resourcesList = []; + + this.__reloadWorkspaces(); + } else { + this._resourcesContainer.setResourcesToList([]); + this._resourcesList = []; + this.invalidateStudies(); - this.__reloadResources(); + this.__reloadFoldersAndStudies(); + } } }, + // WORKSPACES + __reloadWorkspaceCards: function() { + this._resourcesContainer.setWorkspacesToList(this.__foldersList); + this._resourcesContainer.reloadWorkspaces(); + + const currentWorkspace = osparc.store.Workspaces.getFolder(this.getCurrentFolderId()) + if (currentWorkspace == null || currentWorkspace.getMyAccessRights()["write"]) { + const newWorkspaceCard = new osparc.dashboard.WorkspaceButtonNew(); + newWorkspaceCard.setCardKey("new-workspace"); + newWorkspaceCard.subscribeToFilterGroup("searchBarFilter"); + newWorkspaceCard.addListener("createWorkspace", e => { + const data = e.getData(); + osparc.store.Workspaces.postWorkspace(data.name, data.description, currentWorkspace ? currentWorkspace.getFolderId() : null) + .then(() => this.__reloadWorkspaces()) + .catch(err => console.error(err)); + }) + this._resourcesContainer.addNewWorkspaceCard(newWorkspaceCard); + } + }, + // /WORKSPACES + // FOLDERS __applyCurrentFolderId: function(currentFolderId) { if (osparc.utils.DisabledPlugins.isFoldersEnabled()) { @@ -396,7 +437,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { this._resourcesList = []; this.invalidateStudies(); - this.__reloadResources(); + this.__reloadFoldersAndStudies(); }) .catch(console.error); } @@ -434,7 +475,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { .then(() => this.__reloadFolders()) .catch(err => console.error(err)); }, - // FOLDERS + // /FOLDERS __configureCards: function(cards) { cards.forEach(card => { @@ -815,7 +856,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { if (filterData.text) { this.__reloadFilteredResources(filterData.text); } else { - this.__reloadResources(); + this.__reloadFoldersAndStudies(); } sharedWithButton.filterChanged(filterData); }, this); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js index 3b72a5700b9..91794a4b4fe 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js @@ -52,6 +52,12 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonBase", { check: ["workspace"], init: "workspace", nullable: false + }, + + priority: { + check: "Number", + init: null, + nullable: false } }, From 59c42b073e71463b6c46176e8686839a79005a74 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 12:45:02 +0200 Subject: [PATCH 17/59] rename file --- .../{FolderWithSharedIcon.js => WorkspaceWithSharedIcon.js} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename services/static-webserver/client/source/class/osparc/dashboard/{FolderWithSharedIcon.js => WorkspaceWithSharedIcon.js} (95%) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/FolderWithSharedIcon.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceWithSharedIcon.js similarity index 95% rename from services/static-webserver/client/source/class/osparc/dashboard/FolderWithSharedIcon.js rename to services/static-webserver/client/source/class/osparc/dashboard/WorkspaceWithSharedIcon.js index af6573fb16f..2e3b8a88d89 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderWithSharedIcon.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceWithSharedIcon.js @@ -15,7 +15,7 @@ ************************************************************************ */ -qx.Class.define("osparc.dashboard.FolderWithSharedIcon", { +qx.Class.define("osparc.dashboard.WorkspaceWithSharedIcon", { extend: qx.ui.core.Widget, construct: function() { From 7ea260be629161453b707bc880610910355f27aa Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 13:56:49 +0200 Subject: [PATCH 18/59] thumbnails --- .../client/source/class/osparc/store/Workspaces.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/store/Workspaces.js b/services/static-webserver/client/source/class/osparc/store/Workspaces.js index bcb044824fc..e22c630e746 100644 --- a/services/static-webserver/client/source/class/osparc/store/Workspaces.js +++ b/services/static-webserver/client/source/class/osparc/store/Workspaces.js @@ -29,7 +29,7 @@ qx.Class.define("osparc.store.Workspaces", { workspaceId: 1, name: "Workspace 1", description: "Workspace 1 desc", - thumbnail: "", + thumbnail: "https://images.ctfassets.net/hrltx12pl8hq/01rJn4TormMsGQs1ZRIpzX/16a1cae2440420d0fd0a7a9a006f2dcb/Artboard_Copy_231.jpg?fit=fill&w=600&h=600", myAccessRights: { read: true, write: true, @@ -58,7 +58,7 @@ qx.Class.define("osparc.store.Workspaces", { workspaceId: 2, name: "Workspace 2", description: "Workspace 2 desc", - thumbnail: "", + thumbnail: "https://image.shutterstock.com/image-vector/dotted-spiral-vortex-royaltyfree-images-600w-2227567913.jpg", myAccessRights: { read: true, write: true, @@ -87,7 +87,7 @@ qx.Class.define("osparc.store.Workspaces", { workspaceId: 3, name: "Workspace 3", description: "Workspace 3 desc", - thumbnail: "", + thumbnail: "https://media.springernature.com/lw703/springer-static/image/art%3A10.1038%2F528452a/MediaObjects/41586_2015_Article_BF528452a_Figg_HTML.jpg", myAccessRights: { read: true, write: false, From ecf2a31c56b77a3f9d11908b73b1698ae4efe048 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 15:09:36 +0200 Subject: [PATCH 19/59] own layout --- .../osparc/dashboard/WorkspaceButtonBase.js | 148 ++++++++++++++---- .../osparc/dashboard/WorkspaceButtonItem.js | 86 +++++----- 2 files changed, 159 insertions(+), 75 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js index 91794a4b4fe..1074d9343e5 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js @@ -25,18 +25,15 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonBase", { this.base(arguments); this.set({ - width: osparc.dashboard.GridButtonBase.ITEM_WIDTH, - minHeight: this.self().HEIGHT, + width: this.self().ITEM_WIDTH, + height: this.self().ITEM_HEIGHT, padding: 5, alignY: "middle" }); - const gridLayout = new qx.ui.layout.Grid(); - gridLayout.setSpacing(this.self().SPACING); - gridLayout.setColumnFlex(this.self().POS.TITLE.column, 1); - gridLayout.setColumnAlign(this.self().POS.ICON.column, "center", "middle"); - gridLayout.setColumnAlign(this.self().POS.TITLE.column, "left", "middle"); - this._setLayout(gridLayout); + this._setLayout(new qx.ui.layout.Canvas()); + + this.getChildControl("main-layout"); this.addListener("pointerover", this.__onPointerOver, this); this.addListener("pointerout", this.__onPointerOut, this); @@ -62,27 +59,24 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonBase", { }, statics: { - HEIGHT: 50, - SPACING: 5, + ITEM_WIDTH: 190, + ITEM_HEIGHT: 190, + PADDING: 10, + SPACING_IN: 5, + SPACING: 15, + HEADER_MAX_HEIGHT: 40, // two lines in Manrope POS: { - ICON: { - column: 0, - row: 0, - rowSpan: 2 - }, - TITLE: { - column: 1, - row: 0 - }, - SUBTITLE: { - column: 1, - row: 1 - }, - MENU: { - column: 2, - row: 0, - rowSpan: 2 - } + HEADER: 0, + BODY: 1, + FOOTER: 2 + }, + HPOS: { + SHARED: 0, + TITLE: 1, + MENU: 2, + }, + FPOS: { + MODIFIED: 0 } }, @@ -95,6 +89,104 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonBase", { dragover : true }, + // overridden + _createChildControlImpl: function(id) { + let layout; + let control; + switch (id) { + case "main-layout": { + control = new qx.ui.container.Composite(new qx.ui.layout.VBox(this.self().SPACING_IN)); + const header = this.getChildControl("header"); + const body = this.getChildControl("body"); + const footer = this.getChildControl("footer"); + control.addAt(header, this.self().POS.HEADER); + control.addAt(body, this.self().POS.BODY, { + flex: 1 + }); + control.addAt(footer, this.self().POS.FOOTER); + this._add(control, { + top: 0, + right: 0, + bottom: 0, + left: 0 + }); + break; + } + case "header": + control = new qx.ui.container.Composite(new qx.ui.layout.HBox(5)).set({ + backgroundColor: "background-card-overlay", + anonymous: true, + maxWidth: this.self().ITEM_WIDTH, + maxHeight: this.self().HEADER_MAX_HEIGHT, + padding: this.self().PADDING, + alignY: "middle", + }); + break; + case "body": + control = new qx.ui.container.Composite(new qx.ui.layout.VBox(5)).set({ + decorator: "main", + allowGrowY: true, + allowGrowX: true, + allowShrinkX: true, + padding: this.self().PADDING + }); + control.getContentElement().setStyles({ + "border-width": 0 + }); + break; + case "footer": { + control = new qx.ui.container.Composite(new qx.ui.layout.HBox(5)).set({ + backgroundColor: "background-card-overlay", + anonymous: true, + maxWidth: this.self().ITEM_WIDTH, + maxHeight: this.self().ITEM_HEIGHT, + padding: this.self().PADDING, + alignY: "middle", + }); + break; + } + case "title": + control = new qx.ui.basic.Label().set({ + textColor: "contrasted-text-light", + font: "text-14", + maxWidth: this.self().ITEM_WIDTH - 2*this.self().PADDING, + maxHeight: this.self().HEADER_MAX_HEIGHT + }); + layout = this.getChildControl("header"); + layout.addAt(control, this.self().HPOS.TITLE, { + flex: 1 + }); + break; + } + return control || this.base(arguments, id); + }, + + // overridden + _applyIcon: function(value, old) { + if (value.includes("@FontAwesome5Solid/")) { + value += this.self().ICON_SIZE; + const image = this.getChildControl("icon").getChildControl("image"); + image.set({ + source: value + }); + + [ + "appear", + "loaded" + ].forEach(eventName => { + image.addListener(eventName, () => this.__fitIconHeight(), this); + }); + } else { + this.getContentElement().setStyles({ + "background-image": `url(${value})`, + "background-repeat": "no-repeat", + "background-size": "cover", // auto width, 85% height + "background-position": "center center", + "background-origin": "border-box" + }); + } + }, + __onPointerOver: function() { this.addState("hovered"); }, diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js index c545af0f233..826487c87bc 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js @@ -29,10 +29,6 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonItem", { construct: function(workspace) { this.base(arguments); - this.set({ - appearance: "pb-study" - }); - this.addListener("changeValue", e => this.__itemSelected(e.getData()), this); this.setPriority(osparc.dashboard.CardBase.CARD_PRIORITY.ITEM); @@ -61,12 +57,6 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonItem", { nullable: false }, - parentWorkspaceId: { - check: "Number", - nullable: true, - init: true - }, - title: { check: "String", nullable: true, @@ -98,63 +88,65 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonItem", { } }, + statics: { + MENU_BTN_DIMENSIONS: 24 + }, + members: { _createChildControlImpl: function(id) { let control; + let layout; switch (id) { - case "icon": { - control = new osparc.dashboard.WorkspaceWithSharedIcon().set({ - anonymous: true, - height: 40, - padding: 5 - }); - this._add(control, osparc.dashboard.WorkspaceButtonBase.POS.ICON); - break; - } - case "title": - control = new qx.ui.basic.Label().set({ - anonymous: true, - font: "text-14", - rich: true, - }); - this._add(control, osparc.dashboard.WorkspaceButtonBase.POS.TITLE); - break; - case "last-modified": + case "shared-icon": control = new qx.ui.basic.Label().set({ - anonymous: true, - font: "text-12", + textColor: "contrasted-text-light", + font: "text-14" }); - this._add(control, osparc.dashboard.WorkspaceButtonBase.POS.SUBTITLE); + layout = this.getChildControl("header"); + layout.addAt(control, osparc.dashboard.WorkspaceButtonBase.HPOS.SHARED); break; - case "menu-button": { + case "menu-button": control = new qx.ui.form.MenuButton().set({ appearance: "form-button-outlined", - padding: [0, 8], - maxWidth: osparc.dashboard.ListButtonItem.MENU_BTN_DIMENSIONS, - maxHeight: osparc.dashboard.ListButtonItem.MENU_BTN_DIMENSIONS, + width: this.self().MENU_BTN_DIMENSIONS, + height: this.self().MENU_BTN_DIMENSIONS, + padding: [0, 8, 0, 8], + alignX: "center", + alignY: "middle", icon: "@FontAwesome5Solid/ellipsis-v/14", focusable: false }); // make it circular control.getContentElement().setStyles({ - "border-radius": `${osparc.dashboard.ListButtonItem.MENU_BTN_DIMENSIONS / 2}px` + "border-radius": `${this.self().MENU_BTN_DIMENSIONS / 2}px` }); - this._add(control, osparc.dashboard.WorkspaceButtonBase.POS.MENU); + layout = this.getChildControl("header"); + layout.addAt(control, osparc.dashboard.WorkspaceButtonBase.HPOS.MENU); + break; + case "modified-text": + control = new qx.ui.basic.Label().set({ + textColor: "contrasted-text-dark", + alignY: "middle", + rich: true, + anonymous: true, + font: "text-12", + allowGrowY: false + }); + layout = this.getChildControl("footer"); + layout.addAt(control, osparc.dashboard.WorkspaceButtonBase.FPOS.MODIFIED); break; - } } return control || this.base(arguments, id); }, __applyWorkspace: function(workspace) { - this.getChildControl("icon"); this.set({ cardKey: "workspace-" + workspace.getWorkspaceId() }); workspace.bind("workspaceId", this, "workspaceId"); - workspace.bind("parentId", this, "parentWorkspaceId"); workspace.bind("name", this, "title"); workspace.bind("description", this, "description"); + workspace.bind("thumbnail", this, "icon"); workspace.bind("accessRights", this, "accessRights"); workspace.bind("lastModified", this, "lastModified"); workspace.bind("myAccessRights", this, "myAccessRights"); @@ -170,13 +162,6 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonItem", { this.__updateTooltip(); }, - __applyLastModified: function(value) { - if (value) { - const label = this.getChildControl("last-modified"); - label.setValue(osparc.utils.Utils.formatDateAndTime(value)); - } - }, - __applyMyAccessRights: function(value) { if (value && value["delete"]) { const menuButton = this.getChildControl("menu-button"); @@ -230,6 +215,7 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonItem", { __applyAccessRights: function(value) { if (value && Object.keys(value).length) { + /* const shareIcon = this.getChildControl("icon").getChildControl("shared-icon"); // if it's not shared don't show the share icon shareIcon.addListener("changeSource", e => { @@ -239,9 +225,15 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonItem", { }); }); osparc.dashboard.CardBase.populateShareIcon(shareIcon, value); + */ } }, + __applyLastModified: function(value) { + const label = this.getChildControl("modified-text"); + label.setValue(osparc.utils.Utils.formatDateAndTime(value)); + }, + __updateTooltip: function() { const toolTipText = this.getTitle() + (this.getDescription() ? "
" + this.getDescription() : ""); this.set({ From 3bcd2d31403f438aa5baca831587bcf09ee21a57 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 15:16:44 +0200 Subject: [PATCH 20/59] minor --- .../client/source/class/osparc/dashboard/FolderHeader.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/FolderHeader.js b/services/static-webserver/client/source/class/osparc/dashboard/FolderHeader.js index 9d420937bea..08490cad850 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderHeader.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/FolderHeader.js @@ -114,7 +114,9 @@ qx.Class.define("osparc.dashboard.FolderHeader", { folderButton = new qx.ui.form.Button(folder.getName(), "@FontAwesome5Solid/folder/14"); } else { const workspaceId = this.getCurrentWorkspaceId(); - if (workspaceId) { + if (workspaceId === -1) { + folderButton = new qx.ui.form.Button(this.tr("Shared Workspaces"), osparc.store.Workspaces.iconPath()); + } else if (workspaceId) { folderButton = new qx.ui.form.Button(workspaceId, osparc.store.Workspaces.iconPath()); } else { folderButton = new qx.ui.form.Button(this.tr("My Workspace"), "@FontAwesome5Solid/home/14"); From 5a47cd16d9db3be7c3f6cea4a31f827b8a727613 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 15:18:23 +0200 Subject: [PATCH 21/59] fix --- .../client/source/class/osparc/data/model/Workspace.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/static-webserver/client/source/class/osparc/data/model/Workspace.js b/services/static-webserver/client/source/class/osparc/data/model/Workspace.js index 5578f52a509..ea4c324e9aa 100644 --- a/services/static-webserver/client/source/class/osparc/data/model/Workspace.js +++ b/services/static-webserver/client/source/class/osparc/data/model/Workspace.js @@ -36,7 +36,7 @@ qx.Class.define("osparc.data.model.Workspace", { myAccessRights: workspaceData.myAccessRights, accessRights: workspaceData.accessRights, createdAt: new Date(workspaceData.createdAt), - lastModified: new Date(workspaceData.modifiedAt), + lastModified: new Date(workspaceData.lastModified), }); }, From 2e2d6406031094530f1c30111bdc6d8d2e88d9d6 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 15:19:03 +0200 Subject: [PATCH 22/59] all items on workspace --- .../osparc/dashboard/WorkspaceButtonItem.js | 36 ++++++++----------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js index 826487c87bc..27eb13f18a6 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js @@ -98,9 +98,10 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonItem", { let layout; switch (id) { case "shared-icon": - control = new qx.ui.basic.Label().set({ - textColor: "contrasted-text-light", - font: "text-14" + control = new qx.ui.basic.Image().set({ + alignY: "middle", + allowGrowX: false, + allowShrinkX: false }); layout = this.getChildControl("header"); layout.addAt(control, osparc.dashboard.WorkspaceButtonBase.HPOS.SHARED); @@ -215,17 +216,13 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonItem", { __applyAccessRights: function(value) { if (value && Object.keys(value).length) { - /* - const shareIcon = this.getChildControl("icon").getChildControl("shared-icon"); - // if it's not shared don't show the share icon - shareIcon.addListener("changeSource", e => { - const newSource = e.getData(); - shareIcon.set({ - visibility: newSource.includes(osparc.dashboard.CardBase.SHARE_ICON) ? "hidden" : "visible" - }); - }); + const shareIcon = this.getChildControl("shared-icon"); + shareIcon.addListener("tap", e => { + e.stopPropagation(); + this.__openShareWith(); + }, this); + shareIcon.addListener("pointerdown", e => e.stopPropagation()); osparc.dashboard.CardBase.populateShareIcon(shareIcon, value); - */ } }, @@ -249,15 +246,10 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonItem", { }, __openShareWith: function() { - const disableShare = true; - if (disableShare) { - osparc.FlashMessenger.getInstance().logAs(this.tr("Not yet implemented"), "WARNING"); - } else { - const title = this.tr("Share Workspace"); - const permissionsView = new osparc.share.CollaboratorsWorkspace(this.getWorkspace()); - osparc.ui.window.Window.popUpInWindow(permissionsView, title); - permissionsView.addListener("updateAccessRights", () => this.__applyAccessRights(this.getWorkspace().getAccessRights()), this); - } + const title = this.tr("Share Workspace"); + const permissionsView = new osparc.share.CollaboratorsWorkspace(this.getWorkspace()); + osparc.ui.window.Window.popUpInWindow(permissionsView, title); + permissionsView.addListener("updateAccessRights", () => this.__applyAccessRights(this.getWorkspace().getAccessRights()), this); }, __deleteStudyRequested: function() { From 3e22cc1b6f866eaca0661035dc115388d5d60a1f Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 15:29:21 +0200 Subject: [PATCH 23/59] load workspaces --- .../dashboard/ResourceContainerManager.js | 4 ++- .../class/osparc/dashboard/StudyBrowser.js | 36 ++++++++----------- .../osparc/dashboard/WorkspaceButtonBase.js | 12 +++---- 3 files changed, 24 insertions(+), 28 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js index 3a5162c70e3..86c145d6fe8 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js @@ -108,6 +108,8 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { __foldersLayout: null, __folderHeader: null, __foldersContainer: null, + __workspacesList: null, + __workspacesContainer: null, __nonGroupedContainer: null, __groupedContainersList: null, __groupedContainersLayout: null, @@ -318,7 +320,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { __workspaceToCard: function(workspaceData) { const card = this.__createWorkspaceCard(workspaceData); - this.__foldersContainer.add(card); + this.__workspacesContainer.add(card); return card; }, 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 c1f39e83369..8fa1d53010a 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -102,6 +102,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }, members: { + __workspacesList: null, __foldersList: null, // overridden @@ -167,7 +168,9 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { __reloadWorkspaces: function() { osparc.store.Workspaces.fetchWorkspaces() .then(workspaces => { - this.__setWorkspacesToList(workspaces); + this.__workspacesList = workspaces; + workspaces.forEach(workspace => workspace["resourceType"] = "workspace"); + this.__reloadWorkspaceCards(); }); }, @@ -331,12 +334,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { }); }, - __setWorkspacesToList: function(workspaces) { - this.__foldersList = workspaces; - workspaces.forEach(workspace => workspace["resourceType"] = "workspace"); - this.__reloadWorkspaceCards(); - }, - __setFoldersToList: function(folders) { this.__foldersList = folders; folders.forEach(folder => folder["resourceType"] = "folder"); @@ -409,22 +406,19 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { // WORKSPACES __reloadWorkspaceCards: function() { - this._resourcesContainer.setWorkspacesToList(this.__foldersList); + this._resourcesContainer.setWorkspacesToList(this.__workspacesList); this._resourcesContainer.reloadWorkspaces(); - const currentWorkspace = osparc.store.Workspaces.getFolder(this.getCurrentFolderId()) - if (currentWorkspace == null || currentWorkspace.getMyAccessRights()["write"]) { - const newWorkspaceCard = new osparc.dashboard.WorkspaceButtonNew(); - newWorkspaceCard.setCardKey("new-workspace"); - newWorkspaceCard.subscribeToFilterGroup("searchBarFilter"); - newWorkspaceCard.addListener("createWorkspace", e => { - const data = e.getData(); - osparc.store.Workspaces.postWorkspace(data.name, data.description, currentWorkspace ? currentWorkspace.getFolderId() : null) - .then(() => this.__reloadWorkspaces()) - .catch(err => console.error(err)); - }) - this._resourcesContainer.addNewWorkspaceCard(newWorkspaceCard); - } + const newWorkspaceCard = new osparc.dashboard.WorkspaceButtonNew(); + newWorkspaceCard.setCardKey("new-workspace"); + newWorkspaceCard.subscribeToFilterGroup("searchBarFilter"); + newWorkspaceCard.addListener("createWorkspace", e => { + const data = e.getData(); + osparc.store.Workspaces.postWorkspace(data.name, data.description) + .then(() => this.__reloadWorkspaces()) + .catch(err => console.error(err)); + }); + this._resourcesContainer.addNewWorkspaceCard(newWorkspaceCard); }, // /WORKSPACES diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js index 1074d9343e5..d20d8f3194a 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js @@ -35,8 +35,8 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonBase", { this.getChildControl("main-layout"); - this.addListener("pointerover", this.__onPointerOver, this); - this.addListener("pointerout", this.__onPointerOut, this); + this.addListener("pointerover", this._onPointerOver, this); + this.addListener("pointerout", this._onPointerOut, this); }, properties: { @@ -187,11 +187,11 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonBase", { } }, - __onPointerOver: function() { + _onPointerOver: function() { this.addState("hovered"); }, - __onPointerOut : function() { + _onPointerOut : function() { this.removeState("hovered"); }, @@ -215,7 +215,7 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonBase", { }, destruct: function() { - this.removeListener("pointerover", this.__onPointerOver, this); - this.removeListener("pointerout", this.__onPointerOut, this); + this.removeListener("pointerover", this._onPointerOver, this); + this.removeListener("pointerout", this._onPointerOut, this); } }); From b5bf29ed620da38c50f7d171a4e9b152dc8eeb3b Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 15:37:12 +0200 Subject: [PATCH 24/59] minor --- .../class/osparc/dashboard/ResourceContainerManager.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js index 86c145d6fe8..b8612a9b594 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js @@ -28,6 +28,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { }); this.__foldersList = []; + this.__workspacesList = []; this.__resourcesList = []; const folders = this.__foldersLayout = new qx.ui.container.Composite(new qx.ui.layout.VBox(10)); @@ -38,6 +39,10 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { this._add(folders); folders.setVisibility(osparc.utils.DisabledPlugins.isFoldersEnabled() ? "visible" : "excluded"); + const workspacesContainer = this.__workspacesContainer = new osparc.dashboard.ToggleButtonContainer(); + this._add(workspacesContainer); + workspacesContainer.setVisibility(osparc.utils.DisabledPlugins.isFoldersEnabled() ? "visible" : "excluded"); + const nonGroupedContainer = this.__nonGroupedContainer = new osparc.dashboard.ToggleButtonContainer(); [ "changeSelection", From c919ef59392e1cb42d0312f9d3e412813e6cbede Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 15:39:55 +0200 Subject: [PATCH 25/59] FolderHeader -> ContainerHeader --- .../{FolderHeader.js => ContainerHeader.js} | 2 +- .../osparc/dashboard/ResourceContainerManager.js | 12 +++++++----- .../source/class/osparc/dashboard/StudyBrowser.js | 8 ++++---- 3 files changed, 12 insertions(+), 10 deletions(-) rename services/static-webserver/client/source/class/osparc/dashboard/{FolderHeader.js => ContainerHeader.js} (98%) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/FolderHeader.js b/services/static-webserver/client/source/class/osparc/dashboard/ContainerHeader.js similarity index 98% rename from services/static-webserver/client/source/class/osparc/dashboard/FolderHeader.js rename to services/static-webserver/client/source/class/osparc/dashboard/ContainerHeader.js index 08490cad850..2eed151afbf 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/FolderHeader.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ContainerHeader.js @@ -20,7 +20,7 @@ * */ -qx.Class.define("osparc.dashboard.FolderHeader", { +qx.Class.define("osparc.dashboard.ContainerHeader", { extend: qx.ui.core.Widget, construct: function() { diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js index b8612a9b594..ad1c8ff4a53 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js @@ -31,9 +31,11 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { this.__workspacesList = []; this.__resourcesList = []; + const containerHeader = this.__containerHeader = new osparc.dashboard.ContainerHeader(); + this._add(containerHeader); + containerHeader.setVisibility(osparc.utils.DisabledPlugins.isFoldersEnabled() ? "visible" : "excluded"); + const folders = this.__foldersLayout = new qx.ui.container.Composite(new qx.ui.layout.VBox(10)); - const folderHeader = this.__folderHeader = new osparc.dashboard.FolderHeader(); - folders.add(folderHeader); const foldersContainer = this.__foldersContainer = new osparc.dashboard.ToggleButtonContainer(); folders.add(foldersContainer); this._add(folders); @@ -111,7 +113,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { __foldersList: null, __resourcesList: null, __foldersLayout: null, - __folderHeader: null, + __containerHeader: null, __foldersContainer: null, __workspacesList: null, __workspacesContainer: null, @@ -158,8 +160,8 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { } }, - getFolderHeader: function() { - return this.__folderHeader; + getContainerHeader: function() { + return this.__containerHeader; }, getFlatList: function() { 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 8fa1d53010a..03f321aca66 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -762,10 +762,10 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { _createLayout: function() { this._createResourcesLayout(); - const folderHeader = this._resourcesContainer.getFolderHeader(); - if (folderHeader) { - this.bind("currentFolderId", folderHeader, "currentFolderId"); - folderHeader.addListener("changeCurrentFolderId", e => this.setCurrentFolderId(e.getData())); + const containerHeader = this._resourcesContainer.getContainerHeader(); + if (containerHeader) { + this.bind("currentFolderId", containerHeader, "currentFolderId"); + containerHeader.addListener("changeCurrentFolderId", e => this.setCurrentFolderId(e.getData())); } const list = this._resourcesContainer.getFlatList(); if (list) { From a8a398a8d7e24c61e17f93fba776786325b2ac70 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 15:43:26 +0200 Subject: [PATCH 26/59] header --- .../source/class/osparc/dashboard/ContainerHeader.js | 10 +++------- .../source/class/osparc/dashboard/StudyBrowser.js | 2 ++ .../{WrokspaceButtonNew.js => WorkspaceButtonNew.js} | 0 3 files changed, 5 insertions(+), 7 deletions(-) rename services/static-webserver/client/source/class/osparc/dashboard/{WrokspaceButtonNew.js => WorkspaceButtonNew.js} (100%) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ContainerHeader.js b/services/static-webserver/client/source/class/osparc/dashboard/ContainerHeader.js index 2eed151afbf..5eaa59a0cb7 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ContainerHeader.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ContainerHeader.js @@ -40,8 +40,8 @@ qx.Class.define("osparc.dashboard.ContainerHeader", { check: "Number", nullable: true, init: null, - event: "changeCurrentFolderId", - apply: "__applyCurrentFolderId" + event: "changeCurrentWorkspaceId", + apply: "__buildBreadcrumbs" }, currentFolderId: { @@ -49,7 +49,7 @@ qx.Class.define("osparc.dashboard.ContainerHeader", { nullable: true, init: null, event: "changeCurrentFolderId", - apply: "__applyCurrentFolderId" + apply: "__buildBreadcrumbs" } }, @@ -67,10 +67,6 @@ qx.Class.define("osparc.dashboard.ContainerHeader", { return control || this.base(arguments, id); }, - __applyCurrentFolderId: function() { - this.__buildBreadcrumbs(); - }, - __buildBreadcrumbs: function() { const breadcrumbsLayout = this.getChildControl("breadcrumbs-layout"); breadcrumbsLayout.removeAll(); 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 03f321aca66..3b77e8137bf 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -766,6 +766,8 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { if (containerHeader) { this.bind("currentFolderId", containerHeader, "currentFolderId"); containerHeader.addListener("changeCurrentFolderId", e => this.setCurrentFolderId(e.getData())); + this.bind("currentFolderId", containerHeader, "currentFolderId"); + containerHeader.addListener("changeCurrentFolderId", e => this.setCurrentFolderId(e.getData())); } const list = this._resourcesContainer.getFlatList(); if (list) { diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WrokspaceButtonNew.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js similarity index 100% rename from services/static-webserver/client/source/class/osparc/dashboard/WrokspaceButtonNew.js rename to services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js From 802c11aee6633f882d4878b27e87912c72d33eb3 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 15:52:27 +0200 Subject: [PATCH 27/59] new workspace --- .../dashboard/ResourceContainerManager.js | 2 +- .../osparc/dashboard/WorkspaceButtonBase.js | 27 ++++++++---- .../osparc/dashboard/WorkspaceButtonNew.js | 42 ++++--------------- 3 files changed, 27 insertions(+), 44 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js index ad1c8ff4a53..f97cd044f53 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js @@ -21,7 +21,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { construct: function() { this.base(arguments); - this._setLayout(new qx.ui.layout.VBox(20)); + this._setLayout(new qx.ui.layout.VBox(15)); this.set({ paddingBottom: 60 diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js index d20d8f3194a..c054b7b1910 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js @@ -65,6 +65,7 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonBase", { SPACING_IN: 5, SPACING: 15, HEADER_MAX_HEIGHT: 40, // two lines in Manrope + ICON_SIZE: 50, POS: { HEADER: 0, BODY: 1, @@ -157,25 +158,35 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonBase", { flex: 1 }); break; + case "icon": { + layout = this.getChildControl("body"); + const maxWidth = this.self().ITEM_WIDTH; + control = new osparc.ui.basic.Thumbnail(null, maxWidth, 124); + control.getChildControl("image").set({ + anonymous: true, + alignY: "middle", + alignX: "center", + allowGrowX: true, + allowGrowY: true + }); + layout.getContentElement().setStyles({ + "border-width": "0px" + }); + layout.add(control, {flex: 1}); + break; + } } return control || this.base(arguments, id); }, // overridden - _applyIcon: function(value, old) { + _applyIcon: function(value) { if (value.includes("@FontAwesome5Solid/")) { value += this.self().ICON_SIZE; const image = this.getChildControl("icon").getChildControl("image"); image.set({ source: value }); - - [ - "appear", - "loaded" - ].forEach(eventName => { - image.addListener(eventName, () => this.__fitIconHeight(), this); - }); } else { this.getContentElement().setStyles({ "background-image": `url(${value})`, diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js index 62f47117e82..bfcb6655f9d 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js @@ -30,11 +30,16 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonNew", { appearance: "pb-new" }); - this.addListener("changeValue", e => this.__itemSelected(e.getData()), this); + // this.addListener("changeValue", e => this.__itemSelected(e.getData()), this); this.setPriority(osparc.dashboard.CardBase.CARD_PRIORITY.NEW); - this.__buildLayout(); + const title = this.getChildControl("title"); + title.setValue(this.tr("New Workspace")); + + this.setIcon(osparc.dashboard.CardBase.NEW_ICON); + + this.getChildControl("footer").exclude(); }, events: { @@ -42,39 +47,6 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonNew", { }, members: { - _createChildControlImpl: function(id) { - let control; - switch (id) { - case "icon": { - control = new qx.ui.basic.Image().set({ - source: osparc.dashboard.CardBase.NEW_ICON + "26", - anonymous: true, - height: 40, - padding: 5 - }); - this._add(control, osparc.dashboard.WorkspaceButtonBase.POS.ICON); - break; - } - case "title": - control = new qx.ui.basic.Label(this.tr("New workspace")).set({ - anonymous: true, - font: "text-14", - rich: true, - }); - this._add(control, { - ...osparc.dashboard.WorkspaceButtonBase.POS.TITLE, - ...{rowSpan: 2} - }); - break; - } - return control || this.base(arguments, id); - }, - - __buildLayout: function() { - this.getChildControl("icon"); - this.getChildControl("title"); - }, - __itemSelected: function(newVal) { if (newVal) { const newWorkspace = true; From e82a6bc9f0a4d6ab0110d5e7a5fb794a2391c18f Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 15:59:52 +0200 Subject: [PATCH 28/59] appearance --- .../osparc/dashboard/WorkspaceButtonBase.js | 27 +++++++++++++++---- .../osparc/dashboard/WorkspaceButtonItem.js | 4 +++ 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js index c054b7b1910..cad561fec9e 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js @@ -27,16 +27,22 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonBase", { this.set({ width: this.self().ITEM_WIDTH, height: this.self().ITEM_HEIGHT, - padding: 5, - alignY: "middle" + padding: 0 }); this._setLayout(new qx.ui.layout.Canvas()); this.getChildControl("main-layout"); - this.addListener("pointerover", this._onPointerOver, this); - this.addListener("pointerout", this._onPointerOut, this); + [ + "pointerover", + "focus" + ].forEach(e => this.addListener(e, this._onPointerOver, this)); + + [ + "pointerout", + "focusout" + ].forEach(e => this.addListener(e, this._onPointerOut, this)); }, properties: { @@ -81,6 +87,11 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonBase", { } }, + events: { + /** (Fired by {@link qx.ui.form.List}) */ + "action": "qx.event.type.Event" + }, + members: { // eslint-disable-line qx-rules/no-refs-in-members // overridden _forwardStates: { @@ -150,7 +161,7 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonBase", { control = new qx.ui.basic.Label().set({ textColor: "contrasted-text-light", font: "text-14", - maxWidth: this.self().ITEM_WIDTH - 2*this.self().PADDING, + allowGrowX: true, maxHeight: this.self().HEADER_MAX_HEIGHT }); layout = this.getChildControl("header"); @@ -198,10 +209,16 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonBase", { } }, + /** + * Event handler for the pointer over event. + */ _onPointerOver: function() { this.addState("hovered"); }, + /** + * Event handler for the pointer out event. + */ _onPointerOut : function() { this.removeState("hovered"); }, diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js index 27eb13f18a6..04261be019b 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js @@ -29,6 +29,10 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonItem", { construct: function(workspace) { this.base(arguments); + this.set({ + appearance: "pb-listitem" + }); + this.addListener("changeValue", e => this.__itemSelected(e.getData()), this); this.setPriority(osparc.dashboard.CardBase.CARD_PRIORITY.ITEM); From a0776583fb2f44fe613cda866ed6d594952d6a3a Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 16:01:04 +0200 Subject: [PATCH 29/59] styling --- .../client/source/class/osparc/dashboard/WorkspaceButtonItem.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js index 04261be019b..1ac796b98b4 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js @@ -113,6 +113,8 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonItem", { case "menu-button": control = new qx.ui.form.MenuButton().set({ appearance: "form-button-outlined", + minWidth: this.self().MENU_BTN_DIMENSIONS, + minHeight: this.self().MENU_BTN_DIMENSIONS, width: this.self().MENU_BTN_DIMENSIONS, height: this.self().MENU_BTN_DIMENSIONS, padding: [0, 8, 0, 8], From afa86c460cb1c017eff756edd4eb6615dbd0a654 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 16:13:26 +0200 Subject: [PATCH 30/59] simplify --- .../dashboard/ResourceContainerManager.js | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js index f97cd044f53..1a51c4a7839 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js @@ -30,21 +30,22 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { this.__foldersList = []; this.__workspacesList = []; this.__resourcesList = []; + this.__groupedContainersList = []; const containerHeader = this.__containerHeader = new osparc.dashboard.ContainerHeader(); this._add(containerHeader); containerHeader.setVisibility(osparc.utils.DisabledPlugins.isFoldersEnabled() ? "visible" : "excluded"); - const folders = this.__foldersLayout = new qx.ui.container.Composite(new qx.ui.layout.VBox(10)); - const foldersContainer = this.__foldersContainer = new osparc.dashboard.ToggleButtonContainer(); - folders.add(foldersContainer); - this._add(folders); - folders.setVisibility(osparc.utils.DisabledPlugins.isFoldersEnabled() ? "visible" : "excluded"); const workspacesContainer = this.__workspacesContainer = new osparc.dashboard.ToggleButtonContainer(); this._add(workspacesContainer); workspacesContainer.setVisibility(osparc.utils.DisabledPlugins.isFoldersEnabled() ? "visible" : "excluded"); + + const foldersContainer = this.__foldersContainer = new osparc.dashboard.ToggleButtonContainer(); + this._add(foldersContainer); + foldersContainer.setVisibility(osparc.utils.DisabledPlugins.isFoldersEnabled() ? "visible" : "excluded"); + const nonGroupedContainer = this.__nonGroupedContainer = new osparc.dashboard.ToggleButtonContainer(); [ "changeSelection", @@ -54,9 +55,8 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { }); this._add(nonGroupedContainer); - const groupedContainersLayout = this.__groupedContainersLayout = new qx.ui.container.Composite(new qx.ui.layout.VBox(10)); - this._add(groupedContainersLayout); - this.__groupedContainersList = []; + const groupedContainers = this.__groupedContainers = new qx.ui.container.Composite(new qx.ui.layout.VBox(10)); + this._add(groupedContainers); }, properties: { @@ -111,15 +111,15 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { members: { __foldersList: null, + __workspacesList: null, __resourcesList: null, + __groupedContainersList: null, __foldersLayout: null, __containerHeader: null, __foldersContainer: null, - __workspacesList: null, __workspacesContainer: null, __nonGroupedContainer: null, - __groupedContainersList: null, - __groupedContainersLayout: null, + __groupedContainers: null, addNonResourceCard: function(card) { if (card instanceof qx.ui.form.ToggleButton) { @@ -256,8 +256,8 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { this.__nonGroupedContainer.removeAll(); this.__nonGroupedContainer = null; } - if (this.__groupedContainersLayout) { - this.__groupedContainersLayout.removeAll(); + if (this.__groupedContainers) { + this.__groupedContainers.removeAll(); } this.__groupedContainersList.forEach(groupedContainer => groupedContainer.getContentContainer().removeAll()); this.__groupedContainersList = []; @@ -266,11 +266,12 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { reloadCards: function(listId) { this.__cleanAll(); - this._add(this.__foldersLayout); + this._add(this.__containerHeader); + this._add(this.__foldersContainer); if (this.getGroupBy()) { const noGroupContainer = this.__createGroupContainer("no-group", "No Group", "transparent"); - this.__groupedContainersLayout.add(noGroupContainer); - this._add(this.__groupedContainersLayout); + this.__groupedContainers.add(noGroupContainer); + this._add(this.__groupedContainers); } else { const flatList = this.__nonGroupedContainer = new osparc.dashboard.ToggleButtonContainer(); osparc.utils.Utils.setIdToWidget(flatList, listId); @@ -380,9 +381,9 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { // /FOLDERS __moveNoGroupToLast: function() { - const idx = this.__groupedContainersLayout.getChildren().findIndex(grpContainer => grpContainer === this.__getGroupContainer("no-group")); + const idx = this.__groupedContainers.getChildren().findIndex(grpContainer => grpContainer === this.__getGroupContainer("no-group")); if (idx > -1) { - this.__groupedContainersLayout.getChildren().push(this.__groupedContainersLayout.getChildren().splice(idx, 1)[0]); + this.__groupedContainers.getChildren().push(this.__groupedContainers.getChildren().splice(idx, 1)[0]); } }, @@ -400,8 +401,8 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { if (groupContainer === null) { groupContainer = this.__createGroupContainer(tag.id, tag.name, tag.color); groupContainer.setHeaderIcon("@FontAwesome5Solid/tag/24"); - this.__groupedContainersLayout.add(groupContainer); - this.__groupedContainersLayout.getChildren().sort((a, b) => a.getHeaderLabel().localeCompare(b.getHeaderLabel())); + this.__groupedContainers.add(groupContainer); + this.__groupedContainers.getChildren().sort((a, b) => a.getHeaderLabel().localeCompare(b.getHeaderLabel())); this.__moveNoGroupToLast(); } const card = this.__createCard(resourceData); From 245ae0315526141ba73bde0f22a69d584946da6d Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 16:23:11 +0200 Subject: [PATCH 31/59] list shared workspaces --- .../osparc/dashboard/ResourceContainerManager.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js index 1a51c4a7839..396f453cb42 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js @@ -252,6 +252,9 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { }, __cleanAll: function() { + if (this.__workspacesContainer) { + this.__workspacesContainer.removeAll(); + } if (this.__nonGroupedContainer) { this.__nonGroupedContainer.removeAll(); this.__nonGroupedContainer = null; @@ -259,7 +262,9 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { if (this.__groupedContainers) { this.__groupedContainers.removeAll(); } - this.__groupedContainersList.forEach(groupedContainer => groupedContainer.getContentContainer().removeAll()); + this.__groupedContainersList.forEach(groupedContainer => { + groupedContainer.getContentContainer().removeAll(); + }); this.__groupedContainersList = []; this._removeAll(); }, @@ -314,9 +319,8 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { }, reloadWorkspaces: function() { - if (this.__workspacesContainer) { - this.__workspacesContainer.removeAll(); - } + this.__cleanAll(); + this._add(this.__workspacesContainer); let workspacesCards = []; this.__workspacesList.forEach(workspaceData => workspacesCards.push(this.__workspaceToCard(workspaceData))); return workspacesCards; From 249c39928629079e479b4c65310315013618b1d2 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 16:26:35 +0200 Subject: [PATCH 32/59] Do not exclude left filters --- .../class/osparc/dashboard/ResourceBrowserBase.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js index 0511042d84d..bd2ebb3eb01 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js @@ -42,10 +42,10 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { const mainLayoutWithSideSpacers = new qx.ui.container.Composite(new qx.ui.layout.HBox(spacing)) this._addToMainLayout(mainLayoutWithSideSpacers); - this.__leftLayout = new qx.ui.container.Composite(new qx.ui.layout.VBox(10)).set({ + this.__leftFilters = new qx.ui.container.Composite(new qx.ui.layout.VBox(10)).set({ width: leftColumnWidth }); - mainLayoutWithSideSpacers.add(this.__leftLayout); + mainLayoutWithSideSpacers.add(this.__leftFilters); this.__centerLayout = new qx.ui.container.Composite(new qx.ui.layout.VBox(10)); mainLayoutWithSideSpacers.add(this.__centerLayout); @@ -68,7 +68,6 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { } const compactVersion = w < this.__centerLayout.getMinWidth() + leftColumnWidth + emptyColumnMinWidth; - this.__leftLayout.setVisibility(compactVersion ? "excluded" : "visible"); rightColum.setVisibility(compactVersion ? "excluded" : "visible"); }; fitResourceCards(); @@ -83,7 +82,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { statics: { PAGINATED_STUDIES: 10, - MIN_GRID_CARDS_PER_ROW: 4, + MIN_GRID_CARDS_PER_ROW: 3, SIDE_SPACER_WIDTH: 180, checkLoggedIn: function() { @@ -186,7 +185,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { }, members: { - __leftLayout: null, + __leftFilters: null, __centerLayout: null, _resourceType: null, _resourcesList: null, @@ -380,7 +379,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { resourceFilter.filterChanged(filterData); }); - this.__leftLayout.add(resourceFilter); + this.__leftFilters.add(resourceFilter); }, /** From fa1567e578cac3193bc5c2547d006795f82ccefc Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 16:36:46 +0200 Subject: [PATCH 33/59] minor --- .../source/class/osparc/dashboard/ResourceContainerManager.js | 1 + 1 file changed, 1 insertion(+) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js index 396f453cb42..a0b02c75937 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js @@ -320,6 +320,7 @@ 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))); From f4e59a038e726f27541d09196f8a02db8ee856bb Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 16:37:24 +0200 Subject: [PATCH 34/59] minor --- .../client/source/class/osparc/dashboard/ContainerHeader.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ContainerHeader.js b/services/static-webserver/client/source/class/osparc/dashboard/ContainerHeader.js index 5eaa59a0cb7..4e3c5abb5c9 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ContainerHeader.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ContainerHeader.js @@ -32,6 +32,8 @@ qx.Class.define("osparc.dashboard.ContainerHeader", { }, events: { + // OM: Is this needed? + "changeCurrentWorkspaceId": "qx.event.type.Data", "changeCurrentFolderId": "qx.event.type.Data" }, From fcb8a7533ecee707c814c126bf93dc8398d1920b Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Mon, 2 Sep 2024 16:41:22 +0200 Subject: [PATCH 35/59] minor --- .../source/class/osparc/dashboard/ResourceBrowserBase.js | 1 + .../client/source/class/osparc/dashboard/ResourceFilter.js | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js index bd2ebb3eb01..df57008c28a 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js @@ -355,6 +355,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { }); resourceFilter.addListener("changeSharedWith", e => { + this.setCurrentWorkspaceId(null); const sharedWith = e.getData(); this._searchBarFilter.setSharedWithActiveFilter(sharedWith.id, sharedWith.label); }, this); 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 aa4aa6266bf..0c3432a5d32 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.js @@ -121,19 +121,21 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { __addWorkspaceButtons: function(layout, radioGroup) { layout.add(new qx.ui.core.Spacer()); const workspacesButton = new qx.ui.toolbar.RadioButton(this.tr("Shared Workspaces"), osparc.store.Workspaces.iconPath(22)); + workspacesButton.workspaceId = -1; workspacesButton.set({ appearance: "filter-toggle-button" }); layout.add(workspacesButton); radioGroup.add(workspacesButton); workspacesButton.addListener("execute", () => { - this.fireDataEvent("changeWorkspace", -1); + this.fireDataEvent("changeWorkspace", workspacesButton.workspaceId); }); osparc.store.Workspaces.fetchWorkspaces() .then(workspaces => { workspaces.forEach(workspace => { const workspaceButton = new qx.ui.toolbar.RadioButton(workspace.getName(), osparc.store.Workspaces.iconPath(22)); + workspaceButton.workspaceId = workspace.getWorkspaceId(); workspaceButton.set({ appearance: "filter-toggle-button", marginLeft: 15, @@ -141,7 +143,7 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { layout.add(workspaceButton); radioGroup.add(workspaceButton); workspaceButton.addListener("execute", () => { - this.fireDataEvent("changeWorkspace", workspace.getWorkspaceId()); + this.fireDataEvent("changeWorkspace", workspaceButton.workspaceId); }, this); }); }) From b9415b81ab38b17d60b4968b7b8984961a43940b Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 3 Sep 2024 08:41:56 +0200 Subject: [PATCH 36/59] minor --- .../client/source/class/osparc/service/Utils.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/service/Utils.js b/services/static-webserver/client/source/class/osparc/service/Utils.js index c1436ea4f29..b47f3a5b5fa 100644 --- a/services/static-webserver/client/source/class/osparc/service/Utils.js +++ b/services/static-webserver/client/source/class/osparc/service/Utils.js @@ -65,8 +65,6 @@ qx.Class.define("osparc.service.Utils", { } }, - servicesCached: {}, - getTypes: function() { return Object.keys(this.TYPES); }, @@ -262,7 +260,8 @@ qx.Class.define("osparc.service.Utils", { getParametersMetadata: function() { const parametersMetadata = []; - for (const key in this.servicesCached) { + const services = osparc.store.Services.servicesCached; + for (const key in services) { if (key.includes("simcore/services/frontend/parameter/")) { const latest = this.self().getLatest(key); if (latest) { From 5dec9771c508c356d203195cb67ab1511b590da4 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 3 Sep 2024 08:47:55 +0200 Subject: [PATCH 37/59] resetSharedWithActiveFilter --- .../source/class/osparc/dashboard/ResourceBrowserBase.js | 7 ++++++- .../source/class/osparc/dashboard/SearchBarFilter.js | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js index df57008c28a..9eb77b09cee 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js @@ -355,7 +355,9 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { }); resourceFilter.addListener("changeSharedWith", e => { - this.setCurrentWorkspaceId(null); + if (this._resourceType === "study") { + this.setCurrentWorkspaceId(null); + } const sharedWith = e.getData(); this._searchBarFilter.setSharedWithActiveFilter(sharedWith.id, sharedWith.label); }, this); @@ -363,6 +365,9 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { resourceFilter.addListener("changeWorkspace", e => { const workspaceId = e.getData(); this.setCurrentWorkspaceId(workspaceId); + if (this._resourceType === "study") { + this._searchBarFilter.resetSharedWithActiveFilter(); + } }, this); resourceFilter.addListener("changeSelectedTags", e => { diff --git a/services/static-webserver/client/source/class/osparc/dashboard/SearchBarFilter.js b/services/static-webserver/client/source/class/osparc/dashboard/SearchBarFilter.js index 4be366fc05d..99ba301e236 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/SearchBarFilter.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/SearchBarFilter.js @@ -287,6 +287,11 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", { }); }, + resetSharedWithActiveFilter: function() { + this.__removeChips("shared-with"); + this.__filter(); + }, + setSharedWithActiveFilter: function(optionId, optionLabel) { this.__removeChips("shared-with"); if (optionId === "show-all") { From cf3b821523888d41b22b0c7d419122d7b8f32a9b Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 3 Sep 2024 09:18:52 +0200 Subject: [PATCH 38/59] header binding --- .../class/osparc/dashboard/ContainerHeader.js | 39 ++++++++++++------- .../class/osparc/dashboard/StudyBrowser.js | 6 +-- .../source/class/osparc/store/Workspaces.js | 21 +++++----- 3 files changed, 38 insertions(+), 28 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ContainerHeader.js b/services/static-webserver/client/source/class/osparc/dashboard/ContainerHeader.js index 4e3c5abb5c9..5322e8e8d67 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ContainerHeader.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ContainerHeader.js @@ -31,12 +31,6 @@ qx.Class.define("osparc.dashboard.ContainerHeader", { })); }, - events: { - // OM: Is this needed? - "changeCurrentWorkspaceId": "qx.event.type.Data", - "changeCurrentFolderId": "qx.event.type.Data" - }, - properties: { currentWorkspaceId: { check: "Number", @@ -106,21 +100,38 @@ qx.Class.define("osparc.dashboard.ContainerHeader", { return this.__createFolderButton(currentFolder); }, + __createRootButton: function(workspaceId) { + 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.getWorkspace(workspaceId); + rootButton = new qx.ui.form.Button(workspace.getName(), osparc.store.Workspaces.iconPath()); + } + rootButton.addListener("execute", () => this.set({ + currentWorkspaceId: workspaceId, + currentFolderId: null, + })); + } else { + rootButton = new qx.ui.form.Button(this.tr("My Workspace"), "@FontAwesome5Solid/home/14"); + rootButton.addListener("execute", () => this.set({ + currentWorkspaceId: null, + currentFolderId: null, + })); + } + return rootButton; + }, + __createFolderButton: function(folder) { let folderButton = null; if (folder) { folderButton = new qx.ui.form.Button(folder.getName(), "@FontAwesome5Solid/folder/14"); + folderButton.addListener("execute", () => this.fireDataEvent("changeCurrentFolderId", folder ? folder.getFolderId() : null), this); } else { const workspaceId = this.getCurrentWorkspaceId(); - if (workspaceId === -1) { - folderButton = new qx.ui.form.Button(this.tr("Shared Workspaces"), osparc.store.Workspaces.iconPath()); - } else if (workspaceId) { - folderButton = new qx.ui.form.Button(workspaceId, osparc.store.Workspaces.iconPath()); - } else { - folderButton = new qx.ui.form.Button(this.tr("My Workspace"), "@FontAwesome5Solid/home/14"); - } + folderButton = this.__createRootButton(workspaceId); } - folderButton.addListener("execute", () => this.fireDataEvent("changeCurrentFolderId", folder ? folder.getFolderId() : null), this); folderButton.set({ backgroundColor: "transparent", textColor: "text", 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 3b77e8137bf..c3e7c852099 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -764,10 +764,10 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { const containerHeader = this._resourcesContainer.getContainerHeader(); if (containerHeader) { + this.bind("currentWorkspaceId", containerHeader, "currentWorkspaceId"); + containerHeader.bind("currentWorkspaceId", this, "currentWorkspaceId"); this.bind("currentFolderId", containerHeader, "currentFolderId"); - containerHeader.addListener("changeCurrentFolderId", e => this.setCurrentFolderId(e.getData())); - this.bind("currentFolderId", containerHeader, "currentFolderId"); - containerHeader.addListener("changeCurrentFolderId", e => this.setCurrentFolderId(e.getData())); + containerHeader.bind("currentFolderId", this, "currentFolderId"); } const list = this._resourcesContainer.getFlatList(); if (list) { diff --git a/services/static-webserver/client/source/class/osparc/store/Workspaces.js b/services/static-webserver/client/source/class/osparc/store/Workspaces.js index e22c630e746..2e8e2ae9902 100644 --- a/services/static-webserver/client/source/class/osparc/store/Workspaces.js +++ b/services/static-webserver/client/source/class/osparc/store/Workspaces.js @@ -21,7 +21,7 @@ qx.Class.define("osparc.store.Workspaces", { statics: { workspacesCached: [], - iconPath: function(iconsSize = 14) { + iconPath: function(iconsSize = 18) { return "@MaterialIcons/folder_shared/"+iconsSize }, @@ -114,7 +114,7 @@ qx.Class.define("osparc.store.Workspaces", { lastModified: "2024-06-21 13:00:40.33769", }], - fetchWorkspaces: function(workspaceId = null) { + fetchWorkspaces: function() { if (osparc.auth.Data.getInstance().isGuest()) { return new Promise(resolve => { resolve([]); @@ -122,11 +122,6 @@ qx.Class.define("osparc.store.Workspaces", { } /* - const params = { - "url": { - workspaceId - } - }; return osparc.data.Resources.getInstance().getAllPages("workspaces", params) .then(workspacesData => { const workspaces = []; @@ -150,12 +145,16 @@ qx.Class.define("osparc.store.Workspaces", { }); }, - postWorkspace: function(name, description, parentId = null) { - const newWorkspaceData = { - parentWorkspaceId: parentId, - name: name, + createNewWorkspaceData: function(name, description, thumbnail, accessRights) { + return { + name, description: description || "", + thumbnail: thumbnail || "", + accessRights: accessRights || {}, }; + }, + + postWorkspace: function(newWorkspaceData) { const params = { data: newWorkspaceData }; From 35f29800d29d01c9c9a5dd4036610b24b8d5fab0 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 3 Sep 2024 10:03:23 +0200 Subject: [PATCH 39/59] don't add empty container --- .../class/osparc/dashboard/ResourceContainerManager.js | 10 ++++++---- .../source/class/osparc/dashboard/ServiceBrowser.js | 2 +- .../source/class/osparc/dashboard/StudyBrowser.js | 2 +- .../source/class/osparc/dashboard/TemplateBrowser.js | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js index a0b02c75937..9d146b71566 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js @@ -269,17 +269,19 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { this._removeAll(); }, - reloadCards: function(listId) { + reloadCards: function(resourceType) { this.__cleanAll(); - this._add(this.__containerHeader); - this._add(this.__foldersContainer); + if (resourceType === "studies") { + this._add(this.__containerHeader); + this._add(this.__foldersContainer); + } if (this.getGroupBy()) { const noGroupContainer = this.__createGroupContainer("no-group", "No Group", "transparent"); this.__groupedContainers.add(noGroupContainer); this._add(this.__groupedContainers); } else { const flatList = this.__nonGroupedContainer = new osparc.dashboard.ToggleButtonContainer(); - osparc.utils.Utils.setIdToWidget(flatList, listId); + osparc.utils.Utils.setIdToWidget(flatList, resourceType + "List"); [ "changeSelection", "changeVisibility" diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ServiceBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/ServiceBrowser.js index ebfdc693bb6..81583c9b24f 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ServiceBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ServiceBrowser.js @@ -100,7 +100,7 @@ qx.Class.define("osparc.dashboard.ServiceBrowser", { _reloadCards: function() { this._resourcesContainer.setResourcesToList(this._resourcesList); - const cards = this._resourcesContainer.reloadCards("servicesList"); + const cards = this._resourcesContainer.reloadCards("services"); cards.forEach(card => { card.setMultiSelectionMode(this.getMultiSelection()); card.addListener("execute", () => this.__itemClicked(card), this); 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 c3e7c852099..1ec85964671 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -363,7 +363,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { const visibility = this._loadingResourcesBtn ? this._loadingResourcesBtn.getVisibility() : "excluded"; this._resourcesContainer.setResourcesToList(this._resourcesList); - const cards = this._resourcesContainer.reloadCards("studiesList"); + const cards = this._resourcesContainer.reloadCards("studies"); this.__configureCards(cards); this.__addNewStudyButtons(); diff --git a/services/static-webserver/client/source/class/osparc/dashboard/TemplateBrowser.js b/services/static-webserver/client/source/class/osparc/dashboard/TemplateBrowser.js index d9ba8b01296..6a5e516ce9e 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/TemplateBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/TemplateBrowser.js @@ -111,7 +111,7 @@ qx.Class.define("osparc.dashboard.TemplateBrowser", { _reloadCards: function() { this._resourcesContainer.setResourcesToList(this._resourcesList); - const cards = this._resourcesContainer.reloadCards("templatesList"); + const cards = this._resourcesContainer.reloadCards("templates"); cards.forEach(card => { card.setMultiSelectionMode(this.getMultiSelection()); card.addListener("tap", () => this.__itemClicked(card), this); From fad5323a734480789eaa167cd6c0cf10cbeff63a Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 3 Sep 2024 10:03:32 +0200 Subject: [PATCH 40/59] minor --- .../source/class/osparc/store/Workspaces.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/store/Workspaces.js b/services/static-webserver/client/source/class/osparc/store/Workspaces.js index 2e8e2ae9902..e6390fac803 100644 --- a/services/static-webserver/client/source/class/osparc/store/Workspaces.js +++ b/services/static-webserver/client/source/class/osparc/store/Workspaces.js @@ -145,12 +145,21 @@ qx.Class.define("osparc.store.Workspaces", { }); }, - createNewWorkspaceData: function(name, description, thumbnail, accessRights) { + createNewWorkspaceData: function(name, description = "", thumbnail = "") { + const myGroupId = osparc.auth.Data.getInstance().getGroupId(); + const accessRights = {}; + const deleteAccess = { + read: true, + write: false, + delete: false, + }; + accessRights[myGroupId] = deleteAccess; return { name, - description: description || "", - thumbnail: thumbnail || "", - accessRights: accessRights || {}, + description, + thumbnail, + myAccessRights: deleteAccess, + accessRights, }; }, From 8995a784f7a9ba34360e11ab84044480da6337ac Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 3 Sep 2024 10:03:41 +0200 Subject: [PATCH 41/59] WorkspaceEditor --- .../osparc/dashboard/WorkspaceButtonNew.js | 2 +- .../class/osparc/editor/WorkspaceEditor.js | 185 ++++++++++++++++++ 2 files changed, 186 insertions(+), 1 deletion(-) create mode 100644 services/static-webserver/client/source/class/osparc/editor/WorkspaceEditor.js diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js index bfcb6655f9d..9b481fde008 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js @@ -30,7 +30,7 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonNew", { appearance: "pb-new" }); - // this.addListener("changeValue", e => this.__itemSelected(e.getData()), this); + this.addListener("changeValue", e => this.__itemSelected(e.getData()), this); this.setPriority(osparc.dashboard.CardBase.CARD_PRIORITY.NEW); diff --git a/services/static-webserver/client/source/class/osparc/editor/WorkspaceEditor.js b/services/static-webserver/client/source/class/osparc/editor/WorkspaceEditor.js new file mode 100644 index 00000000000..dc7fe35adbf --- /dev/null +++ b/services/static-webserver/client/source/class/osparc/editor/WorkspaceEditor.js @@ -0,0 +1,185 @@ +/* ************************************************************************ + + osparc - the simcore frontend + + https://osparc.io + + Copyright: + 2024 IT'IS Foundation, https://itis.swiss + + License: + MIT: https://opensource.org/licenses/MIT + + Authors: + * Odei Maiz (odeimaiz) + +************************************************************************ */ + +qx.Class.define("osparc.editor.WorkspaceEditor", { + extend: qx.ui.core.Widget, + + construct: function(newWorkspace = true) { + this.base(arguments); + + this.__newWorkspace = newWorkspace; + + this._setLayout(new qx.ui.layout.VBox(8)); + + const manager = this.__validator = new qx.ui.form.validation.Manager(); + const title = this.getChildControl("title"); + title.setRequired(true); + manager.add(title); + this.getChildControl("description"); + this.getChildControl("thumbnail"); + this.getChildControl("share-with"); + newWorkspace ? this.getChildControl("create") : this.getChildControl("save"); + + this.addListener("appear", this.__onAppear, this); + }, + + properties: { + label: { + check: "String", + init: "", + nullable: false, + event: "changeLabel" + }, + + description: { + check: "String", + init: "", + nullable: false, + event: "changeDescription" + }, + + thumbnail: { + check: "String", + init: "", + nullable: false, + event: "changeThumbnail" + }, + + accessRights: { + check: "Object", + init: {}, + nullable: false, + event: "changeAccessRights", + apply: "applyAccessRights" + } + }, + + events: { + "createWorkspace": "qx.event.type.Event", + "updateWorkspace": "qx.event.type.Event", + "cancel": "qx.event.type.Event" + }, + + members: { + _createChildControlImpl: function(id) { + let control; + switch (id) { + case "title": { + control = new qx.ui.form.TextField().set({ + font: "text-14", + backgroundColor: "background-main", + placeholder: this.tr("Title"), + }); + this.bind("label", control, "value"); + control.bind("value", this, "label"); + this._add(control); + break; + } + case "description": { + control = new qx.ui.form.TextArea().set({ + font: "text-14", + placeholder: this.tr("Description"), + autoSize: true, + minHeight: 70, + }); + this.bind("description", control, "value"); + control.bind("value", this, "description"); + this._add(control); + break; + } + case "thumbnail": { + control = new qx.ui.form.TextField().set({ + font: "text-14", + placeholder: this.tr("Thumbnail"), + }); + this.bind("thumbnail", control, "value"); + control.bind("value", this, "thumbnail"); + this._add(control); + break; + } + case "share-with": { + control = this.__createAddCollaboratorSection(); + this._add(control); + break; + } + case "create": { + const buttons = this.getChildControl("buttonsLayout"); + control = new osparc.ui.form.FetchButton(this.tr("Create")).set({ + appearance: "form-button" + }); + control.addListener("execute", () => { + if (this.__validator.validate()) { + control.setFetching(true); + this.fireEvent("createWorkspace"); + } + }, this); + buttons.addAt(control, 1); + break; + } + case "save": { + const buttons = this.getChildControl("buttonsLayout"); + control = new osparc.ui.form.FetchButton(this.tr("Save")).set({ + appearance: "form-button" + }); + control.addListener("execute", () => { + if (this.__validator.validate()) { + control.setFetching(true); + this.fireEvent("updateWorkspace"); + } + }, this); + buttons.addAt(control, 1); + break; + } + case "buttonsLayout": { + control = new qx.ui.container.Composite(new qx.ui.layout.HBox(8).set({ + alignX: "right" + })); + const cancelButton = new qx.ui.form.Button(this.tr("Cancel")).set({ + appearance: "form-button-text" + }); + cancelButton.addListener("execute", () => this.fireEvent("cancel"), this); + control.addAt(cancelButton, 0); + this._add(control); + break; + } + } + + return control || this.base(arguments, id); + }, + + __createAddCollaboratorSection: function() { + let serializedDataCopy = null; + if (this.__newWorkspace) { + serializedDataCopy = osparc.store.Workspaces.createNewWorkspaceData() + } else { + serializedDataCopy = osparc.utils.Utils.deepCloneObject(this._serializedDataCopy); + } + serializedDataCopy["resourceType"] = "workspace"; + const addCollaborators = new osparc.share.CollaboratorsWorkspace(serializedDataCopy); + addCollaborators.addListener("updateAccessRights", e => { + console.log("updateAccessRights", e.getData()) + }, this); + return addCollaborators; + }, + + __onAppear: function() { + const title = this.getChildControl("title"); + title.focus(); + title.activate(); + } + } +}); From 3563cba10b53c019989d8ea6796f73b5dafa62b2 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 3 Sep 2024 10:15:46 +0200 Subject: [PATCH 42/59] default icon --- .../source/class/osparc/dashboard/WorkspaceButtonBase.js | 7 +++++-- .../source/class/osparc/dashboard/WorkspaceButtonItem.js | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js index cad561fec9e..fbcf92b3bf7 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonBase.js @@ -71,7 +71,7 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonBase", { SPACING_IN: 5, SPACING: 15, HEADER_MAX_HEIGHT: 40, // two lines in Manrope - ICON_SIZE: 50, + ICON_SIZE: 60, POS: { HEADER: 0, BODY: 1, @@ -192,7 +192,10 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonBase", { // overridden _applyIcon: function(value) { - if (value.includes("@FontAwesome5Solid/")) { + if ( + value.includes("@FontAwesome5Solid/") || + value.includes("@MaterialIcons/") + ) { value += this.self().ICON_SIZE; const image = this.getChildControl("icon").getChildControl("image"); image.set({ diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js index 1ac796b98b4..98212d9b1ad 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js @@ -153,7 +153,9 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonItem", { workspace.bind("workspaceId", this, "workspaceId"); workspace.bind("name", this, "title"); workspace.bind("description", this, "description"); - workspace.bind("thumbnail", this, "icon"); + workspace.bind("thumbnail", this, "icon", { + converter: thumbnail => thumbnail ? thumbnail : osparc.store.Workspaces.iconPath(-1) + }); workspace.bind("accessRights", this, "accessRights"); workspace.bind("lastModified", this, "lastModified"); workspace.bind("myAccessRights", this, "myAccessRights"); From 6eba402eceefb7303e2b761ca404b96a154ebde7 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 3 Sep 2024 10:16:12 +0200 Subject: [PATCH 43/59] in two steps --- .../class/osparc/editor/WorkspaceEditor.js | 23 ------------------- .../source/class/osparc/store/Workspaces.js | 8 +++++-- 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/editor/WorkspaceEditor.js b/services/static-webserver/client/source/class/osparc/editor/WorkspaceEditor.js index dc7fe35adbf..3a654307006 100644 --- a/services/static-webserver/client/source/class/osparc/editor/WorkspaceEditor.js +++ b/services/static-webserver/client/source/class/osparc/editor/WorkspaceEditor.js @@ -21,8 +21,6 @@ qx.Class.define("osparc.editor.WorkspaceEditor", { construct: function(newWorkspace = true) { this.base(arguments); - this.__newWorkspace = newWorkspace; - this._setLayout(new qx.ui.layout.VBox(8)); const manager = this.__validator = new qx.ui.form.validation.Manager(); @@ -31,7 +29,6 @@ qx.Class.define("osparc.editor.WorkspaceEditor", { manager.add(title); this.getChildControl("description"); this.getChildControl("thumbnail"); - this.getChildControl("share-with"); newWorkspace ? this.getChildControl("create") : this.getChildControl("save"); this.addListener("appear", this.__onAppear, this); @@ -111,11 +108,6 @@ qx.Class.define("osparc.editor.WorkspaceEditor", { this._add(control); break; } - case "share-with": { - control = this.__createAddCollaboratorSection(); - this._add(control); - break; - } case "create": { const buttons = this.getChildControl("buttonsLayout"); control = new osparc.ui.form.FetchButton(this.tr("Create")).set({ @@ -161,21 +153,6 @@ qx.Class.define("osparc.editor.WorkspaceEditor", { return control || this.base(arguments, id); }, - __createAddCollaboratorSection: function() { - let serializedDataCopy = null; - if (this.__newWorkspace) { - serializedDataCopy = osparc.store.Workspaces.createNewWorkspaceData() - } else { - serializedDataCopy = osparc.utils.Utils.deepCloneObject(this._serializedDataCopy); - } - serializedDataCopy["resourceType"] = "workspace"; - const addCollaborators = new osparc.share.CollaboratorsWorkspace(serializedDataCopy); - addCollaborators.addListener("updateAccessRights", e => { - console.log("updateAccessRights", e.getData()) - }, this); - return addCollaborators; - }, - __onAppear: function() { const title = this.getChildControl("title"); title.focus(); diff --git a/services/static-webserver/client/source/class/osparc/store/Workspaces.js b/services/static-webserver/client/source/class/osparc/store/Workspaces.js index e6390fac803..e8aa95b3db2 100644 --- a/services/static-webserver/client/source/class/osparc/store/Workspaces.js +++ b/services/static-webserver/client/source/class/osparc/store/Workspaces.js @@ -22,7 +22,11 @@ qx.Class.define("osparc.store.Workspaces", { workspacesCached: [], iconPath: function(iconsSize = 18) { - return "@MaterialIcons/folder_shared/"+iconsSize + const source = "@MaterialIcons/folder_shared/"; + if (iconsSize === -1) { + return source; + } + return source+iconsSize; }, FAKE_WORKSPACES: [{ @@ -58,7 +62,7 @@ qx.Class.define("osparc.store.Workspaces", { workspaceId: 2, name: "Workspace 2", description: "Workspace 2 desc", - thumbnail: "https://image.shutterstock.com/image-vector/dotted-spiral-vortex-royaltyfree-images-600w-2227567913.jpg", + thumbnail: "", myAccessRights: { read: true, write: true, From 7c2fe6cd69392a841c77d5d6435f3fb598e98506 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 3 Sep 2024 10:22:52 +0200 Subject: [PATCH 44/59] create Workspace --- .../class/osparc/dashboard/StudyBrowser.js | 7 +----- .../osparc/dashboard/WorkspaceButtonNew.js | 25 ++++++++++++++----- .../source/class/osparc/store/Workspaces.js | 10 -------- 3 files changed, 20 insertions(+), 22 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 1ec85964671..eb0050b69d0 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -412,12 +412,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { const newWorkspaceCard = new osparc.dashboard.WorkspaceButtonNew(); newWorkspaceCard.setCardKey("new-workspace"); newWorkspaceCard.subscribeToFilterGroup("searchBarFilter"); - newWorkspaceCard.addListener("createWorkspace", e => { - const data = e.getData(); - osparc.store.Workspaces.postWorkspace(data.name, data.description) - .then(() => this.__reloadWorkspaces()) - .catch(err => console.error(err)); - }); + newWorkspaceCard.addListener("createWorkspace", () => this.__reloadWorkspaces()); this._resourcesContainer.addNewWorkspaceCard(newWorkspaceCard); }, // /WORKSPACES diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js index 9b481fde008..e1bb4e32e9a 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js @@ -49,18 +49,31 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonNew", { members: { __itemSelected: function(newVal) { if (newVal) { - const newWorkspace = true; - const workspaceEditor = new osparc.editor.WorkspaceEditor(newWorkspace); + const workspaceEditor = new osparc.editor.WorkspaceEditor(true); const title = this.tr("New Workspace"); const win = osparc.ui.window.Window.popUpInWindow(workspaceEditor, title, 300, 200); workspaceEditor.addListener("createWorkspace", () => { - const name = workspaceEditor.getLabel(); - const description = workspaceEditor.getDescription(); - this.fireDataEvent("createWorkspace", { + const newWorkspaceData = { + name: workspaceEditor.getLabel(), + description: workspaceEditor.getDescription(), + thumbnail: workspaceEditor.getThumbnail(), + }; + osparc.store.Workspaces.postWorkspace(newWorkspaceData) + .then(newWorkspace => { + this.fireDataEvent("createWorkspace"); + const permissionsView = new osparc.share.CollaboratorsWorkspace(newWorkspace); + permissionsView.addListener("updateAccessRights", e => { + const updatedData = e.getData(); + console.log(updatedData); + }, this); + }) + .catch(console.error) + .finally(() => win.close()); + name, description }); - win.close(); + }); workspaceEditor.addListener("cancel", () => win.close()); } diff --git a/services/static-webserver/client/source/class/osparc/store/Workspaces.js b/services/static-webserver/client/source/class/osparc/store/Workspaces.js index e8aa95b3db2..5c26c8754ac 100644 --- a/services/static-webserver/client/source/class/osparc/store/Workspaces.js +++ b/services/static-webserver/client/source/class/osparc/store/Workspaces.js @@ -150,20 +150,10 @@ qx.Class.define("osparc.store.Workspaces", { }, createNewWorkspaceData: function(name, description = "", thumbnail = "") { - const myGroupId = osparc.auth.Data.getInstance().getGroupId(); - const accessRights = {}; - const deleteAccess = { - read: true, - write: false, - delete: false, - }; - accessRights[myGroupId] = deleteAccess; return { name, description, thumbnail, - myAccessRights: deleteAccess, - accessRights, }; }, From ff30686dbbedb6779606a398edda0b7b78495687 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 3 Sep 2024 10:25:53 +0200 Subject: [PATCH 45/59] minor --- .../source/class/osparc/dashboard/WorkspaceButtonNew.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js index e1bb4e32e9a..bc6acfec9de 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js @@ -69,11 +69,6 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonNew", { }) .catch(console.error) .finally(() => win.close()); - - name, - description - }); - }); workspaceEditor.addListener("cancel", () => win.close()); } From 4fc4e4d3e40d486019b41b87db64c3b0d69d8c0f Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 3 Sep 2024 10:39:37 +0200 Subject: [PATCH 46/59] fake post --- .../source/class/osparc/store/Workspaces.js | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/services/static-webserver/client/source/class/osparc/store/Workspaces.js b/services/static-webserver/client/source/class/osparc/store/Workspaces.js index 5c26c8754ac..5423aa05a92 100644 --- a/services/static-webserver/client/source/class/osparc/store/Workspaces.js +++ b/services/static-webserver/client/source/class/osparc/store/Workspaces.js @@ -158,6 +158,7 @@ qx.Class.define("osparc.store.Workspaces", { }, postWorkspace: function(newWorkspaceData) { + /* const params = { data: newWorkspaceData }; @@ -167,6 +168,25 @@ qx.Class.define("osparc.store.Workspaces", { this.__addToCache(newWorkspace); return newWorkspace; }); + */ + const deleteAccess = { + read: true, + write: true, + delete: true, + } + const workspaceData = newWorkspaceData; + workspaceData["workspaceId"] = Math.floor(Math.random() * 100) + 100; + workspaceData["myAccessRights"] = deleteAccess; + const myGroupId = osparc.auth.Data.getInstance().getGroupId(); + workspaceData["accessRights"] = {}; + workspaceData["accessRights"][myGroupId] = deleteAccess; + workspaceData["createdAt"] = new Date().toISOString(); + workspaceData["lastModified"] = new Date().toISOString(); + return new Promise(resolve => { + const workspace = new osparc.data.model.Workspace(workspaceData); + this.__addToCache(workspace); + resolve(workspace); + }); }, deleteWorkspace: function(workspaceId) { From e73ca99297c49ff2defec91f0e365ed1acdfd6b7 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 3 Sep 2024 10:42:35 +0200 Subject: [PATCH 47/59] WORKSPACE ROLES --- .../client/source/class/osparc/data/Roles.js | 4 ++-- .../osparc/share/CollaboratorsWorkspace.js | 18 +++++++++--------- .../osparc/ui/list/CollaboratorListItem.js | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/data/Roles.js b/services/static-webserver/client/source/class/osparc/data/Roles.js index 658a3ffbd56..5b28b79d3bc 100644 --- a/services/static-webserver/client/source/class/osparc/data/Roles.js +++ b/services/static-webserver/client/source/class/osparc/data/Roles.js @@ -135,7 +135,7 @@ qx.Class.define("osparc.data.Roles", { } }, - WORKSPACE: { + WORKSPACES: { 1: { id: "read", label: qx.locale.Manager.tr("Viewer"), @@ -217,7 +217,7 @@ qx.Class.define("osparc.data.Roles", { }, createRolesFolderInfo: function(showWording = true) { - return this.__createIntoFromRoles(osparc.data.Roles.WORKSPACE, showWording); + return this.__createIntoFromRoles(osparc.data.Roles.WORKSPACES, showWording); } } }); diff --git a/services/static-webserver/client/source/class/osparc/share/CollaboratorsWorkspace.js b/services/static-webserver/client/source/class/osparc/share/CollaboratorsWorkspace.js index a492de677db..218cc53abc2 100644 --- a/services/static-webserver/client/source/class/osparc/share/CollaboratorsWorkspace.js +++ b/services/static-webserver/client/source/class/osparc/share/CollaboratorsWorkspace.js @@ -129,8 +129,8 @@ qx.Class.define("osparc.share.CollaboratorsWorkspace", { this.__make( collaborator["gid"], this.self().getCollaboratorAccessRight(), - this.tr(`${osparc.data.Roles.FOLDERS[1].label} successfully changed ${osparc.data.Roles.FOLDERS[2].label}`), - this.tr(`Something went wrong changing ${osparc.data.Roles.FOLDERS[1].label} to ${osparc.data.Roles.FOLDERS[2].label}`), + this.tr(`${osparc.data.Roles.WORKSPACES[1].label} successfully changed ${osparc.data.Roles.WORKSPACES[2].label}`), + this.tr(`Something went wrong changing ${osparc.data.Roles.WORKSPACES[1].label} to ${osparc.data.Roles.WORKSPACES[2].label}`), item ); }, @@ -139,8 +139,8 @@ qx.Class.define("osparc.share.CollaboratorsWorkspace", { this.__make( collaborator["gid"], this.self().getOwnerAccessRight(), - this.tr(`${osparc.data.Roles.FOLDERS[2].label} successfully changed to ${osparc.data.Roles.FOLDERS[3].label}`), - this.tr(`Something went wrong changing ${osparc.data.Roles.FOLDERS[2].label} to ${osparc.data.Roles.FOLDERS[3].label}`), + this.tr(`${osparc.data.Roles.WORKSPACES[2].label} successfully changed to ${osparc.data.Roles.WORKSPACES[3].label}`), + this.tr(`Something went wrong changing ${osparc.data.Roles.WORKSPACES[2].label} to ${osparc.data.Roles.WORKSPACES[3].label}`), item ); }, @@ -151,8 +151,8 @@ qx.Class.define("osparc.share.CollaboratorsWorkspace", { this.__make( gid, this.self().getViewerAccessRight(), - this.tr(`${osparc.data.Roles.FOLDERS[2].label} successfully changed to ${osparc.data.Roles.FOLDERS[1].label}`), - this.tr(`Something went wrong changing ${osparc.data.Roles.FOLDERS[2].label} to ${osparc.data.Roles.FOLDERS[1].label}`), + this.tr(`${osparc.data.Roles.WORKSPACES[2].label} successfully changed to ${osparc.data.Roles.WORKSPACES[1].label}`), + this.tr(`Something went wrong changing ${osparc.data.Roles.WORKSPACES[2].label} to ${osparc.data.Roles.WORKSPACES[1].label}`), itm ); }; @@ -160,7 +160,7 @@ qx.Class.define("osparc.share.CollaboratorsWorkspace", { const groupData = await osparc.store.Store.getInstance().getGroup(groupId); const isOrganization = (groupData && !("id" in groupData)); if (isOrganization) { - const msg = this.tr(`Demoting to ${osparc.data.Roles.FOLDERS[1].label} will remove write access to all the members of the Organization. Are you sure?`); + const msg = this.tr(`Demoting to ${osparc.data.Roles.WORKSPACES[1].label} will remove write access to all the members of the Organization. Are you sure?`); const win = new osparc.ui.window.Confirmation(msg).set({ confirmAction: "delete", confirmText: this.tr("Yes") @@ -181,8 +181,8 @@ qx.Class.define("osparc.share.CollaboratorsWorkspace", { this.__make( collaborator["gid"], this.self().getCollaboratorAccessRight(), - this.tr(`${osparc.data.Roles.FOLDERS[3].label} successfully changed to ${osparc.data.Roles.FOLDERS[2].label}`), - this.tr(`Something went wrong changing ${osparc.data.Roles.FOLDERS[3].label} to ${osparc.data.Roles.FOLDERS[2].label}`), + this.tr(`${osparc.data.Roles.WORKSPACES[3].label} successfully changed to ${osparc.data.Roles.WORKSPACES[2].label}`), + this.tr(`Something went wrong changing ${osparc.data.Roles.WORKSPACES[3].label} to ${osparc.data.Roles.WORKSPACES[2].label}`), item ); } diff --git a/services/static-webserver/client/source/class/osparc/ui/list/CollaboratorListItem.js b/services/static-webserver/client/source/class/osparc/ui/list/CollaboratorListItem.js index dfba86b6b8c..5ce9cffc9d6 100644 --- a/services/static-webserver/client/source/class/osparc/ui/list/CollaboratorListItem.js +++ b/services/static-webserver/client/source/class/osparc/ui/list/CollaboratorListItem.js @@ -83,8 +83,8 @@ qx.Class.define("osparc.ui.list.CollaboratorListItem", { return osparc.data.Roles.STUDY[i]; } else if (resource === "service") { return osparc.data.Roles.SERVICES[i]; - } else if (resource === "folder") { - return osparc.data.Roles.FOLDERS[i]; + } else if (resource === "workspace") { + return osparc.data.Roles.WORKSPACES[i]; } return undefined; }, From 06b765f96f9e8d8c6cf8bfa4d1df950d3fbcd2f7 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 3 Sep 2024 10:44:54 +0200 Subject: [PATCH 48/59] renaming --- .../client/source/class/osparc/data/Roles.js | 8 ++++---- .../source/class/osparc/share/Collaborators.js | 4 ++-- .../osparc/share/CollaboratorsWorkspace.js | 18 +++++++++--------- .../osparc/ui/list/CollaboratorListItem.js | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/data/Roles.js b/services/static-webserver/client/source/class/osparc/data/Roles.js index 5b28b79d3bc..ccb66ffb7d7 100644 --- a/services/static-webserver/client/source/class/osparc/data/Roles.js +++ b/services/static-webserver/client/source/class/osparc/data/Roles.js @@ -135,7 +135,7 @@ qx.Class.define("osparc.data.Roles", { } }, - WORKSPACES: { + WORKSPACE: { 1: { id: "read", label: qx.locale.Manager.tr("Viewer"), @@ -208,7 +208,7 @@ qx.Class.define("osparc.data.Roles", { return this.__createIntoFromRoles(osparc.data.Roles.WALLET); }, - createRolesWorkspaceInfo: function() { + createRolesStudyInfo: function() { return this.__createIntoFromRoles(osparc.data.Roles.STUDY); }, @@ -216,8 +216,8 @@ qx.Class.define("osparc.data.Roles", { return this.__createIntoFromRoles(osparc.data.Roles.SERVICES); }, - createRolesFolderInfo: function(showWording = true) { - return this.__createIntoFromRoles(osparc.data.Roles.WORKSPACES, showWording); + createRolesWorkspaceInfo: function(showWording = true) { + return this.__createIntoFromRoles(osparc.data.Roles.WORKSPACE, showWording); } } }); diff --git a/services/static-webserver/client/source/class/osparc/share/Collaborators.js b/services/static-webserver/client/source/class/osparc/share/Collaborators.js index 217b53df2b5..c315c7d26d3 100644 --- a/services/static-webserver/client/source/class/osparc/share/Collaborators.js +++ b/services/static-webserver/client/source/class/osparc/share/Collaborators.js @@ -213,10 +213,10 @@ qx.Class.define("osparc.share.Collaborators", { rolesLayout = osparc.data.Roles.createRolesServicesInfo(); break; case "workspace": - rolesLayout = osparc.data.Roles.createRolesFolderInfo(); + rolesLayout = osparc.data.Roles.createRolesWorkspaceInfo(); break; default: - rolesLayout = osparc.data.Roles.createRolesWorkspaceInfo(); + rolesLayout = osparc.data.Roles.createRolesStudyInfo(); break; } return rolesLayout; diff --git a/services/static-webserver/client/source/class/osparc/share/CollaboratorsWorkspace.js b/services/static-webserver/client/source/class/osparc/share/CollaboratorsWorkspace.js index 218cc53abc2..63c2a33b9a9 100644 --- a/services/static-webserver/client/source/class/osparc/share/CollaboratorsWorkspace.js +++ b/services/static-webserver/client/source/class/osparc/share/CollaboratorsWorkspace.js @@ -129,8 +129,8 @@ qx.Class.define("osparc.share.CollaboratorsWorkspace", { this.__make( collaborator["gid"], this.self().getCollaboratorAccessRight(), - this.tr(`${osparc.data.Roles.WORKSPACES[1].label} successfully changed ${osparc.data.Roles.WORKSPACES[2].label}`), - this.tr(`Something went wrong changing ${osparc.data.Roles.WORKSPACES[1].label} to ${osparc.data.Roles.WORKSPACES[2].label}`), + this.tr(`${osparc.data.Roles.WORKSPACE[1].label} successfully changed ${osparc.data.Roles.WORKSPACE[2].label}`), + this.tr(`Something went wrong changing ${osparc.data.Roles.WORKSPACE[1].label} to ${osparc.data.Roles.WORKSPACE[2].label}`), item ); }, @@ -139,8 +139,8 @@ qx.Class.define("osparc.share.CollaboratorsWorkspace", { this.__make( collaborator["gid"], this.self().getOwnerAccessRight(), - this.tr(`${osparc.data.Roles.WORKSPACES[2].label} successfully changed to ${osparc.data.Roles.WORKSPACES[3].label}`), - this.tr(`Something went wrong changing ${osparc.data.Roles.WORKSPACES[2].label} to ${osparc.data.Roles.WORKSPACES[3].label}`), + this.tr(`${osparc.data.Roles.WORKSPACE[2].label} successfully changed to ${osparc.data.Roles.WORKSPACE[3].label}`), + this.tr(`Something went wrong changing ${osparc.data.Roles.WORKSPACE[2].label} to ${osparc.data.Roles.WORKSPACE[3].label}`), item ); }, @@ -151,8 +151,8 @@ qx.Class.define("osparc.share.CollaboratorsWorkspace", { this.__make( gid, this.self().getViewerAccessRight(), - this.tr(`${osparc.data.Roles.WORKSPACES[2].label} successfully changed to ${osparc.data.Roles.WORKSPACES[1].label}`), - this.tr(`Something went wrong changing ${osparc.data.Roles.WORKSPACES[2].label} to ${osparc.data.Roles.WORKSPACES[1].label}`), + this.tr(`${osparc.data.Roles.WORKSPACE[2].label} successfully changed to ${osparc.data.Roles.WORKSPACE[1].label}`), + this.tr(`Something went wrong changing ${osparc.data.Roles.WORKSPACE[2].label} to ${osparc.data.Roles.WORKSPACE[1].label}`), itm ); }; @@ -160,7 +160,7 @@ qx.Class.define("osparc.share.CollaboratorsWorkspace", { const groupData = await osparc.store.Store.getInstance().getGroup(groupId); const isOrganization = (groupData && !("id" in groupData)); if (isOrganization) { - const msg = this.tr(`Demoting to ${osparc.data.Roles.WORKSPACES[1].label} will remove write access to all the members of the Organization. Are you sure?`); + const msg = this.tr(`Demoting to ${osparc.data.Roles.WORKSPACE[1].label} will remove write access to all the members of the Organization. Are you sure?`); const win = new osparc.ui.window.Confirmation(msg).set({ confirmAction: "delete", confirmText: this.tr("Yes") @@ -181,8 +181,8 @@ qx.Class.define("osparc.share.CollaboratorsWorkspace", { this.__make( collaborator["gid"], this.self().getCollaboratorAccessRight(), - this.tr(`${osparc.data.Roles.WORKSPACES[3].label} successfully changed to ${osparc.data.Roles.WORKSPACES[2].label}`), - this.tr(`Something went wrong changing ${osparc.data.Roles.WORKSPACES[3].label} to ${osparc.data.Roles.WORKSPACES[2].label}`), + this.tr(`${osparc.data.Roles.WORKSPACE[3].label} successfully changed to ${osparc.data.Roles.WORKSPACE[2].label}`), + this.tr(`Something went wrong changing ${osparc.data.Roles.WORKSPACE[3].label} to ${osparc.data.Roles.WORKSPACE[2].label}`), item ); } diff --git a/services/static-webserver/client/source/class/osparc/ui/list/CollaboratorListItem.js b/services/static-webserver/client/source/class/osparc/ui/list/CollaboratorListItem.js index 5ce9cffc9d6..6dd098e5bb3 100644 --- a/services/static-webserver/client/source/class/osparc/ui/list/CollaboratorListItem.js +++ b/services/static-webserver/client/source/class/osparc/ui/list/CollaboratorListItem.js @@ -84,7 +84,7 @@ qx.Class.define("osparc.ui.list.CollaboratorListItem", { } else if (resource === "service") { return osparc.data.Roles.SERVICES[i]; } else if (resource === "workspace") { - return osparc.data.Roles.WORKSPACES[i]; + return osparc.data.Roles.WORKSPACE[i]; } return undefined; }, From 939f59de5323ce173c2ee559ec8e3d49d96c5aa5 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 3 Sep 2024 10:51:52 +0200 Subject: [PATCH 49/59] Share workspaces --- .../source/class/osparc/dashboard/WorkspaceButtonNew.js | 6 ++---- .../source/class/osparc/share/CollaboratorsWorkspace.js | 6 +++--- .../client/source/class/osparc/store/Workspaces.js | 9 ++------- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js index bc6acfec9de..c4aedcdd60a 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js @@ -62,10 +62,8 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonNew", { .then(newWorkspace => { this.fireDataEvent("createWorkspace"); const permissionsView = new osparc.share.CollaboratorsWorkspace(newWorkspace); - permissionsView.addListener("updateAccessRights", e => { - const updatedData = e.getData(); - console.log(updatedData); - }, this); + const title2 = qx.locale.Manager.tr("Share Workspace"); + osparc.ui.window.Window.popUpInWindow(permissionsView, title2, 500, 400); }) .catch(console.error) .finally(() => win.close()); diff --git a/services/static-webserver/client/source/class/osparc/share/CollaboratorsWorkspace.js b/services/static-webserver/client/source/class/osparc/share/CollaboratorsWorkspace.js index 63c2a33b9a9..202d86b5e5d 100644 --- a/services/static-webserver/client/source/class/osparc/share/CollaboratorsWorkspace.js +++ b/services/static-webserver/client/source/class/osparc/share/CollaboratorsWorkspace.js @@ -70,7 +70,7 @@ qx.Class.define("osparc.share.CollaboratorsWorkspace", { const newCollaborators = {}; gids.forEach(gid => newCollaborators[gid] = this.self().getCollaboratorAccessRight()); - osparc.store.Workspaces.getInstance().addCollaborators(this.__workspace.getWorkspaceId(), newCollaborators) + osparc.store.Workspaces.addCollaborators(this.__workspace.getWorkspaceId(), newCollaborators) .then(() => { this.fireDataEvent("updateAccessRights", this.__workspace.serialize()); const text = this.tr("User(s) successfully added."); @@ -88,7 +88,7 @@ qx.Class.define("osparc.share.CollaboratorsWorkspace", { item.setEnabled(false); } - osparc.store.Workspaces.getInstance().removeCollaborator(this.__workspace.getWorkspaceId(), collaborator["gid"]) + osparc.store.Workspaces.removeCollaborator(this.__workspace.getWorkspaceId(), collaborator["gid"]) .then(() => { this.fireDataEvent("updateAccessRights", this.__workspace.serialize()); osparc.FlashMessenger.getInstance().logAs(this.tr("Member successfully removed")); @@ -108,7 +108,7 @@ qx.Class.define("osparc.share.CollaboratorsWorkspace", { __make: function(collaboratorGId, newAccessRights, successMsg, failureMsg, item) { item.setEnabled(false); - osparc.store.Workspaces.getInstance().updateCollaborator(this.__workspace.getWorkspaceId(), collaboratorGId, newAccessRights) + osparc.store.Workspaces.updateCollaborator(this.__workspace.getWorkspaceId(), collaboratorGId, newAccessRights) .then(() => { this.fireDataEvent("updateAccessRights", this.__workspace.serialize()); osparc.FlashMessenger.getInstance().logAs(successMsg); diff --git a/services/static-webserver/client/source/class/osparc/store/Workspaces.js b/services/static-webserver/client/source/class/osparc/store/Workspaces.js index 5423aa05a92..074f1f2b73d 100644 --- a/services/static-webserver/client/source/class/osparc/store/Workspaces.js +++ b/services/static-webserver/client/source/class/osparc/store/Workspaces.js @@ -169,17 +169,12 @@ qx.Class.define("osparc.store.Workspaces", { return newWorkspace; }); */ - const deleteAccess = { - read: true, - write: true, - delete: true, - } const workspaceData = newWorkspaceData; workspaceData["workspaceId"] = Math.floor(Math.random() * 100) + 100; - workspaceData["myAccessRights"] = deleteAccess; + workspaceData["myAccessRights"] = osparc.share.CollaboratorsWorkspace.getOwnerAccessRight(); const myGroupId = osparc.auth.Data.getInstance().getGroupId(); workspaceData["accessRights"] = {}; - workspaceData["accessRights"][myGroupId] = deleteAccess; + workspaceData["accessRights"][myGroupId] = osparc.share.CollaboratorsWorkspace.getOwnerAccessRight(); workspaceData["createdAt"] = new Date().toISOString(); workspaceData["lastModified"] = new Date().toISOString(); return new Promise(resolve => { From 544130908d2a8ae405c40d57c58833397f581438 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 3 Sep 2024 10:54:59 +0200 Subject: [PATCH 50/59] use cache --- .../client/source/class/osparc/store/Workspaces.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/static-webserver/client/source/class/osparc/store/Workspaces.js b/services/static-webserver/client/source/class/osparc/store/Workspaces.js index 074f1f2b73d..9dd6c4005ae 100644 --- a/services/static-webserver/client/source/class/osparc/store/Workspaces.js +++ b/services/static-webserver/client/source/class/osparc/store/Workspaces.js @@ -140,6 +140,10 @@ qx.Class.define("osparc.store.Workspaces", { return new Promise(resolve => { const workspaces = []; + if (Object.keys(this.workspacesCached)) { + resolve(workspaces); + return; + } this.self().FAKE_WORKSPACES.forEach(workspaceData => { const workspace = new osparc.data.model.Workspace(workspaceData); this.__addToCache(workspace); From 7f31bd44322f942339c3747e0d83fab4ae43eb25 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 3 Sep 2024 10:58:29 +0200 Subject: [PATCH 51/59] minor --- .../source/class/osparc/store/Workspaces.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/store/Workspaces.js b/services/static-webserver/client/source/class/osparc/store/Workspaces.js index 9dd6c4005ae..f21b50c18e2 100644 --- a/services/static-webserver/client/source/class/osparc/store/Workspaces.js +++ b/services/static-webserver/client/source/class/osparc/store/Workspaces.js @@ -139,17 +139,13 @@ qx.Class.define("osparc.store.Workspaces", { */ return new Promise(resolve => { - const workspaces = []; - if (Object.keys(this.workspacesCached)) { - resolve(workspaces); - return; + if (this.workspacesCached.length === 0) { + this.self().FAKE_WORKSPACES.forEach(workspaceData => { + const workspace = new osparc.data.model.Workspace(workspaceData); + this.__addToCache(workspace); + }); } - this.self().FAKE_WORKSPACES.forEach(workspaceData => { - const workspace = new osparc.data.model.Workspace(workspaceData); - this.__addToCache(workspace); - workspaces.push(workspace); - }); - resolve(workspaces); + resolve(this.workspacesCached); }); }, From f4e3efab283d088871bac2cb6b734b3978354f4c Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 3 Sep 2024 11:05:09 +0200 Subject: [PATCH 52/59] Share workspaces --- .../source/class/osparc/dashboard/WorkspaceButtonItem.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js index 98212d9b1ad..779debeab04 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js @@ -212,6 +212,10 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonItem", { }); menu.add(editButton); + const shareButton = new qx.ui.menu.Button(this.tr("Share..."), "@FontAwesome5Solid/share-alt/12"); + shareButton.addListener("execute", () => this.__openShareWith(), this); + menu.add(shareButton); + menu.addSeparator(); const deleteButton = new qx.ui.menu.Button(this.tr("Delete"), "@FontAwesome5Solid/trash/12"); From f3c0129ee7046eb481380bdc34ac1b8a1cb2c817 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 3 Sep 2024 11:06:53 +0200 Subject: [PATCH 53/59] minor --- .../source/class/osparc/dashboard/WorkspaceButtonItem.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js index 779debeab04..6f2c4640e71 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js @@ -258,9 +258,9 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonItem", { }, __openShareWith: function() { - const title = this.tr("Share Workspace"); const permissionsView = new osparc.share.CollaboratorsWorkspace(this.getWorkspace()); - osparc.ui.window.Window.popUpInWindow(permissionsView, title); + const title = this.tr("Share Workspace"); + osparc.ui.window.Window.popUpInWindow(permissionsView, title, 500, 400); permissionsView.addListener("updateAccessRights", () => this.__applyAccessRights(this.getWorkspace().getAccessRights()), this); }, From 689fb6ebf82e5f0f751643d5712a13e4647b1fbd Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 3 Sep 2024 11:13:10 +0200 Subject: [PATCH 54/59] updateWorkspace --- .../client/source/class/osparc/dashboard/StudyBrowser.js | 1 + .../source/class/osparc/dashboard/WorkspaceButtonNew.js | 4 +++- 2 files changed, 4 insertions(+), 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 eb0050b69d0..17fe0302fc8 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -413,6 +413,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { newWorkspaceCard.setCardKey("new-workspace"); newWorkspaceCard.subscribeToFilterGroup("searchBarFilter"); newWorkspaceCard.addListener("createWorkspace", () => this.__reloadWorkspaces()); + newWorkspaceCard.addListener("updateWorkspace", () => this.__reloadWorkspaces()); this._resourcesContainer.addNewWorkspaceCard(newWorkspaceCard); }, // /WORKSPACES diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js index c4aedcdd60a..8c8b1d0e70e 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js @@ -43,7 +43,8 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonNew", { }, events: { - "createWorkspace": "qx.event.type.Data" + "createWorkspace": "qx.event.type.Data", + "updateWorkspace": "qx.event.type.Data" }, members: { @@ -64,6 +65,7 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonNew", { const permissionsView = new osparc.share.CollaboratorsWorkspace(newWorkspace); const title2 = qx.locale.Manager.tr("Share Workspace"); osparc.ui.window.Window.popUpInWindow(permissionsView, title2, 500, 400); + permissionsView.addListener("updateAccessRights", () => this.fireDataEvent("updateWorkspace", this.getWorkspace().getWorkspaceId()), this); }) .catch(console.error) .finally(() => win.close()); From e05c8df750db40b6132f7478aef7219354d3bc3e Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 3 Sep 2024 11:25:02 +0200 Subject: [PATCH 55/59] add resources --- .../source/class/osparc/data/Resources.js | 36 +++++++++++++++++++ .../client/source/class/osparc/store/Store.js | 4 +++ 2 files changed, 40 insertions(+) diff --git a/services/static-webserver/client/source/class/osparc/data/Resources.js b/services/static-webserver/client/source/class/osparc/data/Resources.js index 2b09478dc10..098d3239bfa 100644 --- a/services/static-webserver/client/source/class/osparc/data/Resources.js +++ b/services/static-webserver/client/source/class/osparc/data/Resources.js @@ -319,6 +319,42 @@ qx.Class.define("osparc.data.Resources", { } } }, + "workspaces": { + endpoints: { + getPage: { + method: "GET", + url: statics.API + "/workspaces?workspace_id={workspaceId}&offset={offset}&limit={limit}" + }, + getOne: { + method: "GET", + url: statics.API + "/workspaces/{workspaceId}" + }, + post: { + method: "POST", + url: statics.API + "/workspaces" + }, + update: { + method: "PUT", + url: statics.API + "/workspaces/{workspaceId}" + }, + delete: { + method: "DELETE", + url: statics.API + "/workspaces/{workspaceId}" + }, + postAccessRights: { + method: "POST", + url: statics.API + "/workspaces/{workspaceId}/groups/{groupId}" + }, + putAccessRights: { + method: "PUT", + url: statics.API + "/workspaces/{workspaceId}/groups/{groupId}" + }, + deleteAccessRights: { + method: "DELETE", + url: statics.API + "/workspaces/{workspaceId}/groups/{groupId}" + }, + } + }, "resourceUsage": { useCache: false, endpoints: { diff --git a/services/static-webserver/client/source/class/osparc/store/Store.js b/services/static-webserver/client/source/class/osparc/store/Store.js index c6c25606acc..1c03b85ea44 100644 --- a/services/static-webserver/client/source/class/osparc/store/Store.js +++ b/services/static-webserver/client/source/class/osparc/store/Store.js @@ -74,6 +74,10 @@ qx.Class.define("osparc.store.Store", { check: "Array", init: [] }, + workspaces: { + check: "Array", + init: [] + }, studyComments: { check: "Array", init: [] From b7bc3bd12ceac3bcb450d4d3762c97baa2934e3c Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 3 Sep 2024 11:33:40 +0200 Subject: [PATCH 56/59] update access rights --- .../source/class/osparc/dashboard/WorkspaceButtonNew.js | 4 ++-- .../client/source/class/osparc/info/StudyUtils.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js index 8c8b1d0e70e..b06dd548529 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonNew.js @@ -64,8 +64,8 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonNew", { this.fireDataEvent("createWorkspace"); const permissionsView = new osparc.share.CollaboratorsWorkspace(newWorkspace); const title2 = qx.locale.Manager.tr("Share Workspace"); - osparc.ui.window.Window.popUpInWindow(permissionsView, title2, 500, 400); - permissionsView.addListener("updateAccessRights", () => this.fireDataEvent("updateWorkspace", this.getWorkspace().getWorkspaceId()), this); + osparc.ui.window.Window.popUpInWindow(permissionsView, title2, 500, 500); + permissionsView.addListener("updateAccessRights", () => this.fireDataEvent("updateWorkspace", newWorkspace.getWorkspaceId()), this); }) .catch(console.error) .finally(() => win.close()); diff --git a/services/static-webserver/client/source/class/osparc/info/StudyUtils.js b/services/static-webserver/client/source/class/osparc/info/StudyUtils.js index eb1f70913c5..abbee546dae 100644 --- a/services/static-webserver/client/source/class/osparc/info/StudyUtils.js +++ b/services/static-webserver/client/source/class/osparc/info/StudyUtils.js @@ -370,7 +370,7 @@ qx.Class.define("osparc.info.StudyUtils", { openAccessRights: function(studyData) { const permissionsView = new osparc.share.CollaboratorsStudy(studyData); const title = qx.locale.Manager.tr("Share with Editors and Organizations"); - osparc.ui.window.Window.popUpInWindow(permissionsView, title, 500, 400); + osparc.ui.window.Window.popUpInWindow(permissionsView, title, 500, 500); return permissionsView; }, From 3d8c6fe3c37dfbf850230a03ed4b8d3aa33f3b7f Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 3 Sep 2024 11:44:09 +0200 Subject: [PATCH 57/59] wire signals --- .../class/osparc/dashboard/ResourceBrowserBase.js | 15 +++++++++++++++ .../osparc/dashboard/ResourceContainerManager.js | 3 +++ .../source/class/osparc/dashboard/StudyBrowser.js | 14 ++++++++++++++ .../class/osparc/dashboard/WorkspaceButtonItem.js | 4 ++-- .../source/class/osparc/store/Workspaces.js | 7 +++++++ 5 files changed, 41 insertions(+), 2 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js index 9eb77b09cee..363d2d36530 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js @@ -253,6 +253,9 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { resourcesContainer.addListener("folderSelected", e => this._folderSelected(e.getData())); resourcesContainer.addListener("folderUpdated", e => this._folderUpdated(e.getData())); resourcesContainer.addListener("deleteFolderRequested", e => this._deleteFolderRequested(e.getData())); + resourcesContainer.addListener("workspaceSelected", e => this._workspaceSelected(e.getData())); + resourcesContainer.addListener("workspaceUpdated", e => this._workspaceUpdated(e.getData())); + resourcesContainer.addListener("deleteWorkspaceRequested", e => this._deleteWorkspaceRequested(e.getData())); this._addToLayout(resourcesContainer); }, @@ -470,6 +473,18 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { throw new Error("Abstract method called!"); }, + _workspaceSelected: function(workspaceId) { + throw new Error("Abstract method called!"); + }, + + _workspaceUpdated: function(workspaceId) { + throw new Error("Abstract method called!"); + }, + + _deleteWorkspaceRequested: function(workspaceId) { + throw new Error("Abstract method called!"); + }, + _getOpenMenuButton: function(resourceData) { const openButton = new qx.ui.menu.Button(this.tr("Open")); openButton["openResourceButton"] = true; diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js index 9d146b71566..84b2e680f5f 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js @@ -87,6 +87,9 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", { "folderSelected": "qx.event.type.Data", "folderUpdated": "qx.event.type.Data", "deleteFolderRequested": "qx.event.type.Data", + "workspaceSelected": "qx.event.type.Data", + "workspaceUpdated": "qx.event.type.Data", + "deleteWorkspaceRequested": "qx.event.type.Data", }, statics: { 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 17fe0302fc8..e9b61fadca7 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js @@ -416,6 +416,20 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { newWorkspaceCard.addListener("updateWorkspace", () => this.__reloadWorkspaces()); this._resourcesContainer.addNewWorkspaceCard(newWorkspaceCard); }, + + _workspaceSelected: function(workspaceId) { + this.setCurrentWorkspaceId(workspaceId); + }, + + _workspaceUpdated: function() { + this.__reloadWorkspaceCards(); + }, + + _deleteWorkspaceRequested: function(workspaceId) { + osparc.store.Workspaces.deleteWorkspace(workspaceId) + .then(() => this.__reloadWorkspaceCards()) + .catch(err => console.error(err)); + }, // /WORKSPACES // FOLDERS diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js index 6f2c4640e71..4a7cba756e2 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js @@ -219,7 +219,7 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonItem", { menu.addSeparator(); const deleteButton = new qx.ui.menu.Button(this.tr("Delete"), "@FontAwesome5Solid/trash/12"); - deleteButton.addListener("execute", () => this.__deleteStudyRequested(), this); + deleteButton.addListener("execute", () => this.__deleteWorkspaceRequested(), this); menu.add(deleteButton); menuButton.setMenu(menu); @@ -264,7 +264,7 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonItem", { permissionsView.addListener("updateAccessRights", () => this.__applyAccessRights(this.getWorkspace().getAccessRights()), this); }, - __deleteStudyRequested: function() { + __deleteWorkspaceRequested: function() { const msg = this.tr("Are you sure you want to delete") + " " + this.getTitle() + "?"; const confirmationWin = new osparc.ui.window.Confirmation(msg).set({ confirmText: this.tr("Delete"), diff --git a/services/static-webserver/client/source/class/osparc/store/Workspaces.js b/services/static-webserver/client/source/class/osparc/store/Workspaces.js index f21b50c18e2..6d0664abb0a 100644 --- a/services/static-webserver/client/source/class/osparc/store/Workspaces.js +++ b/services/static-webserver/client/source/class/osparc/store/Workspaces.js @@ -186,6 +186,12 @@ qx.Class.define("osparc.store.Workspaces", { deleteWorkspace: function(workspaceId) { return new Promise((resolve, reject) => { + if (this.__deleteFromCache(workspaceId)) { + resolve(); + } else { + reject(); + } + /* const params = { "url": { workspaceId @@ -200,6 +206,7 @@ qx.Class.define("osparc.store.Workspaces", { } }) .catch(err => reject(err)); + */ }); }, From b3a2079dce424bd478ddd565512ed62bf51b3a1e Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 3 Sep 2024 11:58:45 +0200 Subject: [PATCH 58/59] sync buttons --- .../class/osparc/dashboard/ResourceBrowserBase.js | 8 ++++++-- .../source/class/osparc/dashboard/ResourceFilter.js | 10 ++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js index 363d2d36530..40178ea468d 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceBrowserBase.js @@ -253,7 +253,11 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { resourcesContainer.addListener("folderSelected", e => this._folderSelected(e.getData())); resourcesContainer.addListener("folderUpdated", e => this._folderUpdated(e.getData())); resourcesContainer.addListener("deleteFolderRequested", e => this._deleteFolderRequested(e.getData())); - resourcesContainer.addListener("workspaceSelected", e => this._workspaceSelected(e.getData())); + resourcesContainer.addListener("workspaceSelected", e => { + const workspaceId = e.getData(); + this._workspaceSelected(workspaceId); + this.__resourceFilter.workspaceSelected(workspaceId); + }); resourcesContainer.addListener("workspaceUpdated", e => this._workspaceUpdated(e.getData())); resourcesContainer.addListener("deleteWorkspaceRequested", e => this._deleteWorkspaceRequested(e.getData())); this._addToLayout(resourcesContainer); @@ -351,7 +355,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", { }, _addResourceFilter: function() { - const resourceFilter = new osparc.dashboard.ResourceFilter(this._resourceType).set({ + const resourceFilter = this.__resourceFilter = new osparc.dashboard.ResourceFilter(this._resourceType).set({ marginTop: osparc.dashboard.SearchBarFilter.HEIGHT + 10, // aligned with toolbar buttons: search bar + spacing maxWidth: this.self().SIDE_SPACER_WIDTH, width: this.self().SIDE_SPACER_WIDTH 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 0c3432a5d32..0a47f4e12ec 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/ResourceFilter.js @@ -26,6 +26,7 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { this.__resourceType = resourceType; this.__sharedWithButtons = []; + this.__workspaceButtons = []; this.__tagButtons = []; this.__serviceTypeButtons = []; @@ -43,6 +44,7 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { members: { __resourceType: null, __sharedWithButtons: null, + __workspaceButtons: null, __tagButtons: null, __serviceTypeButtons: null, @@ -136,6 +138,7 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { workspaces.forEach(workspace => { const workspaceButton = new qx.ui.toolbar.RadioButton(workspace.getName(), osparc.store.Workspaces.iconPath(22)); workspaceButton.workspaceId = workspace.getWorkspaceId(); + this.__workspaceButtons.push(workspaceButton); workspaceButton.set({ appearance: "filter-toggle-button", marginLeft: 15, @@ -149,6 +152,13 @@ qx.Class.define("osparc.dashboard.ResourceFilter", { }) .catch(console.error); }, + + workspaceSelected: function(workspaceId) { + const foundButton = this.__workspaceButtons.find(workspaceButton => workspaceButton.workspaceId === workspaceId); + if (foundButton) { + foundButton.execute(); + } + }, /* /WORKSPACES */ /* TAGS */ From 888ee5d88609d91225ddeb675b27b26af91da27c Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 3 Sep 2024 12:26:56 +0200 Subject: [PATCH 59/59] warning message --- .../source/class/osparc/dashboard/WorkspaceButtonItem.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js index 4a7cba756e2..176d2775f46 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/WorkspaceButtonItem.js @@ -265,7 +265,8 @@ qx.Class.define("osparc.dashboard.WorkspaceButtonItem", { }, __deleteWorkspaceRequested: function() { - const msg = this.tr("Are you sure you want to delete") + " " + this.getTitle() + "?"; + let msg = this.tr("Are you sure you want to delete") + " " + this.getTitle() + "?"; + msg += "
" + this.tr("All the content of the workspace will be deleted."); const confirmationWin = new osparc.ui.window.Confirmation(msg).set({ confirmText: this.tr("Delete"), confirmAction: "delete"