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

@@ -32,12 +32,14 @@ const CreateInfrastructureMonitor = () => {
usage_memory: "",
disk: false,
usage_disk: "",
temperature: false,
usage_temperature: "",
secret: "",
});
const MS_PER_MINUTE = 60000;
const THRESHOLD_FIELD_PREFIX = "usage_";
const HARDWARE_MONITOR_TYPES = ["cpu", "memory", "disk"];
const HARDWARE_MONITOR_TYPES = ["cpu", "memory", "disk", "temperature"];
const { user, authToken } = useSelector((state) => state.auth);
const monitorState = useSelector((state) => state.infrastructureMonitor);
const dispatch = useDispatch();
@@ -74,18 +76,18 @@ const CreateInfrastructureMonitor = () => {
});
};
const handleBlur = (event, appenedID) => {
const handleBlur = (event, appendID) => {
event.preventDefault();
const { value, id } = event.target;
if (id?.startsWith("notify-email-")) return;
const { error } = infrastructureMonitorValidation.validate(
{ [id ?? appenedID]: value },
{ [id ?? appendID]: value },
{
abortEarly: false,
}
);
setErrors((prev) => {
return buildErrors(prev, id ?? appenedID, error);
return buildErrors(prev, id ?? appendID, error);
});
};
@@ -297,7 +299,8 @@ const CreateInfrastructureMonitor = () => {
<Box>
<Typography component="h2">Customize alerts</Typography>
<Typography component="p">
Send a notification to user(s) when thresholds exceed a specified percentage.
Send a notification to user(s) when thresholds exceed a specified
percentage.
</Typography>
</Box>
<Stack gap={theme.spacing(6)}>