Skip to content

Commit 346aa3b

Browse files
cpathipamjac0bscoliu-akamai
authored
upcoming: [M3-10416] - Redirect /account/quotas → /quotas when feature flag is enabled (linode#12693)
* Added new feature flag to support PrimaryNav changes * Add Administration section to the primary Nav * Update PrimaryNav.tsx * Added changeset: Added a new feature flag and Administration section in the Primary Nav * Test coverage * disable the flag in cypress tests * Rename Account section to Administration in the top right menu * Added changeset: IAM: Rename Account section to Administration in the top right menu * Show new chip next to Identity and Access link * Update packages/manager/.changeset/pr-12633-upcoming-features-1754346094060.md Co-authored-by: Mariah Jacobs <[email protected]> * Mock the iamRbacPrimaryNavChanges feature flag to be disabled in Cypress tests * Add billing page route * upadate primarynav * Add billing landing page * Add Billing details page * Replace new feature chip with Beta chip - @aaleksee-akamai * Update packages/manager/.changeset/pr-12640-upcoming-features-1754423037270.md Co-authored-by: Connie Liu <[email protected]> * Add login history link - @coliu-akamai * Add billing link in the UserMenuPopover * Update the all sublinks in billing page wrt new billing route * Added changeset: Redirect /account/billing → /billing when feature flag is enabled * disabel the iamRbacPrimaryNavChanges in cypress tests * Code cleanup add redirects at router level * Fix the broken cypress tests and pr feedback - @dwiley-akamai * catch invalid billing routes * Show Users & Grants link for non beta users * Added changeset: Restrict access to the Identity & Access link from the Primary Nav for non-beta users * replace 'account/quotas' with flat route '/quotas' * Load Quotas Landing page or /quotas route * Fix the test PrimaryNav --------- Co-authored-by: Mariah Jacobs <[email protected]> Co-authored-by: Connie Liu <[email protected]>
1 parent d05be26 commit 346aa3b

File tree

12 files changed

+154
-9
lines changed

12 files changed

+154
-9
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@linode/manager": Upcoming Features
3+
---
4+
5+
Restrict access to the Identity & Access link from the Primary Nav for non-beta users ([#12692](https://github.com/linode/manager/pull/12692))

packages/manager/src/components/PrimaryNav/PrimaryNav.test.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,11 @@ describe('PrimaryNav', () => {
340340
beta: true,
341341
enabled: true,
342342
},
343+
limitsEvolution: {
344+
enabled: true,
345+
requestForIncreaseDisabledForAll: true,
346+
requestForIncreaseDisabledForInternalAccountsOnly: true,
347+
},
343348
};
344349

345350
queryMocks.useIsIAMEnabled.mockReturnValue({

packages/manager/src/components/PrimaryNav/PrimaryNav.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export type NavEntity =
6161
| 'Service Transfers'
6262
| 'Settings'
6363
| 'StackScripts'
64+
| 'Users & Grants'
6465
| 'Volumes'
6566
| 'VPC';
6667

@@ -105,7 +106,7 @@ export const PrimaryNav = (props: PrimaryNavProps) => {
105106
flags.aclpAlerting?.recentActivity ||
106107
flags.aclpAlerting?.notificationChannels);
107108

108-
const isIAMRbacPrimaryNavChangesEnabled = flags?.iamRbacPrimaryNavChanges;
109+
const { iamRbacPrimaryNavChanges, limitsEvolution } = flags;
109110

110111
const { isPlacementGroupsEnabled } = useIsPlacementGroupsEnabled();
111112
const { isDatabasesEnabled, isDatabasesV2Beta } = useIsDatabasesEnabled();
@@ -251,13 +252,13 @@ export const PrimaryNav = (props: PrimaryNavProps) => {
251252
},
252253
{
253254
display: 'Identity & Access',
254-
hide: !isIAMEnabled || isIAMRbacPrimaryNavChangesEnabled,
255+
hide: !isIAMEnabled || iamRbacPrimaryNavChanges,
255256
to: '/iam',
256257
isBeta: isIAMBeta,
257258
},
258259
{
259260
display: 'Account',
260-
hide: isIAMRbacPrimaryNavChangesEnabled,
261+
hide: iamRbacPrimaryNavChanges,
261262
to: '/account',
262263
},
263264
{
@@ -269,14 +270,19 @@ export const PrimaryNav = (props: PrimaryNavProps) => {
269270
},
270271
];
271272

272-
if (isIAMRbacPrimaryNavChangesEnabled) {
273+
if (iamRbacPrimaryNavChanges) {
273274
groups.splice(groups.length - 1, 0, {
274275
icon: <CoreUser />,
275276
links: [
276277
{
277278
display: 'Billing',
278279
to: '/billing',
279280
},
281+
{
282+
display: 'Users & Grants',
283+
hide: isIAMEnabled,
284+
to: '/account/users',
285+
},
280286
{
281287
display: 'Identity & Access',
282288
hide: !isIAMEnabled,
@@ -285,7 +291,8 @@ export const PrimaryNav = (props: PrimaryNavProps) => {
285291
},
286292
{
287293
display: 'Quotas',
288-
to: '/account/quotas', // TODO: replace with '/quotas' when flat route is added
294+
hide: !limitsEvolution?.enabled,
295+
to: '/quotas',
289296
},
290297
{
291298
display: 'Login History',
@@ -319,7 +326,7 @@ export const PrimaryNav = (props: PrimaryNavProps) => {
319326
isACLPEnabled,
320327
isIAMBeta,
321328
isIAMEnabled,
322-
isIAMRbacPrimaryNavChangesEnabled,
329+
iamRbacPrimaryNavChanges,
323330
]
324331
);
325332

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import * as React from 'react';
1212

1313
import { DocumentTitleSegment } from 'src/components/DocumentTitle';
1414
import { Link } from 'src/components/Link';
15+
import { useFlags } from 'src/hooks/useFlags';
1516

1617
import { QuotasTable } from './QuotasTable';
1718
import { useGetLocationsForQuotaService } from './utils';
@@ -22,6 +23,8 @@ import type { Theme } from '@mui/material';
2223

2324
export const Quotas = () => {
2425
const navigate = useNavigate();
26+
const flags = useFlags();
27+
2528
const [selectedLocation, setSelectedLocation] =
2629
React.useState<null | SelectOption<Quota['region_applied']>>(null);
2730
const locationData = useGetLocationsForQuotaService('object-storage');
@@ -68,7 +71,11 @@ export const Quotas = () => {
6871
label: value?.label,
6972
value: value?.value,
7073
});
71-
navigate({ to: '/account/quotas' });
74+
navigate({
75+
to: flags?.iamRbacPrimaryNavChanges
76+
? '/quotas'
77+
: '/account/quotas',
78+
});
7279
}}
7380
options={
7481
sortedS3Endpoints?.map((location) => ({

packages/manager/src/features/Account/Quotas/QuotasTable.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { TableHead } from 'src/components/TableHead';
1212
import { TableRow } from 'src/components/TableRow/TableRow';
1313
import { TableRowEmpty } from 'src/components/TableRowEmpty/TableRowEmpty';
1414
import { TableRowLoading } from 'src/components/TableRowLoading/TableRowLoading';
15+
import { useFlags } from 'src/hooks/useFlags';
1516
import { usePaginationV2 } from 'src/hooks/usePaginationV2';
1617

1718
import { QuotasIncreaseForm } from './QuotasIncreaseForm';
@@ -31,9 +32,12 @@ interface QuotasTableProps {
3132

3233
export const QuotasTable = (props: QuotasTableProps) => {
3334
const { selectedLocation, selectedService } = props;
35+
const flags = useFlags();
3436
const navigate = useNavigate();
3537
const pagination = usePaginationV2({
36-
currentRoute: '/account/quotas',
38+
currentRoute: flags?.iamRbacPrimaryNavChanges
39+
? '/quotas'
40+
: '/account/quotas',
3741
initialPage: 1,
3842
preferenceKey: 'quotas-table',
3943
});
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { Navigate, useLocation } from '@tanstack/react-router';
2+
import * as React from 'react';
3+
4+
import { DocumentTitleSegment } from 'src/components/DocumentTitle';
5+
import { LandingHeader } from 'src/components/LandingHeader';
6+
import { MaintenanceBannerV2 } from 'src/components/MaintenanceBanner/MaintenanceBannerV2';
7+
import { PlatformMaintenanceBanner } from 'src/components/PlatformMaintenanceBanner/PlatformMaintenanceBanner';
8+
import { useFlags } from 'src/hooks/useFlags';
9+
10+
import { Quotas } from '../Account/Quotas/Quotas';
11+
12+
import type { LandingHeaderProps } from 'src/components/LandingHeader';
13+
14+
export const QuotasLanding = () => {
15+
const flags = useFlags();
16+
const location = useLocation();
17+
18+
const isIAMRbacPrimaryNavChangesEnabled = flags?.iamRbacPrimaryNavChanges;
19+
20+
if (
21+
!isIAMRbacPrimaryNavChangesEnabled &&
22+
location.pathname !== '/account/quotas'
23+
) {
24+
return <Navigate replace to="/account/quotas" />;
25+
}
26+
27+
const landingHeaderProps: LandingHeaderProps = {
28+
breadcrumbProps: {
29+
pathname: '/quotas',
30+
},
31+
32+
title: 'Quotas',
33+
};
34+
35+
return (
36+
<>
37+
<PlatformMaintenanceBanner pathname={location.pathname} />
38+
<MaintenanceBannerV2 pathname={location.pathname} />
39+
<DocumentTitleSegment segment="Quotas" />
40+
<LandingHeader {...landingHeaderProps} spacingBottom={4} />
41+
<Quotas />
42+
</>
43+
);
44+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { createLazyRoute } from '@tanstack/react-router';
2+
3+
import { QuotasLanding } from './QuotasLanding';
4+
5+
export const quotasLandingLazyRoute = createLazyRoute('/quotas')({
6+
component: QuotasLanding,
7+
});

packages/manager/src/features/TopMenu/UserMenu/UserMenuPopover.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export const UserMenuPopover = (props: UserMenuPopoverProps) => {
120120
{
121121
display: 'Quotas',
122122
hide: !flags.limitsEvolution?.enabled,
123-
to: '/account/quotas',
123+
to: flags?.iamRbacPrimaryNavChanges ? '/quotas' : '/account/quotas',
124124
},
125125
{
126126
display: 'Login History',

packages/manager/src/routes/account/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ const accountUsersRoute = createRoute({
6767
const accountQuotasRoute = createRoute({
6868
getParentRoute: () => accountTabsRoute,
6969
path: '/quotas',
70+
beforeLoad: ({ context }) => {
71+
if (context?.flags?.iamRbacPrimaryNavChanges) {
72+
throw redirect({
73+
to: `/quotas`,
74+
replace: true,
75+
});
76+
}
77+
},
7078
}).lazy(() =>
7179
import('src/features/Account/Quotas/quotasLazyRoute').then(
7280
(m) => m.quotasLazyRoute

packages/manager/src/routes/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { nodeBalancersRouteTree } from './nodeBalancers';
3131
import { objectStorageRouteTree } from './objectStorage';
3232
import { placementGroupsRouteTree } from './placementGroups';
3333
import { profileRouteTree } from './profile';
34+
import { quotasRouteTree } from './quotas';
3435
import { rootRoute } from './root';
3536
import { searchRouteTree } from './search';
3637
import { stackScriptsRouteTree } from './stackscripts';
@@ -74,6 +75,7 @@ export const routeTree = rootRoute.addChildren([
7475
objectStorageRouteTree,
7576
placementGroupsRouteTree,
7677
profileRouteTree,
78+
quotasRouteTree,
7779
searchRouteTree,
7880
stackScriptsRouteTree,
7981
supportRouteTree,

0 commit comments

Comments
 (0)