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
82 setIsLoading(true);82 setIsLoading(true);
83 try {83 try {
84 // Check if all values are empty, if so, send null to clear the database84 // 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 !== "";
86 89
87 await mutateAsync({90 await mutateAsync({
88 applicationId: id || "",91 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
90 setIsLoading(true);90 setIsLoading(true);
91 try {91 try {
92 // Check if all values are empty, if so, send null to clear the database92 // Check if all values are empty, if so, send null to clear the database
93 const hasAnyValue = 93 const hasAnyValue =
94 (formData.Test && formData.Test.length > 0) ||94 (formData.Test && formData.Test.length > 0) ||
95 formData.Interval !== undefined ||95 formData.Interval !== undefined ||
96 formData.Timeout !== undefined ||96 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
103 setIsLoading(true);103 setIsLoading(true);
104 try {104 try {
105 // Check if all values are empty, if so, send null to clear the database105 // Check if all values are empty, if so, send null to clear the database
106 const hasAnyValue = 106 const hasAnyValue =
107 (formData.Constraints && formData.Constraints.length > 0) ||107 (formData.Constraints && formData.Constraints.length > 0) ||
108 (formData.Preferences && formData.Preferences.length > 0) ||108 (formData.Preferences && formData.Preferences.length > 0) ||
109 (formData.Platforms && formData.Platforms.length > 0) ||109 (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
94 try {94 try {
95 // Check if all values are empty, if so, send null to clear the database95 // Check if all values are empty, if so, send null to clear the database
96 const hasAnyValue = Object.values(formData).some(96 const hasAnyValue = Object.values(formData).some(
97 value => value !== undefined && value !== null && value !== ""97 (value) => value !== undefined && value !== null && value !== "",
98 );98 );
99 99
100 await mutateAsync({100 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
93 try {93 try {
94 // Check if all values are empty, if so, send null to clear the database94 // Check if all values are empty, if so, send null to clear the database
95 const hasAnyValue = Object.values(formData).some(95 const hasAnyValue = Object.values(formData).some(
96 value => value !== undefined && value !== null && value !== ""96 (value) => value !== undefined && value !== null && value !== "",
97 );97 );
98 98
99 await mutateAsync({99 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
119 type="number"119 type="number"
120 placeholder="30000000000"120 placeholder="30000000000"
121 {...field}121 {...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 }
123 onChange={(e) =>127 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 )
125 }131 }
126 />132 />
127 </FormControl>133 </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
99 try {99 try {
100 // Check if all values are empty, if so, send null to clear the database100 // Check if all values are empty, if so, send null to clear the database
101 const hasAnyValue = Object.values(formData).some(101 const hasAnyValue = Object.values(formData).some(
102 value => value !== undefined && value !== null && value !== ""102 (value) => value !== undefined && value !== null && value !== "",
103 );103 );
104 104
105 await mutateAsync({105 await mutateAsync({
apps/dokploy/components/dashboard/application/advanced/cluster/swarm-forms/utils.ts+17−12
@@ -2,20 +2,25 @@ · 1 unmodified line
2 * Filters out undefined, null, and empty string values from form data2 * Filters out undefined, null, and empty string values from form data
3 * Only returns fields that have actual values3 * Only returns fields that have actual values
4 */4 */
5export const filterEmptyValues = (formData: Record<string, any>): Record<string, any> => {5export const filterEmptyValues = (
6 return Object.entries(formData).reduce((acc, [key, value]) => {6 formData: Record<string, any>,
7 // Keep arrays even if empty (they might be intentionally cleared)7): Record<string, any> => {
8 if (Array.isArray(value)) {8 return Object.entries(formData).reduce(
9 if (value.length > 0) {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 !== "") {
10 acc[key] = value;18 acc[key] = value;
11 }19 }
12 }20 return acc;
13 // For other values, filter out undefined, null, and empty strings21 },
14 else if (value !== undefined && value !== null && value !== "") {22 {} as Record<string, any>,
15 acc[key] = value;23 );
16 }
17 return acc;
18 }, {} as Record<string, any>);
19};24};
20 25
21/**26/**

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