Skip to content

Commit 97b69c1

Browse files
update cds-react-components, refactoring
1 parent 872f923 commit 97b69c1

File tree

6 files changed

+58
-68
lines changed

6 files changed

+58
-68
lines changed

packages/manager/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"@tanstack/react-query-devtools": "5.51.24",
4646
"@tanstack/react-router": "^1.111.11",
4747
"@xterm/xterm": "^5.5.0",
48-
"akamai-cds-react-components": "0.0.1-alpha.19",
48+
"akamai-cds-react-components": "0.1.0",
4949
"algoliasearch": "^4.14.3",
5050
"axios": "~1.12.0",
5151
"braintree-web": "^3.92.2",

packages/manager/src/features/Account/SwitchAccountDrawer.tsx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,9 @@ export const SwitchAccountDrawer = (props: Props) => {
234234
setPage(1); // Reset to first page when page size changes
235235
};
236236

237+
const hasError = isIAMDelegationEnabled
238+
? allChildAccountsError
239+
: childAccountInfiniteError;
237240
return (
238241
<Drawer onClose={handleClose} open={open} title="Switch Account">
239242
{createTokenErrorReason && (
@@ -266,7 +269,7 @@ export const SwitchAccountDrawer = (props: Props) => {
266269
.
267270
</Typography>
268271

269-
{(childAccountInfiniteError || allChildAccountsError) && (
272+
{hasError && (
270273
<Stack alignItems="center" gap={1} justifyContent="center">
271274
<ErrorStateCloud />
272275
<Typography>Unable to load data.</Typography>
@@ -284,7 +287,7 @@ export const SwitchAccountDrawer = (props: Props) => {
284287
</Button>
285288
</Stack>
286289
)}
287-
{!(childAccountInfiniteError || allChildAccountsError) && (
290+
{!hasError && (
288291
<>
289292
<DebouncedSearchTextField
290293
clearable
@@ -315,7 +318,11 @@ export const SwitchAccountDrawer = (props: Props) => {
315318
{isIAMDelegationEnabled && (
316319
<ChildAccountsTable
317320
childAccounts={childAccounts}
318-
currentTokenWithBearer={currentTokenWithBearer}
321+
currentTokenWithBearer={
322+
isProxyOrDelegateUserType
323+
? currentParentTokenWithBearer
324+
: currentTokenWithBearer
325+
}
319326
isLoading={isLoading}
320327
isSwitchingChildAccounts={isSwitchingChildAccounts}
321328
onClose={onClose}
@@ -334,15 +341,9 @@ export const SwitchAccountDrawer = (props: Props) => {
334341
childAccounts={childAccounts}
335342
currentTokenWithBearer={
336343
isProxyOrDelegateUserType
337-
? currentParentTokenWithBearer
338-
: currentTokenWithBearer
344+
? currentParentTokenWithBearer
345+
: currentTokenWithBearer
339346
}
340-
errors={{
341-
childAccountInfiniteError,
342-
allChildAccountsError: allChildAccountsError?.[0]
343-
? new Error(allChildAccountsError[0].reason)
344-
: null,
345-
}}
346347
fetchNextPage={fetchNextPage}
347348
filter={filter}
348349
hasNextPage={hasNextPage}

packages/manager/src/features/Account/SwitchAccounts/ChildAccountList.test.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ const props: ChildAccountListProps = {
2626
onClose: vi.fn(),
2727
onSwitchAccount: vi.fn(),
2828
userType: undefined,
29-
errors: {
30-
childAccountInfiniteError: false,
31-
allChildAccountsError: null,
32-
},
3329
fetchNextPage: vi.fn(),
3430
filter: {},
3531
hasNextPage: false,

packages/manager/src/features/Account/SwitchAccounts/ChildAccountList.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ import type { ChildAccount, Filter, UserType } from '@linode/api-v4';
99
export interface ChildAccountListProps {
1010
childAccounts: ChildAccount[] | undefined;
1111
currentTokenWithBearer: string;
12-
errors: {
13-
allChildAccountsError: Error | null;
14-
childAccountInfiniteError: boolean;
15-
};
1612
fetchNextPage: () => void;
1713
filter: Filter;
1814
hasNextPage: boolean;

packages/manager/src/features/Account/SwitchAccounts/ChildAccountsTable.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ export const ChildAccountsTable = (props: ChildAccountsTableProps) => {
9292
userType,
9393
});
9494
}}
95+
sx={{
96+
textOverflow: 'ellipsis',
97+
overflow: 'hidden',
98+
textAlign: 'left',
99+
whiteSpace: 'nowrap',
100+
}}
95101
>
96102
{childAccount.company}
97103
</LinkButton>
@@ -103,6 +109,7 @@ export const ChildAccountsTable = (props: ChildAccountsTableProps) => {
103109
{totalResults > pageSize && (
104110
<Pagination
105111
count={totalResults}
112+
itemsLabel="Accounts: "
106113
onPageChange={(e: CustomEvent<number>) =>
107114
handlePageChange(Number(e.detail))
108115
}

pnpm-lock.yaml

Lines changed: 38 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)