feat(phase-2): workstream 6 — Web Dashboard UI
- dashboard/: Vite 5 + React 18 + TypeScript strict SPA
- Auth: sessionStorage credentials, TokenManager validation, AuthProvider context
- Pages: Login, Agents (search + filter), AgentDetail (suspend/reactivate),
Credentials (generate/rotate/revoke, new secret shown once),
AuditLog (filters + pagination), Health (PG + Redis status, 30s refresh)
- Components: Button, Badge, ConfirmDialog, AppShell, RequireAuth
- All destructive actions gated by ConfirmDialog
- Zero dangerouslySetInnerHTML; sessionStorage only (OWASP compliant)
- src/routes/health.ts: unauthenticated GET /health — PG + Redis connectivity
- src/app.ts: health route + dashboard/dist/ served at /dashboard with SPA fallback
- 6 new health route tests; 308/308 unit tests passing
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
33
dashboard/src/App.tsx
Normal file
33
dashboard/src/App.tsx
Normal file
@@ -0,0 +1,33 @@
|
||||
import * as React from 'react';
|
||||
import { Routes, Route, Navigate } from 'react-router-dom';
|
||||
import { AuthProvider } from '@/lib/auth';
|
||||
import { RequireAuth } from '@/components/RequireAuth';
|
||||
import { AppShell } from '@/components/layout/AppShell';
|
||||
import Login from '@/pages/Login';
|
||||
import Agents from '@/pages/Agents';
|
||||
import AgentDetail from '@/pages/AgentDetail';
|
||||
import Credentials from '@/pages/Credentials';
|
||||
import AuditLog from '@/pages/AuditLog';
|
||||
import Health from '@/pages/Health';
|
||||
|
||||
/** Top-level router — defines all application routes. */
|
||||
export default function App(): React.JSX.Element {
|
||||
return (
|
||||
<AuthProvider>
|
||||
<Routes>
|
||||
<Route path="/dashboard/login" element={<Login />} />
|
||||
<Route element={<RequireAuth />}>
|
||||
<Route element={<AppShell />}>
|
||||
<Route path="/dashboard/agents" element={<Agents />} />
|
||||
<Route path="/dashboard/agents/:agentId" element={<AgentDetail />} />
|
||||
<Route path="/dashboard/agents/:agentId/credentials" element={<Credentials />} />
|
||||
<Route path="/dashboard/audit" element={<AuditLog />} />
|
||||
<Route path="/dashboard/health" element={<Health />} />
|
||||
</Route>
|
||||
</Route>
|
||||
<Route path="/dashboard" element={<Navigate to="/dashboard/agents" replace />} />
|
||||
<Route path="*" element={<Navigate to="/dashboard/agents" replace />} />
|
||||
</Routes>
|
||||
</AuthProvider>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user