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 ea593ac9239..0d335b114c1 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 @@ -17,11 +17,12 @@ import { isEmpty } from 'lodash'; import { observer } from 'mobx-react'; import { Match } from 'Models'; import React, { useEffect, useState } from 'react'; -import { useHistory, useLocation, useRouteMatch } from 'react-router-dom'; +import { Link, useHistory, useLocation, useRouteMatch } from 'react-router-dom'; import appState from '../../AppState'; import { getVersion } from '../../axiosAPIs/miscAPI'; import { getExplorePathWithSearch, + getTeamDetailsPath, navLinkSettings, ROUTES, } from '../../constants/constants'; @@ -126,23 +127,52 @@ const Appbar: React.FC = (): JSX.Element => { }, ]; - const getUserDisplayName = () => { - const name = isAuthDisabled - ? appState.users?.length > 0 - ? appState.users[0].displayName - : 'User' - : appState.userDetails.displayName || appState.userDetails.name; + const getUserData = () => { + const currentUser = isAuthDisabled + ? appState.users[0] + : appState.userDetails; + + const name = currentUser?.displayName || currentUser?.name || 'User'; + + const roles = currentUser?.roles; + + const teams = currentUser?.teams; return ( - +
{name} - +
+ {(roles?.length ?? 0) > 0 ? ( +
+
Roles
+ {roles?.map((r, i) => ( +

+ {r.displayName} +

+ ))} +
+ ) : null} +
+ {(teams?.length ?? 0) > 0 ? ( +
+ Teams + {teams?.map((t, i) => ( +

+ + {t.displayName} + +

+ ))} +
+
+ ) : null} +
); }; const profileDropdown = [ { - name: getUserDisplayName(), + name: getUserData(), to: '', disabled: false, icon: <>, diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/UsedDataUtils.ts b/openmetadata-ui/src/main/resources/ui/src/utils/UsedDataUtils.ts index 0f84930f800..f70f0ac7840 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/UsedDataUtils.ts +++ b/openmetadata-ui/src/main/resources/ui/src/utils/UsedDataUtils.ts @@ -31,7 +31,7 @@ const getAllTeams = (): void => { }; export const fetchAllUsers = () => { - getAllUsersList('profile,teams'); + getAllUsersList('profile,teams,roles'); getAllTeams(); // TODO: uncomment below line to update users list in real time. // setInterval(getAllUsersList, TIMEOUT.USER_LIST);