-
Notifications
You must be signed in to change notification settings - Fork 402
feat: [UIE-9357] - IAM Delegation: Default Roles table #12990
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
mpolotsk-akamai
merged 11 commits into
linode:develop
from
mpolotsk-akamai:UIE-9357-default-roles-table
Oct 29, 2025
Merged
Changes from 6 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
26cc544
feat: [UIE-9357] - IAM Delegation: Default Roles Table
abailly-akamai 679bae0
feat: [UIE-9357] - IAM Delegation: unit test
mpolotsk-akamai a906373
feat: [UIE-9357] - IAM Delegation: refactoring
mpolotsk-akamai 87db233
feat: [UIE-9357] - rebase
mpolotsk-akamai 4c7b9be
feat: [UIE-9357] - remove useAssignedRoles hook since it's no longer β¦
mpolotsk-akamai f240d78
Added changeset: IAM: Default Roles Table
mpolotsk-akamai 116c374
feat: [UIE-9357] - review fix
mpolotsk-akamai 5ace735
feat: [UIE-9357] - test fix
mpolotsk-akamai cfc7c1e
feat: [UIE-9357] - review fix
mpolotsk-akamai 189e47f
feat: [UIE-9357] - mock data fix, view entities url fix
mpolotsk-akamai d599b68
feat: [UIE-9357] - refactor
mpolotsk-akamai 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-12990-upcoming-features-1761211528417.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 | ||
| --- | ||
|
|
||
| IAM: Default Roles Table ([#12990](https://github.com/linode/manager/pull/12990)) |
23 changes: 13 additions & 10 deletions
23
packages/manager/src/features/IAM/Roles/Defaults/DefaultRoles.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 |
|---|---|---|
| @@ -1,18 +1,21 @@ | ||
| import { Paper, Stack, Typography } from '@linode/ui'; | ||
| import { Paper, Typography } from '@linode/ui'; | ||
| import * as React from 'react'; | ||
|
|
||
| import { AssignedRolesTable } from '../../Shared/AssignedRolesTable/AssignedRolesTable'; | ||
|
|
||
| export const DefaultRoles = () => { | ||
| return ( | ||
| <Paper> | ||
| <Stack> | ||
| <Typography variant="h2">Default Roles for Delegate Users</Typography> | ||
| <Typography marginTop={2}> | ||
| View and manage roles to be assigned to delegate users by default. | ||
| Note that changes implemented here will apply to only new delegate | ||
| users. For existing delegate users, use their Assigned Roles page to | ||
| update the assignment. | ||
| </Typography> | ||
| </Stack> | ||
| <Typography variant="h2">Default Roles for Delegate Users</Typography> | ||
| <Typography mt={2}> | ||
| View and manage roles to be assigned to delegate users by default. Note | ||
| that changes implemented here will apply to only new delegate users. | ||
| </Typography> | ||
| <Typography mb={2}> | ||
| For existing delegate users, use their Assigned Roles page to update the | ||
| assignment. | ||
| </Typography> | ||
| <AssignedRolesTable /> | ||
| </Paper> | ||
| ); | ||
| }; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,12 @@ | ||
| import { useAccountRoles, useUserRoles } from '@linode/queries'; | ||
| import { | ||
| useAccountRoles, | ||
| useGetDefaultDelegationAccessQuery, | ||
| useUserRoles, | ||
| } from '@linode/queries'; | ||
| import { Button, CircleProgress, Select, Typography } from '@linode/ui'; | ||
| import { useTheme } from '@mui/material'; | ||
| import Grid from '@mui/material/Grid'; | ||
| import { useNavigate, useParams } from '@tanstack/react-router'; | ||
| import { useNavigate } from '@tanstack/react-router'; | ||
| import React from 'react'; | ||
|
|
||
| import { CollapsibleTable } from 'src/components/CollapsibleTable/CollapsibleTable'; | ||
|
|
@@ -17,6 +21,7 @@ import { TableSortCell } from 'src/components/TableSortCell/TableSortCell'; | |
| import { usePaginationV2 } from 'src/hooks/usePaginationV2'; | ||
| import { useAllAccountEntities } from 'src/queries/entities/entities'; | ||
|
|
||
| import { useIsDefaultDelegationRolesForChildAccount } from '../../hooks/useDelegationRole'; | ||
| import { usePermissions } from '../../hooks/usePermissions'; | ||
| import { AssignedEntities } from '../../Users/UserRoles/AssignedEntities'; | ||
| import { AssignNewRoleDrawer } from '../../Users/UserRoles/AssignNewRoleDrawer'; | ||
|
|
@@ -65,9 +70,11 @@ const ALL_ROLES_OPTION: SelectOption = { | |
| label: 'All Assigned Roles', | ||
| value: 'all', | ||
| }; | ||
|
|
||
| export const AssignedRolesTable = () => { | ||
| const { username } = useParams({ from: '/iam/users/$username' }); | ||
| interface Props { | ||
| username?: string; | ||
| } | ||
| export const AssignedRolesTable = (props: Props) => { | ||
| const { username } = props; | ||
| const navigate = useNavigate(); | ||
| const theme = useTheme(); | ||
|
|
||
|
|
@@ -76,8 +83,33 @@ export const AssignedRolesTable = () => { | |
| const [isInitialLoad, setIsInitialLoad] = React.useState(true); | ||
| const { data: permissions } = usePermissions('account', ['is_account_admin']); | ||
|
|
||
| // Determine if we're on the default roles view based on delegation role and path | ||
| const { isDefaultDelegationRolesForChildAccount } = | ||
| useIsDefaultDelegationRolesForChildAccount(); | ||
|
|
||
| const shouldFetchDefaultRoles = | ||
| isDefaultDelegationRolesForChildAccount && !username; | ||
| const shouldFetchUserRoles = | ||
| !isDefaultDelegationRolesForChildAccount && permissions?.is_account_admin; | ||
|
mpolotsk-akamai marked this conversation as resolved.
Outdated
|
||
|
|
||
| const { data: defaultRolesData, isLoading: defaultRolesLoading } = | ||
| useGetDefaultDelegationAccessQuery({ enabled: shouldFetchDefaultRoles }); | ||
|
mpolotsk-akamai marked this conversation as resolved.
Outdated
|
||
|
|
||
| const { data: userRolesData, isLoading: userRolesLoading } = useUserRoles( | ||
| username ?? '', | ||
| shouldFetchUserRoles | ||
| ); | ||
|
|
||
| const assignedRoles = isDefaultDelegationRolesForChildAccount | ||
| ? defaultRolesData | ||
| : userRolesData; | ||
| const assignedRolesLoading = isDefaultDelegationRolesForChildAccount | ||
| ? defaultRolesLoading | ||
| : userRolesLoading; | ||
| const pagination = usePaginationV2({ | ||
| currentRoute: '/iam/users/$username/roles', | ||
| currentRoute: isDefaultDelegationRolesForChildAccount | ||
| ? '/iam/roles/defaults/roles' | ||
| : '/iam/users/$username/roles', | ||
| initialPage: 1, | ||
| preferenceKey: ASSIGNED_ROLES_TABLE_PREFERENCE_KEY, | ||
| }); | ||
|
|
@@ -139,9 +171,6 @@ export const AssignedRolesTable = () => { | |
| {} | ||
| ); | ||
|
|
||
| const { data: assignedRoles, isLoading: assignedRolesLoading } = useUserRoles( | ||
| username ?? '' | ||
| ); | ||
| const { filterableOptions, roles } = React.useMemo(() => { | ||
| if (!assignedRoles || !accountRoles) { | ||
| return { filterableOptions: [], roles: [] }; | ||
|
|
@@ -174,7 +203,7 @@ export const AssignedRolesTable = () => { | |
| const selectedRole = roleName; | ||
| navigate({ | ||
| to: '/iam/users/$username/entities', | ||
| params: { username }, | ||
| params: { username: username || '' }, | ||
| search: { selectedRole }, | ||
| }); | ||
| }; | ||
|
|
@@ -388,7 +417,9 @@ export const AssignedRolesTable = () => { | |
| : undefined | ||
| } | ||
| > | ||
| Assign New Roles | ||
| {isDefaultDelegationRolesForChildAccount | ||
| ? 'Add New Default Roles' | ||
| : 'Assign New Roles'} | ||
| </Button> | ||
| </Grid> | ||
| </Grid> | ||
|
|
@@ -401,24 +432,33 @@ export const AssignedRolesTable = () => { | |
| /> | ||
| <AssignNewRoleDrawer | ||
| assignedRoles={assignedRoles} | ||
| isDefaultRolesView={isDefaultDelegationRolesForChildAccount} | ||
|
mpolotsk-akamai marked this conversation as resolved.
Outdated
|
||
| onClose={() => setIsAssignNewRoleDrawerOpen(false)} | ||
| open={isAssignNewRoleDrawerOpen} | ||
| username={username} | ||
| /> | ||
| <ChangeRoleDrawer | ||
| assignedRoles={assignedRoles} | ||
|
mpolotsk-akamai marked this conversation as resolved.
Outdated
|
||
| isDefaultRolesView={isDefaultDelegationRolesForChildAccount} | ||
| mode={drawerMode} | ||
| onClose={() => setIsChangeRoleDrawerOpen(false)} | ||
| open={isChangeRoleDrawerOpen} | ||
| role={selectedRole} | ||
| username={username} | ||
| /> | ||
| <UnassignRoleConfirmationDialog | ||
| assignedRoles={assignedRoles} | ||
| isDefaultRolesView={isDefaultDelegationRolesForChildAccount} | ||
| onClose={() => setIsUnassignRoleDialogOpen(false)} | ||
| open={isUnassignRoleDialogOpen} | ||
| role={selectedRole} | ||
| username={username} | ||
| /> | ||
| <UpdateEntitiesDrawer | ||
| onClose={() => setIsUpdateEntitiesDrawerOpen(false)} | ||
| open={isUpdateEntitiesDrawerOpen} | ||
| role={selectedRole} | ||
| username={username} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same comment as above. This can all be cleaned up since the |
||
| /> | ||
| <RemoveAssignmentConfirmationDialog | ||
| onClose={() => setIsRemoveAssignmentDialogOpen(false)} | ||
|
|
||
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.