diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Users/UsersProfile/UserProfileDetails/UserProfileDetails.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Users/UsersProfile/UserProfileDetails/UserProfileDetails.component.tsx index 5d8cb88c728..f0085561708 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Users/UsersProfile/UserProfileDetails/UserProfileDetails.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Users/UsersProfile/UserProfileDetails/UserProfileDetails.component.tsx @@ -24,6 +24,7 @@ import { ICON_DIMENSION, NO_DATA_PLACEHOLDER, } from '../../../../constants/constants'; +import { EntityType } from '../../../../enums/entity.enum'; import { ChangePasswordRequest, RequestType, @@ -36,6 +37,7 @@ import { getEntityName } from '../../../../utils/EntityUtils'; import { showErrorToast, showSuccessToast } from '../../../../utils/ToastUtils'; import { useAuthContext } from '../../../Auth/AuthProviders/AuthProvider'; import Chip from '../../../common/Chip/Chip.component'; +import { DomainLabel } from '../../../common/DomainLabel/DomainLabel.component'; import { PersonaSelectableList } from '../../../Persona/PersonaSelectableList/PersonaSelectableList.component'; import UserProfileImage from '../UserProfileImage/UserProfileImage.component'; import { UserProfileDetailsProps } from './UserProfileDetails.interface'; @@ -216,6 +218,28 @@ const UserProfileDetails = ({ [userData.email] ); + const userDomainRender = useMemo( + () => ( + + {`${t( + 'label.domain' + )} :`} + + + + + ), + [userData.domain] + ); + const handleDefaultPersonaUpdate = useCallback( async (defaultPersona?: EntityReference) => { await updateUserDetails({ ...userData, defaultPersona }); @@ -271,6 +295,9 @@ const UserProfileDetails = ({ {defaultPersonaRender} + + + {userDomainRender} {changePasswordRenderComponent} diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Users/UsersProfile/UserProfileDetails/UserProfileDetails.test.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Users/UsersProfile/UserProfileDetails/UserProfileDetails.test.tsx index 37455111270..5827f574a1b 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Users/UsersProfile/UserProfileDetails/UserProfileDetails.test.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Users/UsersProfile/UserProfileDetails/UserProfileDetails.test.tsx @@ -123,6 +123,16 @@ describe('Test User Profile Details Component', () => { expect(screen.getByTestId('default-persona-label')).toBeInTheDocument(); expect(screen.getByText('PersonaSelectableList')).toBeInTheDocument(); + // user domain + expect(screen.getByTestId('user-domain-label')).toContainHTML( + 'label.domain' + ); + expect(screen.getByTestId('domain-link')).toBeInTheDocument(); + expect(screen.getByTestId('domain-link')).toHaveAttribute( + 'href', + '/domain/Engineering' + ); + expect(screen.getByTestId('change-password-button')).toBeInTheDocument(); }); diff --git a/openmetadata-ui/src/main/resources/ui/src/mocks/User.mock.ts b/openmetadata-ui/src/main/resources/ui/src/mocks/User.mock.ts index f6fcf51227b..a70288c2a26 100644 --- a/openmetadata-ui/src/main/resources/ui/src/mocks/User.mock.ts +++ b/openmetadata-ui/src/main/resources/ui/src/mocks/User.mock.ts @@ -11,6 +11,7 @@ * limitations under the License. */ +import { EntityType } from '../enums/entity.enum'; import { User } from '../generated/entity/teams/user'; export const USER_DATA: User = { @@ -66,6 +67,15 @@ export const USER_DATA: User = { previousVersion: 3.2, }, deleted: false, + domain: { + id: '303ca53b-5050-4caa-9c4e-d4fdada76a53', + type: EntityType.DOMAIN, + name: 'Engineering', + fullyQualifiedName: 'Engineering', + description: 'description', + inherited: true, + href: 'http://localhost:8585/api/v1/domains/303ca53b-5050-4caa-9c4e-d4fdada76a53', + }, roles: [ { id: 'ed94fd7c-0974-4b87-9295-02b36c4c6bcd', diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/UserPage/UserPage.component.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/UserPage/UserPage.component.tsx index 3ef5dc1f071..631c1e57114 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/UserPage/UserPage.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/UserPage/UserPage.component.tsx @@ -47,7 +47,7 @@ const UserPage = () => { try { const res = await getUserByName( username, - 'profile,roles,teams,personas,defaultPersona' + 'profile,roles,teams,personas,defaultPersona,domain' ); setUserData(res); } catch (error) { diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/UserPage/UserPage.test.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/UserPage/UserPage.test.tsx index d30c27bed31..8eda253a763 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/UserPage/UserPage.test.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/UserPage/UserPage.test.tsx @@ -14,6 +14,7 @@ import { findByTestId, findByText, render } from '@testing-library/react'; import React from 'react'; import { MemoryRouter } from 'react-router-dom'; +import { EntityType } from '../../enums/entity.enum'; import { getUserByName } from '../../rest/userAPI'; import UserPage from './UserPage.component'; @@ -27,6 +28,15 @@ const mockUserData = { email: 'xyz@gmail.com', href: 'http://localhost:8585/api/v1/users/d6764107-e8b4-4748-b256-c86fecc66064', isAdmin: false, + domain: { + id: '303ca53b-5050-4caa-9c4e-d4fdada76a53', + type: EntityType.DOMAIN, + name: 'Engineering', + fullyQualifiedName: 'Engineering', + description: 'description', + inherited: true, + href: 'http://localhost:8585/api/v1/domains/303ca53b-5050-4caa-9c4e-d4fdada76a53', + }, profile: { images: { image: