-
Notifications
You must be signed in to change notification settings - Fork 389
feat: [UIE-8140] - IAM RBAC - Assign New Roles drawer update #11834
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
cpathipa
merged 9 commits into
linode:develop
from
rodonnel-akamai:UIE-8140-assign-roles-drawer
Mar 25, 2025
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
bfa2997
UIE-8140: Assign New Roles drawer update
rodonnel-akamai 51d1b60
Added changeset: Adding in the functionality behind the Assign New Roβ¦
rodonnel-akamai b85d012
fix with using FormProvider
aaleksee-akamai 9066886
resolve conflicts and update the drawer for changing role
aaleksee-akamai 55792df
Merge branch 'develop' into UIE-8140-assign-roles-drawer
cpathipa dff6d86
Merge branch 'develop' into UIE-8140-assign-roles-drawer
cpathipa d93e488
Merge branch 'develop' into UIE-8140-assign-roles-drawer
cpathipa 0653215
Merge branch 'develop' into UIE-8140-assign-roles-drawer
cpathipa 0445403
Merge branch 'develop' into UIE-8140-assign-roles-drawer
cpathipa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
packages/manager/.changeset/pr-11834-upcoming-features-1741795011556.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@linode/manager": Upcoming Features | ||
| --- | ||
|
|
||
| Add functionality to support the 'Assign New Roles' drawer for a single user in IAM ([#11834](https://github.com/linode/manager/pull/11834)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
packages/manager/src/features/IAM/Users/UserRoles/AssignSingleRole.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| import { Autocomplete, Button } from '@linode/ui'; | ||
| import Close from '@mui/icons-material/Close'; | ||
| import { Divider, useTheme } from '@mui/material'; | ||
| import Box from '@mui/material/Box'; | ||
| import React from 'react'; | ||
| import { Controller, useFormContext } from 'react-hook-form'; | ||
|
|
||
| import { AssignedPermissionsPanel } from 'src/features/IAM/Shared/AssignedPermissionsPanel/AssignedPermissionsPanel'; | ||
| import { getRoleByName } from 'src/features/IAM/Shared/utilities'; | ||
|
|
||
| import type { IamAccountPermissions } from '@linode/api-v4'; | ||
| import type { | ||
| AssignNewRoleFormValues, | ||
| RolesType, | ||
| } from 'src/features/IAM/Shared/utilities'; | ||
|
|
||
| interface Props { | ||
| index: number; | ||
| onRemove: (idx: number) => void; | ||
| options: RolesType[]; | ||
| permissions: IamAccountPermissions; | ||
| } | ||
|
|
||
| export const AssignSingleRole = ({ | ||
| index, | ||
| onRemove, | ||
| options, | ||
| permissions, | ||
| }: Props) => { | ||
| const theme = useTheme(); | ||
|
|
||
| const { control } = useFormContext<AssignNewRoleFormValues>(); | ||
|
|
||
| return ( | ||
| <Box display="flex"> | ||
| <Box display="flex" flexDirection="column" sx={{ flex: '5 1 auto' }}> | ||
| {index !== 0 && ( | ||
| <Divider | ||
| sx={{ | ||
| marginBottom: theme.tokens.spacing.S12, | ||
| }} | ||
| /> | ||
| )} | ||
|
|
||
| <Controller | ||
| render={({ field: { onChange, value } }) => ( | ||
| <> | ||
| <Autocomplete | ||
| onChange={(event, newValue) => { | ||
| onChange(newValue); | ||
| }} | ||
| label="Assign New Roles" | ||
| options={options} | ||
| placeholder="Select a Role" | ||
| textFieldProps={{ hideLabel: true }} | ||
| value={value || null} | ||
| /> | ||
| {value && ( | ||
| <AssignedPermissionsPanel | ||
| role={getRoleByName(permissions, value.value)!} | ||
| /> | ||
| )} | ||
| </> | ||
| )} | ||
| control={control} | ||
| name={`roles.${index}.role`} | ||
| /> | ||
| </Box> | ||
| <Box | ||
| sx={{ | ||
| flex: '0 1 auto', | ||
| marginTop: | ||
| index === 0 ? -theme.tokens.spacing.S4 : theme.tokens.spacing.S16, | ||
| verticalAlign: 'top', | ||
| }} | ||
| > | ||
| <Button disabled={index === 0} onClick={() => onRemove(index)}> | ||
|
||
| <Close /> | ||
| </Button> | ||
| </Box> | ||
| </Box> | ||
| ); | ||
| }; | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The entire drawer will need to wrapped in a
FormProvider:<FormProvider {...form}>