diff --git a/src/app/deployments/page.tsx b/src/app/deployments/page.tsx index 0938bda..6e75de2 100644 --- a/src/app/deployments/page.tsx +++ b/src/app/deployments/page.tsx @@ -12,95 +12,37 @@ import { Plus, GitBranch, } from "lucide-react"; - -const deployments = [ - { - id: "dep-001", - app: "api-gateway", - version: "v2.4.1", - previousVersion: "v2.4.0", - status: "running" as const, - deployedAt: "2024-01-15 14:32:18", - deployedBy: "ci/github-actions", - duration: "45s", - replicas: "3/3", - strategy: "rolling", - }, - { - id: "dep-002", - app: "auth-service", - version: "v1.8.0", - previousVersion: "v1.7.9", - status: "running" as const, - deployedAt: "2024-01-15 14:18:42", - deployedBy: "admin@dockship.io", - duration: "32s", - replicas: "2/2", - strategy: "rolling", - }, - { - id: "dep-003", - app: "worker-queue", - version: "v3.1.2", - previousVersion: "v3.1.1", - status: "pending" as const, - deployedAt: "2024-01-15 13:58:05", - deployedBy: "ci/github-actions", - duration: "—", - replicas: "3/4", - strategy: "rolling", - }, - { - id: "dep-004", - app: "metrics-collector", - version: "v1.2.0", - previousVersion: "v1.1.8", - status: "error" as const, - deployedAt: "2024-01-15 13:42:11", - deployedBy: "ci/github-actions", - duration: "—", - replicas: "0/2", - strategy: "rolling", - }, - { - id: "dep-005", - app: "postgres-db", - version: "15-alpine", - previousVersion: "14-alpine", - status: "running" as const, - deployedAt: "2024-01-10 09:15:33", - deployedBy: "admin@dockship.io", - duration: "2m 18s", - replicas: "1/1", - strategy: "recreate", - }, - { - id: "dep-006", - app: "redis-cache", - version: "7-alpine", - previousVersion: "7-alpine", - status: "running" as const, - deployedAt: "2024-01-08 16:45:22", - deployedBy: "admin@dockship.io", - duration: "18s", - replicas: "1/1", - strategy: "recreate", - }, -]; +import { useEffect, useState } from "react"; +import { Deployment } from "@/lib/types"; +import { getDeployments } from "@/core/server/deployment"; +import { getApplications } from "@/core/application"; export default function DeploymentsPage() { + const [deployments, setDeployments] = useState([]); + + useEffect(() => { + const fetch = async () => { + setDeployments( + (await getDeployments(await getApplications())).filter( + (d) => d !== null + ) + ); + }; + fetch(); + }, []); + return ( {/* Header */} -
+
{deployments.length} deployments -
@@ -111,16 +53,7 @@ export default function DeploymentsPage() { - {[ - "Application", - "Version", - "Status", - "Replicas", - "Deployed", - "Duration", - "Deployed By", - "Actions", - ].map((h) => ( + {["Application", "Status", "Actions"].map((h) => ( {deployments.map((dep) => ( - + - - - - - - - - - -
- {dep.app} -
-
-
- - {dep.version} - - ← {dep.previousVersion} - + {dep.image}
{dep.status} - {dep.replicas} - - {dep.deployedAt} - - {dep.duration} - - {dep.deployedBy} -