mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-05 14:05:30 +02:00
[autofix.ci] apply automated fixes
This commit is contained in:
@@ -82,7 +82,10 @@ export const EndpointSpecForm = ({ id, type }: EndpointSpecFormProps) => {
|
|||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
try {
|
try {
|
||||||
// Check if all values are empty, if so, send null to clear the database
|
// Check if all values are empty, if so, send null to clear the database
|
||||||
const hasAnyValue = formData.Mode !== undefined && formData.Mode !== null && formData.Mode !== "";
|
const hasAnyValue =
|
||||||
|
formData.Mode !== undefined &&
|
||||||
|
formData.Mode !== null &&
|
||||||
|
formData.Mode !== "";
|
||||||
|
|
||||||
await mutateAsync({
|
await mutateAsync({
|
||||||
applicationId: id || "",
|
applicationId: id || "",
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ export const HealthCheckForm = ({ id, type }: HealthCheckFormProps) => {
|
|||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
try {
|
try {
|
||||||
// Check if all values are empty, if so, send null to clear the database
|
// Check if all values are empty, if so, send null to clear the database
|
||||||
const hasAnyValue =
|
const hasAnyValue =
|
||||||
(formData.Test && formData.Test.length > 0) ||
|
(formData.Test && formData.Test.length > 0) ||
|
||||||
formData.Interval !== undefined ||
|
formData.Interval !== undefined ||
|
||||||
formData.Timeout !== undefined ||
|
formData.Timeout !== undefined ||
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ export const PlacementForm = ({ id, type }: PlacementFormProps) => {
|
|||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
try {
|
try {
|
||||||
// Check if all values are empty, if so, send null to clear the database
|
// Check if all values are empty, if so, send null to clear the database
|
||||||
const hasAnyValue =
|
const hasAnyValue =
|
||||||
(formData.Constraints && formData.Constraints.length > 0) ||
|
(formData.Constraints && formData.Constraints.length > 0) ||
|
||||||
(formData.Preferences && formData.Preferences.length > 0) ||
|
(formData.Preferences && formData.Preferences.length > 0) ||
|
||||||
(formData.Platforms && formData.Platforms.length > 0) ||
|
(formData.Platforms && formData.Platforms.length > 0) ||
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ export const RestartPolicyForm = ({ id, type }: RestartPolicyFormProps) => {
|
|||||||
try {
|
try {
|
||||||
// Check if all values are empty, if so, send null to clear the database
|
// Check if all values are empty, if so, send null to clear the database
|
||||||
const hasAnyValue = Object.values(formData).some(
|
const hasAnyValue = Object.values(formData).some(
|
||||||
value => value !== undefined && value !== null && value !== ""
|
(value) => value !== undefined && value !== null && value !== "",
|
||||||
);
|
);
|
||||||
|
|
||||||
await mutateAsync({
|
await mutateAsync({
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ export const RollbackConfigForm = ({ id, type }: RollbackConfigFormProps) => {
|
|||||||
try {
|
try {
|
||||||
// Check if all values are empty, if so, send null to clear the database
|
// Check if all values are empty, if so, send null to clear the database
|
||||||
const hasAnyValue = Object.values(formData).some(
|
const hasAnyValue = Object.values(formData).some(
|
||||||
value => value !== undefined && value !== null && value !== ""
|
(value) => value !== undefined && value !== null && value !== "",
|
||||||
);
|
);
|
||||||
|
|
||||||
await mutateAsync({
|
await mutateAsync({
|
||||||
|
|||||||
@@ -119,9 +119,15 @@ export const StopGracePeriodForm = ({ id, type }: StopGracePeriodFormProps) => {
|
|||||||
type="number"
|
type="number"
|
||||||
placeholder="30000000000"
|
placeholder="30000000000"
|
||||||
{...field}
|
{...field}
|
||||||
value={field?.value !== null && field?.value !== undefined ? field.value.toString() : ""}
|
value={
|
||||||
|
field?.value !== null && field?.value !== undefined
|
||||||
|
? field.value.toString()
|
||||||
|
: ""
|
||||||
|
}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
field.onChange(e.target.value ? BigInt(e.target.value) : null)
|
field.onChange(
|
||||||
|
e.target.value ? BigInt(e.target.value) : null,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ export const UpdateConfigForm = ({ id, type }: UpdateConfigFormProps) => {
|
|||||||
try {
|
try {
|
||||||
// Check if all values are empty, if so, send null to clear the database
|
// Check if all values are empty, if so, send null to clear the database
|
||||||
const hasAnyValue = Object.values(formData).some(
|
const hasAnyValue = Object.values(formData).some(
|
||||||
value => value !== undefined && value !== null && value !== ""
|
(value) => value !== undefined && value !== null && value !== "",
|
||||||
);
|
);
|
||||||
|
|
||||||
await mutateAsync({
|
await mutateAsync({
|
||||||
|
|||||||
@@ -2,20 +2,25 @@
|
|||||||
* Filters out undefined, null, and empty string values from form data
|
* Filters out undefined, null, and empty string values from form data
|
||||||
* Only returns fields that have actual values
|
* Only returns fields that have actual values
|
||||||
*/
|
*/
|
||||||
export const filterEmptyValues = (formData: Record<string, any>): Record<string, any> => {
|
export const filterEmptyValues = (
|
||||||
return Object.entries(formData).reduce((acc, [key, value]) => {
|
formData: Record<string, any>,
|
||||||
// Keep arrays even if empty (they might be intentionally cleared)
|
): Record<string, any> => {
|
||||||
if (Array.isArray(value)) {
|
return Object.entries(formData).reduce(
|
||||||
if (value.length > 0) {
|
(acc, [key, value]) => {
|
||||||
|
// Keep arrays even if empty (they might be intentionally cleared)
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
if (value.length > 0) {
|
||||||
|
acc[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// For other values, filter out undefined, null, and empty strings
|
||||||
|
else if (value !== undefined && value !== null && value !== "") {
|
||||||
acc[key] = value;
|
acc[key] = value;
|
||||||
}
|
}
|
||||||
}
|
return acc;
|
||||||
// For other values, filter out undefined, null, and empty strings
|
},
|
||||||
else if (value !== undefined && value !== null && value !== "") {
|
{} as Record<string, any>,
|
||||||
acc[key] = value;
|
);
|
||||||
}
|
|
||||||
return acc;
|
|
||||||
}, {} as Record<string, any>);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user