From ff4f17fe7e6eace3144f75baed75d6b5bda58e3f Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 28 Apr 2025 10:56:49 +0200 Subject: [PATCH 1/5] rewording --- .../client/source/class/osparc/dashboard/SearchBarFilter.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 a2eada31b7a..f8d178e9623 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/SearchBarFilter.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/SearchBarFilter.js @@ -65,7 +65,10 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", { icon: "@FontAwesome5Solid/users/20" }, { id: "shared-with-everyone", - label: qx.locale.Manager.tr("Shared with Everyone"), + label: qx.locale.Manager.tr("Public") + osparc.product.Utils.resourceTypeToAlias(resourceType, { + firstUpperCase: true, + plural: true + }), icon: "@FontAwesome5Solid/globe/20" }]; } From 9e413f90b650a2077859c7e0466033ef1a632339 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 28 Apr 2025 11:00:53 +0200 Subject: [PATCH 2/5] minor --- .../client/source/class/osparc/dashboard/SearchBarFilter.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 f8d178e9623..062c963ef8f 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/SearchBarFilter.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/SearchBarFilter.js @@ -47,14 +47,14 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", { getSharedWithOptions: function(resourceType) { return [{ id: "show-all", - label: qx.locale.Manager.tr("All ") + osparc.product.Utils.resourceTypeToAlias(resourceType, { + label: qx.locale.Manager.tr("All") + " " + osparc.product.Utils.resourceTypeToAlias(resourceType, { firstUpperCase: true, plural: true }), icon: "@FontAwesome5Solid/home/20" }, { id: "my-resources", - label: qx.locale.Manager.tr("My ") + osparc.product.Utils.resourceTypeToAlias(resourceType, { + label: qx.locale.Manager.tr("My") + " " + osparc.product.Utils.resourceTypeToAlias(resourceType, { firstUpperCase: true, plural: true }), @@ -65,7 +65,7 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", { icon: "@FontAwesome5Solid/users/20" }, { id: "shared-with-everyone", - label: qx.locale.Manager.tr("Public") + osparc.product.Utils.resourceTypeToAlias(resourceType, { + label: qx.locale.Manager.tr("Public") + " " + osparc.product.Utils.resourceTypeToAlias(resourceType, { firstUpperCase: true, plural: true }), From 6a7ff26aaed9e89807139da5ce0469888e6239d5 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 28 Apr 2025 11:42:29 +0200 Subject: [PATCH 3/5] filterSharedWith --- .../source/class/osparc/dashboard/CardBase.js | 43 +++++++++++-------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js b/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js index 188176b812e..56531604fb6 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js @@ -118,28 +118,37 @@ qx.Class.define("osparc.dashboard.CardBase", { }, filterSharedWith: function(checks, sharedWith) { - if (sharedWith && sharedWith !== "show-all") { + if (sharedWith && checks) { const groupsStore = osparc.store.Groups.getInstance(); const myGroupId = groupsStore.getMyGroupId(); - if (checks && myGroupId in checks) { - const myAccessRights = checks[myGroupId]; - const totalAccess = "delete" in myAccessRights ? myAccessRights["delete"] : myAccessRights["write"]; - if (sharedWith === "my-resources") { + + if (sharedWith === "show-all") { + // show all + return false; + } else if (sharedWith === "shared-with-everyone") { + const everyoneGroupIds = [ + groupsStore.getEveryoneProductGroup().getGroupId(), + groupsStore.getEveryoneGroup().getGroupId(), + ]; + const found = Object.keys(checks).some(gId => everyoneGroupIds.includes(parseInt(gId))); + // show those that are shared with "1" or product everyone's groupId + return !found; + } else if (sharedWith === "my-resources") { + if (myGroupId in checks) { + const myAccessRights = checks[myGroupId]; + const totalAccess = "delete" in myAccessRights ? myAccessRights["delete"] : myAccessRights["write"]; + // show those that I have ownership of: have explicit delete (study/template) or write (service) access return !totalAccess; - } else if (sharedWith === "shared-with-me") { + } + return true; + } else if (sharedWith === "shared-with-me") { + if (myGroupId in checks) { + const myAccessRights = checks[myGroupId]; + const totalAccess = "delete" in myAccessRights ? myAccessRights["delete"] : myAccessRights["write"]; + // hide those that I'm ownership of: have explicit and delete (study/template) or write (service) access return totalAccess; - } else if (sharedWith === "shared-with-everyone") { - const everyoneGroupIds = [ - groupsStore.getEveryoneProductGroup().getGroupId(), - groupsStore.getEveryoneGroup().getGroupId(), - ]; - const found = Object.keys(checks).some(gId => everyoneGroupIds.includes(parseInt(gId))); - return !found; } - return false; - } - // if we get here, it means that it was shared-with-me via an organization - if (sharedWith === "shared-with-me") { + // if we get here, it means that it was shared-with-me via an organization return false; } return true; From 4f31809f670efa98f57f1255b8939a641779cf15 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 28 Apr 2025 11:45:24 +0200 Subject: [PATCH 4/5] better reading --- .../source/class/osparc/dashboard/CardBase.js | 58 ++++++++++--------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js b/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js index 56531604fb6..40767cfa991 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js @@ -122,36 +122,40 @@ qx.Class.define("osparc.dashboard.CardBase", { const groupsStore = osparc.store.Groups.getInstance(); const myGroupId = groupsStore.getMyGroupId(); - if (sharedWith === "show-all") { - // show all - return false; - } else if (sharedWith === "shared-with-everyone") { - const everyoneGroupIds = [ - groupsStore.getEveryoneProductGroup().getGroupId(), - groupsStore.getEveryoneGroup().getGroupId(), - ]; - const found = Object.keys(checks).some(gId => everyoneGroupIds.includes(parseInt(gId))); - // show those that are shared with "1" or product everyone's groupId - return !found; - } else if (sharedWith === "my-resources") { - if (myGroupId in checks) { - const myAccessRights = checks[myGroupId]; - const totalAccess = "delete" in myAccessRights ? myAccessRights["delete"] : myAccessRights["write"]; - // show those that I have ownership of: have explicit delete (study/template) or write (service) access - return !totalAccess; + switch (sharedWith) { + case "show-all": + return false; + case "shared-with-everyone": { + const everyoneGroupIds = [ + groupsStore.getEveryoneProductGroup().getGroupId(), + groupsStore.getEveryoneGroup().getGroupId(), + ]; + const found = Object.keys(checks).some(gId => everyoneGroupIds.includes(parseInt(gId))); + // show those that are shared with "1" or product everyone's groupId + return !found; } - return true; - } else if (sharedWith === "shared-with-me") { - if (myGroupId in checks) { - const myAccessRights = checks[myGroupId]; - const totalAccess = "delete" in myAccessRights ? myAccessRights["delete"] : myAccessRights["write"]; - // hide those that I'm ownership of: have explicit and delete (study/template) or write (service) access - return totalAccess; + case "my-resources": { + if (myGroupId in checks) { + const myAccessRights = checks[myGroupId]; + const totalAccess = "delete" in myAccessRights ? myAccessRights["delete"] : myAccessRights["write"]; + // show those that I have ownership of: have explicit delete (study/template) or write (service) access + return !totalAccess; + } + return true; + } + case "shared-with-me": { + if (myGroupId in checks) { + const myAccessRights = checks[myGroupId]; + const totalAccess = "delete" in myAccessRights ? myAccessRights["delete"] : myAccessRights["write"]; + // hide those that I'm ownership of: have explicit and delete (study/template) or write (service) access + return totalAccess; + } + // if we get here, it means that it was shared-with-me via an organization + return false; } - // if we get here, it means that it was shared-with-me via an organization - return false; + default: + return true; } - return true; } return false; }, From 120c5cd4313f2fb2115f22705aee69526c6df53f Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 28 Apr 2025 11:48:30 +0200 Subject: [PATCH 5/5] minor --- .../source/class/osparc/dashboard/CardBase.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js b/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js index 40767cfa991..63eead024d0 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js @@ -125,15 +125,6 @@ qx.Class.define("osparc.dashboard.CardBase", { switch (sharedWith) { case "show-all": return false; - case "shared-with-everyone": { - const everyoneGroupIds = [ - groupsStore.getEveryoneProductGroup().getGroupId(), - groupsStore.getEveryoneGroup().getGroupId(), - ]; - const found = Object.keys(checks).some(gId => everyoneGroupIds.includes(parseInt(gId))); - // show those that are shared with "1" or product everyone's groupId - return !found; - } case "my-resources": { if (myGroupId in checks) { const myAccessRights = checks[myGroupId]; @@ -153,6 +144,15 @@ qx.Class.define("osparc.dashboard.CardBase", { // if we get here, it means that it was shared-with-me via an organization return false; } + case "shared-with-everyone": { + const everyoneGroupIds = [ + groupsStore.getEveryoneProductGroup().getGroupId(), + groupsStore.getEveryoneGroup().getGroupId(), + ]; + const found = Object.keys(checks).some(gId => everyoneGroupIds.includes(parseInt(gId))); + // show those that are shared with "1" or product everyone's groupId + return !found; + } default: return true; }