From a5676eeb58259c42728dc4fe1d4dcea44718026f Mon Sep 17 00:00:00 2001 From: mpolotsk Date: Fri, 13 Feb 2026 13:51:21 +0100 Subject: [PATCH] fix: [UIE-10203], [UIE-10223], [UIE-10237] - IAM Delegate Users bug fix --- .../src/features/Account/SwitchAccountDrawer.tsx | 6 +++--- .../UserDelegations/UserDelegationsTable.tsx | 15 +++++++++------ .../src/features/TopMenu/UserMenu/UserMenu.tsx | 13 +------------ 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/packages/manager/src/features/Account/SwitchAccountDrawer.tsx b/packages/manager/src/features/Account/SwitchAccountDrawer.tsx index d8be164ba46..6ef602d1968 100644 --- a/packages/manager/src/features/Account/SwitchAccountDrawer.tsx +++ b/packages/manager/src/features/Account/SwitchAccountDrawer.tsx @@ -146,12 +146,12 @@ export const SwitchAccountDrawer = (props: Props) => { userType: isProxyUserType ? 'proxy' : 'delegate', }); onClose(event); - location.reload(); - } catch (error) { + location.replace('/linodes'); + } catch { // Error is handled by createTokenError. } }, - [createToken, updateCurrentToken, revokeToken] + [createToken, isProxyUserType, updateCurrentToken, revokeToken] ); const [isSwitchingChildAccounts, setIsSwitchingChildAccounts] = diff --git a/packages/manager/src/features/IAM/Users/UserDelegations/UserDelegationsTable.tsx b/packages/manager/src/features/IAM/Users/UserDelegations/UserDelegationsTable.tsx index 7448aa5aba8..8716aa4bdb8 100644 --- a/packages/manager/src/features/IAM/Users/UserDelegations/UserDelegationsTable.tsx +++ b/packages/manager/src/features/IAM/Users/UserDelegations/UserDelegationsTable.tsx @@ -11,6 +11,7 @@ import * as React from 'react'; import { DebouncedSearchTextField } from 'src/components/DebouncedSearchTextField'; import { PaginationFooter } from 'src/components/PaginationFooter/PaginationFooter'; +import { MIN_PAGE_SIZE } from 'src/components/PaginationFooter/PaginationFooter.constants'; import { Table } from 'src/components/Table'; import { TableBody } from 'src/components/TableBody'; import { TableCell } from 'src/components/TableCell'; @@ -25,11 +26,13 @@ import { usePaginationV2 } from 'src/hooks/usePaginationV2'; import type { Theme } from '@mui/material'; +const USER_DELEGATION_ROUTE = '/iam/users/$username/delegations'; + export const UserDelegationsTable = () => { const { username } = useParams({ from: '/iam/users/$username' }); const { isIAMDelegationEnabled } = useIsIAMDelegationEnabled(); const { company } = useSearch({ - from: '/iam/users/$username/delegations', + from: USER_DELEGATION_ROUTE, }); const navigate = useNavigate(); @@ -39,13 +42,13 @@ export const UserDelegationsTable = () => { order: 'asc', orderBy: 'company', }, - from: '/iam/users/$username/delegations', + from: USER_DELEGATION_ROUTE, }, preferenceKey: 'user-delegations', }); const pagination = usePaginationV2({ - currentRoute: '/iam/users/$username/delegations', + currentRoute: USER_DELEGATION_ROUTE, preferenceKey: 'user-delegations', initialPage: 1, searchParams: (prev) => ({ @@ -79,7 +82,7 @@ export const UserDelegationsTable = () => { const handleSearch = (value: string) => { pagination.handlePageChange(1); navigate({ - to: '/iam/users/$username/delegations', + to: USER_DELEGATION_ROUTE, params: { username }, search: { company: value || undefined }, }); @@ -134,7 +137,7 @@ export const UserDelegationsTable = () => { {childAccount.company} ))} - {(childAccounts?.results ?? 0) > pagination.pageSize && ( + {(childAccounts?.results ?? 0) > MIN_PAGE_SIZE && ( { ); -}; \ No newline at end of file +}; diff --git a/packages/manager/src/features/TopMenu/UserMenu/UserMenu.tsx b/packages/manager/src/features/TopMenu/UserMenu/UserMenu.tsx index e33fc1ff850..f4be4036c8a 100644 --- a/packages/manager/src/features/TopMenu/UserMenu/UserMenu.tsx +++ b/packages/manager/src/features/TopMenu/UserMenu/UserMenu.tsx @@ -48,17 +48,6 @@ export const UserMenu = React.memo(() => { profile, }); - // Used for fetching parent profile and account data by making a request with the parent's token. - const proxyHeaders = isProxyOrDelegateUserType - ? { - Authorization: getStorage(`authentication/parent_token/token`), - } - : undefined; - - const { data: parentProfile } = useProfile({ headers: proxyHeaders }); - - const userName = - (isProxyOrDelegateUserType ? parentProfile : profile)?.username ?? ''; const matchesSmDown = useMediaQuery((theme: Theme) => theme.breakpoints.down('sm') @@ -133,7 +122,7 @@ export const UserMenu = React.memo(() => { > {companyNameOrEmail && (