diff --git a/src/app/overview/page.tsx b/src/app/overview/page.tsx index e6007c9..b071fa1 100644 --- a/src/app/overview/page.tsx +++ b/src/app/overview/page.tsx @@ -12,16 +12,16 @@ import { Activity, ArrowRight, Clock, + Rocket, } from "lucide-react"; import { Progress } from "@/components/ui/progress"; import Link from "next/link"; import { getLiveNodes } from "@/core/node"; import { useEffect, useState } from "react"; -import { Docker, Node, NodeLiveData } from "@/lib/types"; -import axios from "axios"; -import Cookies from "js-cookie"; -import { getSession } from "@/core/auth/session"; +import { Application, Docker, Node, NodeLiveData } from "@/lib/types"; import { getDocker } from "@/core/docker"; +import { getApplications } from "@/core/application"; +import { cn } from "@/lib/utils"; const recentDeployments = [ { @@ -54,53 +54,17 @@ const recentDeployments = [ }, ]; -const applications = [ - { - name: "api-gateway", - containers: 3, - cpu: 45, - memory: 62, - status: "running" as const, - }, - { - name: "auth-service", - containers: 2, - cpu: 28, - memory: 45, - status: "running" as const, - }, - { - name: "postgres-db", - containers: 1, - cpu: 65, - memory: 78, - status: "running" as const, - }, - { - name: "redis-cache", - containers: 1, - cpu: 12, - memory: 34, - status: "running" as const, - }, - { - name: "worker-queue", - containers: 4, - cpu: 55, - memory: 48, - status: "pending" as const, - }, -].slice(-5); - export default function OverviewPage() { const [nodes, setNodes] = useState<(NodeLiveData & Node)[]>([]); const [dockerNodes, setDockerNodes] = useState([]); + const [apps, setApplications] = useState([]); useEffect(() => { const fetchNodes = async () => { const nodes = await getLiveNodes(); setNodes(nodes); setDockerNodes(await getDocker(nodes)); + setApplications(await getApplications()); }; fetchNodes(); const interval = setInterval(fetchNodes, 3000); @@ -114,10 +78,24 @@ export default function OverviewPage() {
app.deployments.length > 0).length + } Deployed`} icon={} /> + } + /> + n.liveData).length} + subtitle="online" + icon={} + /> } /> - n.liveData).length} - subtitle="online" - icon={} - /> - } - />
{/* Applications & Deployments */} @@ -158,33 +124,21 @@ export default function OverviewPage() {
Name
-
Containers
-
CPU
-
Memory
-
Status
+
Deployments
+
Node
- {applications.map((app) => ( + {apps.slice(-5).map((app) => (
{app.name}
- {app.containers} + {app.deployments.length}
-
- - - {app.cpu}% - +
+ {nodes.find((node) => node.node_id === app.nodeId)?.name}
-
- - - {app.memory}% - -
-
{app.status}
))}
@@ -209,7 +163,14 @@ export default function OverviewPage() { className="flex flex-col sm:flex-row sm:items-center sm:justify-between py-2 border-b border-border last:border-0" >
- {dep.status} +
{dep.app}