From 83ea20545d2338a205986431d24e9863fc96a6c3 Mon Sep 17 00:00:00 2001 From: headlessdev Date: Sat, 19 Apr 2025 00:13:12 +0200 Subject: [PATCH] Update server count handling in Dashboard component to separate physical servers and VMs --- app/dashboard/Dashboard.tsx | 23 +++++++++---- components/ui/progress.tsx | 31 +++++++++++++++++ package-lock.json | 67 +++++++++++++++++++++++++++---------- package.json | 1 + 4 files changed, 99 insertions(+), 23 deletions(-) create mode 100644 components/ui/progress.tsx diff --git a/app/dashboard/Dashboard.tsx b/app/dashboard/Dashboard.tsx index b096e62..a514d2f 100644 --- a/app/dashboard/Dashboard.tsx +++ b/app/dashboard/Dashboard.tsx @@ -19,20 +19,23 @@ import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } import { Button } from "@/components/ui/button" interface StatsResponse { - serverCount: number + serverCountNoVMs: number + serverCountOnlyVMs: number applicationCount: number onlineApplicationsCount: number } export default function Dashboard() { - const [serverCount, setServerCount] = useState(0) + const [serverCountNoVMs, setServerCountNoVMs] = useState(0) + const [serverCountOnlyVMs, setServerCountOnlyVMs] = useState(0) const [applicationCount, setApplicationCount] = useState(0) const [onlineApplicationsCount, setOnlineApplicationsCount] = useState(0) const getStats = async () => { try { const response = await axios.post("/api/dashboard/get", {}) - setServerCount(response.data.serverCount) + setServerCountNoVMs(response.data.serverCountNoVMs) + setServerCountOnlyVMs(response.data.serverCountOnlyVMs) setApplicationCount(response.data.applicationCount) setOnlineApplicationsCount(response.data.onlineApplicationsCount) } catch (error: any) { @@ -78,8 +81,16 @@ export default function Dashboard() { Manage your server infrastructure -
{serverCount}
-

Active servers

+
+
+
{serverCountNoVMs}
+

Physical servers

+
+
+
{serverCountOnlyVMs}
+

VMs

+
+