Remove team column in team details page (#17387)

This commit is contained in:
Ashish Gupta 2024-08-11 20:40:53 +05:30 committed by GitHub
parent eb3cddae4d
commit a8dc394f95
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 21 additions and 6 deletions

View File

@ -96,7 +96,7 @@ export const UserTab = ({
const getCurrentTeamUsers = (team: string, paging: Partial<Paging> = {}) => {
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<User> = useMemo(() => {
const tabColumns: ColumnsType<User> = [
...commonUserDetailColumns(),
// will not show teams column in the Team Page
...commonUserDetailColumns().filter((item) => item.key !== 'teams'),
{
title: t('label.action-plural'),
dataIndex: 'actions',

View File

@ -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', () => {
</BrowserRouter>
);
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();

View File

@ -30,7 +30,9 @@ import { getRoleWithFqnPath, getTeamsWithFqnPath } from './RouterUtils';
export const userCellRenderer = (user: EntityReference | User) => {
return user.name ? (
<UserPopOverCard showUserName profileWidth={16} userName={user.name} />
<div className="w-fit-content">
<UserPopOverCard showUserName profileWidth={16} userName={user.name} />
</div>
) : (
getEntityName(user)
);