remove dead unions
This commit is contained in:
1 parent
d070a33d7f
commit
8ec285ed41
2 files changed
+5
-13
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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(),
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user