diff --git a/apps/dokploy/components/dashboard/settings/servers/show-swarm-overview-modal.tsx b/apps/dokploy/components/dashboard/settings/servers/show-swarm-overview-modal.tsx index f8acd207..1bb6fe5a 100644 --- a/apps/dokploy/components/dashboard/settings/servers/show-swarm-overview-modal.tsx +++ b/apps/dokploy/components/dashboard/settings/servers/show-swarm-overview-modal.tsx @@ -39,11 +39,8 @@ export const ShowSwarmOverviewModal = ({ serverId }: Props) => {

-
-
- -
+
diff --git a/apps/dokploy/components/dashboard/swarm/details/details-card.tsx b/apps/dokploy/components/dashboard/swarm/details/details-card.tsx index a499f898..2de0901a 100644 --- a/apps/dokploy/components/dashboard/swarm/details/details-card.tsx +++ b/apps/dokploy/components/dashboard/swarm/details/details-card.tsx @@ -1,140 +1,127 @@ import { Badge } from "@/components/ui/badge"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; +import { Separator } from "@/components/ui/separator"; import { api } from "@/utils/api"; import { - AlertCircle, - CheckCircle, - HelpCircle, - Loader2, - LoaderIcon, + Box, + Cpu, + Database, + HardDrive, + Loader2, } from "lucide-react"; import { ShowNodeApplications } from "../applications/show-applications"; import { ShowNodeConfig } from "./show-node-config"; export interface SwarmList { - ID: string; - Hostname: string; - Availability: string; - EngineVersion: string; - Status: string; - ManagerStatus: string; - TLSStatus: string; + ID: string; + Hostname: string; + Availability: string; + EngineVersion: string; + Status: string; + ManagerStatus: string; + TLSStatus: string; } interface Props { - node: SwarmList; - serverId?: string; + node: SwarmList; + serverId?: string; } export function NodeCard({ node, serverId }: Props) { - const { data, isLoading } = api.swarm.getNodeInfo.useQuery({ - nodeId: node.ID, - serverId, - }); + const { data, isLoading } = api.swarm.getNodeInfo.useQuery({ + nodeId: node.ID, + serverId, + }); - const getStatusIcon = (status: string) => { - switch (status) { - case "Ready": - return ; - case "Down": - return ; - default: - return ; - } - }; - if (isLoading) { - return ( - - - - - {getStatusIcon(node.Status)} - {node.Hostname} - - - {node.ManagerStatus || "Worker"} - - - - -
- -
-
-
- ); - } + if (isLoading) { + return ( + + + + + {node.Hostname} + + + {node.ManagerStatus || "Worker"} + + + + +
+ +
+
+
+ ); + } - return ( - - - - - {getStatusIcon(node.Status)} - {node.Hostname} - - - {node.ManagerStatus || "Worker"} - - - - -
-
- Status: - {node.Status} -
-
- IP Address: - {isLoading ? ( - - ) : ( - {data?.Status?.Addr} - )} -
-
- Availability: - {node.Availability} -
-
- Engine Version: - {node.EngineVersion} -
-
- CPU: - {isLoading ? ( - - ) : ( - - {(data?.Description?.Resources?.NanoCPUs / 1e9).toFixed(2)} GHz - - )} -
-
- Memory: - {isLoading ? ( - - ) : ( - - {( - data?.Description?.Resources?.MemoryBytes / - 1024 ** 3 - ).toFixed(2)}{" "} - GB - - )} -
-
- TLS Status: - {node.TLSStatus} -
-
-
- - -
-
-
- ); -} + return ( + + + Node Status + + +
+
+
+
+
{node.Hostname}
+ + {node.ManagerStatus || "Worker"} + +
+
+ + TLS Status: {node.TLSStatus} + + + Availability: {node.Availability} + +
+
+ + + +
+
+
+ + Engine Version +
+
{node.EngineVersion}
+
+
+
+ + CPU +
+
{data && (data.Description?.Resources?.NanoCPUs / 1e9).toFixed(2)} Core(s)
+
+
+
+ + Memory +
+
+ {data && (data.Description?.Resources?.MemoryBytes / 1024 ** 3).toFixed(2)} GB +
+
+
+
+ + IP Address +
+
{data?.Status?.Addr}
+
+
+ +
+ + +
+
+ + + ); +} \ No newline at end of file diff --git a/apps/dokploy/components/dashboard/swarm/monitoring-card.tsx b/apps/dokploy/components/dashboard/swarm/monitoring-card.tsx index e2453dd9..bd8570db 100644 --- a/apps/dokploy/components/dashboard/swarm/monitoring-card.tsx +++ b/apps/dokploy/components/dashboard/swarm/monitoring-card.tsx @@ -2,35 +2,35 @@ 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 { - AlertCircle, - CheckCircle, - HelpCircle, - Loader2, - Server, + 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 (
-
+
@@ -50,139 +50,116 @@ export default function SwarmMonitorCard({ serverId }: Props) { ); } - 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 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 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 && ( + + )} +
- const getStatusIcon = (status: string) => { - switch (status) { - case "Ready": - return ; - case "Down": - return ; - case "Disconnected": - return ; - default: - return ; - } - }; +
+ + + Total Nodes +
+ +
+
+ +
{totalNodes}
+
+
- return ( -
-
-

Docker Swarm Overview

- {!serverId && ( - - )} -
- - - - - Monitor - - - -
-
- Total Nodes: - {totalNodes} -
-
- Active Nodes: - - - - - {activeNodesCount} / {totalNodes} - - - -
- {activeNodes.map((node) => ( -
- {getStatusIcon(node.Status)} - {node.Hostname} -
- ))} -
-
-
-
-
-
- Manager Nodes: - - - - - {managerNodesCount} / {totalNodes} - - - -
- {managerNodes.map((node) => ( -
- {getStatusIcon(node.Status)} - {node.Hostname} -
- ))} -
-
-
-
-
-
-
-

Node Status:

-
    - {nodes.map((node) => ( -
  • - - {getStatusIcon(node.Status)} - {node.Hostname} - - - {node.ManagerStatus || "Worker"} - -
  • - ))} -
-
-
-
-
- {nodes.map((node) => ( - - ))} -
-
- ); -} + + + + Active Nodes + + Online + + +
+ +
+
+ + + + +
+ {activeNodesCount} / {totalNodes} +
+
+ +
+ {activeNodes.map((node) => ( +
+ {node.Hostname} +
+ ))} +
+
+
+
+
+
+ + + + + Manager Nodes + + Online + + +
+ +
+
+ + + + +
+ {managerNodesCount} / {totalNodes} +
+
+ +
+ {managerNodes.map((node) => ( +
+ {node.Hostname} +
+ ))} +
+
+
+
+
+
+
+ +
+ {nodes.map((node) => ( + + ))} +
+
+
+ ); +} \ No newline at end of file diff --git a/apps/dokploy/pages/dashboard/swarm.tsx b/apps/dokploy/pages/dashboard/swarm.tsx index 15a7d793..f36de68e 100644 --- a/apps/dokploy/pages/dashboard/swarm.tsx +++ b/apps/dokploy/pages/dashboard/swarm.tsx @@ -10,9 +10,7 @@ import superjson from "superjson"; const Dashboard = () => { return ( <> -
- -
+ ); };