Skip to content

Commit

Permalink
getFullName
Browse files Browse the repository at this point in the history
  • Loading branch information
odeimaiz committed Dec 17, 2024
1 parent ad1d4af commit 800e322
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
11 changes: 11 additions & 0 deletions services/static-webserver/client/source/class/osparc/auth/Data.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, " ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 800e322

Please sign in to comment.