Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@
"@tanstack/react-query-devtools": "5.51.24",
"@tanstack/react-router": "^1.111.11",
"@xterm/xterm": "^5.5.0",
"akamai-cds-react-components": "0.1.0",
"@akamai/cds-components": "0.0.0-20260407204557",
"@akamai/cds-icons": "0.0.0-20260407204557",
"@akamai/cds-tokens": "0.0.0-20260407204557",
"algoliasearch": "^4.14.3",
"axios": "~1.13.5",
"braintree-web": "^3.92.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ import {
useTheme,
} from '@linode/ui';
import useMediaQuery from '@mui/material/useMediaQuery';
import { Pagination } from 'akamai-cds-react-components/Pagination';
import { Pagination } from '@akamai/cds-components/react/Pagination';
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeaderCell,
TableRow,
} from 'akamai-cds-react-components/Table';
} from '@akamai/cds-components/react/Table';
import React, { useState } from 'react';

import { DebouncedSearchTextField } from 'src/components/DebouncedSearchTextField';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from '@linode/ui';
import { convertStorageUnit, pluralize } from '@linode/utilities';
import useMediaQuery from '@mui/material/useMediaQuery';
import { TableCell, TableRow } from 'akamai-cds-react-components/Table';
import { TableCell, TableRow } from '@akamai/cds-components/react/Table';
import React from 'react';

import CloudInitIcon from 'src/assets/icons/cloud-init.svg';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Box, CircleProgress, LinkButton, useTheme } from '@linode/ui';
import { Pagination } from 'akamai-cds-react-components/Pagination';
import { Pagination } from '@akamai/cds-components/react/Pagination';
import {
Table,
TableBody,
TableCell,
TableRow,
} from 'akamai-cds-react-components/Table';
} from '@akamai/cds-components/react/Table';
import React from 'react';

import { MIN_PAGE_SIZE } from 'src/components/PaginationFooter/PaginationFooter.constants';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Hidden } from '@linode/ui';
import { TableCell, TableRow } from 'akamai-cds-react-components/Table';
import { TableCell, TableRow } from '@akamai/cds-components/react/Table';
import * as React from 'react';

import { ActionMenu } from 'src/components/ActionMenu/ActionMenu';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import {
} from '@linode/ui';
import Grid from '@mui/material/Grid';
import { useTheme } from '@mui/material/styles';
import { Pagination } from 'akamai-cds-react-components/Pagination';
import { Pagination } from '@akamai/cds-components/react/Pagination';
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeaderCell,
TableRow,
} from 'akamai-cds-react-components/Table';
} from '@akamai/cds-components/react/Table';
import React from 'react';

import { Link } from 'src/components/Link';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Hidden } from '@linode/ui';
import { useTheme } from '@mui/material/styles';
import { Pagination } from 'akamai-cds-react-components/Pagination';
import { Pagination } from '@akamai/cds-components/react/Pagination';
import {
Table,
TableBody,
TableHead,
TableHeaderCell,
TableRow,
} from 'akamai-cds-react-components/Table';
} from '@akamai/cds-components/react/Table';
import React from 'react';

import { MIN_PAGE_SIZE } from 'src/components/PaginationFooter/PaginationFooter.constants';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
} from '@linode/queries';
import { Chip, Hidden } from '@linode/ui';
import { formatStorageUnits } from '@linode/utilities';
import { TableCell, TableRow } from 'akamai-cds-react-components/Table';
import { TableCell, TableRow } from '@akamai/cds-components/react/Table';
import * as React from 'react';

import { Link } from 'src/components/Link';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useTheme } from '@mui/material';
import Grid from '@mui/material/Grid';
import Paper from '@mui/material/Paper';
import { useLocation, useNavigate, useSearch } from '@tanstack/react-router';
import { Pagination } from 'akamai-cds-react-components/Pagination';
import { Pagination } from '@akamai/cds-components/react/Pagination';
import {
sortRows,
Table,
Expand All @@ -14,7 +14,7 @@ import {
TableHeaderCell,
TableRow,
TableRowExpanded,
} from 'akamai-cds-react-components/Table';
} from '@akamai/cds-components/react/Table';
import React, { useState } from 'react';

import { DebouncedSearchTextField } from 'src/components/DebouncedSearchTextField';
Expand All @@ -38,7 +38,7 @@ import {

import type { RoleView } from '../../Shared/types';
import type { SelectOption } from '@linode/ui';
import type { Order } from 'akamai-cds-react-components/Table';
import type { Order } from '@akamai/cds-components/react/Table';

const ALL_ROLES_OPTION: SelectOption = {
label: 'All Roles',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const StyledPaper = styled(Paper)(({ theme }) => ({
: theme.tokens.color.Neutrals[100],
marginTop: theme.tokens.spacing.S8,
padding: theme.tokens.spacing.S12,
boxSizing: 'border-box',
}));

export const StyledTitle = styled(Typography, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import {
Button,
Drawer,
NotificationBanner,
} from '@akamai/cds-components/react';
import {
delegationQueries,
iamQueries,
Expand All @@ -6,22 +11,12 @@ import {
useUpdateDefaultDelegationAccessQuery,
useUserRolesMutation,
} from '@linode/queries';
import {
ActionsPanel,
Drawer,
LinkButton,
Notice,
Typography,
} from '@linode/ui';
import { useTheme } from '@mui/material';
import Grid from '@mui/material/Grid';
import { useParams } from '@tanstack/react-router';
import { enqueueSnackbar } from 'notistack';
import React, { useEffect, useState } from 'react';
import { FormProvider, useFieldArray, useForm } from 'react-hook-form';

import { Link } from 'src/components/Link';
import { StyledLinkButtonBox } from 'src/components/SelectFirewallPanel/SelectFirewallPanel';
import { AssignSingleRole } from 'src/features/IAM/Users/UserRoles/AssignSingleRole';

import { useIsDefaultDelegationRolesForChildAccount } from '../../hooks/useDelegationRole';
Expand Down Expand Up @@ -131,8 +126,8 @@ export const AssignNewRoleDrawer = ({
}
enqueueSnackbar(`Roles added.`, { variant: 'success' });
handleClose();
} catch (error) {
setError(error.field ?? 'root', {
} catch {
setError('root', {
message: INTERNAL_ERROR_NO_CHANGES_SAVED,
});
}
Expand All @@ -152,50 +147,51 @@ export const AssignNewRoleDrawer = ({
}, [open, reset]);

return (
<Drawer
onClose={handleClose}
open={open}
title={
isDefaultDelegationRolesForChildAccount
<Drawer onClose={handleClose} open={open}>
<span slot="header">
{isDefaultDelegationRolesForChildAccount
? 'Add New Default Roles'
: 'Assign New Roles'
}
>
: 'Assign New Roles'}
</span>

<FormProvider {...form}>
<form onSubmit={handleSubmit(onSubmit)}>
{formState.errors.root?.message && (
<Notice text={formState.errors.root?.message} variant="error" />
<NotificationBanner
style={{ marginBottom: theme.tokens.spacing.S16 }}
text={formState.errors.root?.message}
type="error"
/>
)}

<Typography sx={{ marginBottom: 2.5 }}>
<p style={{ marginBottom: theme.tokens.spacing.S20, marginTop: 0 }}>
{isDefaultDelegationRolesForChildAccount
? 'Add a role you want to assign by default to new delegate users. Some roles require selecting entities they should apply to. Configure the first role and continue adding roles or save the assignment.'
: 'Select a role you want to assign to a user. Some roles require selecting entities they should apply to. Configure the first role and continue adding roles or save the assignment.'}{' '}
<Link to={ROLES_LEARN_MORE_LINK}>
<a href={ROLES_LEARN_MORE_LINK}>
Learn more about roles and permissions
</Link>
</a>
.
</Typography>
<Grid
container
direction="row"
spacing={2}
sx={() => ({
</p>
<div
style={{
display: 'flex',
justifyContent: 'space-between',
marginBottom: theme.tokens.spacing.S16,
})}
}}
>
<Typography variant={'h3'}>Roles</Typography>
<h3 style={{ margin: 0, fontSize: theme.tokens.font.FontSize.S }}>
Roles
</h3>
{roles.length > 0 && roles.some((field) => field.role) && (
<StyledLinkButtonBox sx={{ marginTop: 0 }}>
<LinkButton
onClick={() => setAreDetailsHidden(!areDetailsHidden)}
>
{areDetailsHidden ? 'Show' : 'Hide'} details
</LinkButton>
</StyledLinkButtonBox>
<Button
onClick={() => setAreDetailsHidden(!areDetailsHidden)}
style={{ marginTop: 0 }}
variant="link"
>
{areDetailsHidden ? 'Show' : 'Hide'} details
</Button>
)}
</Grid>
</div>

{!!accountRoles &&
fields.map((field, index) => (
Expand All @@ -211,31 +207,50 @@ export const AssignNewRoleDrawer = ({

{/* If all roles are filled, allow them to add another */}
{roles.length > 0 && roles.every((field) => field.role?.value) && (
<StyledLinkButtonBox sx={{ marginTop: theme.tokens.spacing.S12 }}>
<LinkButton onClick={() => append({ role: null })}>
Add another role
</LinkButton>
</StyledLinkButtonBox>
<Button
onClick={() => append({ role: null })}
style={{ marginTop: theme.tokens.spacing.S12 }}
variant="link"
>
Add another role
</Button>
)}
<ActionsPanel
primaryButtonProps={{
'data-testid': 'submit',
label: isDefaultDelegationRolesForChildAccount ? 'Add' : 'Assign',
type: 'submit',
loading:
<div
style={{
display: 'flex',
justifyContent: 'flex-end',
gap: theme.tokens.spacing.S8,
marginTop: theme.tokens.spacing.S16,
alignItems: 'center',
}}
>
{/* <Button onClick={handleClose} variant="secondary">
Cancel
</Button> */}
<Button
onClick={handleClose}
style={{ marginRight: theme.tokens.spacing.S8 }}
variant="link"
>
Cancel
</Button>
<Button
data-pendo-id={
isDefaultDelegationRolesForChildAccount
? IAM_ROLES_PENDO_IDS.addNewDefaultRolesDrawer
: undefined
}
processing={
isUserRolesPending ||
isDefaultRolesPending ||
formState.isSubmitting,
'data-pendo-id': isDefaultDelegationRolesForChildAccount
? IAM_ROLES_PENDO_IDS.addNewDefaultRolesDrawer
: undefined,
}}
secondaryButtonProps={{
'data-testid': 'cancel',
label: 'Cancel',
onClick: handleClose,
}}
/>
formState.isSubmitting
}
type="submit"
variant="primary"
>
{isDefaultDelegationRolesForChildAccount ? 'Add' : 'Assign'}
</Button>
</div>
</form>
</FormProvider>
</Drawer>
Expand Down
Loading
Loading