From e7f4b627f7ff708c49ec5e9226e860b1fe272ae3 Mon Sep 17 00:00:00 2001 From: Nadeesha Cabral Date: Tue, 17 Dec 2024 17:18:32 +1100 Subject: [PATCH 1/2] feat: Introduce ControlPlaneBox component and enhance ServiceCard layout --- app/components/cluster-details.tsx | 177 ++++++++++++++++++----------- 1 file changed, 111 insertions(+), 66 deletions(-) diff --git a/app/components/cluster-details.tsx b/app/components/cluster-details.tsx index ad02a7b6..6ca24daf 100644 --- a/app/components/cluster-details.tsx +++ b/app/components/cluster-details.tsx @@ -7,7 +7,7 @@ import { SheetTitle, SheetTrigger, } from "@/components/ui/sheet"; -import { Blocks, Cpu } from "lucide-react"; +import { Blocks, Cpu, Network } from "lucide-react"; import { useCallback, useEffect, useState } from "react"; import { SmallDeadRedCircle, SmallLiveGreenCircle } from "./circles"; import { Button } from "./ui/button"; @@ -32,6 +32,7 @@ import { DeadGrayCircle, DeadRedCircle, LiveGreenCircle } from "./circles"; import ErrorDisplay from "./error-display"; import { EventsOverlayButton } from "./events-overlay"; import { ServerConnectionStatus } from "./server-connection-pane"; +import { cn } from "@/lib/utils"; function toServiceName(name: string) { return {name}; @@ -45,73 +46,110 @@ function toFunctionName(name: string, serviceName: string) { return {name}; } +function ControlPlaneBox() { + return ( +
+
+
+
+ +
+
+
+ Control Plane + +
+
+ api.inferable.ai +
+
+
+
+ ); +} + function ServiceCard({ service, clusterId, + index, + total, }: { service: ClientInferResponseBody[number]; clusterId: string; + index: number; + total: number; }) { return ( -
-
-
- {service.name === "InferableApplications" ? ( - - ) : ( - - )} -
-
-
- {toServiceName(service.name)} +
+
+
+ +
+
+
+ {service.name === "InferableApplications" ? ( + + ) : ( + + )}
-
- {service.functions?.length || 0} Functions +
+
+ {toServiceName(service.name)} +
+
+ {service.functions?.length || 0} Functions +
+ + + + Function + Description + Last Ping + + + + {service.functions + ?.sort((a, b) => a.name.localeCompare(b.name)) + .map((func) => ( + + +
+ + {toFunctionName(func.name, service.name)} + + +
+
+ + {func.description || "No description"} + + + {new Date(service.timestamp) > new Date() ? ( +

+ Permanent Sync +

+ ) : ( + formatDistance(new Date(service.timestamp), new Date()) + )} +
+
+ ))} +
+
- - - - Function - Description - Last Ping - - - - {service.functions - ?.sort((a, b) => a.name.localeCompare(b.name)) - .map((func) => ( - - -
- - {toFunctionName(func.name, service.name)} - - -
-
- - {func.description || "No description"} - - - {new Date(service.timestamp) > new Date() ? ( -

- Permanent Sync -

- ) : ( - formatDistance(new Date(service.timestamp), new Date()) - )} -
-
- ))} -
-
); } @@ -143,18 +181,25 @@ export default function ServicesOverview({ clusterId }: { clusterId: string }) { getClusterServices(); }, [getClusterServices]); + const sortedServices = services.sort((a, b) => a.name.localeCompare(b.name)); + return (
-
- {services - .sort((a, b) => a.name.localeCompare(b.name)) - .map((service) => ( - - ))} + +
+ {sortedServices.length > 0 && ( +
+ )} + + {sortedServices.map((service, index) => ( + + ))}
); From c424f205d805f39b2619a4de1dbad92878da8a78 Mon Sep 17 00:00:00 2001 From: Nadeesha Cabral Date: Tue, 17 Dec 2024 17:29:33 +1100 Subject: [PATCH 2/2] update --- app/components/cluster-details.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/cluster-details.tsx b/app/components/cluster-details.tsx index 6ca24daf..c06b9da4 100644 --- a/app/components/cluster-details.tsx +++ b/app/components/cluster-details.tsx @@ -7,7 +7,7 @@ import { SheetTitle, SheetTrigger, } from "@/components/ui/sheet"; -import { Blocks, Cpu, Network } from "lucide-react"; +import { Blocks, Cpu } from "lucide-react"; import { useCallback, useEffect, useState } from "react"; import { SmallDeadRedCircle, SmallLiveGreenCircle } from "./circles"; import { Button } from "./ui/button";