From a0566cdbd777f0d3e14052b18d1800196bbd6687 Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Sat, 21 Feb 2026 14:59:50 -0600 Subject: [PATCH] refactor: remove unused server value and update network handling logic - Eliminated the unused DOKPLOY_SERVER_VALUE constant from the network handling component. - Updated the default serverId to undefined in the network form values and adjusted related logic to ensure compatibility with cloud environments. - Enhanced server validation in the createNetwork function to require a serverId when in cloud mode, improving error handling for network creation. --- .../dashboard/networks/handle-network.tsx | 13 +++++-------- packages/server/src/services/network.ts | 19 ++++++++++++------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/apps/dokploy/components/dashboard/networks/handle-network.tsx b/apps/dokploy/components/dashboard/networks/handle-network.tsx index 8af7db795..86d328b8e 100644 --- a/apps/dokploy/components/dashboard/networks/handle-network.tsx +++ b/apps/dokploy/components/dashboard/networks/handle-network.tsx @@ -48,9 +48,6 @@ const networkDriverEnum = [ /** Sentinel for "no scope" */ const SCOPE_EMPTY = "__scope_none__"; -/** Value for "Dokploy server" (local / no specific server). Not used in cloud. */ -const DOKPLOY_SERVER_VALUE = "__dokploy_server__"; - const ipamConfigEntrySchema = z.object({ subnet: z.string().optional(), ipRange: z.string().optional(), @@ -78,7 +75,7 @@ const defaultValues: NetworkFormValues = { name: "", driver: "bridge", scope: SCOPE_EMPTY, - serverId: DOKPLOY_SERVER_VALUE, + serverId: undefined, internal: false, attachable: false, ingress: false, @@ -134,7 +131,7 @@ export const HandleNetwork = ({ networkId, children }: HandleNetworkProps) => { name: network.name, driver: network.driver, scope: network.scope ?? SCOPE_EMPTY, - serverId: network.serverId ?? DOKPLOY_SERVER_VALUE, + serverId: network.serverId || undefined, internal: network.internal, attachable: network.attachable, enableIPv4: network.enableIPv4, @@ -157,7 +154,7 @@ export const HandleNetwork = ({ networkId, children }: HandleNetworkProps) => { name: data.name, driver: data.driver, scope, - serverId: data.serverId ?? undefined, + serverId: data.serverId || undefined, internal: data.internal, attachable: data.attachable, ingress: data.ingress, @@ -268,7 +265,7 @@ export const HandleNetwork = ({ networkId, children }: HandleNetworkProps) => { Server