Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Align Docker route ownership

rcourtman6fc846f4da59
diff --git a/frontend-modern/src/App.tsx b/frontend-modern/src/App.tsx
index 6e577a9e0f..9763823086 100644
--- a/frontend-modern/src/App.tsx
+++ b/frontend-modern/src/App.tsx
@@ -1,6 +1,6 @@
import { Show, lazy, createSignal, createEffect, createMemo, onCleanup, onMount } from 'solid-js';
import type { JSX } from 'solid-js';
-import { Navigate, Router, Route, useNavigate, useLocation } from '@solidjs/router';
+import { Router, Route, useNavigate, useLocation } from '@solidjs/router';
import { ToastContainer } from './components/Toast/Toast';
import { ErrorBoundary, RouteErrorBoundary } from './components/ErrorBoundary';
import { SecurityWarning } from './components/SecurityWarning';
@@ -108,8 +108,6 @@ const SetupCompletionPreviewPage = lazy(() =>
);
const ROOT_PATROL_PATH = PATROL_PATH;
-const RetiredDockerWorkloadsRoute = () => <Navigate href={buildDockerPath()} />;
-
const PRIMARY_INFRASTRUCTURE_ROUTE_BY_ID: Record<PrimaryPlatformNavId, string> = {
proxmox: buildProxmoxPath(),
docker: buildDockerPath(),
@@ -567,7 +565,6 @@ function App() {
<Route path={PROXMOX_PATH} component={ProxmoxPage} />
<Route path={`${PROXMOX_PATH}/*`} component={ProxmoxPage} />
<Route path={DOCKER_PATH} component={DockerPage} />
- <Route path={`${DOCKER_PATH}/workloads`} component={RetiredDockerWorkloadsRoute} />
<Route path={`${DOCKER_PATH}/*`} component={DockerPage} />
<Route path={KUBERNETES_PATH} component={KubernetesPage} />
<Route path={`${KUBERNETES_PATH}/*`} component={KubernetesPage} />
diff --git a/frontend-modern/src/pages/Docker.tsx b/frontend-modern/src/pages/Docker.tsx
index a256f475e6..c66819f178 100644
--- a/frontend-modern/src/pages/Docker.tsx
+++ b/frontend-modern/src/pages/Docker.tsx
@@ -1,6 +1,15 @@
+import { Navigate, useLocation } from '@solidjs/router';
import { DockerPageSurface } from '@/features/docker/DockerPageSurface';
+import { buildDockerPath, DOCKER_PATH } from '@/routing/resourceLinks';
export function Docker() {
+ const location = useLocation();
+ const pathname = () => location.pathname.replace(/\/+$/, '');
+
+ if (pathname() === `${DOCKER_PATH}/workloads`) {
+ return <Navigate href={buildDockerPath()} />;
+ }
+
return <DockerPageSurface />;
}
diff --git a/frontend-modern/src/pages/__tests__/Docker.test.tsx b/frontend-modern/src/pages/__tests__/Docker.test.tsx
new file mode 100644
index 0000000000..2d54adafca
--- /dev/null
+++ b/frontend-modern/src/pages/__tests__/Docker.test.tsx
@@ -0,0 +1,44 @@
+import { cleanup, render, screen } from '@solidjs/testing-library';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+
+import { Docker } from '../Docker';
+
+const mocks = vi.hoisted(() => ({
+ pathname: '/docker/overview',
+}));
+
+vi.mock('@solidjs/router', () => ({
+ Navigate: (props: { href: string }) => <div data-testid="navigate" data-href={props.href} />,
+ useLocation: () => ({
+ get pathname() {
+ return mocks.pathname;
+ },
+ }),
+}));
+
+vi.mock('@/features/docker/DockerPageSurface', () => ({
+ DockerPageSurface: () => <div data-testid="docker-page-surface" />,
+}));
+
+afterEach(() => {
+ cleanup();
+ mocks.pathname = '/docker/overview';
+});
+
+describe('Docker page route ownership', () => {
+ it('renders the canonical Docker surface for current routes', () => {
+ render(() => <Docker />);
+
+ expect(screen.getByTestId('docker-page-surface')).toBeInTheDocument();
+ expect(screen.queryByTestId('navigate')).not.toBeInTheDocument();
+ });
+
+ it('redirects the retired workload route to the canonical overview', () => {
+ mocks.pathname = '/docker/workloads/';
+
+ render(() => <Docker />);
+
+ expect(screen.getByTestId('navigate')).toHaveAttribute('data-href', '/docker/overview');
+ expect(screen.queryByTestId('docker-page-surface')).not.toBeInTheDocument();
+ });
+});