ids.alfacom.it/client/src/App.tsx
marco370 4a2d7f9c5c Add service monitoring and status indicators to the dashboard
Introduce a new services page, integrate real-time status monitoring for ML backend, database, and syslog parser, and update the dashboard to display service health indicators.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 7a657272-55ba-4a79-9a2e-f1ed9bc7a528
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: cde95c60-908b-48a0-b7b9-38e5e924b3b3
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/449cf7c4-c97a-45ae-8234-e5c5b8d6a84f/7a657272-55ba-4a79-9a2e-f1ed9bc7a528/n4Q2eeE
2025-11-22 09:24:10 +00:00

101 lines
3.6 KiB
TypeScript

import { Switch, Route } from "wouter";
import { queryClient } from "./lib/queryClient";
import { QueryClientProvider } from "@tanstack/react-query";
import { Toaster } from "@/components/ui/toaster";
import { TooltipProvider } from "@/components/ui/tooltip";
import { SidebarProvider, Sidebar, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarTrigger } from "@/components/ui/sidebar";
import { LayoutDashboard, AlertTriangle, Server, Shield, Brain, Menu, Activity } from "lucide-react";
import Dashboard from "@/pages/Dashboard";
import Detections from "@/pages/Detections";
import Routers from "@/pages/Routers";
import Whitelist from "@/pages/Whitelist";
import Training from "@/pages/Training";
import Services from "@/pages/Services";
import NotFound from "@/pages/not-found";
const menuItems = [
{ title: "Dashboard", url: "/", icon: LayoutDashboard },
{ title: "Rilevamenti", url: "/detections", icon: AlertTriangle },
{ title: "Training ML", url: "/training", icon: Brain },
{ title: "Router", url: "/routers", icon: Server },
{ title: "Whitelist", url: "/whitelist", icon: Shield },
{ title: "Servizi", url: "/services", icon: Activity },
];
function AppSidebar() {
return (
<Sidebar data-testid="sidebar">
<SidebarContent>
<SidebarGroup>
<SidebarGroupLabel data-testid="text-sidebar-title">IDS System</SidebarGroupLabel>
<SidebarGroupContent>
<SidebarMenu>
{menuItems.map((item) => (
<SidebarMenuItem key={item.title}>
<SidebarMenuButton asChild data-testid={`link-${item.title.toLowerCase()}`}>
<a href={item.url}>
<item.icon />
<span>{item.title}</span>
</a>
</SidebarMenuButton>
</SidebarMenuItem>
))}
</SidebarMenu>
</SidebarGroupContent>
</SidebarGroup>
</SidebarContent>
</Sidebar>
);
}
function Router() {
return (
<Switch>
<Route path="/" component={Dashboard} />
<Route path="/detections" component={Detections} />
<Route path="/training" component={Training} />
<Route path="/routers" component={Routers} />
<Route path="/whitelist" component={Whitelist} />
<Route path="/services" component={Services} />
<Route component={NotFound} />
</Switch>
);
}
function App() {
const style = {
"--sidebar-width": "16rem",
"--sidebar-width-icon": "3rem",
};
return (
<QueryClientProvider client={queryClient}>
<TooltipProvider>
<SidebarProvider style={style as React.CSSProperties}>
<div className="flex h-screen w-full" data-testid="app-container">
<AppSidebar />
<div className="flex flex-col flex-1 overflow-hidden">
<header className="flex items-center gap-2 p-4 border-b" data-testid="header">
<SidebarTrigger data-testid="button-sidebar-toggle">
<Menu className="h-5 w-5" />
</SidebarTrigger>
<div className="flex-1">
<h1 className="text-sm font-medium text-muted-foreground" data-testid="text-header-title">
Intrusion Detection System
</h1>
</div>
</header>
<main className="flex-1 overflow-auto" data-testid="main-content">
<Router />
</main>
</div>
</div>
</SidebarProvider>
<Toaster />
</TooltipProvider>
</QueryClientProvider>
);
}
export default App;