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 b12a322351d..4a55c04633d 100644 --- a/services/static-webserver/client/source/class/osparc/auth/Data.js +++ b/services/static-webserver/client/source/class/osparc/auth/Data.js @@ -25,6 +25,38 @@ qx.Class.define("osparc.auth.Data", { type: "singleton", properties: { + /** + * Basic authentification with a token + */ + auth: { + init: null, + nullable: true, + check: "osparc.io.request.authentication.Token", + apply: "__applyAuth" + }, + + role: { + check: ["anonymous", "guest", "user", "tester", "product_owner", "admin"], + init: null, + nullable: false, + event: "changeRole", + apply: "__applyRole" + }, + + guest: { + check: "Boolean", + init: true, + nullable: false, + event: "changeGuest" + }, + + loggedIn: { + check: "Boolean", + nullable: false, + init: false, + event: "changeLoggedIn", + }, + /** * User Id */ @@ -43,14 +75,11 @@ qx.Class.define("osparc.auth.Data", { check: "Number" }, - /** - * Basic authentification with a token - */ - auth: { + username: { + check: "String", init: null, - nullable: true, - check: "osparc.io.request.authentication.Token", - apply: "__applyAuth" + nullable: false, + event: "changeUsername", }, /** @@ -76,34 +105,12 @@ qx.Class.define("osparc.auth.Data", { event: "changeLastName" }, - role: { - check: ["anonymous", "guest", "user", "tester", "product_owner", "admin"], - init: null, - nullable: false, - event: "changeRole", - apply: "__applyRole" - }, - - guest: { - check: "Boolean", - init: true, - nullable: false, - event: "changeGuest" - }, - expirationDate: { init: null, nullable: true, check: "Date", event: "changeExpirationDate" }, - - loggedIn: { - check: "Boolean", - nullable: false, - init: false, - event: "changeLoggedIn", - } }, members: { @@ -135,16 +142,12 @@ qx.Class.define("osparc.auth.Data", { return osparc.utils.Utils.cookie.getCookie("user") === "logout"; }, - getUserName: function() { + getFriendlyUsername: function() { const firstName = this.getFirstName(); if (firstName) { return firstName; } - const email = this.getEmail(); - if (email) { - return osparc.utils.Utils.getNameFromEmail(email); - } - return "user"; + return this.getUsername(); }, getFriendlyRole: function() { 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 5b5efeef7d0..0cdda5c49b6 100644 --- a/services/static-webserver/client/source/class/osparc/auth/Manager.js +++ b/services/static-webserver/client/source/class/osparc/auth/Manager.js @@ -240,6 +240,7 @@ qx.Class.define("osparc.auth.Manager", { const authData = osparc.auth.Data.getInstance(); authData.set({ email: profile["login"], + username: profile["userName"], firstName: profile["first_name"] || profile["login"], lastName: profile["last_name"] || "", expirationDate: "expirationDate" in profile ? new Date(profile["expirationDate"]) : null 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 1332df084a9..de1d5aeddaa 100644 --- a/services/static-webserver/client/source/class/osparc/data/Resources.js +++ b/services/static-webserver/client/source/class/osparc/data/Resources.js @@ -722,7 +722,11 @@ qx.Class.define("osparc.data.Resources", { getOne: { method: "GET", url: statics.API + "/me" - } + }, + patch: { + method: "PATCH", + url: statics.API + "/me" + }, } }, /* @@ -1117,7 +1121,11 @@ qx.Class.define("osparc.data.Resources", { postResetPassword: { method: "POST", url: statics.API + "/auth/reset-password/{code}" - } + }, + changeEmail: { + method: "POST", + url: statics.API + "/auth/change-email" + }, } }, /* 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 4ab5a8da6f4..3afec8ca34b 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 @@ -105,7 +105,7 @@ qx.Class.define("osparc.data.model.Group", { }, getGroupMemberByLogin: function(userEmail) { - return Object.values(this.getGroupMembers()).find(user => user.getLogin() === userEmail); + return Object.values(this.getGroupMembers()).find(user => user.getEmail() === userEmail); }, addGroupMember: function(user) { 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 b3c03d837c6..dc943c3202a 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,14 +28,23 @@ qx.Class.define("osparc.data.model.User", { construct: function(userData) { this.base(arguments); - const label = this.self().namesToLabel(userData["first_name"], userData["last_name"]) || userData["login"]; + let label = userData["login"]; + if (userData["first_name"]) { + label = qx.lang.String.firstUp(userData["first_name"]); + if (userData["last_name"]) { + label += " " + qx.lang.String.firstUp(userData["last_name"]); + } + } + const thumbnail = osparc.utils.Avatar.emailToThumbnail(userData["login"]); this.set({ - userId: userData.id, - groupId: userData.gid, + userId: userData["id"], + groupId: userData["gid"], label: label, - login: userData.login, - thumbnail: this.self().emailToThumbnail(userData.login), - accessRights: userData.accessRights, + username: userData["username"] || "", + firstName: userData["first_name"], + lastName: userData["last_name"], + email: userData["login"], + thumbnail, }); }, @@ -61,18 +70,32 @@ qx.Class.define("osparc.data.model.User", { event: "changeLabel", }, - login: { + username: { check: "String", nullable: true, init: null, - event: "changeLogin", + event: "changeUsername", }, - accessRights: { - check: "Object", - nullable: false, + firstName: { + init: "", + nullable: true, + check: "String", + event: "changeFirstName" + }, + + lastName: { + init: "", + nullable: true, + check: "String", + event: "changeLastName" + }, + + email: { + check: "String", + nullable: true, init: null, - event: "changeAccessRights", + event: "changeEmail", }, thumbnail: { @@ -82,21 +105,4 @@ qx.Class.define("osparc.data.model.User", { event: "changeThumbnail", }, }, - - statics: { - namesToLabel: function(firstName, lastName) { - let label = ""; - if (firstName) { - label = osparc.utils.Utils.firstsUp(firstName); - if (lastName) { - label += " " + osparc.utils.Utils.firstsUp(lastName); - } - } - return label; - }, - - emailToThumbnail: function(email) { - return osparc.utils.Avatar.getUrl(email, 32) - }, - } }); diff --git a/services/static-webserver/client/source/class/osparc/data/model/UserMember.js b/services/static-webserver/client/source/class/osparc/data/model/UserMember.js new file mode 100644 index 00000000000..82628ae33ec --- /dev/null +++ b/services/static-webserver/client/source/class/osparc/data/model/UserMember.js @@ -0,0 +1,44 @@ +/* ************************************************************************ + + 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 User data + access rights to the resource. + */ + +qx.Class.define("osparc.data.model.UserMember", { + extend: osparc.data.model.User, + + /** + * @param userData {Object} Object containing the serialized User Data + */ + construct: function(userData) { + this.base(arguments, userData); + + this.set({ + accessRights: userData["accessRights"], + }); + }, + + properties: { + accessRights: { + check: "Object", + nullable: false, + init: null, + event: "changeAccessRights", + }, + }, +}); diff --git a/services/static-webserver/client/source/class/osparc/desktop/account/MyAccount.js b/services/static-webserver/client/source/class/osparc/desktop/account/MyAccount.js index d61bbb5f4d4..2380a9745f3 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/account/MyAccount.js +++ b/services/static-webserver/client/source/class/osparc/desktop/account/MyAccount.js @@ -42,6 +42,7 @@ qx.Class.define("osparc.desktop.account.MyAccount", { }); const authData = osparc.auth.Data.getInstance(); + const email = authData.getEmail(); const avatarSize = 80; const img = new qx.ui.basic.Image().set({ @@ -56,10 +57,17 @@ qx.Class.define("osparc.desktop.account.MyAccount", { }); layout.add(img); - const name = new qx.ui.basic.Label().set({ + const usernameLabel = new qx.ui.basic.Label().set({ font: "text-14", alignX: "center" }); + authData.bind("username", usernameLabel, "value"); + layout.add(usernameLabel); + + const name = new qx.ui.basic.Label().set({ + font: "text-13", + alignX: "center" + }); layout.add(name); authData.bind("firstName", name, "value", { converter: firstName => firstName + " " + authData.getLastName() @@ -77,12 +85,6 @@ qx.Class.define("osparc.desktop.account.MyAccount", { layout.add(roleLabel); } - const emailLabel = new qx.ui.basic.Label(email).set({ - font: "text-13", - alignX: "center" - }); - layout.add(emailLabel); - if (withSpacer) { layout.add(new qx.ui.core.Spacer(15, 15)); } diff --git a/services/static-webserver/client/source/class/osparc/desktop/account/MyAccountWindow.js b/services/static-webserver/client/source/class/osparc/desktop/account/MyAccountWindow.js index 9881c9e71bd..a86eeeb9507 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/account/MyAccountWindow.js +++ b/services/static-webserver/client/source/class/osparc/desktop/account/MyAccountWindow.js @@ -22,10 +22,12 @@ qx.Class.define("osparc.desktop.account.MyAccountWindow", { this.base(arguments, "credits", this.tr("My Account")); const width = 900; - const height = 600; + const height = 700; + const maxHeight = 700; this.set({ width, - height + height, + maxHeight, }); const myAccount = this.__myAccount = new osparc.desktop.account.MyAccount(); diff --git a/services/static-webserver/client/source/class/osparc/desktop/account/ProfilePage.js b/services/static-webserver/client/source/class/osparc/desktop/account/ProfilePage.js index a4f9b773ea3..53fcc95d0b8 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/account/ProfilePage.js +++ b/services/static-webserver/client/source/class/osparc/desktop/account/ProfilePage.js @@ -12,13 +12,14 @@ Authors: * Pedro Crespo (pcrespov) + * Odei Maiz (odeimaiz) ************************************************************************ */ /** * User profile in preferences dialog * - * - user name, surname, email, avatar + * - first name, last name, username, email * */ @@ -30,12 +31,12 @@ qx.Class.define("osparc.desktop.account.ProfilePage", { this._setLayout(new qx.ui.layout.VBox(15)); - this.__userProfileData = null; - this.__userProfileModel = null; - this.__fetchProfile(); this._add(this.__createProfileUser()); + if (osparc.utils.Utils.isDevelopmentPlatform()) { + this._add(this.__createPrivacySection()); + } if (osparc.store.StaticInfo.getInstance().is2FARequired()) { this._add(this.__create2FASection()); } @@ -46,6 +47,42 @@ qx.Class.define("osparc.desktop.account.ProfilePage", { members: { __userProfileData: null, __userProfileModel: null, + __userPrivacyData: null, + __userPrivacyModel: null, + + __fetchProfile: function() { + osparc.data.Resources.getOne("profile", {}, null, false) + .then(profile => { + this.__setDataToProfile(profile); + this.__setDataToPrivacy(profile["privacy"]); + }) + .catch(err => { + console.error(err); + }); + }, + + __setDataToProfile: function(data) { + if (data) { + this.__userProfileData = data; + this.__userProfileModel.set({ + "username": data["userName"] || "", + "firstName": data["first_name"] || "", + "lastName": data["last_name"] || "", + "email": data["login"], + "expirationDate": data["expirationDate"] || null, + }); + } + }, + + __setDataToPrivacy: function(privacyData) { + if (privacyData) { + this.__userPrivacyData = privacyData; + this.__userPrivacyModel.set({ + "hideFullname": "hideFullname" in privacyData ? privacyData["hideFullname"] : true, + "hideEmail": "hideEmail" in privacyData ? privacyData["hideEmail"] : true, + }); + } + }, __createProfileUser: function() { // layout @@ -55,10 +92,13 @@ qx.Class.define("osparc.desktop.account.ProfilePage", { maxWidth: 500 }); + const username = new qx.ui.form.TextField().set({ + placeholder: this.tr("username") + }); + const firstName = new qx.ui.form.TextField().set({ placeholder: this.tr("First Name") }); - const lastName = new qx.ui.form.TextField().set({ placeholder: this.tr("Last Name") }); @@ -69,6 +109,7 @@ qx.Class.define("osparc.desktop.account.ProfilePage", { }); const form = new qx.ui.form.Form(); + form.add(username, "Username", null, "username"); form.add(firstName, "First Name", null, "firstName"); form.add(lastName, "Last Name", null, "lastName"); form.add(email, "Email", null, "email"); @@ -93,15 +134,17 @@ qx.Class.define("osparc.desktop.account.ProfilePage", { // binding to a model const raw = { + "username": "", "firstName": "", "lastName": "", "email": "", - "expirationDate": null + "expirationDate": null, }; const model = this.__userProfileModel = qx.data.marshal.Json.createModel(raw); const controller = new qx.data.controller.Object(model); + controller.addTarget(username, "value", "username", true); controller.addTarget(email, "value", "email", true); controller.addTarget(firstName, "value", "firstName", true, null, { converter: function(data) { @@ -136,59 +179,118 @@ qx.Class.define("osparc.desktop.account.ProfilePage", { updateBtn.addListener("execute", () => { if (!osparc.data.Permissions.getInstance().canDo("user.user.update", true)) { - this.__resetDataToModel(); + this.__resetUserData(); return; } - const requests = { - email: null, - names: null - }; - if (this.__userProfileData["login"] !== model.getEmail()) { - if (emailValidator.validate()) { - const emailReq = new osparc.io.request.ApiRequest("/auth/change-email", "POST"); - emailReq.setRequestData({ - "email": model.getEmail() - }); - requests.email = emailReq; - } + const patchData = {}; + if (this.__userProfileData["username"] !== model.getUsername()) { + patchData["userName"] = model.getUsername(); + } + if (this.__userProfileData["first_name"] !== model.getFirstName()) { + patchData["first_name"] = model.getFirstName(); + } + if (this.__userProfileData["last_name"] !== model.getLastName()) { + patchData["last_name"] = model.getLastName(); } - if (this.__userProfileData["first_name"] !== model.getFirstName() || this.__userProfileData["last_name"] !== model.getLastName()) { + if (Object.keys(patchData).length) { if (namesValidator.validate()) { - const profileReq = new osparc.io.request.ApiRequest("/me", "PATCH"); - profileReq.setRequestData({ - "first_name": model.getFirstName(), - "last_name": model.getLastName() - }); - requests.names = profileReq; + const params = { + data: patchData + }; + osparc.data.Resources.fetch("profile", "patch", params) + .then(() => { + this.__setDataToProfile(Object.assign(this.__userProfileData, params.data)); + osparc.auth.Manager.getInstance().updateProfile(this.__userProfileData); + const msg = this.tr("Profile updated"); + osparc.FlashMessenger.getInstance().logAs(msg, "INFO"); + }) + .catch(err => { + this.__resetUserData(); + const msg = err.message || this.tr("Failed to update profile"); + osparc.FlashMessenger.getInstance().logAs(msg, "ERROR"); + console.error(err); + }); } } + }); - Object.keys(requests).forEach(key => { - const req = requests[key]; - if (req === null) { - return; - } + return box; + }, - req.addListenerOnce("success", e => { - const reqData = e.getTarget().getRequestData(); - this.__setDataToModel(Object.assign(this.__userProfileData, reqData)); - osparc.auth.Manager.getInstance().updateProfile(this.__userProfileData); - const res = e.getTarget().getResponse(); - const msg = (res && res.data) ? res.data : this.tr("Profile updated"); - osparc.FlashMessenger.getInstance().logAs(msg, "INFO"); - }, this); + __createPrivacySection: function() { + const box = osparc.ui.window.TabbedView.createSectionBox(this.tr("Privacy")); + box.set({ + alignX: "left", + maxWidth: 500 + }); - req.addListenerOnce("fail", e => { - this.__resetDataToModel(); - const msg = osparc.data.Resources.getErrorMsg(e.getTarget().getResponse()) || this.tr("Failed to update profile"); - osparc.FlashMessenger.getInstance().logAs(msg, "ERROR"); - }, this); + const label = osparc.ui.window.TabbedView.createHelpLabel(this.tr("For Privacy reasons, you might want to hide your Full Name and/or the email to other users")); + box.add(label); - req.send(); - }); - }, this); + const hideFullname = new qx.ui.form.CheckBox().set({ + value: true + }); + const hideEmail = new qx.ui.form.CheckBox().set({ + value: true + }); + + const form = new qx.ui.form.Form(); + form.add(hideFullname, "Hide Full Name", null, "hideFullname"); + form.add(hideEmail, "Hide email", null, "hideEmail"); + box.add(new qx.ui.form.renderer.Single(form)); + + // binding to a model + const raw = { + "hideFullname": true, + "hideEmail": true, + }; + + const model = this.__userPrivacyModel = qx.data.marshal.Json.createModel(raw); + const controller = new qx.data.controller.Object(model); + controller.addTarget(hideFullname, "value", "hideFullname", true); + controller.addTarget(hideEmail, "value", "hideEmail", true); + + const privacyBtn = new qx.ui.form.Button("Update Privacy").set({ + appearance: "form-button", + alignX: "right", + allowGrowX: false + }); + box.add(privacyBtn); + privacyBtn.addListener("execute", () => { + if (!osparc.data.Permissions.getInstance().canDo("user.user.update", true)) { + this.__resetPrivacyData(); + return; + } + const patchData = { + "privacy": {} + }; + if (this.__userPrivacyData["hideFullname"] !== model.getHideFullname()) { + patchData["privacy"]["hideFullname"] = model.getHideFullname(); + } + if (this.__userPrivacyData["hideEmail"] !== model.getHideEmail()) { + patchData["privacy"]["hideEmail"] = model.getHideEmail(); + } + + if (Object.keys(patchData["privacy"]).length) { + const params = { + data: patchData + }; + osparc.data.Resources.fetch("profile", "patch", params) + .then(() => { + this.__setDataToPrivacy(Object.assign(this.__userPrivacyData, params.data["privacy"])); + const msg = this.tr("Privacy updated"); + osparc.FlashMessenger.getInstance().logAs(msg, "INFO"); + }) + .catch(err => { + this.__resetPrivacyData(); + const msg = err.message || this.tr("Failed to update privacy"); + osparc.FlashMessenger.getInstance().logAs(msg, "ERROR"); + console.error(err); + }); + } + }); return box; }, @@ -261,30 +363,12 @@ qx.Class.define("osparc.desktop.account.ProfilePage", { return box; }, - __fetchProfile: function() { - osparc.data.Resources.getOne("profile", {}, null, false) - .then(profile => { - this.__setDataToModel(profile); - }) - .catch(err => { - console.error(err); - }); - }, - - __setDataToModel: function(data) { - if (data) { - this.__userProfileData = data; - this.__userProfileModel.set({ - "firstName": data["first_name"] || "", - "lastName": data["last_name"] || "", - "email": data["login"], - "expirationDate": data["expirationDate"] || null - }); - } + __resetUserData: function() { + this.__setDataToProfile(this.__userProfileData); }, - __resetDataToModel: function() { - this.__setDataToModel(this.__userProfileData); + __resetPrivacyData: function() { + this.__setDataToPrivacy(this.__userPrivacyData); }, __createPasswordSection: function() { 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 b2e8bcda97f..0a3df0faa3b 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 (("login" in a) && ("login" in b)) { - return a["login"].localeCompare(b["login"]); + if (("email" in a) && ("email" in b)) { + return a["email"].localeCompare(b["email"]); } return 0; } @@ -156,7 +156,7 @@ qx.Class.define("osparc.desktop.organizations.MembersList", { ctrl.bindProperty("thumbnail", "thumbnail", null, item, id); ctrl.bindProperty("name", "title", null, item, id); ctrl.bindProperty("accessRights", "accessRights", null, item, id); - ctrl.bindProperty("login", "subtitleMD", null, item, id); + ctrl.bindProperty("email", "subtitleMD", null, item, id); ctrl.bindProperty("options", "options", null, item, id); ctrl.bindProperty("showOptions", "showOptions", null, item, id); }, @@ -233,7 +233,7 @@ qx.Class.define("osparc.desktop.organizations.MembersList", { member["groupId"] = groupMember.getGroupId(); member["thumbnail"] = groupMember.getThumbnail(); member["name"] = groupMember.getLabel(); - member["login"] = groupMember.getLogin(); + member["email"] = groupMember.getEmail(); member["accessRights"] = groupMember.getAccessRights(); let options = []; if (canIDelete) { 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 da72d06c4e1..4f5b1dd796a 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 (("login" in a) && ("login" in b)) { - return a["login"].localeCompare(b["login"]); + if (("email" in a) && ("email" in b)) { + return a["email"].localeCompare(b["email"]); } return 0; } @@ -172,7 +172,7 @@ qx.Class.define("osparc.desktop.wallets.MembersList", { ctrl.bindProperty("thumbnail", "thumbnail", null, item, id); ctrl.bindProperty("name", "title", null, item, id); ctrl.bindProperty("accessRights", "accessRights", null, item, id); - ctrl.bindProperty("login", "subtitleMD", null, item, id); + ctrl.bindProperty("email", "subtitleMD", null, item, id); ctrl.bindProperty("options", "options", null, item, id); ctrl.bindProperty("showOptions", "showOptions", null, item, id); }, @@ -223,7 +223,7 @@ qx.Class.define("osparc.desktop.wallets.MembersList", { collaborator["groupId"] = collab.getGroupId(); collaborator["thumbnail"] = collab.getThumbnail(); collaborator["name"] = collab.getLabel(); - collaborator["login"] = gid === myGroupId ? osparc.auth.Data.getInstance().getEmail() : collab.getLogin(); + collaborator["email"] = gid === myGroupId ? osparc.auth.Data.getInstance().getEmail() : collab.getEmail(); collaborator["accessRights"] = { read: accessRights["read"], write: accessRights["write"], 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 6100ace059d..23c061cebd3 100644 --- a/services/static-webserver/client/source/class/osparc/filter/CollaboratorToggleButton.js +++ b/services/static-webserver/client/source/class/osparc/filter/CollaboratorToggleButton.js @@ -24,10 +24,10 @@ qx.Class.define("osparc.filter.CollaboratorToggleButton", { }); let label = collaborator.getLabel(); - if ("getLogin" in collaborator) { + if ("getEmail" in collaborator) { // user - label += ` (${collaborator.getLogin()})`; - this.setToolTipText(collaborator.getLogin()); + label += ` (${collaborator.getEmail()})`; + this.setToolTipText(collaborator.getEmail()); } this.setLabel(label); diff --git a/services/static-webserver/client/source/class/osparc/product/quickStart/s4l/Welcome.js b/services/static-webserver/client/source/class/osparc/product/quickStart/s4l/Welcome.js index 518416f1373..8e4386e2258 100644 --- a/services/static-webserver/client/source/class/osparc/product/quickStart/s4l/Welcome.js +++ b/services/static-webserver/client/source/class/osparc/product/quickStart/s4l/Welcome.js @@ -55,7 +55,7 @@ qx.Class.define("osparc.product.quickStart.s4l.Welcome", { }); content.add(intro1); - const welcomeText = this.tr("Welcome onboard ") + osparc.utils.Utils.capitalize(osparc.auth.Data.getInstance().getUserName()) + ","; + const welcomeText = this.tr("Welcome onboard ") + osparc.utils.Utils.capitalize(osparc.auth.Data.getInstance().getFriendlyUsername()) + ","; const welcome = osparc.product.quickStart.Utils.createLabel(welcomeText); content.add(welcome); diff --git a/services/static-webserver/client/source/class/osparc/product/quickStart/s4lacad/Welcome.js b/services/static-webserver/client/source/class/osparc/product/quickStart/s4lacad/Welcome.js index c81b9813d51..49f5fa773dc 100644 --- a/services/static-webserver/client/source/class/osparc/product/quickStart/s4lacad/Welcome.js +++ b/services/static-webserver/client/source/class/osparc/product/quickStart/s4lacad/Welcome.js @@ -55,7 +55,7 @@ qx.Class.define("osparc.product.quickStart.s4lacad.Welcome", { }); content.add(intro1); - const welcomeText = this.tr("Welcome onboard ") + osparc.utils.Utils.capitalize(osparc.auth.Data.getInstance().getUserName()) + ","; + const welcomeText = this.tr("Welcome onboard ") + osparc.utils.Utils.capitalize(osparc.auth.Data.getInstance().getFriendlyUsername()) + ","; const welcome = osparc.product.quickStart.Utils.createLabel(welcomeText); content.add(welcome); diff --git a/services/static-webserver/client/source/class/osparc/product/quickStart/s4llite/Welcome.js b/services/static-webserver/client/source/class/osparc/product/quickStart/s4llite/Welcome.js index 77e187a1d8c..47fd5da29ab 100644 --- a/services/static-webserver/client/source/class/osparc/product/quickStart/s4llite/Welcome.js +++ b/services/static-webserver/client/source/class/osparc/product/quickStart/s4llite/Welcome.js @@ -25,7 +25,7 @@ qx.Class.define("osparc.product.quickStart.s4llite.Welcome", { members: { _populateCard: function() { - const welcomeText = this.tr("Welcome onboard ") + osparc.utils.Utils.capitalize(osparc.auth.Data.getInstance().getUserName()) + ","; + const welcomeText = this.tr("Welcome onboard ") + osparc.utils.Utils.capitalize(osparc.auth.Data.getInstance().getFriendlyUsername()) + ","; const welcome = osparc.product.quickStart.Utils.createLabel(welcomeText); this._add(welcome); diff --git a/services/static-webserver/client/source/class/osparc/product/quickStart/tis/Welcome.js b/services/static-webserver/client/source/class/osparc/product/quickStart/tis/Welcome.js index 7e6c7e2980e..25f3c6444aa 100644 --- a/services/static-webserver/client/source/class/osparc/product/quickStart/tis/Welcome.js +++ b/services/static-webserver/client/source/class/osparc/product/quickStart/tis/Welcome.js @@ -25,7 +25,7 @@ qx.Class.define("osparc.product.quickStart.tis.Welcome", { members: { _populateCard: function() { - const welcomeText = this.tr("Welcome onboard ") + osparc.utils.Utils.capitalize(osparc.auth.Data.getInstance().getUserName()) + ","; + const welcomeText = this.tr("Welcome onboard ") + osparc.utils.Utils.capitalize(osparc.auth.Data.getInstance().getFriendlyUsername()) + ","; const welcome = osparc.product.quickStart.Utils.createLabel(welcomeText); this._add(welcome); 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 4fa94acfb78..426d201d2ab 100644 --- a/services/static-webserver/client/source/class/osparc/share/Collaborators.js +++ b/services/static-webserver/client/source/class/osparc/share/Collaborators.js @@ -295,7 +295,7 @@ qx.Class.define("osparc.share.Collaborators", { 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("login", "subtitleMD", null, item, id); // user + ctrl.bindProperty("email", "subtitleMD", null, item, id); // user ctrl.bindProperty("description", "subtitle", null, item, id); // organization ctrl.bindProperty("resourceType", "resourceType", null, item, id); // Resource type ctrl.bindProperty("accessRights", "accessRights", null, item, id); @@ -413,7 +413,7 @@ qx.Class.define("osparc.share.Collaborators", { if ("getUserId" in collab) { // user collaborator["name"] = collab.getLabel(); - collaborator["login"] = collab.getLogin(); + collaborator["email"] = collab.getEmail(); } else { // org/group collaborator["label"] = collab.getLabel(); 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 08ebcc2904c..862f97d06b1 100644 --- a/services/static-webserver/client/source/class/osparc/store/Groups.js +++ b/services/static-webserver/client/source/class/osparc/store/Groups.js @@ -94,9 +94,9 @@ qx.Class.define("osparc.store.Groups", { this.setGroupMe(groupMe); const myAuthData = osparc.auth.Data.getInstance(); groupMe.set({ - label: osparc.data.model.User.namesToLabel(myAuthData.getFirstName(), myAuthData.getLastName()), - description: myAuthData.getEmail(), - thumbnail: osparc.data.model.User.emailToThumbnail(myAuthData.getEmail()), + label: myAuthData.getUsername(), + description: `${myAuthData.getFirstName()} ${myAuthData.getLastName()} - ${myAuthData.getEmail()}`, + thumbnail: osparc.utils.Avatar.emailToThumbnail(myAuthData.getEmail()), }) return orgs; }); @@ -115,7 +115,7 @@ qx.Class.define("osparc.store.Groups", { // reset group's group members group.setGroupMembers({}); orgMembers.forEach(orgMember => { - const user = new osparc.data.model.User(orgMember); + const user = new osparc.data.model.UserMember(orgMember); this.__addToUsersCache(user, groupId); }); } diff --git a/services/static-webserver/client/source/class/osparc/ui/window/TabbedView.js b/services/static-webserver/client/source/class/osparc/ui/window/TabbedView.js index cea8a1f0b06..e3c75167676 100644 --- a/services/static-webserver/client/source/class/osparc/ui/window/TabbedView.js +++ b/services/static-webserver/client/source/class/osparc/ui/window/TabbedView.js @@ -88,7 +88,9 @@ qx.Class.define("osparc.ui.window.TabbedView", { widget.set({ margin: 10 }); - page.add(widget, { + const scroll = new qx.ui.container.Scroll(); + scroll.add(widget); + page.add(scroll, { flex: 1 }); return page; diff --git a/services/static-webserver/client/source/class/osparc/utils/Avatar.js b/services/static-webserver/client/source/class/osparc/utils/Avatar.js index a2f8c378490..a2d40081bcb 100644 --- a/services/static-webserver/client/source/class/osparc/utils/Avatar.js +++ b/services/static-webserver/client/source/class/osparc/utils/Avatar.js @@ -34,7 +34,11 @@ qx.Class.define("osparc.utils.Avatar", { type: "static", statics: { - getUrl: function(email, size = 100, defIcon = "identicon", rating = "g") { + emailToThumbnail: function(email) { + return this.getUrl(email, 32) + }, + + getUrl: function(email = "", size = 100, defIcon = "identicon", rating = "g") { // MD5 (Message-Digest Algorithm) by WebToolkit let MD5 = function(s) { function L(k, d) {