From 53848e399247ec578cbc1fcad02e0a15a7eea82f Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 9 Jan 2025 15:42:58 +0100 Subject: [PATCH 01/11] lazy load tooltip, this can be an expensive call --- .../source/class/osparc/dashboard/CardBase.js | 78 +++++++++++-------- 1 file changed, 44 insertions(+), 34 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 2be758253a0..8a45143e191 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js @@ -148,7 +148,7 @@ qx.Class.define("osparc.dashboard.CardBase", { return false; }, - populateShareIcon: async function(shareIcon, accessRights) { + populateShareIcon: function(shareIcon, accessRights) { const gids = Object.keys(accessRights).map(key => parseInt(key)); const groupsStore = osparc.store.Groups.getInstance(); @@ -169,6 +169,16 @@ qx.Class.define("osparc.dashboard.CardBase", { } // Tooltip + const canIWrite = osparc.data.model.Study.canIWrite(accessRights); + if (gids.length === 0) { + if (canIWrite) { + shareIcon.set({ + toolTipText: qx.locale.Manager.tr("Share") + }); + } + return; + } + const sharedGrps = []; const groups = []; groups.push(groupEveryone); @@ -181,43 +191,43 @@ qx.Class.define("osparc.dashboard.CardBase", { gids.splice(idx, 1); } }); - // once the groups were removed, the remaining group ids are users' primary groups ids - const usersStore = osparc.store.Users.getInstance(); - const myGroupId = groupsStore.getMyGroupId(); - for (let i=0; i { + hint.show(); + + // lazy load tooltip, this can be an expensive call + + // once the groups were removed, the remaining group ids are users' primary groups ids + const usersStore = osparc.store.Users.getInstance(); + const myGroupId = groupsStore.getMyGroupId(); + for (let i=0; i maxItems) { - sharedGrpLabels.push("..."); - break; - } - const sharedGrpLabel = sharedGrps[i].getLabel(); - if (!sharedGrpLabels.includes(sharedGrpLabel)) { - sharedGrpLabels.push(sharedGrpLabel); + if (hint.getText() === "") { + const sharedGrpLabels = []; + const maxItems = 6; + for (let i=0; i maxItems) { + sharedGrpLabels.push("..."); + break; + } + const sharedGrpLabel = sharedGrps[i].getLabel(); + if (!sharedGrpLabels.includes(sharedGrpLabel)) { + sharedGrpLabels.push(sharedGrpLabel); + } + } + const hintText = sharedGrpLabels.join("
"); + hint.setText(hintText) } - } - const hintText = sharedGrpLabels.join("
"); - const hint = new osparc.ui.hint.Hint(shareIcon, hintText); - shareIcon.addListener("mouseover", () => hint.show(), this); + }, this); shareIcon.addListener("mouseout", () => hint.exclude(), this); }, }, From 23930f651999881a327ff63f90743f2a16180401 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 9 Jan 2025 15:49:20 +0100 Subject: [PATCH 02/11] minor --- .../client/source/class/osparc/share/Collaborators.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 cdeeb99c419..6eedcc1483f 100644 --- a/services/static-webserver/client/source/class/osparc/share/Collaborators.js +++ b/services/static-webserver/client/source/class/osparc/share/Collaborators.js @@ -194,7 +194,7 @@ qx.Class.define("osparc.share.Collaborators", { switch (this._resourceType) { case "study": case "template": - canIShare = osparc.study.Utils.canIWrite(this._serializedDataCopy["accessRights"]); + canIShare = osparc.data.model.Study.canIWrite(this._serializedDataCopy["accessRights"]); break; case "service": canIShare = osparc.service.Utils.canIWrite(this._serializedDataCopy["accessRights"]); From d81842a63da9f043cb4b7f32fd35ca7fddeae3e9 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 9 Jan 2025 16:31:00 +0100 Subject: [PATCH 03/11] load users on demand --- .../class/osparc/share/Collaborators.js | 19 +++++++++++++------ .../source/class/osparc/store/Groups.js | 7 +------ 2 files changed, 14 insertions(+), 12 deletions(-) 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 6eedcc1483f..1e47463e828 100644 --- a/services/static-webserver/client/source/class/osparc/share/Collaborators.js +++ b/services/static-webserver/client/source/class/osparc/share/Collaborators.js @@ -392,7 +392,7 @@ qx.Class.define("osparc.share.Collaborators", { return null; }, - _reloadCollaboratorsList: function() { + _reloadCollaboratorsList: async function() { // reload "Share with..." list if (this.__addCollaborators) { const serializedDataCopy = osparc.utils.Utils.deepCloneObject(this._serializedDataCopy); @@ -412,10 +412,17 @@ qx.Class.define("osparc.share.Collaborators", { const accessRights = this._serializedDataCopy["accessRights"]; const collaboratorsList = []; const showOptions = this.__canIChangePermissions(); - const allGroupsAndUsers = groupsStore.getAllGroupsAndUsers(); - Object.keys(accessRights).forEach(gid => { - if (gid in allGroupsAndUsers) { - const collab = allGroupsAndUsers[gid]; + const allGroups = groupsStore.getAllGroups(); + const usersStore = osparc.store.Users.getInstance(); + for (let i=0; i this.__collaboratorsModel.append(qx.data.marshal.Json.createModel(c))); }, diff --git a/services/static-webserver/client/source/class/osparc/store/Groups.js b/services/static-webserver/client/source/class/osparc/store/Groups.js index 9f4a1b9ac14..e367f0e9cbb 100644 --- a/services/static-webserver/client/source/class/osparc/store/Groups.js +++ b/services/static-webserver/client/source/class/osparc/store/Groups.js @@ -131,7 +131,7 @@ qx.Class.define("osparc.store.Groups", { }) }, - getAllGroupsAndUsers: function() { + getAllGroups: function() { const allGroupsAndUsers = {}; const groupEveryone = this.getEveryoneGroup(); @@ -147,11 +147,6 @@ qx.Class.define("osparc.store.Groups", { allGroupsAndUsers[organization.getGroupId()] = organization; }); - const users = osparc.store.Users.getInstance().getUsers(); - users.forEach(user => { - allGroupsAndUsers[user.getGroupId()] = user; - }); - return allGroupsAndUsers; }, From 75f04ccb9aa5882d4583550d03eda978d77e85b8 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 9 Jan 2025 16:53:02 +0100 Subject: [PATCH 04/11] minor --- .../source/class/osparc/form/tag/TagItem.js | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/form/tag/TagItem.js b/services/static-webserver/client/source/class/osparc/form/tag/TagItem.js index c1a458426c7..80b163c32df 100644 --- a/services/static-webserver/client/source/class/osparc/form/tag/TagItem.js +++ b/services/static-webserver/client/source/class/osparc/form/tag/TagItem.js @@ -109,10 +109,8 @@ qx.Class.define("osparc.form.tag.TagItem", { control = new qx.ui.basic.Image().set({ minWidth: 30, alignY: "middle", - cursor: "pointer", }); - osparc.dashboard.CardBase.populateShareIcon(control, this.getAccessRights()) - control.addListener("tap", () => this.__openAccessRights(), this); + osparc.dashboard.CardBase.populateShareIcon(control, this.getAccessRights()); break; case "name-input": control = new qx.ui.form.TextField().set({ @@ -202,7 +200,6 @@ qx.Class.define("osparc.form.tag.TagItem", { this._add(this.getChildControl("description"), { flex: 1 }); - this._add(this.getChildControl("shared-icon")); this._add(this.__tagItemButtons()); this.resetBackgroundColor(); }, @@ -228,21 +225,32 @@ qx.Class.define("osparc.form.tag.TagItem", { const canIWrite = osparc.share.CollaboratorsTag.canIWrite(this.getMyAccessRights()); const canIDelete = osparc.share.CollaboratorsTag.canIDelete(this.getMyAccessRights()); - const buttonContainer = new qx.ui.container.Composite(new qx.ui.layout.HBox()); + const buttonContainer = new qx.ui.container.Composite(new qx.ui.layout.HBox(5)); + + const sharedIcon = this.getChildControl("shared-icon"); + sharedIcon.set({ + cursor: canIWrite ? "pointer" : null, + }); + if (canIWrite) { + sharedIcon.addListener("tap", () => this.__openAccessRights(), this); + } + buttonContainer.add(sharedIcon); + const editButton = new qx.ui.form.Button().set({ icon: "@FontAwesome5Solid/pencil-alt/12", toolTipText: this.tr("Edit"), enabled: canIWrite, }); + buttonContainer.add(editButton); + editButton.addListener("execute", () => this.setMode(this.self().modes.EDIT), this); + const deleteButton = new osparc.ui.form.FetchButton().set({ appearance: "danger-button", icon: "@FontAwesome5Solid/trash/12", toolTipText: this.tr("Delete"), enabled: canIDelete, }); - buttonContainer.add(editButton); buttonContainer.add(deleteButton); - editButton.addListener("execute", () => this.setMode(this.self().modes.EDIT), this); deleteButton.addListener("execute", () => { deleteButton.setFetching(true); osparc.store.Tags.getInstance().deleteTag(this.getId()) @@ -250,6 +258,7 @@ qx.Class.define("osparc.form.tag.TagItem", { .catch(console.error) .finally(() => deleteButton.setFetching(false)); }, this); + return buttonContainer; }, /** From 016ef3870e84962e730f2886750484b608fbba23 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 9 Jan 2025 17:00:50 +0100 Subject: [PATCH 05/11] minors --- .../client/source/class/osparc/form/tag/TagItem.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/services/static-webserver/client/source/class/osparc/form/tag/TagItem.js b/services/static-webserver/client/source/class/osparc/form/tag/TagItem.js index 80b163c32df..bb31a989cc2 100644 --- a/services/static-webserver/client/source/class/osparc/form/tag/TagItem.js +++ b/services/static-webserver/client/source/class/osparc/form/tag/TagItem.js @@ -14,6 +14,9 @@ qx.Class.define("osparc.form.tag.TagItem", { construct: function() { this.base(arguments); this._setLayout(new qx.ui.layout.HBox(5)); + this.set({ + alignY: "middle", + }); this.__validationManager = new qx.ui.form.validation.Manager(); }, @@ -94,7 +97,9 @@ qx.Class.define("osparc.form.tag.TagItem", { let control; switch (id) { case "tag": - control = new osparc.ui.basic.Tag(); + control = new osparc.ui.basic.Tag().set({ + alignY: "middle", + }); this.bind("name", control, "value"); this.bind("color", control, "color"); break; @@ -102,6 +107,7 @@ qx.Class.define("osparc.form.tag.TagItem", { control = new qx.ui.basic.Label().set({ rich: true, allowGrowX: true, + alignY: "middle", }); this.bind("description", control, "value"); break; From 55cd314df6abb41ff5eb85822e39c89c8b5c66df Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 9 Jan 2025 17:13:50 +0100 Subject: [PATCH 06/11] minor --- .../client/source/class/osparc/share/Collaborators.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 1e47463e828..004666fcbab 100644 --- a/services/static-webserver/client/source/class/osparc/share/Collaborators.js +++ b/services/static-webserver/client/source/class/osparc/share/Collaborators.js @@ -415,7 +415,7 @@ qx.Class.define("osparc.share.Collaborators", { const allGroups = groupsStore.getAllGroups(); const usersStore = osparc.store.Users.getInstance(); for (let i=0; i Date: Thu, 9 Jan 2025 17:54:43 +0100 Subject: [PATCH 07/11] wallet members on demand --- .../class/osparc/desktop/wallets/MembersList.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/desktop/wallets/MembersList.js b/services/static-webserver/client/source/class/osparc/desktop/wallets/MembersList.js index a55b47e9ec4..fe239b9f7ef 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/wallets/MembersList.js +++ b/services/static-webserver/client/source/class/osparc/desktop/wallets/MembersList.js @@ -208,13 +208,15 @@ qx.Class.define("osparc.desktop.wallets.MembersList", { const myGroupId = osparc.auth.Data.getInstance().getGroupId(); const membersList = []; - const potentialCollaborators = osparc.store.Groups.getInstance().getPotentialCollaborators(true); const canIWrite = wallet.getMyAccessRights()["write"]; - wallet.getAccessRights().forEach(accessRights => { + const accessRightss = wallet.getAccessRights(); + const usersStore = osparc.store.Users.getInstance(); + for (let i=0; i membersModel.append(qx.data.marshal.Json.createModel(member))); }, From f58f4c43cd008c09ee54ac3989adcbffbbac7821 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 9 Jan 2025 17:57:47 +0100 Subject: [PATCH 08/11] not used --- .../class/osparc/filter/OrganizationsAndMembers.js | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/filter/OrganizationsAndMembers.js b/services/static-webserver/client/source/class/osparc/filter/OrganizationsAndMembers.js index 03f07f01c97..0ca91537931 100644 --- a/services/static-webserver/client/source/class/osparc/filter/OrganizationsAndMembers.js +++ b/services/static-webserver/client/source/class/osparc/filter/OrganizationsAndMembers.js @@ -59,18 +59,6 @@ qx.Class.define("osparc.filter.OrganizationsAndMembers", { return selectedGIDs; }, - reloadVisibleCollaborators: function(collaboratorsToBeRemoved = null) { - if (collaboratorsToBeRemoved) { - this.__collaboratorsToBeRemoved = collaboratorsToBeRemoved.map(collaboratorToBeRemoved => parseInt(collaboratorToBeRemoved)); - } - - osparc.store.Groups.getInstance().getPotentialCollaborators() - .then(potentialCollaborators => { - this.__visibleCollaborators = potentialCollaborators; - this.__addOrgsAndMembers(); - }); - }, - __addOrgsAndMembers: function() { this.reset(); From 82a9278c33b958e88a569c2f6528679651bc6fc5 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Thu, 9 Jan 2025 18:04:33 +0100 Subject: [PATCH 09/11] minors --- .../client/source/class/osparc/dashboard/CardBase.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 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 8a45143e191..a72fad6b760 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js @@ -170,7 +170,8 @@ qx.Class.define("osparc.dashboard.CardBase", { // Tooltip const canIWrite = osparc.data.model.Study.canIWrite(accessRights); - if (gids.length === 0) { + const myGroupId = groupsStore.getMyGroupId(); + if (gids.length === 0 || (gids.length === 1 && gids[0] === myGroupId)) { if (canIWrite) { shareIcon.set({ toolTipText: qx.locale.Manager.tr("Share") @@ -200,7 +201,6 @@ qx.Class.define("osparc.dashboard.CardBase", { // once the groups were removed, the remaining group ids are users' primary groups ids const usersStore = osparc.store.Users.getInstance(); - const myGroupId = groupsStore.getMyGroupId(); for (let i=0; i"); - hint.setText(hintText) + if (hintText) { + hint.setText(hintText) + } } }, this); shareIcon.addListener("mouseout", () => hint.exclude(), this); From e818f73084c41f8a4be870c2f1087783da9127b6 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 10 Jan 2025 13:16:37 +0100 Subject: [PATCH 10/11] minor --- .../client/source/class/osparc/dashboard/CardBase.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 a72fad6b760..a525d0163b4 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js @@ -226,7 +226,7 @@ qx.Class.define("osparc.dashboard.CardBase", { } const hintText = sharedGrpLabels.join("
"); if (hintText) { - hint.setText(hintText) + hint.setText(hintText); } } }, this); From 50b54172f614088010f219ad0a281549b5eb305f Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Fri, 10 Jan 2025 13:21:30 +0100 Subject: [PATCH 11/11] minor --- .../client/source/class/osparc/share/AddCollaborators.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/static-webserver/client/source/class/osparc/share/AddCollaborators.js b/services/static-webserver/client/source/class/osparc/share/AddCollaborators.js index 788650a1af3..f59327843c8 100644 --- a/services/static-webserver/client/source/class/osparc/share/AddCollaborators.js +++ b/services/static-webserver/client/source/class/osparc/share/AddCollaborators.js @@ -51,6 +51,10 @@ qx.Class.define("osparc.share.AddCollaborators", { _createChildControlImpl: function(id) { let control; switch (id) { + case "intro-text": + control = new qx.ui.basic.Label(); + this._addAt(control, 0); + break; case "buttons-layout": control = new qx.ui.container.Composite(new qx.ui.layout.HBox()); this._add(control);