mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-05-24 11:59:39 -05:00
add global thresholds configbox
This commit is contained in:
@@ -327,11 +327,93 @@ export const SettingsPage = () => {
|
||||
color="error"
|
||||
onClick={() => setIsStatsDialogOpen(true)}
|
||||
>
|
||||
{t("common.buttons.clear")}
|
||||
{t("pages.settings.form.stats.buttonText")}
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Global Thresholds */}
|
||||
{isAdmin && (
|
||||
<ConfigBox
|
||||
title={t("pages.settings.form.thresholds.title")}
|
||||
subtitle={t("pages.settings.form.thresholds.description")}
|
||||
rightContent={
|
||||
<Stack spacing={2}>
|
||||
<Controller
|
||||
name="globalThresholds.cpu"
|
||||
control={form.control}
|
||||
defaultValue={defaults.globalThresholds?.cpu}
|
||||
render={({ field, fieldState }) => (
|
||||
<TextField
|
||||
{...field}
|
||||
fieldLabel={t("pages.settings.form.thresholds.option.cpu.label")}
|
||||
type="number"
|
||||
placeholder={t(
|
||||
"pages.settings.form.thresholds.option.cpu.placeholder"
|
||||
)}
|
||||
error={!!fieldState.error}
|
||||
helperText={fieldState.error?.message}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
<Controller
|
||||
name="globalThresholds.memory"
|
||||
control={form.control}
|
||||
defaultValue={defaults.globalThresholds?.memory}
|
||||
render={({ field, fieldState }) => (
|
||||
<TextField
|
||||
{...field}
|
||||
fieldLabel={t("pages.settings.form.thresholds.option.memory.label")}
|
||||
type="number"
|
||||
placeholder={t(
|
||||
"pages.settings.form.thresholds.option.memory.placeholder"
|
||||
)}
|
||||
error={!!fieldState.error}
|
||||
helperText={fieldState.error?.message}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
<Controller
|
||||
name="globalThresholds.disk"
|
||||
control={form.control}
|
||||
defaultValue={defaults.globalThresholds?.disk}
|
||||
render={({ field, fieldState }) => (
|
||||
<TextField
|
||||
{...field}
|
||||
fieldLabel={t("pages.settings.form.thresholds.option.disk.label")}
|
||||
type="number"
|
||||
placeholder={t(
|
||||
"pages.settings.form.thresholds.option.disk.placeholder"
|
||||
)}
|
||||
error={!!fieldState.error}
|
||||
helperText={fieldState.error?.message}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
<Controller
|
||||
name="globalThresholds.temperature"
|
||||
control={form.control}
|
||||
defaultValue={defaults.globalThresholds?.temperature}
|
||||
render={({ field, fieldState }) => (
|
||||
<TextField
|
||||
{...field}
|
||||
fieldLabel={t(
|
||||
"pages.settings.form.thresholds.option.temperature.label"
|
||||
)}
|
||||
type="number"
|
||||
placeholder={t(
|
||||
"pages.settings.form.thresholds.option.temperature.placeholder"
|
||||
)}
|
||||
error={!!fieldState.error}
|
||||
helperText={fieldState.error?.message}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</Stack>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</Stack>
|
||||
|
||||
{/* Clear Stats Confirmation Dialog */}
|
||||
@@ -370,6 +452,7 @@ export const SettingsPage = () => {
|
||||
{t("common.buttons.save")}
|
||||
</Button>
|
||||
</Stack>
|
||||
<pre>{JSON.stringify(form.formState.isValid, null, 2)}</pre>
|
||||
</BasePage>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -994,6 +994,28 @@
|
||||
"title": "Clear all monitoring history?",
|
||||
"description": "This cannot be undone"
|
||||
}
|
||||
},
|
||||
"thresholds": {
|
||||
"title": "Global Thresholds",
|
||||
"description": "Set global CPU, Memory, Disk, and Temperature thresholds for infrastructure monitoring. These apply to all hardware monitors unless overridden.",
|
||||
"option": {
|
||||
"cpu": {
|
||||
"label": "CPU Threshold (%)",
|
||||
"placeholder": "0 - 100"
|
||||
},
|
||||
"memory": {
|
||||
"label": "Memory Threshold (%)",
|
||||
"placeholder": "0 - 100"
|
||||
},
|
||||
"disk": {
|
||||
"label": "Disk Threshold (%)",
|
||||
"placeholder": "0 - 100"
|
||||
},
|
||||
"temperature": {
|
||||
"label": "Temperature Threshold (°C)",
|
||||
"placeholder": "0 - 150"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user