From 83161ea267d1f31a207384d839c06eef8b993005 Mon Sep 17 00:00:00 2001 From: Natalia Kislicyn <47418786+Nkyn@users.noreply.github.com> Date: Tue, 17 Mar 2020 08:01:22 +0100 Subject: [PATCH] Show username in tables (#946) * formatting the username is slightly improved Signed-off-by: Natalia Kislicyn * formatting the username without steams Signed-off-by: Natalia Kislicyn * formatting the username without information about first or last name Signed-off-by: Natalia Kislicyn --- .../ui/common/UserDetailsFormatter.java | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/UserDetailsFormatter.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/UserDetailsFormatter.java index 4be8966ac..6aa387b02 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/UserDetailsFormatter.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/UserDetailsFormatter.java @@ -34,7 +34,6 @@ import com.vaadin.server.VaadinService; public final class UserDetailsFormatter { private static final String TRIM_APPENDIX = "..."; - private static final String DETAIL_SEPERATOR = ", "; private UserDetailsFormatter() { } @@ -76,7 +75,7 @@ public final class UserDetailsFormatter { * * @param baseEntity * the entity - * @return the formatted 'last modefied by user name' (max 100 characters) + * @return the formatted 'last modified by user name' (max 100 characters) * cannot be */ public static String loadAndFormatLastModifiedBy(final BaseEntity baseEntity) { @@ -125,21 +124,7 @@ public final class UserDetailsFormatter { } final UserPrincipal userPrincipal = (UserPrincipal) userDetails; - - String lastname = StringUtils.defaultIfEmpty(userPrincipal.getLastname(), ""); - - if (!StringUtils.isEmpty(lastname)) { - lastname += DETAIL_SEPERATOR; - } - - final String firstAndLastname = lastname + StringUtils.defaultIfEmpty(userPrincipal.getFirstname(), ""); - - final String trimmedUsername = trimAndFormatDetail(firstAndLastname, expectedNameLength); - - if (StringUtils.isEmpty(trimmedUsername)) { - return trimAndFormatDetail(userPrincipal.getLoginname(), expectedNameLength); - } - return trimmedUsername; + return trimAndFormatDetail(userPrincipal.getLoginname(), expectedNameLength); } /**