remove dead unions
This commit is contained in:
1 parent
fa8764fde2
commit
e9cb302d6e
2 files changed
+5
-13
No files matched your search
@@ -262,15 +262,7 @@ export const SettingsPage = () => {
|
|||||||
if (value === undefined) {
|
if (value === undefined) {
|
||||||
(acc as any)[typedKey] = "";
|
(acc as any)[typedKey] = "";
|
||||||
} else if (typeof value === "object" && value !== null) {
|
} else if (typeof value === "object" && value !== null) {
|
||||||
// Handle nested objects like globalThresholds
|
(acc as any)[typedKey] = value;
|
||||||
// Convert 0 to "" for unsetting thresholds
|
|
||||||
(acc as any)[typedKey] = Object.entries(value).reduce(
|
|
||||||
(nested, [nestedKey, nestedValue]) => ({
|
|
||||||
...nested,
|
|
||||||
[nestedKey]: nestedValue === undefined ? "" : nestedValue,
|
|
||||||
}),
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
(acc as any)[typedKey] = value;
|
(acc as any)[typedKey] = value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ export const updateAppSettingsBodyValidation = z
|
|||||||
|
|
||||||
globalThresholds: z
|
globalThresholds: z
|
||||||
.object({
|
.object({
|
||||||
cpu: z.union([z.number().min(1).max(100)]).optional(),
|
cpu: z.number().min(1).max(100).optional(),
|
||||||
memory: z.union([z.number().min(1).max(100)]).optional(),
|
memory: z.number().min(1).max(100).optional(),
|
||||||
disk: z.union([z.number().min(1).max(100)]).optional(),
|
disk: z.number().min(1).max(100).optional(),
|
||||||
temperature: z.union([z.number().min(1).max(150)]).optional(),
|
temperature: z.number().min(1).max(150).optional(),
|
||||||
})
|
})
|
||||||
.optional(),
|
.optional(),
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in new issue
Block a user