Skip to content

Commit 8174cdc

Browse files
feat: [UIE-8792], [UIE-8794] - IAM: Roles Table pagination fix, Assign Roles Drawer UI fix (linode#12317)
* feat: [UIE-8792], [UIE-8794] - Roles Table pagination fix, Assign Roles Drawer UI fix * feat: [UIE-8792], [UIE-8794] - fix after rebase * Added changeset: IAM RBAC: Roles Table - Hide pagination when results are empty or only one short page, fix styling issues in Assign Roles Drawer
1 parent c9f2652 commit 8174cdc

File tree

7 files changed

+31
-19
lines changed

7 files changed

+31
-19
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@linode/manager": Upcoming Features
3+
---
4+
5+
IAM RBAC: Roles Table - Hide pagination when results are empty or only one short page, fix styling issues in Assign Roles Drawer ([#12317](https://github.com/linode/manager/pull/12317))

packages/manager/src/features/IAM/Roles/RolesTable/AssignSelectedRolesDrawer.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,11 @@ export const AssignSelectedRolesDrawer = ({
118118
};
119119

120120
return (
121-
<Drawer onClose={onClose} open={open} title="Assign Selected Roles to User">
121+
<Drawer
122+
onClose={onClose}
123+
open={open}
124+
title={`Assign Role${selectedRoles.length > 1 ? `s` : ``}`}
125+
>
122126
<FormProvider {...form}>
123127
<form onSubmit={handleSubmit(onSubmit)}>
124128
{formState.errors.root?.message && (
@@ -139,10 +143,12 @@ export const AssignSelectedRolesDrawer = ({
139143
direction="column"
140144
sx={() => ({
141145
justifyContent: 'space-between',
142-
marginBottom: theme.spacingFunction(16),
146+
marginBottom: theme.spacingFunction(20),
143147
})}
144148
>
145-
<Typography variant={'h3'}>Users</Typography>
149+
<Typography mb={theme.spacingFunction(8)} variant="h3">
150+
Users
151+
</Typography>
146152
{allUsers && allUsers?.data?.length > 0 && (
147153
<Controller
148154
control={control}
@@ -160,7 +166,6 @@ export const AssignSelectedRolesDrawer = ({
160166
}}
161167
options={getUserOptions() || []}
162168
placeholder="Select a User"
163-
sx={{ marginTop: theme.tokens.spacing.S12 }}
164169
textFieldProps={{ hideLabel: true }}
165170
/>
166171
)}
@@ -175,7 +180,6 @@ export const AssignSelectedRolesDrawer = ({
175180
spacing={2}
176181
sx={() => ({
177182
justifyContent: 'space-between',
178-
marginBottom: theme.spacingFunction(16),
179183
})}
180184
>
181185
<Typography variant={'h3'}>

packages/manager/src/features/IAM/Roles/RolesTable/AssignSingleSelectedRole.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ export const AssignSingleSelectedRole = ({
2929
{index !== 0 && (
3030
<Divider
3131
sx={{
32-
marginBottom: theme.tokens.spacing.S12,
32+
marginBottom: theme.tokens.spacing.S6,
33+
marginTop: theme.tokens.spacing.S12,
3334
}}
3435
/>
3536
)}

packages/manager/src/features/IAM/Roles/RolesTable/RolesTable.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const ALL_ROLES_OPTION: SelectOption = {
3939
interface Props {
4040
roles?: RoleView[];
4141
}
42-
42+
const DEFAULT_PAGE_SIZE = 10;
4343
export const RolesTable = ({ roles = [] }: Props) => {
4444
// Filter string for the search bar
4545
const [filterString, setFilterString] = React.useState('');
@@ -288,14 +288,16 @@ export const RolesTable = ({ roles = [] }: Props) => {
288288
)}
289289
</TableBody>
290290
</Table>
291-
<Pagination
292-
count={filteredRows.length}
293-
onPageChange={handlePageChange}
294-
onPageSizeChange={handlePageSizeChange}
295-
page={pagination.page}
296-
pageSize={pagination.pageSize}
297-
style={{ borderTop: 0 }}
298-
/>
291+
{sortedRows.length !== 0 && sortedRows.length > DEFAULT_PAGE_SIZE && (
292+
<Pagination
293+
count={filteredRows.length}
294+
onPageChange={handlePageChange}
295+
onPageSizeChange={handlePageSizeChange}
296+
page={pagination.page}
297+
pageSize={pagination.pageSize}
298+
style={{ borderTop: 0 }}
299+
/>
300+
)}
299301
</Paper>
300302
<AssignSelectedRolesDrawer
301303
onClose={() => setIsDrawerOpen(false)}

packages/manager/src/features/IAM/Shared/AssignedPermissionsPanel/AssignedPermissionsPanel.style.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const StyledTitle = styled(Typography, {
2222

2323
export const StyledDescription = styled(Typography)(({ theme }) => ({
2424
marginBottom: theme.tokens.spacing.S12,
25-
marginTop: theme.tokens.spacing.S6,
25+
marginTop: theme.tokens.spacing.S8,
2626
overflowWrap: 'anywhere',
2727
wordBreak: 'normal',
2828
}));
@@ -34,5 +34,5 @@ export const StyledEntityBox = styled(Box, {
3434
})<{
3535
hideDetails: boolean | undefined;
3636
}>(({ theme, hideDetails }) => ({
37-
marginTop: !hideDetails ? theme.tokens.spacing.S12 : undefined,
37+
marginTop: !hideDetails ? theme.tokens.spacing.S16 : undefined,
3838
}));

packages/manager/src/features/IAM/Shared/Entities/Entities.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export const Entities = ({
5555
<FormLabel>
5656
<Typography
5757
sx={{
58-
marginBottom: theme.tokens.spacing.S4,
58+
marginBottom: theme.tokens.spacing.S8,
5959
font: theme.tokens.alias.Typography.Label.Bold.S,
6060
}}
6161
>

packages/manager/src/features/IAM/Shared/Permissions/Permissions.style.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { styled } from '@mui/material/styles';
44
export const StyledTitle = styled(Typography, { label: 'StyledTitle' })(
55
({ theme }) => ({
66
font: theme.tokens.alias.Typography.Label.Bold.S,
7-
marginBottom: theme.tokens.spacing.S4,
7+
marginBottom: theme.tokens.spacing.S8,
88
})
99
);
1010

0 commit comments

Comments
 (0)