Add temperature threshold to create infrastructure monitor page

This commit is contained in:
Alex Holliday committed 2024-11-25 11:20:52 +08:00
1 parent 24d5a38527
commit 71cde317a7
4 files changed
+20 -10

No files matched your search

+7 -2
View File
@@ -37,8 +37,13 @@ const hasValidationErrors = (form, validation, setErrors) => {
if (!form.disk || form.usage_disk) {
newErrors["usage_disk"] = null;
}
if (!form.temperature || form.usage_temperature) {
newErrors["usage_temperature"] = null;
}
});
if (Object.values(newErrors).some(v=> v)) {
console.log("newErrors", newErrors);
if (Object.values(newErrors).some((v) => v)) {
setErrors(newErrors);
return true;
} else {
@@ -48,4 +53,4 @@ const hasValidationErrors = (form, validation, setErrors) => {
}
return false;
};
export { buildErrors, hasValidationErrors };
export { buildErrors, hasValidationErrors };
+4 -3
View File
@@ -190,15 +190,16 @@ const infrastructureMonitorValidation = joi.object({
cpu: joi.boolean(),
memory: joi.boolean(),
disk: joi.boolean(),
temperature: joi.boolean(),
usage_memory: joi.number().messages({
"number.base": THRESHOLD_COMMON_BASE_MSG,
}),
usage_disk: joi.number().messages({
"number.base": THRESHOLD_COMMON_BASE_MSG,
}),
// usage_temperature: joi.number().messages({
// "number.base": "Temperature must be a number.",
// }),
usage_temperature: joi.number().messages({
"number.base": "Temperature must be a number.",
}),
// usage_system: joi.number().messages({
// "number.base": "System load must be a number.",
// }),