History

[autofix.ci] apply automated fixes

autofix-ci[bot] committed 9 months ago

Commit 7e48b2c1 parent a0d8eb98 files · +34 −20Browse files

Unified · Split

8 files
  1. apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/endpoint-spec-form.tsx +4 −1
  2. apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/health-check-form.tsx +1 −1
  3. apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/placement-form.tsx +1 −1
  4. apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/restart-policy-form.tsx +1 −1
  5. apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/rollback-config-form.tsx +1 −1
  6. apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/stop-grace-period-form.tsx +8 −2
  7. apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/update-config-form.tsx +1 −1
  8. apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/utils.ts +17 −12
apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/endpoint-spec-form.tsx+4−1
@@ -82,7 +82,10 @@ export const EndpointSpecForm = ({ id, type }: EndpointSpecFormProps) => { · 81 unmodified lines
8282 setIsLoading(true);
8383 try {
8484 // Check if all values are empty, if so, send null to clear the database
85− const hasAnyValue = formData.Mode !== undefined && formData.Mode !== null && formData.Mode !== "";
85+ const hasAnyValue =
86+ formData.Mode !== undefined &&
87+ formData.Mode !== null &&
88+ formData.Mode !== "";
8689
8790 await mutateAsync({
8891 applicationId: id || "",
apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/health-check-form.tsx+1−1
@@ -90,7 +90,7 @@ export const HealthCheckForm = ({ id, type }: HealthCheckFormProps) => { · 89 unmodified lines
9090 setIsLoading(true);
9191 try {
9292 // Check if all values are empty, if so, send null to clear the database
93− const hasAnyValue =
93+ const hasAnyValue =
9494 (formData.Test && formData.Test.length > 0) ||
9595 formData.Interval !== undefined ||
9696 formData.Timeout !== undefined ||
apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/placement-form.tsx+1−1
@@ -103,7 +103,7 @@ export const PlacementForm = ({ id, type }: PlacementFormProps) => { · 102 unmodified lines
103103 setIsLoading(true);
104104 try {
105105 // Check if all values are empty, if so, send null to clear the database
106− const hasAnyValue =
106+ const hasAnyValue =
107107 (formData.Constraints && formData.Constraints.length > 0) ||
108108 (formData.Preferences && formData.Preferences.length > 0) ||
109109 (formData.Platforms && formData.Platforms.length > 0) ||
apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/restart-policy-form.tsx+1−1
@@ -94,7 +94,7 @@ export const RestartPolicyForm = ({ id, type }: RestartPolicyFormProps) => { · 93 unmodified lines
9494 try {
9595 // Check if all values are empty, if so, send null to clear the database
9696 const hasAnyValue = Object.values(formData).some(
97− value => value !== undefined && value !== null && value !== ""
97+ (value) => value !== undefined && value !== null && value !== "",
9898 );
9999
100100 await mutateAsync({
apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/rollback-config-form.tsx+1−1
@@ -93,7 +93,7 @@ export const RollbackConfigForm = ({ id, type }: RollbackConfigFormProps) => { · 92 unmodified lines
9393 try {
9494 // Check if all values are empty, if so, send null to clear the database
9595 const hasAnyValue = Object.values(formData).some(
96− value => value !== undefined && value !== null && value !== ""
96+ (value) => value !== undefined && value !== null && value !== "",
9797 );
9898
9999 await mutateAsync({
apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/stop-grace-period-form.tsx+8−2
@@ -119,9 +119,15 @@ export const StopGracePeriodForm = ({ id, type }: StopGracePeriodFormProps) => { · 118 unmodified lines
119119 type="number"
120120 placeholder="30000000000"
121121 {...field}
122− value={field?.value !== null && field?.value !== undefined ? field.value.toString() : ""}
122+ value={
123+ field?.value !== null && field?.value !== undefined
124+ ? field.value.toString()
125+ : ""
126+ }
123127 onChange={(e) =>
124− field.onChange(e.target.value ? BigInt(e.target.value) : null)
128+ field.onChange(
129+ e.target.value ? BigInt(e.target.value) : null,
130+ )
125131 }
126132 />
127133 </FormControl>
apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/update-config-form.tsx+1−1
@@ -99,7 +99,7 @@ export const UpdateConfigForm = ({ id, type }: UpdateConfigFormProps) => { · 98 unmodified lines
9999 try {
100100 // Check if all values are empty, if so, send null to clear the database
101101 const hasAnyValue = Object.values(formData).some(
102− value => value !== undefined && value !== null && value !== ""
102+ (value) => value !== undefined && value !== null && value !== "",
103103 );
104104
105105 await mutateAsync({
apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/utils.ts+17−12
@@ -2,20 +2,25 @@ · 1 unmodified line
22 * Filters out undefined, null, and empty string values from form data
33 * Only returns fields that have actual values
44 */
5−export const filterEmptyValues = (formData: Record<string, any>): Record<string, any> => {
6− return Object.entries(formData).reduce((acc, [key, value]) => {
7− // Keep arrays even if empty (they might be intentionally cleared)
8− if (Array.isArray(value)) {
9− if (value.length > 0) {
5+export const filterEmptyValues = (
6+ formData: Record<string, any>,
7+): Record<string, any> => {
8+ return Object.entries(formData).reduce(
9+ (acc, [key, value]) => {
10+ // Keep arrays even if empty (they might be intentionally cleared)
11+ if (Array.isArray(value)) {
12+ if (value.length > 0) {
13+ acc[key] = value;
14+ }
15+ }
16+ // For other values, filter out undefined, null, and empty strings
17+ else if (value !== undefined && value !== null && value !== "") {
1018 acc[key] = value;
1119 }
12− }
13− // For other values, filter out undefined, null, and empty strings
14− else if (value !== undefined && value !== null && value !== "") {
15− acc[key] = value;
16− }
17− return acc;
18− }, {} as Record<string, any>);
20+ return acc;
21+ },
22+ {} as Record<string, any>,
23+ );
1924 };
2025
2126 /**

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t