diff --git a/client/src/App.tsx b/client/src/App.tsx index 7b7fe41..efd03ec 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -19,6 +19,7 @@ import AdminAegis from "@/pages/admin-aegis"; import AdminSites from "@/pages/admin-sites"; import AdminLogs from "@/pages/admin-logs"; import AdminAchievements from "@/pages/admin-achievements"; +import AdminApplications from "@/pages/admin-applications"; function Router() { return ( @@ -37,6 +38,7 @@ function Router() { + diff --git a/client/src/pages/admin-aegis.tsx b/client/src/pages/admin-aegis.tsx index 285ed04..709d3e5 100644 --- a/client/src/pages/admin-aegis.tsx +++ b/client/src/pages/admin-aegis.tsx @@ -1,15 +1,16 @@ import { useEffect } from "react"; import { Link, useLocation } from "wouter"; -import { useQuery } from "@tanstack/react-query"; +import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query"; import { useAuth } from "@/lib/auth"; import { Users, FileCode, Shield, Activity, LogOut, - BarChart3, User, AlertTriangle, CheckCircle, XCircle, Eye, Globe, Award, Key + BarChart3, User, AlertTriangle, CheckCircle, XCircle, Globe, Award, Key, Inbox } from "lucide-react"; export default function AdminAegis() { const { user, isAuthenticated, isLoading: authLoading, logout } = useAuth(); const [, setLocation] = useLocation(); + const queryClient = useQueryClient(); useEffect(() => { if (!authLoading && !isAuthenticated) { @@ -37,6 +38,21 @@ export default function AdminAegis() { enabled: isAuthenticated, }); + const resolveAlertMutation = useMutation({ + mutationFn: async ({ id, is_resolved }: { id: string; is_resolved: boolean }) => { + const res = await fetch(`/api/alerts/${id}`, { + method: "PATCH", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ is_resolved }), + }); + if (!res.ok) throw new Error("Failed to update alert"); + return res.json(); + }, + onSuccess: () => { + queryClient.invalidateQueries({ queryKey: ["alerts"] }); + }, + }); + if (authLoading || !isAuthenticated) { return (
@@ -130,6 +146,18 @@ export default function AdminAegis() { }`}> {alert.is_resolved ? 'resolved' : 'active'} +
))} @@ -179,6 +207,7 @@ function Sidebar({ user, onLogout, active }: { user: any; onLogout: () => void;