From 800e3228809b3d64b76b73c7a782782dd023b59e Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 17 Dec 2024 10:33:56 +0100 Subject: [PATCH] getFullName --- .../client/source/class/osparc/auth/Data.js | 11 +++++++++ .../class/osparc/desktop/account/MyAccount.js | 23 +++++++------------ .../source/class/osparc/theme/Appearance.js | 1 - 3 files changed, 19 insertions(+), 16 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 306d3032558..2a4b27a9646 100644 --- a/services/static-webserver/client/source/class/osparc/auth/Data.js +++ b/services/static-webserver/client/source/class/osparc/auth/Data.js @@ -147,6 +147,17 @@ qx.Class.define("osparc.auth.Data", { return this.getUsername(); }, + getFullName: function() { + let name = ""; + if (this.getFirstName()) { + name += this.getFirstName(); + } + if (this.getLastName()) { + name += " " + this.getLastName(); + } + return name; + }, + getFriendlyRole: function() { const role = this.getRole(); let friendlyRole = role.replace(/_/g, " "); 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 1d19d05f390..0df1dc1d8be 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 @@ -64,24 +64,17 @@ qx.Class.define("osparc.desktop.account.MyAccount", { authData.bind("username", usernameLabel, "value"); layout.add(usernameLabel); - const nameLabel = new qx.ui.basic.Label().set({ + const fullNameLabel = new qx.ui.basic.Label().set({ font: "text-13", alignX: "center" }); - layout.add(nameLabel); - const updateName = () => { - let name = ""; - if (authData.getFirstName()) { - name += authData.getFirstName(); - } - if (authData.getLastName()) { - name += " " + authData.getLastName(); - } - nameLabel.setValue(name); - } - updateName(); - authData.addListener("changeFirstName", updateName); - authData.addListener("changeLastName", updateName); + layout.add(fullNameLabel); + authData.bind("firstName", fullNameLabel, "value", { + converter: () => authData.getFullName() + }); + authData.bind("lastName", fullNameLabel, "value", { + converter: () => authData.getFullName() + }); if (authData.getRole() !== "user") { const role = authData.getFriendlyRole(); diff --git a/services/static-webserver/client/source/class/osparc/theme/Appearance.js b/services/static-webserver/client/source/class/osparc/theme/Appearance.js index f293cde9228..8f3f01bbf4c 100644 --- a/services/static-webserver/client/source/class/osparc/theme/Appearance.js +++ b/services/static-webserver/client/source/class/osparc/theme/Appearance.js @@ -576,7 +576,6 @@ qx.Theme.define("osparc.theme.Appearance", { decorator: "form-button", cursor: "pointer", padding: 5, - center: true, }; if (states.hovered) { style.decorator = "form-button-hovered";