diff --git a/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/health-check-form.tsx b/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/health-check-form.tsx index 06c8eb94a..0f640cc37 100644 --- a/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/health-check-form.tsx +++ b/apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/health-check-form.tsx @@ -16,12 +16,17 @@ import { import { Input } from "@/components/ui/input"; import { api } from "@/utils/api"; +const optionalNumber = z + .union([z.string(), z.number()]) + .transform((val) => (val === "" ? undefined : Number(val))) + .optional(); + export const healthCheckFormSchema = z.object({ Test: z.array(z.string()).optional(), - Interval: z.coerce.number().optional(), - Timeout: z.coerce.number().optional(), - StartPeriod: z.coerce.number().optional(), - Retries: z.coerce.number().optional(), + Interval: optionalNumber, + Timeout: optionalNumber, + StartPeriod: optionalNumber, + Retries: optionalNumber, }); interface HealthCheckFormProps { @@ -195,7 +200,7 @@ export const HealthCheckForm = ({ id, type }: HealthCheckFormProps) => { Time between health checks (e.g., 10000000000 for 10 seconds) - + @@ -212,7 +217,7 @@ export const HealthCheckForm = ({ id, type }: HealthCheckFormProps) => { Maximum time to wait for health check response - + @@ -229,7 +234,7 @@ export const HealthCheckForm = ({ id, type }: HealthCheckFormProps) => { Initial grace period before health checks begin - + @@ -247,7 +252,7 @@ export const HealthCheckForm = ({ id, type }: HealthCheckFormProps) => { unhealthy - +