From 152f7573849a82d25f0b16397a17dbddac0f837f Mon Sep 17 00:00:00 2001 From: Shailesh Parmar Date: Tue, 5 Jul 2022 21:47:00 +0530 Subject: [PATCH] Fix: issue 5645: UI feedback 0.11 (#5853) --- .../ui/src/components/app-bar/Appbar.tsx | 47 +++++++++---------- .../common/entityPageInfo/EntityPageInfo.tsx | 4 +- 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/src/components/app-bar/Appbar.tsx b/openmetadata-ui/src/main/resources/ui/src/components/app-bar/Appbar.tsx index 1f45db8c9ea..037ff222695 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/app-bar/Appbar.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/app-bar/Appbar.tsx @@ -40,6 +40,7 @@ import { useAuth } from '../../hooks/authHooks'; import jsonData from '../../jsons/en'; import { addToRecentSearched, + getEntityName, getNonDeletedTeams, } from '../../utils/CommonUtils'; import SVGIcons, { Icons } from '../../utils/SvgUtils'; @@ -145,6 +146,20 @@ const Appbar: React.FC = (): JSX.Element => { }, ]; + const getUsersRoles = (userRoleArr: string[], name: string) => { + return ( +
+
{name}
+ {userRoleArr.map((userRole, i) => ( +

+ {userRole} +

+ ))} +
+
+ ); + }; + const getUserName = () => { const currentUser = isAuthDisabled ? appState.nonSecureUserDetails @@ -175,9 +190,9 @@ const Appbar: React.FC = (): JSX.Element => { const name = currentUser?.displayName || currentUser?.name || TERM_USER; - const roles = currentUser?.roles?.map((r) => r.displayName) || []; + const roles = currentUser?.roles?.map((r) => getEntityName(r)) || []; const inheritedRoles = - currentUser?.inheritedRoles?.map((r) => r.displayName) || []; + currentUser?.inheritedRoles?.map((r) => getEntityName(r)) || []; currentUser?.isAdmin && roles.unshift(TERM_ADMIN); @@ -190,31 +205,13 @@ const Appbar: React.FC = (): JSX.Element => { {name}
- {roles.length > 0 ? ( -
-
Roles
- {roles.map((r, i) => ( -

- {r} -

- ))} -
-
- ) : null} - {inheritedRoles.length > 0 ? ( -
-
Inherited Roles
- {inheritedRoles.map((inheritedRole, i) => ( -

- {inheritedRole} -

- ))} -
-
- ) : null} + {roles.length > 0 ? getUsersRoles(roles, 'Roles') : null} + {inheritedRoles.length > 0 + ? getUsersRoles(inheritedRoles, 'Inherited Roles') + : null} {teams.length > 0 ? (
- Teams + Teams {teams.map((t, i) => (

diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/entityPageInfo/EntityPageInfo.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/entityPageInfo/EntityPageInfo.tsx index 60b14cff306..00a3e2f5855 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/entityPageInfo/EntityPageInfo.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/entityPageInfo/EntityPageInfo.tsx @@ -200,7 +200,7 @@ const EntityPageInfo = ({ )}>