Skip to content

Commit 98effff

Browse files
fix: [UIE-10093], [UIE-10139] - IAM Users Table: Fix pagination when the last user on a page is removed, UX copy updates (#13352)
* fix: [UIE-10093] - IAM users table UI fix * fix: [UIE-10139] - IAM UX copy updates * test fix * revert prop drilling * test fix
1 parent 7981284 commit 98effff

4 files changed

Lines changed: 24 additions & 7 deletions

File tree

packages/manager/src/features/IAM/Delegations/AccountDelegationsTableRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export const AccountDelegationsTableRow = ({ delegation, index }: Props) => {
118118
sx={{ fontStyle: 'italic', textTransform: 'capitalize' }}
119119
variant="body1"
120120
>
121-
no delegate users added
121+
No Users Added
122122
</Typography>
123123
)}
124124
</TableCell>

packages/manager/src/features/IAM/Users/UserDetails/UserEmailPanel.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,12 @@ export const UserEmailPanel = ({ activeUser }: Props) => {
4848

4949
const disabledReason = isProxyOrDelegateUserType
5050
? RESTRICTED_FIELD_TOOLTIP
51-
: profileUserName !== activeUser.username
52-
? 'You can\u{2019}t change another user\u{2019}s email address.'
53-
: undefined;
51+
: activeUser.user_type === 'delegate' &&
52+
profileUserName !== activeUser.username
53+
? 'E-mail addresses of delegate users are not displayed.'
54+
: profileUserName !== activeUser.username
55+
? 'You can\u{2019}t change another user\u{2019}s email address.'
56+
: undefined;
5457

5558
// This should be disabled if this is NOT the current user or if the proxy user is viewing their own profile.
5659
const disableEmailField =

packages/manager/src/features/IAM/Users/UsersTable/Users.tsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,11 @@ export const UsersLanding = () => {
134134
const isSmDown = useMediaQuery(theme.breakpoints.down('sm'));
135135
const isLgDown = useMediaQuery(theme.breakpoints.up('lg'));
136136

137-
const numColsLg = isLgDown ? 4 : 3;
137+
const numColsLg = isLgDown
138+
? isChildOrDelegateWithDelegationEnabled
139+
? 5
140+
: 4
141+
: 3;
138142

139143
const numCols = isSmDown ? 2 : numColsLg;
140144

@@ -159,8 +163,17 @@ export const UsersLanding = () => {
159163
setSelectedUsername(username);
160164
};
161165

162-
const canCreateUser = permissions.create_user;
166+
const handleDeleteDialogClose = () => {
167+
const removedLastOnPage =
168+
users && users?.data.length % pagination.pageSize === 1;
163169

170+
setIsDeleteDialogOpen(false);
171+
if (removedLastOnPage) {
172+
pagination.handlePageChange(pagination.page - 1);
173+
}
174+
};
175+
176+
const canCreateUser = permissions.create_user;
164177
return (
165178
<React.Fragment>
166179
<Paper sx={(theme) => ({ marginTop: theme.tokens.spacing.S16 })}>
@@ -256,7 +269,7 @@ export const UsersLanding = () => {
256269
open={isCreateDrawerOpen}
257270
/>
258271
<UserDeleteConfirmation
259-
onClose={() => setIsDeleteDialogOpen(false)}
272+
onClose={handleDeleteDialogClose}
260273
open={isDeleteDialogOpen}
261274
username={selectedUsername}
262275
/>

packages/manager/src/features/IAM/Users/UsersTable/UsersLandingTableHead.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const defaultProps = {
4545
order: 'asc' as Order,
4646
orderBy: 'username',
4747
},
48+
isChildWithDelegationEnabled: true,
4849
};
4950

5051
describe('UsersLandingTableHead', () => {

0 commit comments

Comments
 (0)