From bb02de690b47cde4567f9f570b2a65a25615ddf6 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Mon, 9 Feb 2026 00:06:56 +0000 Subject: [PATCH] [autofix.ci] apply automated fixes --- .../swarm/containers/container-row.tsx | 23 +--- .../swarm/containers/node-section.tsx | 40 ++---- .../containers/show-swarm-containers.tsx | 121 ++++++++---------- packages/server/src/services/docker.ts | 2 +- 4 files changed, 71 insertions(+), 115 deletions(-) diff --git a/apps/dokploy/components/dashboard/swarm/containers/container-row.tsx b/apps/dokploy/components/dashboard/swarm/containers/container-row.tsx index 5e97b1d8c..26d58ab77 100644 --- a/apps/dokploy/components/dashboard/swarm/containers/container-row.tsx +++ b/apps/dokploy/components/dashboard/swarm/containers/container-row.tsx @@ -1,13 +1,6 @@ -import { - AlertCircle, - HardDrive, - Network, -} from "lucide-react"; +import { AlertCircle, HardDrive, Network } from "lucide-react"; import { Badge } from "@/components/ui/badge"; -import { - TableCell, - TableRow, -} from "@/components/ui/table"; +import { TableCell, TableRow } from "@/components/ui/table"; import { Tooltip, TooltipContent, @@ -27,7 +20,9 @@ export const ContainerRow = ({ container, stat }: ContainerRowProps) => { const hasError = container.Error && container.Error.trim() !== ""; const stateBadge = ( - + {container.CurrentState} ); @@ -36,9 +31,7 @@ export const ContainerRow = ({ container, stat }: ContainerRowProps) => {
- - {container.Name} - + {container.Name} {container.Image} @@ -66,9 +59,7 @@ export const ContainerRow = ({ container, stat }: ContainerRowProps) => { {stat ? ( - - {formatCpu(stat.CPUPerc)} - + {formatCpu(stat.CPUPerc)} ) : ( -- )} diff --git a/apps/dokploy/components/dashboard/swarm/containers/node-section.tsx b/apps/dokploy/components/dashboard/swarm/containers/node-section.tsx index 5f6692809..46248706a 100644 --- a/apps/dokploy/components/dashboard/swarm/containers/node-section.tsx +++ b/apps/dokploy/components/dashboard/swarm/containers/node-section.tsx @@ -1,8 +1,4 @@ -import { - ChevronDown, - ChevronRight, - Server, -} from "lucide-react"; +import { ChevronDown, ChevronRight, Server } from "lucide-react"; import { Badge } from "@/components/ui/badge"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { @@ -63,9 +59,7 @@ export const NodeSection = ({ )}
- - {group.nodeName} - + {group.nodeName} {group.nodeStatus && ( {nodeDown ? ( - {group.nodeStatus?.Status} / {group.nodeStatus?.Availability} + {group.nodeStatus?.Status} /{" "} + {group.nodeStatus?.Availability} ) : runningCount === group.containers.length ? ( All Running ) : ( - {runningCount}/{group.containers.length}{" "} - Running + {runningCount}/{group.containers.length} Running )} @@ -105,29 +99,17 @@ export const NodeSection = ({ - - Container - + Container State - - CPU - - - Memory - - - Block I/O - - - Network I/O - + CPU + Memory + Block I/O + Network I/O {group.containers.map((container) => { - const stat = findStatsForContainer( - container.Name, - ); + const stat = findStatsForContainer(container.Name); return ( { if (nodeApps && appDetails) { for (const app of nodeApps) { const details = - appDetails?.filter( - (detail: { Name: string }) => - detail.Name.startsWith(`${app.Name}.`), + appDetails?.filter((detail: { Name: string }) => + detail.Name.startsWith(`${app.Name}.`), ) || []; if (details.length === 0) { @@ -236,22 +235,24 @@ export const ShowSwarmContainers = ({ serverId }: Props) => { No Swarm Services Found Docker Swarm is active with{" "} - {nodes?.length ?? 0} node(s), but there - are no application services running in the swarm. + {nodes?.length ?? 0} node(s), but there are no + application services running in the swarm.

This view shows containers deployed as{" "} - Swarm services. Standalone or - Docker Compose containers won't appear here. + Swarm services. Standalone or Docker Compose + containers won't appear here. +

+

+ To see containers in this view, make sure your applications are:

-

To see containers in this view, make sure your applications are:

  1. - Deployed as Swarm services — - Applications in Dokploy deploy to Swarm by default. - Docker Compose projects need to use{" "} + Deployed as Swarm services — Applications + in Dokploy deploy to Swarm by default. Docker Compose projects + need to use{" "} Stack {" "} @@ -262,9 +263,9 @@ export const ShowSwarmContainers = ({ serverId }: Props) => { ) to run as Swarm services.
  2. - Using a registry (for multi-node - setups) — Worker nodes need to pull images - from a shared registry. Configure one in{" "} + Using a registry (for multi-node setups) — + Worker nodes need to pull images from a shared registry. Configure + one in{" "} { .
  3. - Successfully built and deployed{" "} - — Check your project's deployment logs for - errors. + Successfully built and deployed — Check + your project's deployment logs for errors.
@@ -303,8 +303,8 @@ export const ShowSwarmContainers = ({ serverId }: Props) => { No Running Containers - Found {nodeApps.length} service(s) in - the swarm, but none have running containers. + Found {nodeApps.length} service(s) in the swarm, + but none have running containers. {hasErrors && ( @@ -328,16 +328,13 @@ export const ShowSwarmContainers = ({ serverId }: Props) => {

This can happen when:

    +
  • Services are scaled to 0 replicas
  • - Services are scaled to 0 replicas + Containers are failing to start — check deployment logs for + errors
  • - Containers are failing to start — check - deployment logs for errors -
  • -
  • - Images can't be pulled on worker nodes — - verify your{" "} + Images can't be pulled on worker nodes — verify your{" "} {
  • - Node constraints prevent scheduling — check - placement rules in your app's Cluster settings + Node constraints prevent scheduling — check placement rules + in your app's Cluster settings
@@ -432,8 +429,7 @@ export const ShowSwarmContainers = ({ serverId }: Props) => { Container Breakdown by Node

- Showing containers across{" "} - {nodes?.length ?? 0} swarm node(s) + Showing containers across {nodes?.length ?? 0} swarm node(s) {statsLoading ? "" : " (metrics refresh every 5s)"}

@@ -446,17 +442,13 @@ export const ShowSwarmContainers = ({ serverId }: Props) => {
- - Swarm Nodes - + Swarm Nodes
-
- {nodes?.length ?? 0} -
+
{nodes?.length ?? 0}
{downNodes.length > 0 && (

{downNodes.length} node(s) down or drained @@ -467,17 +459,13 @@ export const ShowSwarmContainers = ({ serverId }: Props) => { - - Services - + Services

-
- {nodeApps?.length ?? 0} -
+
{nodeApps?.length ?? 0}
{unscheduledServices.length > 0 && (

{unscheduledServices.length} with no running tasks @@ -496,9 +484,7 @@ export const ShowSwarmContainers = ({ serverId }: Props) => {

-
- {runningContainers.length} -
+
{runningContainers.length}
@@ -507,19 +493,17 @@ export const ShowSwarmContainers = ({ serverId }: Props) => { {downNodes.length > 0 && ( - - {downNodes.length} Node(s) Unavailable - + {downNodes.length} Node(s) Unavailable

- The following nodes are not ready or have been drained. - Containers scheduled on these nodes may not be running. + The following nodes are not ready or have been drained. Containers + scheduled on these nodes may not be running.

    {downNodes.map((node: SwarmNode) => (
  • - {node.Hostname} —{" "} - Status: {node.Status}, Availability: {node.Availability} + {node.Hostname} — Status: {node.Status} + , Availability: {node.Availability} {node.ManagerStatus && ` (${node.ManagerStatus})`}
  • ))} @@ -543,9 +527,12 @@ export const ShowSwarmContainers = ({ serverId }: Props) => { Multi-Node Metrics Note - CPU, memory, and I/O metrics are collected from the manager - node via docker stats. - Containers running on worker nodes will show “--” for metrics. + CPU, memory, and I/O metrics are collected from the manager node via{" "} + + docker stats + + . Containers running on worker nodes will show “--” for + metrics. )} @@ -571,8 +558,8 @@ export const ShowSwarmContainers = ({ serverId }: Props) => {

    - These services exist in the swarm but have no running - containers. They may be scaled to 0 replicas or failing to start. + These services exist in the swarm but have no running containers. + They may be scaled to 0 replicas or failing to start.

      {unscheduledServices.map((svc) => ( @@ -634,7 +621,10 @@ interface SwarmNotAvailableProps { onRetry: () => void; } -const SwarmNotAvailable = ({ errorMessage, onRetry }: SwarmNotAvailableProps) => ( +const SwarmNotAvailable = ({ + errorMessage, + onRetry, +}: SwarmNotAvailableProps) => (
      @@ -642,16 +632,14 @@ const SwarmNotAvailable = ({ errorMessage, onRetry }: SwarmNotAvailableProps) => Could not reach Docker Swarm.{" "} {errorMessage && ( - - {errorMessage} - + {errorMessage} )}

      - This feature requires Docker Swarm to be initialized and active. - To get started: + This feature requires Docker Swarm to be initialized and active. To get + started:

      1. @@ -679,12 +667,7 @@ const SwarmNotAvailable = ({ errorMessage, onRetry }: SwarmNotAvailableProps) =>
      - diff --git a/packages/server/src/services/docker.ts b/packages/server/src/services/docker.ts index ee69393a5..ef36ec91c 100644 --- a/packages/server/src/services/docker.ts +++ b/packages/server/src/services/docker.ts @@ -498,7 +498,7 @@ export const getAllContainerStats = async (serverId?: string) => { try { let stdout = ""; const command = - "docker stats --no-stream --format '{\"BlockIO\":\"{{.BlockIO}}\",\"CPUPerc\":\"{{.CPUPerc}}\",\"Container\":\"{{.Container}}\",\"ID\":\"{{.ID}}\",\"MemPerc\":\"{{.MemPerc}}\",\"MemUsage\":\"{{.MemUsage}}\",\"Name\":\"{{.Name}}\",\"NetIO\":\"{{.NetIO}}\"}'"; + 'docker stats --no-stream --format \'{"BlockIO":"{{.BlockIO}}","CPUPerc":"{{.CPUPerc}}","Container":"{{.Container}}","ID":"{{.ID}}","MemPerc":"{{.MemPerc}}","MemUsage":"{{.MemUsage}}","Name":"{{.Name}}","NetIO":"{{.NetIO}}"}\''; if (serverId) { const result = await execAsyncRemote(serverId, command);