From 1c20d4e76866a7366bb45534de1fccf3c0ca28b3 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 10 Dec 2024 16:18:14 +0100 Subject: [PATCH 01/20] add members by username --- .../osparc/desktop/organizations/MembersList.js | 14 +++++++------- .../client/source/class/osparc/store/Groups.js | 11 +++++++---- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/desktop/organizations/MembersList.js b/services/static-webserver/client/source/class/osparc/desktop/organizations/MembersList.js index 0a3df0faa3b..58cadd52612 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/organizations/MembersList.js +++ b/services/static-webserver/client/source/class/osparc/desktop/organizations/MembersList.js @@ -105,21 +105,21 @@ qx.Class.define("osparc.desktop.organizations.MembersList", { alignY: "middle" })); - const userEmail = new qx.ui.form.TextField().set({ + const newMemberUserName = new qx.ui.form.TextField().set({ required: true, - placeholder: this.tr(" New Member's email") + placeholder: this.tr(" New Member's username") }); - hBox.add(userEmail, { + hBox.add(newMemberUserName, { flex: 1 }); const validator = new qx.ui.form.validation.Manager(); - validator.add(userEmail, qx.util.Validate.email()); + validator.add(newMemberUserName, qx.util.Validate.email()); const addBtn = new qx.ui.form.Button(this.tr("Add")); addBtn.addListener("execute", function() { if (validator.validate()) { - this.__addMember(userEmail.getValue()); + this.__addMember(newMemberUserName.getValue()); } }, this); hBox.add(addBtn); @@ -217,7 +217,7 @@ qx.Class.define("osparc.desktop.organizations.MembersList", { const canIDelete = organization.getAccessRights()["delete"]; const introText = canIWrite ? - this.tr("You can add new members and promote or demote existing ones.") : + this.tr("You can add new members and promote or demote existing ones.
In order to add new members, type their username or email if it's public.") : this.tr("You can't add new members to this Organization. Please contact an Administrator or Manager."); this.__introLabel.setValue(introText); @@ -310,7 +310,7 @@ qx.Class.define("osparc.desktop.organizations.MembersList", { const orgId = this.__currentOrg.getGroupId(); const groupsStore = osparc.store.Groups.getInstance(); - groupsStore.postMember(orgId, orgMemberEmail) + groupsStore.addMember(orgId, orgMemberEmail) .then(newMember => { const text = orgMemberEmail + this.tr(" successfully added"); osparc.FlashMessenger.getInstance().logAs(text); 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 862f97d06b1..0a258ca221c 100644 --- a/services/static-webserver/client/source/class/osparc/store/Groups.js +++ b/services/static-webserver/client/source/class/osparc/store/Groups.js @@ -330,16 +330,19 @@ qx.Class.define("osparc.store.Groups", { // CRUD GROUP // CRUD GROUP MEMBERS - postMember: function(orgId, newMemberEmail) { + addMember: function(orgId, newMemberUserName, newMemberEmail = null) { const gid = parseInt(orgId); const params = { url: { "gid": gid }, - data: { - "email": newMemberEmail - } + data: {}, }; + if (newMemberEmail) { + params.data["email"] = newMemberEmail; + } else { + params.data["userName"] = newMemberUserName; + } return osparc.data.Resources.fetch("organizationMembers", "post", params) .then(() => { // the backend doesn't return the user back, From f0a02c7e5632914f3b25f265dacf7336216f32bb Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 10 Dec 2024 16:36:57 +0100 Subject: [PATCH 02/20] label and description for User --- .../client/source/class/osparc/data/model/Group.js | 4 ++++ .../client/source/class/osparc/data/model/User.js | 13 +++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/data/model/Group.js b/services/static-webserver/client/source/class/osparc/data/model/Group.js index 3afec8ca34b..e345265ba68 100644 --- a/services/static-webserver/client/source/class/osparc/data/model/Group.js +++ b/services/static-webserver/client/source/class/osparc/data/model/Group.js @@ -104,6 +104,10 @@ qx.Class.define("osparc.data.model.Group", { return Object.values(this.getGroupMembers()).find(user => user.getUserId() === userId); }, + getGroupMemberByUsername: function(username) { + return Object.values(this.getGroupMembers()).find(user => user.getUsername() === username); + }, + getGroupMemberByLogin: function(userEmail) { return Object.values(this.getGroupMembers()).find(user => user.getEmail() === userEmail); }, diff --git a/services/static-webserver/client/source/class/osparc/data/model/User.js b/services/static-webserver/client/source/class/osparc/data/model/User.js index dc943c3202a..8c02ff84071 100644 --- a/services/static-webserver/client/source/class/osparc/data/model/User.js +++ b/services/static-webserver/client/source/class/osparc/data/model/User.js @@ -28,22 +28,27 @@ qx.Class.define("osparc.data.model.User", { construct: function(userData) { this.base(arguments); - let label = userData["login"]; + let description = ""; if (userData["first_name"]) { - label = qx.lang.String.firstUp(userData["first_name"]); + description = userData["first_name"]; if (userData["last_name"]) { - label += " " + qx.lang.String.firstUp(userData["last_name"]); + description += " " + userData["last_name"]; } + description += " | "; + } + if (userData["login"]) { + description += userData["login"]; } const thumbnail = osparc.utils.Avatar.emailToThumbnail(userData["login"]); this.set({ userId: userData["id"], groupId: userData["gid"], - label: label, username: userData["username"] || "", firstName: userData["first_name"], lastName: userData["last_name"], email: userData["login"], + label: userData["username"], + description, thumbnail, }); }, From 3b96d0d4fdf1b7670fa85c2b31e438f21b010c73 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 10 Dec 2024 16:57:31 +0100 Subject: [PATCH 03/20] label and description --- .../source/class/osparc/data/model/User.js | 14 ++++++++++++-- .../source/class/osparc/share/Collaborators.js | 18 ++++++------------ 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/data/model/User.js b/services/static-webserver/client/source/class/osparc/data/model/User.js index 8c02ff84071..62a6ef731e1 100644 --- a/services/static-webserver/client/source/class/osparc/data/model/User.js +++ b/services/static-webserver/client/source/class/osparc/data/model/User.js @@ -28,13 +28,16 @@ qx.Class.define("osparc.data.model.User", { construct: function(userData) { this.base(arguments); + if (!userData["username"]) { + userData["username"] = "odeimaiz"; + } let description = ""; if (userData["first_name"]) { description = userData["first_name"]; if (userData["last_name"]) { description += " " + userData["last_name"]; } - description += " | "; + description += " - "; } if (userData["login"]) { description += userData["login"]; @@ -43,7 +46,7 @@ qx.Class.define("osparc.data.model.User", { this.set({ userId: userData["id"], groupId: userData["gid"], - username: userData["username"] || "", + username: userData["username"], firstName: userData["first_name"], lastName: userData["last_name"], email: userData["login"], @@ -75,6 +78,13 @@ qx.Class.define("osparc.data.model.User", { event: "changeLabel", }, + description: { + check: "String", + nullable: true, + init: null, + event: "changeDescription", + }, + username: { check: "String", nullable: true, 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 426d201d2ab..b012119b025 100644 --- a/services/static-webserver/client/source/class/osparc/share/Collaborators.js +++ b/services/static-webserver/client/source/class/osparc/share/Collaborators.js @@ -293,10 +293,8 @@ qx.Class.define("osparc.share.Collaborators", { ctrl.bindProperty("gid", "key", null, item, id); ctrl.bindProperty("collabType", "collabType", null, item, id); ctrl.bindProperty("thumbnail", "thumbnail", null, item, id); - ctrl.bindProperty("name", "title", null, item, id); // user - ctrl.bindProperty("label", "title", null, item, id); // organization - ctrl.bindProperty("email", "subtitleMD", null, item, id); // user - ctrl.bindProperty("description", "subtitle", null, item, id); // organization + ctrl.bindProperty("label", "title", null, item, id); + ctrl.bindProperty("description", "subtitleMD", null, item, id); ctrl.bindProperty("resourceType", "resourceType", null, item, id); // Resource type ctrl.bindProperty("accessRights", "accessRights", null, item, id); ctrl.bindProperty("showOptions", "showOptions", null, item, id); @@ -409,15 +407,11 @@ qx.Class.define("osparc.share.Collaborators", { const collaborator = { "gid": collab.getGroupId(), "thumbnail": collab.getThumbnail(), + "label": collab.getLabel(), + "description": collab.getDescription(), }; - if ("getUserId" in collab) { - // user - collaborator["name"] = collab.getLabel(); - collaborator["email"] = collab.getEmail(); - } else { - // org/group - collaborator["label"] = collab.getLabel(); - collaborator["description"] = collab.getDescription(); + if (!("getUserId" in collab)) { + // orgnanization if (everyoneGIds.includes(parseInt(gid))) { collaborator["thumbnail"] = "@FontAwesome5Solid/globe/32"; } else if (!collaborator["thumbnail"]) { From 64a50d358dbfa8dcfe83013b41ebbbf8d73f05cd Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 10 Dec 2024 17:02:08 +0100 Subject: [PATCH 04/20] minor --- .../client/source/class/osparc/store/Groups.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) 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 0a258ca221c..fa5ec549fa4 100644 --- a/services/static-webserver/client/source/class/osparc/store/Groups.js +++ b/services/static-webserver/client/source/class/osparc/store/Groups.js @@ -261,6 +261,14 @@ qx.Class.define("osparc.store.Groups", { return null; }, + getGroupMemberByUsername: function(orgId, username) { + const org = this.getGroup(orgId); + if (org) { + return org.getGroupMemberByUsername(username); + } + return null; + }, + getGroupMemberByLogin: function(orgId, userEmail) { const org = this.getGroup(orgId); if (org) { @@ -330,7 +338,7 @@ qx.Class.define("osparc.store.Groups", { // CRUD GROUP // CRUD GROUP MEMBERS - addMember: function(orgId, newMemberUserName, newMemberEmail = null) { + addMember: function(orgId, username, email = null) { const gid = parseInt(orgId); const params = { url: { @@ -338,10 +346,10 @@ qx.Class.define("osparc.store.Groups", { }, data: {}, }; - if (newMemberEmail) { - params.data["email"] = newMemberEmail; + if (email) { + params.data["email"] = email; } else { - params.data["userName"] = newMemberUserName; + params.data["userName"] = username; } return osparc.data.Resources.fetch("organizationMembers", "post", params) .then(() => { @@ -350,7 +358,7 @@ qx.Class.define("osparc.store.Groups", { return this.__fetchGroupMembers(gid); }) .then(() => { - const groupMember = this.getGroupMemberByLogin(gid, newMemberEmail); + const groupMember = email ? this.getGroupMemberByLogin(gid, email) : this.getGroupMemberByUsername(gid, username); if (groupMember) { return groupMember; } From f20f9b8f87f93cc9523b4ddab9d6e0cef22aabe3 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 10 Dec 2024 17:03:26 +0100 Subject: [PATCH 05/20] username is not nullable --- .../client/source/class/osparc/data/model/User.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/data/model/User.js b/services/static-webserver/client/source/class/osparc/data/model/User.js index 62a6ef731e1..99a6ac92b8b 100644 --- a/services/static-webserver/client/source/class/osparc/data/model/User.js +++ b/services/static-webserver/client/source/class/osparc/data/model/User.js @@ -87,22 +87,22 @@ qx.Class.define("osparc.data.model.User", { username: { check: "String", - nullable: true, + nullable: false, init: null, event: "changeUsername", }, firstName: { - init: "", - nullable: true, check: "String", + nullable: true, + init: "", event: "changeFirstName" }, lastName: { - init: "", - nullable: true, check: "String", + nullable: true, + init: "", event: "changeLastName" }, From 96e4ff2457bac149347efda9636d23c5564e5705 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 10 Dec 2024 17:20:02 +0100 Subject: [PATCH 06/20] minor --- .../static-webserver/client/source/class/osparc/auth/Data.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/auth/Data.js b/services/static-webserver/client/source/class/osparc/auth/Data.js index 4a55c04633d..306d3032558 100644 --- a/services/static-webserver/client/source/class/osparc/auth/Data.js +++ b/services/static-webserver/client/source/class/osparc/auth/Data.js @@ -82,12 +82,9 @@ qx.Class.define("osparc.auth.Data", { event: "changeUsername", }, - /** - * Email of logged in user, otherwise null - */ email: { init: null, - nullable: true, + nullable: true, // email of logged in user, otherwise null check: "String" }, From b9221d8ab10c82ad7b2c954327028d0eb02dbe37 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 10 Dec 2024 17:20:17 +0100 Subject: [PATCH 07/20] minor --- .../client/source/class/osparc/auth/Manager.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/auth/Manager.js b/services/static-webserver/client/source/class/osparc/auth/Manager.js index 0cdda5c49b6..ca497e5eabb 100644 --- a/services/static-webserver/client/source/class/osparc/auth/Manager.js +++ b/services/static-webserver/client/source/class/osparc/auth/Manager.js @@ -241,8 +241,8 @@ qx.Class.define("osparc.auth.Manager", { authData.set({ email: profile["login"], username: profile["userName"], - firstName: profile["first_name"] || profile["login"], - lastName: profile["last_name"] || "", + firstName: profile["first_name"], + lastName: profile["last_name"], expirationDate: "expirationDate" in profile ? new Date(profile["expirationDate"]) : null }); }, From 8a84295d50eaa0af6a56dade6b5e0372bb584929 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 10 Dec 2024 17:20:48 +0100 Subject: [PATCH 08/20] comment --- .../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 3bcd200c2ee..0d058644bce 100644 --- a/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js +++ b/services/static-webserver/client/source/class/osparc/dashboard/CardBase.js @@ -674,7 +674,7 @@ qx.Class.define("osparc.dashboard.CardBase", { __showBlockedCardFromStatus: function(lockedStatus) { const status = lockedStatus["status"]; const owner = lockedStatus["owner"]; - let toolTip = osparc.utils.Utils.firstsUp(owner["first_name"] || this.tr("A user"), owner["last_name"] || ""); + let toolTip = osparc.utils.Utils.firstsUp(owner["first_name"] || this.tr("A user"), owner["last_name"] || ""); // it will be replaced by "userName" let image = null; switch (status) { case "CLOSING": From e8b9a77ea04587abb5f749a277cf4941fc98d2ad Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 10 Dec 2024 17:21:42 +0100 Subject: [PATCH 09/20] minor --- .../client/source/class/osparc/desktop/MainPageHandler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/static-webserver/client/source/class/osparc/desktop/MainPageHandler.js b/services/static-webserver/client/source/class/osparc/desktop/MainPageHandler.js index 0872a1b627b..6e34be5d88c 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/MainPageHandler.js +++ b/services/static-webserver/client/source/class/osparc/desktop/MainPageHandler.js @@ -94,7 +94,7 @@ qx.Class.define("osparc.desktop.MainPageHandler", { lockedBy = studyData["state"]["locked"]["owner"]; } if (locked && lockedBy["user_id"] !== osparc.auth.Data.getInstance().getUserId()) { - const msg = `${studyAlias} ${qx.locale.Manager.tr("is already open by")} ${ + const msg = `${studyAlias} ${qx.locale.Manager.tr("is already open by")} ${ // it will be replaced "userName" "first_name" in lockedBy && lockedBy["first_name"] != null ? lockedBy["first_name"] : qx.locale.Manager.tr("another user.") From e07cf702fba9191e591a8d448101d8f5ba1f75a2 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 10 Dec 2024 17:40:20 +0100 Subject: [PATCH 10/20] more label and description --- .../osparc/desktop/organizations/MembersList.js | 15 ++++++++------- .../class/osparc/desktop/wallets/MembersList.js | 8 ++++---- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/desktop/organizations/MembersList.js b/services/static-webserver/client/source/class/osparc/desktop/organizations/MembersList.js index 58cadd52612..fce81bd439a 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/organizations/MembersList.js +++ b/services/static-webserver/client/source/class/osparc/desktop/organizations/MembersList.js @@ -154,9 +154,9 @@ qx.Class.define("osparc.desktop.organizations.MembersList", { ctrl.bindProperty("userId", "model", null, item, id); ctrl.bindProperty("userId", "key", null, item, id); ctrl.bindProperty("thumbnail", "thumbnail", null, item, id); - ctrl.bindProperty("name", "title", null, item, id); + ctrl.bindProperty("label", "title", null, item, id); + ctrl.bindProperty("description", "subtitleMD", null, item, id); ctrl.bindProperty("accessRights", "accessRights", null, item, id); - ctrl.bindProperty("email", "subtitleMD", null, item, id); ctrl.bindProperty("options", "options", null, item, id); ctrl.bindProperty("showOptions", "showOptions", null, item, id); }, @@ -225,15 +225,17 @@ qx.Class.define("osparc.desktop.organizations.MembersList", { enabled: canIWrite }); + const myGroupId = osparc.auth.Data.getInstance().getGroupId(); const membersList = []; const groupMembers = organization.getGroupMembers(); Object.values(groupMembers).forEach(groupMember => { + const gid = parseInt(groupMember.getGroupId()); const member = {}; - member["userId"] = groupMember.getUserId(); - member["groupId"] = groupMember.getGroupId(); + member["userId"] = gid === myGroupId ? osparc.auth.Data.getInstance().getUserId() : groupMember.getUserId(); + member["groupId"] = gid; member["thumbnail"] = groupMember.getThumbnail(); - member["name"] = groupMember.getLabel(); - member["email"] = groupMember.getEmail(); + member["label"] = groupMember.getLabel(); + member["description"] = gid === myGroupId ? osparc.auth.Data.getInstance().getEmail() : groupMember.getDescription(); member["accessRights"] = groupMember.getAccessRights(); let options = []; if (canIDelete) { @@ -287,7 +289,6 @@ qx.Class.define("osparc.desktop.organizations.MembersList", { } // Let me go? const openStudy = osparc.store.Store.getInstance().getCurrentStudy(); - const myGroupId = osparc.store.Groups.getInstance().getMyGroupId(); if ( openStudy === null && canIWrite && 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 4f5b1dd796a..b3b4226e37d 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 @@ -170,9 +170,9 @@ qx.Class.define("osparc.desktop.wallets.MembersList", { ctrl.bindProperty("userId", "key", null, item, id); ctrl.bindProperty("groupId", "gid", null, item, id); ctrl.bindProperty("thumbnail", "thumbnail", null, item, id); - ctrl.bindProperty("name", "title", null, item, id); + ctrl.bindProperty("label", "title", null, item, id); + ctrl.bindProperty("description", "subtitleMD", null, item, id); ctrl.bindProperty("accessRights", "accessRights", null, item, id); - ctrl.bindProperty("email", "subtitleMD", null, item, id); ctrl.bindProperty("options", "options", null, item, id); ctrl.bindProperty("showOptions", "showOptions", null, item, id); }, @@ -222,8 +222,8 @@ qx.Class.define("osparc.desktop.wallets.MembersList", { collaborator["userId"] = gid === myGroupId ? osparc.auth.Data.getInstance().getUserId() : collab.getUserId(); collaborator["groupId"] = collab.getGroupId(); collaborator["thumbnail"] = collab.getThumbnail(); - collaborator["name"] = collab.getLabel(); - collaborator["email"] = gid === myGroupId ? osparc.auth.Data.getInstance().getEmail() : collab.getEmail(); + collaborator["label"] = collab.getLabel(); + collaborator["description"] = gid === myGroupId ? osparc.auth.Data.getInstance().getEmail() : collab.getDescription(); collaborator["accessRights"] = { read: accessRights["read"], write: accessRights["write"], From e9ccc9f99d3ddc97ba8493bca5073a5a7c1a5c2f Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 10 Dec 2024 17:42:23 +0100 Subject: [PATCH 11/20] remove this --- .../client/source/class/osparc/data/model/User.js | 1 + 1 file changed, 1 insertion(+) diff --git a/services/static-webserver/client/source/class/osparc/data/model/User.js b/services/static-webserver/client/source/class/osparc/data/model/User.js index 99a6ac92b8b..a8af0ddca72 100644 --- a/services/static-webserver/client/source/class/osparc/data/model/User.js +++ b/services/static-webserver/client/source/class/osparc/data/model/User.js @@ -28,6 +28,7 @@ qx.Class.define("osparc.data.model.User", { construct: function(userData) { this.base(arguments); + // OM remove this if (!userData["username"]) { userData["username"] = "odeimaiz"; } From e9e790ce81872824378d99115388c27c59cf54a4 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 10 Dec 2024 17:44:41 +0100 Subject: [PATCH 12/20] sort by label --- .../source/class/osparc/desktop/organizations/MembersList.js | 4 ++-- .../client/source/class/osparc/desktop/wallets/MembersList.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/desktop/organizations/MembersList.js b/services/static-webserver/client/source/class/osparc/desktop/organizations/MembersList.js index fce81bd439a..462419dcee5 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/organizations/MembersList.js +++ b/services/static-webserver/client/source/class/osparc/desktop/organizations/MembersList.js @@ -70,8 +70,8 @@ qx.Class.define("osparc.desktop.organizations.MembersList", { if (sorted !== 0) { return sorted; } - if (("email" in a) && ("email" in b)) { - return a["email"].localeCompare(b["email"]); + if (("label" in a) && ("label" in b)) { + return a["label"].localeCompare(b["label"]); } return 0; } 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 b3b4226e37d..dc27a0cfee3 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 @@ -70,8 +70,8 @@ qx.Class.define("osparc.desktop.wallets.MembersList", { if (sorted !== 0) { return sorted; } - if (("email" in a) && ("email" in b)) { - return a["email"].localeCompare(b["email"]); + if (("label" in a) && ("label" in b)) { + return a["label"].localeCompare(b["label"]); } return 0; } From b200baef27da69f33d8f68c1ba4350419ca79866 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 10 Dec 2024 17:59:23 +0100 Subject: [PATCH 13/20] username on sharing widget --- .../class/osparc/filter/CollaboratorToggleButton.js | 11 +++++------ .../class/osparc/share/NewCollaboratorsManager.js | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/filter/CollaboratorToggleButton.js b/services/static-webserver/client/source/class/osparc/filter/CollaboratorToggleButton.js index 23c061cebd3..013df17a4f3 100644 --- a/services/static-webserver/client/source/class/osparc/filter/CollaboratorToggleButton.js +++ b/services/static-webserver/client/source/class/osparc/filter/CollaboratorToggleButton.js @@ -23,13 +23,12 @@ qx.Class.define("osparc.filter.CollaboratorToggleButton", { appearance: "tagbutton" }); - let label = collaborator.getLabel(); - if ("getEmail" in collaborator) { - // user - label += ` (${collaborator.getEmail()})`; - this.setToolTipText(collaborator.getEmail()); - } + const label = collaborator.getLabel(); this.setLabel(label); + if (collaborator.getDescription()) { + const ttt = label + "
" + collaborator.getDescription(); + this.setToolTipText(ttt); + } let iconPath = null; switch (collaborator["collabType"]) { diff --git a/services/static-webserver/client/source/class/osparc/share/NewCollaboratorsManager.js b/services/static-webserver/client/source/class/osparc/share/NewCollaboratorsManager.js index fcbe5befff5..d8bfe447fd2 100644 --- a/services/static-webserver/client/source/class/osparc/share/NewCollaboratorsManager.js +++ b/services/static-webserver/client/source/class/osparc/share/NewCollaboratorsManager.js @@ -18,7 +18,7 @@ qx.Class.define("osparc.share.NewCollaboratorsManager", { showMaximize: false, autoDestroy: true, modal: true, - width: 350, + width: 300, maxHeight: 500, clickAwayClose: true }); From 24665e2ccb1d8de7148deb49e0974e1effb037d9 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 10 Dec 2024 18:02:40 +0100 Subject: [PATCH 14/20] show email on label --- .../class/osparc/filter/CollaboratorToggleButton.js | 8 ++++++-- .../source/class/osparc/share/NewCollaboratorsManager.js | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/filter/CollaboratorToggleButton.js b/services/static-webserver/client/source/class/osparc/filter/CollaboratorToggleButton.js index 013df17a4f3..0008c5d7c48 100644 --- a/services/static-webserver/client/source/class/osparc/filter/CollaboratorToggleButton.js +++ b/services/static-webserver/client/source/class/osparc/filter/CollaboratorToggleButton.js @@ -23,10 +23,14 @@ qx.Class.define("osparc.filter.CollaboratorToggleButton", { appearance: "tagbutton" }); - const label = collaborator.getLabel(); + let label = collaborator.getLabel(); + if ("getEmail" in collaborator && collaborator.getEmail()) { + label += ` (${collaborator.getEmail()})`; + } this.setLabel(label); + if (collaborator.getDescription()) { - const ttt = label + "
" + collaborator.getDescription(); + const ttt = collaborator.getLabel() + "
" + collaborator.getDescription(); this.setToolTipText(ttt); } diff --git a/services/static-webserver/client/source/class/osparc/share/NewCollaboratorsManager.js b/services/static-webserver/client/source/class/osparc/share/NewCollaboratorsManager.js index d8bfe447fd2..fcbe5befff5 100644 --- a/services/static-webserver/client/source/class/osparc/share/NewCollaboratorsManager.js +++ b/services/static-webserver/client/source/class/osparc/share/NewCollaboratorsManager.js @@ -18,7 +18,7 @@ qx.Class.define("osparc.share.NewCollaboratorsManager", { showMaximize: false, autoDestroy: true, modal: true, - width: 300, + width: 350, maxHeight: 500, clickAwayClose: true }); From 2ddda0c72466ccb7b76cf19a2c860dd1cd516d36 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 11 Dec 2024 09:54:26 +0100 Subject: [PATCH 15/20] parseInt gid and uid --- .../client/source/class/osparc/data/model/User.js | 4 ++-- .../client/source/class/osparc/store/Groups.js | 1 + .../client/source/class/osparc/store/Store.js | 12 ++++++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/data/model/User.js b/services/static-webserver/client/source/class/osparc/data/model/User.js index a8af0ddca72..59d99ce7b25 100644 --- a/services/static-webserver/client/source/class/osparc/data/model/User.js +++ b/services/static-webserver/client/source/class/osparc/data/model/User.js @@ -45,8 +45,8 @@ qx.Class.define("osparc.data.model.User", { } const thumbnail = osparc.utils.Avatar.emailToThumbnail(userData["login"]); this.set({ - userId: userData["id"], - groupId: userData["gid"], + userId: parseInt(userData["id"]), + groupId: parseInt(userData["gid"]), username: userData["username"], firstName: userData["first_name"], lastName: userData["last_name"], 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 fa5ec549fa4..21e2d4b2a29 100644 --- a/services/static-webserver/client/source/class/osparc/store/Groups.js +++ b/services/static-webserver/client/source/class/osparc/store/Groups.js @@ -231,6 +231,7 @@ qx.Class.define("osparc.store.Groups", { }, getOrganization: function(groupId) { + groupId = parseInt(groupId); if (groupId && groupId in this.getOrganizations()) { return this.getOrganizations()[groupId]; } 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 e560a643980..6b986a0a34d 100644 --- a/services/static-webserver/client/source/class/osparc/store/Store.js +++ b/services/static-webserver/client/source/class/osparc/store/Store.js @@ -55,6 +55,14 @@ qx.Class.define("osparc.store.Store", { check: "Object", init: {} }, + announcements: { + check: "Array", + init: [] + }, + maintenance: { + check: "Object", + init: {} + }, currentStudy: { check: "osparc.data.model.Study", init: null, @@ -111,10 +119,6 @@ qx.Class.define("osparc.store.Store", { init: [], event: "changeIterations" }, - maintenance: { - check: "Object", - init: {} - }, templates: { check: "Array", init: [] From 76164e8b7c89ba291e24b0259d3f64ee4cc889c6 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 11 Dec 2024 10:05:19 +0100 Subject: [PATCH 16/20] cleanup --- .../client/source/class/osparc/data/model/User.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/data/model/User.js b/services/static-webserver/client/source/class/osparc/data/model/User.js index 59d99ce7b25..2a877a41d6f 100644 --- a/services/static-webserver/client/source/class/osparc/data/model/User.js +++ b/services/static-webserver/client/source/class/osparc/data/model/User.js @@ -28,10 +28,6 @@ qx.Class.define("osparc.data.model.User", { construct: function(userData) { this.base(arguments); - // OM remove this - if (!userData["username"]) { - userData["username"] = "odeimaiz"; - } let description = ""; if (userData["first_name"]) { description = userData["first_name"]; From 526683569f8ca234ef6f584c392f1dc1f9ccc888 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 11 Dec 2024 10:05:56 +0100 Subject: [PATCH 17/20] minor --- .../class/osparc/desktop/organizations/MembersList.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/desktop/organizations/MembersList.js b/services/static-webserver/client/source/class/osparc/desktop/organizations/MembersList.js index 462419dcee5..8d7a0e59960 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/organizations/MembersList.js +++ b/services/static-webserver/client/source/class/osparc/desktop/organizations/MembersList.js @@ -304,16 +304,16 @@ qx.Class.define("osparc.desktop.organizations.MembersList", { membersList.forEach(member => membersModel.append(qx.data.marshal.Json.createModel(member))); }, - __addMember: async function(orgMemberEmail) { + __addMember: async function(newMemberIdentifier) { if (this.__currentOrg === null) { return; } const orgId = this.__currentOrg.getGroupId(); const groupsStore = osparc.store.Groups.getInstance(); - groupsStore.addMember(orgId, orgMemberEmail) + groupsStore.addMember(orgId, newMemberIdentifier) .then(newMember => { - const text = orgMemberEmail + this.tr(" successfully added"); + const text = newMemberIdentifier + this.tr(" successfully added"); osparc.FlashMessenger.getInstance().logAs(text); this.__reloadOrgMembers(); From de0e476b696d30da76c1b705e196ad29238c05ad Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 11 Dec 2024 10:07:51 +0100 Subject: [PATCH 18/20] minor --- .../client/source/class/osparc/data/model/User.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/data/model/User.js b/services/static-webserver/client/source/class/osparc/data/model/User.js index 2a877a41d6f..f0c8a5dabb1 100644 --- a/services/static-webserver/client/source/class/osparc/data/model/User.js +++ b/services/static-webserver/client/source/class/osparc/data/model/User.js @@ -43,11 +43,11 @@ qx.Class.define("osparc.data.model.User", { this.set({ userId: parseInt(userData["id"]), groupId: parseInt(userData["gid"]), - username: userData["username"], + username: userData["userName"], firstName: userData["first_name"], lastName: userData["last_name"], email: userData["login"], - label: userData["username"], + label: userData["userName"], description, thumbnail, }); From df99f3b7928be681061e5c6e90ddfa17ef650468 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 11 Dec 2024 10:18:24 +0100 Subject: [PATCH 19/20] isEmail --- .../osparc/desktop/organizations/MembersList.js | 12 ++++-------- .../client/source/class/osparc/utils/Utils.js | 5 +++++ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/desktop/organizations/MembersList.js b/services/static-webserver/client/source/class/osparc/desktop/organizations/MembersList.js index 8d7a0e59960..eeca96c04e0 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/organizations/MembersList.js +++ b/services/static-webserver/client/source/class/osparc/desktop/organizations/MembersList.js @@ -113,14 +113,9 @@ qx.Class.define("osparc.desktop.organizations.MembersList", { flex: 1 }); - const validator = new qx.ui.form.validation.Manager(); - validator.add(newMemberUserName, qx.util.Validate.email()); - const addBtn = new qx.ui.form.Button(this.tr("Add")); addBtn.addListener("execute", function() { - if (validator.validate()) { - this.__addMember(newMemberUserName.getValue()); - } + this.__addMember(newMemberUserName.getValue()); }, this); hBox.add(addBtn); @@ -217,7 +212,7 @@ qx.Class.define("osparc.desktop.organizations.MembersList", { const canIDelete = organization.getAccessRights()["delete"]; const introText = canIWrite ? - this.tr("You can add new members and promote or demote existing ones.
In order to add new members, type their username or email if it's public.") : + this.tr("You can add new members and promote or demote existing ones.
In order to add new members, type their username or email if this is public.") : this.tr("You can't add new members to this Organization. Please contact an Administrator or Manager."); this.__introLabel.setValue(introText); @@ -311,7 +306,8 @@ qx.Class.define("osparc.desktop.organizations.MembersList", { const orgId = this.__currentOrg.getGroupId(); const groupsStore = osparc.store.Groups.getInstance(); - groupsStore.addMember(orgId, newMemberIdentifier) + const isEmail = osparc.utils.Utils.isEmail(newMemberIdentifier); + isEmail ? groupsStore.addMember(orgId, null, newMemberIdentifier) : groupsStore.addMember(orgId, newMemberIdentifier) .then(newMember => { const text = newMemberIdentifier + this.tr(" successfully added"); osparc.FlashMessenger.getInstance().logAs(text); diff --git a/services/static-webserver/client/source/class/osparc/utils/Utils.js b/services/static-webserver/client/source/class/osparc/utils/Utils.js index 075db07763e..233198affb8 100644 --- a/services/static-webserver/client/source/class/osparc/utils/Utils.js +++ b/services/static-webserver/client/source/class/osparc/utils/Utils.js @@ -107,6 +107,11 @@ qx.Class.define("osparc.utils.Utils", { return newName; }, + isEmail: function(value) { + const reg = /^([A-Za-z0-9_\-.+])+@([A-Za-z0-9_\-.])+\.([A-Za-z]{2,})$/; + return reg.test(value); + }, + replaceTokens: function(str, key, value) { // `str` might be a a localized string, get the string first str = str.toString ? str.toString() : str; From 4f3a606ac36441283f75625b3565192f0ff71195 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 11 Dec 2024 10:36:17 +0100 Subject: [PATCH 20/20] callback --- .../source/class/osparc/desktop/organizations/MembersList.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/static-webserver/client/source/class/osparc/desktop/organizations/MembersList.js b/services/static-webserver/client/source/class/osparc/desktop/organizations/MembersList.js index eeca96c04e0..acd68c25680 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/organizations/MembersList.js +++ b/services/static-webserver/client/source/class/osparc/desktop/organizations/MembersList.js @@ -307,7 +307,8 @@ qx.Class.define("osparc.desktop.organizations.MembersList", { const orgId = this.__currentOrg.getGroupId(); const groupsStore = osparc.store.Groups.getInstance(); const isEmail = osparc.utils.Utils.isEmail(newMemberIdentifier); - isEmail ? groupsStore.addMember(orgId, null, newMemberIdentifier) : groupsStore.addMember(orgId, newMemberIdentifier) + const request = isEmail ? groupsStore.addMember(orgId, null, newMemberIdentifier) : groupsStore.addMember(orgId, newMemberIdentifier); + request .then(newMember => { const text = newMemberIdentifier + this.tr(" successfully added"); osparc.FlashMessenger.getInstance().logAs(text);