From a8dc394f9509403681d2aef37a290e3203473f18 Mon Sep 17 00:00:00 2001 From: Ashish Gupta Date: Sun, 11 Aug 2024 20:40:53 +0530 Subject: [PATCH] Remove team column in team details page (#17387) --- .../TeamDetails/UserTab/UserTab.component.tsx | 5 +++-- .../Team/TeamDetails/UserTab/UserTab.test.tsx | 18 +++++++++++++++--- .../main/resources/ui/src/utils/Users.util.tsx | 4 +++- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Settings/Team/TeamDetails/UserTab/UserTab.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Settings/Team/TeamDetails/UserTab/UserTab.component.tsx index e0efec7d31f..851b88bfb5e 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Settings/Team/TeamDetails/UserTab/UserTab.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Settings/Team/TeamDetails/UserTab/UserTab.component.tsx @@ -96,7 +96,7 @@ export const UserTab = ({ const getCurrentTeamUsers = (team: string, paging: Partial = {}) => { setIsLoading(true); getUsers({ - fields: `${TabSpecificField.TEAMS},${TabSpecificField.ROLES}`, + fields: `${TabSpecificField.ROLES}`, limit: pageSize, team, ...paging, @@ -182,7 +182,8 @@ export const UserTab = ({ const columns: ColumnsType = useMemo(() => { const tabColumns: ColumnsType = [ - ...commonUserDetailColumns(), + // will not show teams column in the Team Page + ...commonUserDetailColumns().filter((item) => item.key !== 'teams'), { title: t('label.action-plural'), dataIndex: 'actions', diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Settings/Team/TeamDetails/UserTab/UserTab.test.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Settings/Team/TeamDetails/UserTab/UserTab.test.tsx index 1191a1ed945..271a817bede 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Settings/Team/TeamDetails/UserTab/UserTab.test.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Settings/Team/TeamDetails/UserTab/UserTab.test.tsx @@ -57,7 +57,14 @@ jest.mock( ); jest.mock('../../../../../utils/Users.util', () => ({ - commonUserDetailColumns: jest.fn().mockImplementation(() => []), + commonUserDetailColumns: jest.fn().mockImplementation(() => [ + { title: 'label.users', dataIndex: 'users' }, + { + title: 'label.team-plural', + dataIndex: 'teams', + key: 'teams', + }, + ]), })); jest.mock('../../../../../rest/userAPI', () => ({ @@ -75,8 +82,11 @@ describe('UserTab', () => { ); - expect(getUsers).toHaveBeenCalled(); - // expect(await screen.findByRole('table')).toBeInTheDocument(); + expect(getUsers).toHaveBeenCalledWith({ + fields: 'roles', + limit: 25, + team: 'Marketing', + }); expect( await screen.findByTestId('user-selectable-list') ).toBeInTheDocument(); @@ -107,6 +117,8 @@ describe('UserTab', () => { ); expect(screen.queryByRole('table')).toBeInTheDocument(); + expect(screen.getByText('label.users')).toBeInTheDocument(); + expect(screen.queryByText('label.team-plural')).not.toBeInTheDocument(); expect( await screen.findByTestId('user-selectable-list') ).toBeInTheDocument(); diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/Users.util.tsx b/openmetadata-ui/src/main/resources/ui/src/utils/Users.util.tsx index 73aef1d11e4..b396217f016 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/Users.util.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/utils/Users.util.tsx @@ -30,7 +30,9 @@ import { getRoleWithFqnPath, getTeamsWithFqnPath } from './RouterUtils'; export const userCellRenderer = (user: EntityReference | User) => { return user.name ? ( - +
+ +
) : ( getEntityName(user) );