Skip to content

Commit 802c916

Browse files
committed
refactor(FR-2847): split admin deployment detail route under /admin-deployments/:id (#7312)
Resolves #7310(FR-2847) ## Summary Split the admin-side deployment detail page from the user-side one at the route level. Admins now stay under `/admin-deployments/*` when navigating into a deployment detail, preserving the admin context through breadcrumbs and back navigation. The detail page **component** (`DeploymentDetailPage`) is unchanged — only the route is separated. ## Changes - **`react/src/routes.tsx`** - Add new child route `/admin-deployments/:deploymentId` that mounts the same `DeploymentDetailPage` inside the existing `/admin-deployments` parent route, using the same `BAIErrorBoundary` + `Suspense` pattern as sibling children. - Add `handle: { labelKey: 'webui.menu.DeploymentDetail' }` so the breadcrumb resolves correctly under the admin route. - Update the legacy `/admin-serving/:serviceId` redirect to point to `/admin-deployments/:serviceId` (was `/deployments/:serviceId`), so old admin links keep landing inside the admin URL space. - Update the stale comment that said "/admin-deployments has no nested detail route". - **`react/src/pages/AdminDeploymentListPage.tsx`** — row click now navigates to `/admin-deployments/${id}` instead of `/deployments/${id}`. - **`react/src/components/EndpointList.tsx`** — when rendered with `isAdminMode`, the `BAINameActionCell` `to` prop now points at `/admin-deployments/${endpoint_id}` instead of `/deployments/${endpoint_id}`. (`AdminServingPage` does not navigate to detail directly — it composes `EndpointList` with `isAdminMode`, which is the actual entry point from the legacy admin-serving tab.) ## Out of scope - `DeploymentTagChips.tsx` already branches on `pathname.startsWith('/admin-deployments')` and navigates to the **list** (not detail) for tag filters — unchanged. - `DeploymentConfigurationSection.tsx` (FR-2846) and delete-icon styling (FR-2848) intentionally untouched. ## Verification `bash scripts/verify.sh`: Relay PASS, Lint PASS, Format PASS. TypeScript shows pre-existing errors in `packages/backend.ai-client/src/client.ts` and `react/src/components/DeleteForeverVFolderModalV2.tsx` that are unchanged from `main` and unrelated to FR-2847 (`git diff main HEAD --` confirms).
1 parent 024fcd9 commit 802c916

3 files changed

Lines changed: 25 additions & 6 deletions

File tree

react/src/components/EndpointList.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,10 @@ const EndpointList: React.FC<EndpointListProps> = ({
134134
<BAINameActionCell
135135
title={name}
136136
showActions="always"
137-
to={(isAdminMode ? '/deployments/' : '/serving/') + row.endpoint_id}
137+
to={
138+
(isAdminMode ? '/admin-deployments/' : '/serving/') +
139+
row.endpoint_id
140+
}
138141
actions={[
139142
{
140143
key: 'settings',

react/src/pages/AdminDeploymentListPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ const AdminDeploymentListPageContent: React.FC = () => {
166166
}}
167167
loading={isLoading}
168168
onRowClick={(deploymentId) => {
169-
webUINavigate(`/deployments/${toLocalId(deploymentId)}`);
169+
webUINavigate(`/admin-deployments/${toLocalId(deploymentId)}`);
170170
}}
171171
onEditClick={(frgmt) => setEditingDeploymentFrgmt(frgmt)}
172172
onDeleteComplete={updateFetchKey}

react/src/routes.tsx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,21 @@ export const mainLayoutChildRoutes: RouteObject[] = [
483483
</BAIErrorBoundary>
484484
),
485485
},
486+
{
487+
// FR-2847 — Admin deployment detail route. Reuses the shared
488+
// `DeploymentDetailPage` component but keeps admins under the
489+
// `/admin-deployments/*` URL space so that breadcrumbs and back
490+
// navigation preserve the admin context.
491+
path: ':deploymentId',
492+
handle: { labelKey: 'webui.menu.DeploymentDetail' },
493+
element: (
494+
<BAIErrorBoundary>
495+
<Suspense fallback={<Skeleton active />}>
496+
<DeploymentDetailPage />
497+
</Suspense>
498+
</BAIErrorBoundary>
499+
),
500+
},
486501
],
487502
},
488503
{
@@ -504,16 +519,17 @@ export const mainLayoutChildRoutes: RouteObject[] = [
504519
},
505520
},
506521
{
507-
// /admin-deployments has no nested detail route — the deployment
508-
// detail page is shared at /deployments/:deploymentId regardless
509-
// of the viewer's role.
522+
// FR-2847 — Legacy `/admin-serving/:serviceId` redirects to the
523+
// admin-scoped detail route so admins stay under
524+
// `/admin-deployments/*` instead of the user-facing
525+
// `/deployments/:deploymentId`.
510526
path: ':serviceId',
511527
Component: () => {
512528
const { serviceId } = useParams<{ serviceId: string }>();
513529
const location = useLocation();
514530
return (
515531
<WebUINavigate
516-
to={`/deployments/${serviceId}${location.search}`}
532+
to={`/admin-deployments/${serviceId}${location.search}`}
517533
replace
518534
/>
519535
);

0 commit comments

Comments
 (0)