Introduce new network analytics capabilities with persistent storage, hourly and daily aggregations, and enhanced frontend visualizations. This includes API endpoints for retrieving analytics data, systemd services for automated aggregation, and UI updates for live and historical dashboards. Additionally, country flag emojis are now displayed on the detections page. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 7a657272-55ba-4a79-9a2e-f1ed9bc7a528 Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Event-Id: 3c14f651-7633-4128-8526-314b4942b3a0 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/449cf7c4-c97a-45ae-8234-e5c5b8d6a84f/7a657272-55ba-4a79-9a2e-f1ed9bc7a528/oGXAoP7
107 lines
4.0 KiB
TypeScript
107 lines
4.0 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, BarChart3, TrendingUp } from "lucide-react";
|
|
import Dashboard from "@/pages/Dashboard";
|
|
import Detections from "@/pages/Detections";
|
|
import DashboardLive from "@/pages/DashboardLive";
|
|
import AnalyticsHistory from "@/pages/AnalyticsHistory";
|
|
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: "Dashboard Live", url: "/dashboard-live", icon: Activity },
|
|
{ title: "Analytics Storici", url: "/analytics", icon: BarChart3 },
|
|
{ title: "Training ML", url: "/training", icon: Brain },
|
|
{ title: "Router", url: "/routers", icon: Server },
|
|
{ title: "Whitelist", url: "/whitelist", icon: Shield },
|
|
{ title: "Servizi", url: "/services", icon: TrendingUp },
|
|
];
|
|
|
|
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="/dashboard-live" component={DashboardLive} />
|
|
<Route path="/analytics" component={AnalyticsHistory} />
|
|
<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;
|