From a7983f32a6eb6f28aac9a8b1b5c7fd751d20d013 Mon Sep 17 00:00:00 2001 From: 190km Date: Mon, 30 Dec 2024 20:05:44 +0100 Subject: [PATCH 1/2] style: added gap for cards title & gap for tls status & availability --- .../dashboard/swarm/details/details-card.tsx | 2 +- .../dashboard/swarm/monitoring-card.tsx | 108 ++++++++++-------- 2 files changed, 61 insertions(+), 49 deletions(-) diff --git a/apps/dokploy/components/dashboard/swarm/details/details-card.tsx b/apps/dokploy/components/dashboard/swarm/details/details-card.tsx index 2de0901a0..eb06e79cb 100644 --- a/apps/dokploy/components/dashboard/swarm/details/details-card.tsx +++ b/apps/dokploy/components/dashboard/swarm/details/details-card.tsx @@ -63,7 +63,7 @@ export function NodeCard({ node, serverId }: Props) {
-
+
{node.Hostname}
diff --git a/apps/dokploy/components/dashboard/swarm/monitoring-card.tsx b/apps/dokploy/components/dashboard/swarm/monitoring-card.tsx index bd8570db9..16d2532c2 100644 --- a/apps/dokploy/components/dashboard/swarm/monitoring-card.tsx +++ b/apps/dokploy/components/dashboard/swarm/monitoring-card.tsx @@ -8,13 +8,7 @@ import { TooltipTrigger, } from "@/components/ui/tooltip"; import { api } from "@/utils/api"; -import { - Activity, - Loader2, - Monitor, - Settings, - Server, -} from "lucide-react"; +import { Activity, Loader2, Monitor, Settings, Server } from "lucide-react"; import { NodeCard } from "./details/details-card"; interface Props { @@ -26,46 +20,62 @@ export default function SwarmMonitorCard({ serverId }: Props) { serverId, }); - if (isLoading) { - return ( -
-
-
- -
-
-
- ); - } + if (isLoading) { + return ( +
+
+
+ +
+
+
+ ); + } - if (!nodes) { - return ( -
-
-
- Failed to load data -
-
-
- ); - } + if (!nodes) { + return ( +
+
+
+ Failed to load data +
+
+
+ ); + } const totalNodes = nodes.length; - const activeNodesCount = nodes.filter((node) => node.Status === "Ready").length; - const managerNodesCount = nodes.filter((node) =>node.ManagerStatus === "Leader" || node.ManagerStatus === "Reachable").length; + const activeNodesCount = nodes.filter( + (node) => node.Status === "Ready" + ).length; + const managerNodesCount = nodes.filter( + (node) => + node.ManagerStatus === "Leader" || node.ManagerStatus === "Reachable" + ).length; const activeNodes = nodes.filter((node) => node.Status === "Ready"); - const managerNodes = nodes.filter((node) => node.ManagerStatus === "Leader" || node.ManagerStatus === "Reachable"); + const managerNodes = nodes.filter( + (node) => + node.ManagerStatus === "Leader" || node.ManagerStatus === "Reachable" + ); return (
-

Docker Swarm Overview

-

Monitor and manage your Docker Swarm cluster

+

+ Docker Swarm Overview +

+

+ Monitor and manage your Docker Swarm cluster +

{!serverId && ( - @@ -87,12 +97,13 @@ export default function SwarmMonitorCard({ serverId }: Props) { - - Active Nodes - - Online - - +
+ + Active Nodes + + Online + +
@@ -121,12 +132,13 @@ export default function SwarmMonitorCard({ serverId }: Props) { - - Manager Nodes - - Online - - +
+ + Manager Nodes + + Online + +
@@ -162,4 +174,4 @@ export default function SwarmMonitorCard({ serverId }: Props) {
); -} \ No newline at end of file +} From b17369264cfa2cef011a4173ee0dbd1297cfdd87 Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Wed, 1 Jan 2025 19:02:24 -0600 Subject: [PATCH 2/2] refactor: remove min-h-screen --- .../dashboard/swarm/monitoring-card.tsx | 308 +++++++++--------- 1 file changed, 153 insertions(+), 155 deletions(-) diff --git a/apps/dokploy/components/dashboard/swarm/monitoring-card.tsx b/apps/dokploy/components/dashboard/swarm/monitoring-card.tsx index 16d2532c2..0dd34852a 100644 --- a/apps/dokploy/components/dashboard/swarm/monitoring-card.tsx +++ b/apps/dokploy/components/dashboard/swarm/monitoring-card.tsx @@ -2,176 +2,174 @@ import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { - Tooltip, - TooltipContent, - TooltipProvider, - TooltipTrigger, + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, } from "@/components/ui/tooltip"; import { api } from "@/utils/api"; import { Activity, Loader2, Monitor, Settings, Server } from "lucide-react"; import { NodeCard } from "./details/details-card"; interface Props { - serverId?: string; + serverId?: string; } export default function SwarmMonitorCard({ serverId }: Props) { - const { data: nodes, isLoading } = api.swarm.getNodes.useQuery({ - serverId, - }); + const { data: nodes, isLoading } = api.swarm.getNodes.useQuery({ + serverId, + }); - if (isLoading) { - return ( -
-
-
- -
-
-
- ); - } + if (isLoading) { + return ( +
+
+
+ +
+
+
+ ); + } - if (!nodes) { - return ( -
-
-
- Failed to load data -
-
-
- ); - } + if (!nodes) { + return ( +
+
+
+ Failed to load data +
+
+
+ ); + } - const totalNodes = nodes.length; - const activeNodesCount = nodes.filter( - (node) => node.Status === "Ready" - ).length; - const managerNodesCount = nodes.filter( - (node) => - node.ManagerStatus === "Leader" || node.ManagerStatus === "Reachable" - ).length; - const activeNodes = nodes.filter((node) => node.Status === "Ready"); - const managerNodes = nodes.filter( - (node) => - node.ManagerStatus === "Leader" || node.ManagerStatus === "Reachable" - ); + const totalNodes = nodes.length; + const activeNodesCount = nodes.filter( + (node) => node.Status === "Ready", + ).length; + const managerNodesCount = nodes.filter( + (node) => + node.ManagerStatus === "Leader" || node.ManagerStatus === "Reachable", + ).length; + const activeNodes = nodes.filter((node) => node.Status === "Ready"); + const managerNodes = nodes.filter( + (node) => + node.ManagerStatus === "Leader" || node.ManagerStatus === "Reachable", + ); - return ( -
-
-
-
-

- Docker Swarm Overview -

-

- Monitor and manage your Docker Swarm cluster -

-
- {!serverId && ( - - )} -
+ return ( +
+
+
+
+

+ Docker Swarm Overview +

+

+ Monitor and manage your Docker Swarm cluster +

+
+ {!serverId && ( + + )} +
-
- - - Total Nodes -
- -
-
- -
{totalNodes}
-
-
+
+ + + Total Nodes +
+ +
+
+ +
{totalNodes}
+
+
- - -
- - Active Nodes - - Online + + +
+ + Active Nodes + + Online +
+
+ +
+
+ + + + +
+ {activeNodesCount} / {totalNodes} +
+
+ +
+ {activeNodes.map((node) => ( +
+ {node.Hostname} +
+ ))} +
+
+
+
+
+
-
-
- -
-
- - - - -
- {activeNodesCount} / {totalNodes} -
-
- -
- {activeNodes.map((node) => ( -
- {node.Hostname} -
- ))} -
-
-
-
-
-
+ + +
+ + Manager Nodes + + Online +
+
+ +
+
+ + + + +
+ {managerNodesCount} / {totalNodes} +
+
+ +
+ {managerNodes.map((node) => ( +
+ {node.Hostname} +
+ ))} +
+
+
+
+
+
+
- - -
- - Manager Nodes - - Online - -
-
- -
-
- - - - -
- {managerNodesCount} / {totalNodes} -
-
- -
- {managerNodes.map((node) => ( -
- {node.Hostname} -
- ))} -
-
-
-
-
-
-
- -
- {nodes.map((node) => ( - - ))} -
-
-
- ); +
+ {nodes.map((node) => ( + + ))} +
+
+
+ ); }