[autofix.ci] apply automated fixes

This commit is contained in:
autofix-ci[bot]
2026-01-20 15:02:58 +00:00
committed by GitHub
parent a0d8eb9380
commit 7e48b2cf29
8 changed files with 34 additions and 20 deletions
@@ -82,7 +82,10 @@ export const EndpointSpecForm = ({ id, type }: EndpointSpecFormProps) => {
setIsLoading(true);
try {
// 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({
applicationId: id || "",
@@ -90,7 +90,7 @@ export const HealthCheckForm = ({ id, type }: HealthCheckFormProps) => {
setIsLoading(true);
try {
// 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.Interval !== undefined ||
formData.Timeout !== undefined ||
@@ -103,7 +103,7 @@ export const PlacementForm = ({ id, type }: PlacementFormProps) => {
setIsLoading(true);
try {
// 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.Preferences && formData.Preferences.length > 0) ||
(formData.Platforms && formData.Platforms.length > 0) ||
@@ -94,7 +94,7 @@ export const RestartPolicyForm = ({ id, type }: RestartPolicyFormProps) => {
try {
// Check if all values are empty, if so, send null to clear the database
const hasAnyValue = Object.values(formData).some(
value => value !== undefined && value !== null && value !== ""
(value) => value !== undefined && value !== null && value !== "",
);
await mutateAsync({
@@ -93,7 +93,7 @@ export const RollbackConfigForm = ({ id, type }: RollbackConfigFormProps) => {
try {
// Check if all values are empty, if so, send null to clear the database
const hasAnyValue = Object.values(formData).some(
value => value !== undefined && value !== null && value !== ""
(value) => value !== undefined && value !== null && value !== "",
);
await mutateAsync({
@@ -119,9 +119,15 @@ export const StopGracePeriodForm = ({ id, type }: StopGracePeriodFormProps) => {
type="number"
placeholder="30000000000"
{...field}
value={field?.value !== null && field?.value !== undefined ? field.value.toString() : ""}
value={
field?.value !== null && field?.value !== undefined
? field.value.toString()
: ""
}
onChange={(e) =>
field.onChange(e.target.value ? BigInt(e.target.value) : null)
field.onChange(
e.target.value ? BigInt(e.target.value) : null,
)
}
/>
</FormControl>
@@ -99,7 +99,7 @@ export const UpdateConfigForm = ({ id, type }: UpdateConfigFormProps) => {
try {
// Check if all values are empty, if so, send null to clear the database
const hasAnyValue = Object.values(formData).some(
value => value !== undefined && value !== null && value !== ""
(value) => value !== undefined && value !== null && value !== "",
);
await mutateAsync({
@@ -2,20 +2,25 @@
* Filters out undefined, null, and empty string values from form data
* Only returns fields that have actual values
*/
export const filterEmptyValues = (formData: Record<string, any>): Record<string, any> => {
return Object.entries(formData).reduce((acc, [key, value]) => {
// Keep arrays even if empty (they might be intentionally cleared)
if (Array.isArray(value)) {
if (value.length > 0) {
export const filterEmptyValues = (
formData: Record<string, any>,
): Record<string, any> => {
return Object.entries(formData).reduce(
(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;
}
}
// For other values, filter out undefined, null, and empty strings
else if (value !== undefined && value !== null && value !== "") {
acc[key] = value;
}
return acc;
}, {} as Record<string, any>);
return acc;
},
{} as Record<string, any>,
);
};
/**