Skip to content

Commit bb53f1b

Browse files
Refactor Router deletion process (#2371)
* Update message on Router deletion to warn about routes; disable system router deletion --------- Co-authored-by: David Crespo <david-crespo@users.noreply.github.com>
1 parent 29398e7 commit bb53f1b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

app/forms/vpc-router-route/shared.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ export const routeFormMessage = {
6565
// https://github.com/oxidecomputer/omicron/blob/914f5fd7d51f9b060dcc0382a30b607e25df49b2/nexus/src/app/vpc_router.rs#L201-L204
6666
noNewRoutesOnSystemRouter: 'User-provided routes cannot be added to a system router',
6767
// https://github.com/oxidecomputer/omicron/blob/914f5fd7d51f9b060dcc0382a30b607e25df49b2/nexus/src/app/vpc_router.rs#L300-L304
68-
noDeletingRoutesOnSystemRouter: 'System routes can not be deleted',
68+
noDeletingRoutesOnSystemRouter: 'System routes cannot be deleted',
69+
// https://github.com/oxidecomputer/omicron/blob/914f5fd7d51f9b060dcc0382a30b607e25df49b2/nexus/src/app/vpc_router.rs#L136-L138
70+
noDeletingSystemRouters: 'System routers cannot be deleted',
6971
}
7072

7173
export const targetValueDescription = (targetType: RouteTarget['type']) =>

app/pages/project/vpcs/VpcPage/tabs/VpcRoutersTab.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { Outlet, useNavigate, type LoaderFunctionArgs } from 'react-router-dom'
1111

1212
import { apiQueryClient, useApiMutation, type VpcRouter } from '@oxide/api'
1313

14+
import { routeFormMessage } from '~/forms/vpc-router-route/shared'
1415
import { getVpcSelector, useVpcSelector } from '~/hooks'
1516
import { confirmDelete } from '~/stores/confirm-delete'
1617
import { addToast } from '~/stores/toast'
@@ -84,14 +85,17 @@ export function VpcRoutersTab() {
8485
},
8586
{
8687
label: 'Delete',
88+
className: 'destructive',
8789
onActivate: confirmDelete({
8890
doDelete: () =>
8991
deleteRouter.mutateAsync({
9092
path: { router: router.name },
9193
query: { project, vpc },
9294
}),
95+
extraContent: 'This will also delete any routes belonging to this router.',
9396
label: router.name,
9497
}),
98+
disabled: router.kind === 'system' && routeFormMessage.noDeletingSystemRouters,
9599
},
96100
],
97101
[deleteRouter, project, vpc, navigate]

0 commit comments

Comments
 (0)