add global thresholds configbox
This commit is contained in:
1 parent
a3a25b2add
commit
216c7753b4
2 files changed
+106
-1
No files matched your search
@@ -327,11 +327,93 @@ export const SettingsPage = () => {
|
|||||||
color="error"
|
color="error"
|
||||||
onClick={() => setIsStatsDialogOpen(true)}
|
onClick={() => setIsStatsDialogOpen(true)}
|
||||||
>
|
>
|
||||||
{t("common.buttons.clear")}
|
{t("pages.settings.form.stats.buttonText")}
|
||||||
</Button>
|
</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>
|
</Stack>
|
||||||
|
|
||||||
{/* Clear Stats Confirmation Dialog */}
|
{/* Clear Stats Confirmation Dialog */}
|
||||||
@@ -370,6 +452,7 @@ export const SettingsPage = () => {
|
|||||||
{t("common.buttons.save")}
|
{t("common.buttons.save")}
|
||||||
</Button>
|
</Button>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
<pre>{JSON.stringify(form.formState.isValid, null, 2)}</pre>
|
||||||
</BasePage>
|
</BasePage>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -994,6 +994,28 @@
|
|||||||
"title": "Clear all monitoring history?",
|
"title": "Clear all monitoring history?",
|
||||||
"description": "This cannot be undone"
|
"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