diff --git a/client/src/Pages/Settings/index.tsx b/client/src/Pages/Settings/index.tsx index 679d66126..e51255157 100644 --- a/client/src/Pages/Settings/index.tsx +++ b/client/src/Pages/Settings/index.tsx @@ -262,15 +262,7 @@ export const SettingsPage = () => { if (value === undefined) { (acc as any)[typedKey] = ""; } else if (typeof value === "object" && value !== null) { - // Handle nested objects like globalThresholds - // Convert 0 to "" for unsetting thresholds - (acc as any)[typedKey] = Object.entries(value).reduce( - (nested, [nestedKey, nestedValue]) => ({ - ...nested, - [nestedKey]: nestedValue === undefined ? "" : nestedValue, - }), - {} - ); + (acc as any)[typedKey] = value; } else { (acc as any)[typedKey] = value; } diff --git a/server/src/validation/settingsValidation.ts b/server/src/validation/settingsValidation.ts index 91953eef4..b9551dd4e 100644 --- a/server/src/validation/settingsValidation.ts +++ b/server/src/validation/settingsValidation.ts @@ -28,10 +28,10 @@ export const updateAppSettingsBodyValidation = z globalThresholds: z .object({ - cpu: z.union([z.number().min(1).max(100)]).optional(), - memory: z.union([z.number().min(1).max(100)]).optional(), - disk: z.union([z.number().min(1).max(100)]).optional(), - temperature: z.union([z.number().min(1).max(150)]).optional(), + cpu: z.number().min(1).max(100).optional(), + memory: z.number().min(1).max(100).optional(), + disk: z.number().min(1).max(100).optional(), + temperature: z.number().min(1).max(150).optional(), }) .optional(), })