Some checks failed
CI Pipeline / Rust Format Check (push) Failing after 4s
CI Pipeline / Clippy Lints (push) Successful in 46s
CI Pipeline / Rust Unit Tests (push) Successful in 1m1s
CI Pipeline / Security Audit (push) Successful in 4s
CI Pipeline / Frontend Lint & Type Check (push) Successful in 12s
CI Pipeline / Build .deb & Release (push) Has been skipped
- Created AppLayout.tsx with MUI AppBar + permanent sidebar drawer - Grouped navigation: Overview, Fleet, Operations, Administration - RBAC visibility: admin-only items (Users, Certificates, Settings) - User menu with logout functionality - Mobile-responsive collapsible drawer - Active state indicator on current page - Switched theme from lightTheme to darkTheme in App.tsx - Wrapped authenticated routes in AppLayout with React Router Outlet - 404 redirect to dashboard instead of placeholder page
57 lines
2.4 KiB
TypeScript
57 lines
2.4 KiB
TypeScript
import { Routes, Route, Navigate } from 'react-router-dom'
|
|
import { CssBaseline, ThemeProvider } from '@mui/material'
|
|
import { darkTheme } from './theme/theme'
|
|
import { useAuthStore } from './store/authStore'
|
|
import AppLayout from './components/AppLayout'
|
|
import LoginPage from './pages/LoginPage'
|
|
import MfaSetupPage from './pages/MfaSetupPage'
|
|
import HostsPage from './pages/HostsPage'
|
|
import HostDetailPage from './pages/HostDetailPage'
|
|
import GroupsPage from './pages/GroupsPage'
|
|
import UsersPage from './pages/UsersPage'
|
|
import DashboardPage from './pages/DashboardPage'
|
|
import PatchDeploymentPage from './pages/PatchDeploymentPage'
|
|
import JobsPage from './pages/JobsPage'
|
|
import MaintenanceWindowsPage from './pages/MaintenanceWindowsPage'
|
|
import CertificatesPage from './pages/CertificatesPage'
|
|
import ReportsPage from './pages/ReportsPage'
|
|
import SettingsPage from './pages/SettingsPage'
|
|
|
|
function RequireAuth({ children }: { children: React.ReactNode }) {
|
|
const isAuthenticated = useAuthStore((s) => s.isAuthenticated)
|
|
return isAuthenticated ? <>{children}</> : <Navigate to="/login" replace />
|
|
}
|
|
|
|
function App() {
|
|
return (
|
|
<ThemeProvider theme={darkTheme}>
|
|
<CssBaseline />
|
|
<Routes>
|
|
{/* Public */}
|
|
<Route path="/login" element={<LoginPage />} />
|
|
|
|
{/* Protected — wrapped in AppLayout with sidebar navigation */}
|
|
<Route element={<RequireAuth><AppLayout /></RequireAuth>}>
|
|
<Route path="/" element={<Navigate to="/dashboard" replace />} />
|
|
<Route path="/mfa/setup" element={<MfaSetupPage />} />
|
|
<Route path="/dashboard" element={<DashboardPage />} />
|
|
<Route path="/hosts" element={<HostsPage />} />
|
|
<Route path="/hosts/:id" element={<HostDetailPage />} />
|
|
<Route path="/groups" element={<GroupsPage />} />
|
|
<Route path="/users" element={<UsersPage />} />
|
|
<Route path="/jobs" element={<JobsPage />} />
|
|
<Route path="/deployment" element={<PatchDeploymentPage />} />
|
|
<Route path="/maintenance" element={<MaintenanceWindowsPage />} />
|
|
<Route path="/reports" element={<ReportsPage />} />
|
|
<Route path="/certificates" element={<CertificatesPage />} />
|
|
<Route path="/settings" element={<SettingsPage />} />
|
|
</Route>
|
|
|
|
<Route path="*" element={<Navigate to="/dashboard" replace />} />
|
|
</Routes>
|
|
</ThemeProvider>
|
|
)
|
|
}
|
|
|
|
export default App
|