Skip to content

Commit 006fb97

Browse files
wrap up initial cleanup
1 parent d3c4855 commit 006fb97

File tree

9 files changed

+56
-161
lines changed

9 files changed

+56
-161
lines changed

packages/manager/src/features/Profile/Settings/settingsLazyRoute.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@ import { createLazyRoute } from '@tanstack/react-router';
22

33
import { ProfileSettings } from './Settings';
44

5-
export const settingsLazyRoute = createLazyRoute('/profile/settings')({
6-
component: ProfileSettings,
7-
});
8-
9-
/**
10-
* @todo As part of the IAM Primary Nav flag (iamRbacPrimaryNavChanges) cleanup, /profile/settings will be removed.
11-
* Adding the lazy route in this file will also require the necessary cleanup work, such as renaming the file and removing settingsLazyRoute(/profile/settings), as part of the flag cleanup.
12-
*/
135
export const preferencesLazyRoute = createLazyRoute('/profile/preferences')({
146
component: ProfileSettings,
157
});

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

Lines changed: 50 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,11 @@ const accountBillingRoute = createRoute({
3131
getParentRoute: () => accountTabsRoute,
3232
path: 'billing',
3333
validateSearch: (search: AccountBillingSearch) => search,
34-
beforeLoad: ({ context, params }) => {
35-
if (context?.flags?.iamRbacPrimaryNavChanges) {
36-
throw redirect({
37-
to: `/billing`,
38-
replace: true,
39-
});
40-
}
34+
beforeLoad: () => {
35+
throw redirect({
36+
to: `/billing`,
37+
replace: true,
38+
});
4139
},
4240
}).lazy(() =>
4341
import('src/features/Billing/billingDetailLazyRoute').then(
@@ -58,10 +56,6 @@ const accountUsersRoute = createRoute({
5856
if (isIAMEnabled) {
5957
throw redirect({ to: '/iam/users' });
6058
}
61-
62-
if (context?.flags?.iamRbacPrimaryNavChanges && !isIAMEnabled) {
63-
throw redirect({ to: '/users' });
64-
}
6559
},
6660
}).lazy(() =>
6761
import('src/features/Users/usersLandingLazyRoute').then(
@@ -72,13 +66,11 @@ const accountUsersRoute = createRoute({
7266
const accountQuotasRoute = createRoute({
7367
getParentRoute: () => accountTabsRoute,
7468
path: '/quotas',
75-
beforeLoad: ({ context }) => {
76-
if (context?.flags?.iamRbacPrimaryNavChanges) {
77-
throw redirect({
78-
to: `/quotas`,
79-
replace: true,
80-
});
81-
}
69+
beforeLoad: () => {
70+
throw redirect({
71+
to: `/quotas`,
72+
replace: true,
73+
});
8274
},
8375
}).lazy(() =>
8476
import('src/features/Account/Quotas/quotasLazyRoute').then(
@@ -90,12 +82,10 @@ const accountLoginHistoryRoute = createRoute({
9082
getParentRoute: () => accountTabsRoute,
9183
path: '/login-history',
9284
beforeLoad: ({ context }) => {
93-
if (context?.flags?.iamRbacPrimaryNavChanges) {
94-
throw redirect({
95-
to: `/login-history`,
96-
replace: true,
97-
});
98-
}
85+
throw redirect({
86+
to: `/login-history`,
87+
replace: true,
88+
});
9989
},
10090
}).lazy(() =>
10191
import('src/features/Account/accountLoginsLazyRoute').then(
@@ -106,13 +96,11 @@ const accountLoginHistoryRoute = createRoute({
10696
const accountServiceTransfersRoute = createRoute({
10797
getParentRoute: () => accountTabsRoute,
10898
path: '/service-transfers',
109-
beforeLoad: ({ context }) => {
110-
if (context?.flags?.iamRbacPrimaryNavChanges) {
111-
throw redirect({
112-
to: `/service-transfers`,
113-
replace: true,
114-
});
115-
}
99+
beforeLoad: () => {
100+
throw redirect({
101+
to: `/service-transfers`,
102+
replace: true,
103+
});
116104
},
117105
}).lazy(() =>
118106
import(
@@ -123,13 +111,11 @@ const accountServiceTransfersRoute = createRoute({
123111
const accountMaintenanceRoute = createRoute({
124112
getParentRoute: () => accountTabsRoute,
125113
path: '/maintenance',
126-
beforeLoad: ({ context }) => {
127-
if (context?.flags?.iamRbacPrimaryNavChanges) {
128-
throw redirect({
129-
to: `/maintenance`,
130-
replace: true,
131-
});
132-
}
114+
beforeLoad: () => {
115+
throw redirect({
116+
to: `/maintenance`,
117+
replace: true,
118+
});
133119
},
134120
}).lazy(() =>
135121
import('src/features/Account/Maintenance/maintenanceLandingLazyRoute').then(
@@ -140,13 +126,11 @@ const accountMaintenanceRoute = createRoute({
140126
const accountSettingsRoute = createRoute({
141127
getParentRoute: () => accountTabsRoute,
142128
path: '/settings',
143-
beforeLoad: ({ context }) => {
144-
if (context?.flags?.iamRbacPrimaryNavChanges) {
145-
throw redirect({
146-
to: `/account-settings`,
147-
replace: true,
148-
});
149-
}
129+
beforeLoad: () => {
130+
throw redirect({
131+
to: `/account-settings`,
132+
replace: true,
133+
});
150134
},
151135
}).lazy(() =>
152136
import('src/features/Account/globalSettingsLazyRoute').then(
@@ -182,18 +166,16 @@ const accountUsersUsernameRoute = createRoute({
182166
});
183167
}
184168

185-
if (context?.flags?.iamRbacPrimaryNavChanges && !isIAMEnabled) {
186-
const url = location.pathname.endsWith('/profile')
187-
? '/users/$username/profile'
188-
: location.pathname.endsWith('/permissions')
189-
? '/users/$username/permissions'
190-
: '/users/$username';
191-
throw redirect({
192-
to: url,
193-
params: { username },
194-
replace: true,
195-
});
196-
}
169+
const url = location.pathname.endsWith('/profile')
170+
? '/users/$username/profile'
171+
: location.pathname.endsWith('/permissions')
172+
? '/users/$username/permissions'
173+
: '/users/$username';
174+
throw redirect({
175+
to: url,
176+
params: { username },
177+
replace: true,
178+
});
197179
},
198180
}).lazy(() =>
199181
import('src/features/Users/userDetailLazyRoute').then(
@@ -225,14 +207,12 @@ const accountInvoiceDetailsRoute = createRoute({
225207
invoiceId: Number(params.invoiceId),
226208
}),
227209
path: 'billing/invoices/$invoiceId',
228-
beforeLoad: ({ context, params }) => {
229-
if (context?.flags?.iamRbacPrimaryNavChanges) {
230-
throw redirect({
231-
to: `/billing/invoices/$invoiceId`,
232-
params: { invoiceId: params.invoiceId },
233-
replace: true,
234-
});
235-
}
210+
beforeLoad: ({ params }) => {
211+
throw redirect({
212+
to: `/billing/invoices/$invoiceId`,
213+
params: { invoiceId: params.invoiceId },
214+
replace: true,
215+
});
236216
},
237217
}).lazy(() =>
238218
import('src/features/Billing/InvoiceDetail/InvoiceDetail').then(
@@ -243,13 +223,11 @@ const accountInvoiceDetailsRoute = createRoute({
243223
const accountEntityTransfersCreateRoute = createRoute({
244224
getParentRoute: () => accountRoute,
245225
path: 'service-transfers/create',
246-
beforeLoad: ({ context }) => {
247-
if (context?.flags?.iamRbacPrimaryNavChanges) {
248-
throw redirect({
249-
to: `/service-transfers/create`,
250-
replace: true,
251-
});
252-
}
226+
beforeLoad: () => {
227+
throw redirect({
228+
to: `/service-transfers/create`,
229+
replace: true,
230+
});
253231
},
254232
}).lazy(() =>
255233
import(

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@ const accountSettingsCatchAllRoute = createRoute({
2222
const accountSettingsIndexRoute = createRoute({
2323
getParentRoute: () => accountSettingsRoute,
2424
path: '/',
25-
beforeLoad: ({ context }) => {
26-
if (!context?.flags?.iamRbacPrimaryNavChanges) {
27-
throw redirect({
28-
to: `/account/settings`,
29-
replace: true,
30-
});
31-
}
32-
},
3325
}).lazy(() =>
3426
import('src/features/AccountSettings/accountSettingsLandingLazyRoute').then(
3527
(m) => m.accountSettingsLandingLazyRoute

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

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,6 @@ const billingCatchAllRoute = createRoute({
3030
const billingIndexRoute = createRoute({
3131
getParentRoute: () => billingRoute,
3232
path: '/',
33-
beforeLoad: ({ context }) => {
34-
if (!context?.flags?.iamRbacPrimaryNavChanges) {
35-
throw redirect({
36-
to: `/account/billing`,
37-
replace: true,
38-
});
39-
}
40-
},
4133
}).lazy(() =>
4234
import('src/features/Billing/BillingLanding/billingLandingLazyRoute').then(
4335
(m) => m.billingLandingLazyRoute
@@ -50,15 +42,6 @@ const billingInvoiceDetailsRoute = createRoute({
5042
invoiceId: Number(params.invoiceId),
5143
}),
5244
path: 'invoices/$invoiceId',
53-
beforeLoad: ({ context, params }) => {
54-
if (!context?.flags?.iamRbacPrimaryNavChanges) {
55-
throw redirect({
56-
to: `/account/billing/invoices/$invoiceId`,
57-
params: { invoiceId: params.invoiceId },
58-
replace: true,
59-
});
60-
}
61-
},
6245
}).lazy(() =>
6346
import('src/features/Billing/InvoiceDetail/InvoiceDetail').then(
6447
(m) => m.invoiceDetailLazyRoute

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@ const loginHistoryCatchAllRoute = createRoute({
2222
const loginHistoryIndexRoute = createRoute({
2323
getParentRoute: () => loginHistoryRoute,
2424
path: '/',
25-
beforeLoad: ({ context }) => {
26-
if (!context?.flags?.iamRbacPrimaryNavChanges) {
27-
throw redirect({
28-
to: `/account/login-history`,
29-
replace: true,
30-
});
31-
}
32-
},
3325
}).lazy(() =>
3426
import('src/features/LoginHistory/loginHistoryLandingLazyRoute').then(
3527
(m) => m.loginHistoryLandingLazyRoute

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@ const maintenanceCatchAllRoute = createRoute({
2222
const maintenanceIndexRoute = createRoute({
2323
getParentRoute: () => maintenanceRoute,
2424
path: '/',
25-
beforeLoad: ({ context }) => {
26-
if (!context?.flags?.iamRbacPrimaryNavChanges) {
27-
throw redirect({
28-
to: `/account/maintenance`,
29-
replace: true,
30-
});
31-
}
32-
},
3325
}).lazy(() =>
3426
import('src/features/Maintenance/maintenanceLandingLazyRoute').then(
3527
(m) => m.maintenanceLandingLandingLazyRoute

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

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,6 @@ const profileReferralsRoute = createRoute({
9898
*/
9999

100100
const profilePreferencesRoute = createRoute({
101-
beforeLoad: ({ context }) => {
102-
if (!context?.flags?.iamRbacPrimaryNavChanges) {
103-
throw redirect({
104-
to: `/profile/settings`,
105-
replace: true,
106-
});
107-
}
108-
},
109101
getParentRoute: () => profileRoute,
110102
path: 'preferences',
111103
validateSearch: (search: ProfileSettingsSearchParams) => search,
@@ -116,20 +108,18 @@ const profilePreferencesRoute = createRoute({
116108
);
117109

118110
const profileSettingsRoute = createRoute({
119-
beforeLoad: ({ context }) => {
120-
if (context?.flags?.iamRbacPrimaryNavChanges) {
121-
throw redirect({
122-
to: `/profile/preferences`,
123-
replace: true,
124-
});
125-
}
111+
beforeLoad: () => {
112+
throw redirect({
113+
to: `/profile/preferences`,
114+
replace: true,
115+
});
126116
},
127117
getParentRoute: () => profileRoute,
128118
path: 'settings',
129119
validateSearch: (search: ProfileSettingsSearchParams) => search,
130120
}).lazy(() =>
131121
import('src/features/Profile/Settings/settingsLazyRoute').then(
132-
(m) => m.settingsLazyRoute
122+
(m) => m.preferencesLazyRoute
133123
)
134124
);
135125

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@ const quotasCatchAllRoute = createRoute({
2222
const quotasIndexRoute = createRoute({
2323
getParentRoute: () => quotasRoute,
2424
path: '/',
25-
beforeLoad: ({ context }) => {
26-
if (!context?.flags?.iamRbacPrimaryNavChanges) {
27-
throw redirect({
28-
to: `/account/quotas`,
29-
replace: true,
30-
});
31-
}
32-
},
3325
}).lazy(() =>
3426
import('src/features/Quotas//quotasLandingLazyRoute').then(
3527
(m) => m.quotasLandingLazyRoute

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

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@ const serviceTransfersCatchAllRoute = createRoute({
2222
const serviceTransfersIndexRoute = createRoute({
2323
getParentRoute: () => serviceTransfersRoute,
2424
path: '/',
25-
beforeLoad: ({ context }) => {
26-
if (!context?.flags?.iamRbacPrimaryNavChanges) {
27-
throw redirect({
28-
to: `/account/service-transfers`,
29-
replace: true,
30-
});
31-
}
32-
},
3325
}).lazy(() =>
3426
import('src/features/ServiceTransfers/serviceTransfersLandingLazyRoute').then(
3527
(m) => m.serviceTransfersLandingLazyRoute
@@ -39,14 +31,6 @@ const serviceTransfersIndexRoute = createRoute({
3931
const serviceTransfersCreateRoute = createRoute({
4032
getParentRoute: () => serviceTransfersRoute,
4133
path: 'create',
42-
beforeLoad: ({ context }) => {
43-
if (!context?.flags?.iamRbacPrimaryNavChanges) {
44-
throw redirect({
45-
to: `/account/service-transfers/create`,
46-
replace: true,
47-
});
48-
}
49-
},
5034
}).lazy(() =>
5135
import('src/features/ServiceTransfers/serviceTransfersCreateLazyRoute').then(
5236
(m) => m.serviceTransfersCreateLazyRoute

0 commit comments

Comments
 (0)