Add client side types, validation, add swithces to monitor form
This commit is contained in:
1 parent
6d4e944a58
commit
5fa894cb79
5 files changed
+40
-12
No files matched your search
@@ -85,6 +85,8 @@ export const getMonitorDefaults = (
|
||||
dockerTlsKey: "",
|
||||
dockerTlsKeySet: data?.dockerTlsKeySet ?? false,
|
||||
dockerLogsEnabled: data?.dockerLogsEnabled ?? false,
|
||||
dockerAlertOnStopped: data?.dockerAlertOnStopped ?? false,
|
||||
dockerAlertOnUnhealthy: data?.dockerAlertOnUnhealthy ?? false,
|
||||
};
|
||||
break;
|
||||
case "game":
|
||||
|
||||
@@ -617,7 +617,6 @@ const CreateMonitorPage = () => {
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
||||
{showStep(0) && (
|
||||
<ConfigBox
|
||||
title={t("pages.createMonitor.form.general.title")}
|
||||
@@ -758,7 +757,6 @@ const CreateMonitorPage = () => {
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
||||
{showStep(0) && watchedType === "docker" && isDockerTlsUrl(watchedUrl) && (
|
||||
<ConfigBox
|
||||
title={t("pages.createMonitor.form.dockerTls.title")}
|
||||
@@ -816,7 +814,6 @@ const CreateMonitorPage = () => {
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
||||
{showStep(1) && (
|
||||
<ConfigBox
|
||||
title={t("pages.createMonitor.form.frequency.title")}
|
||||
@@ -837,7 +834,6 @@ const CreateMonitorPage = () => {
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Alert Thresholds - only for hardware type */}
|
||||
{watchedType === "hardware" && showStep(1) && (
|
||||
<ConfigBox
|
||||
@@ -893,7 +889,6 @@ const CreateMonitorPage = () => {
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
||||
{showStep(1) && (
|
||||
<ConfigBox
|
||||
title={t("pages.createMonitor.form.incidents.title")}
|
||||
@@ -920,7 +915,6 @@ const CreateMonitorPage = () => {
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
||||
{showStep(1) && (
|
||||
<ConfigBox
|
||||
title={t("pages.createMonitor.form.notifications.title")}
|
||||
@@ -933,7 +927,6 @@ const CreateMonitorPage = () => {
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
||||
{showStep(1) && (
|
||||
<ConfigBox
|
||||
title={t("pages.createMonitor.form.tags.title")}
|
||||
@@ -960,7 +953,6 @@ const CreateMonitorPage = () => {
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
||||
{showStep(1) && watchedType === "docker" && !isCaptureDocker && (
|
||||
<ConfigBox
|
||||
title={t("pages.createMonitor.form.dockerLogs.title")}
|
||||
@@ -973,7 +965,28 @@ const CreateMonitorPage = () => {
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
||||
{showStep(1) && watchedType === "docker" && (
|
||||
<ConfigBox
|
||||
title={t("pages.createMonitor.form.dockerAlerts.title")}
|
||||
subtitle={t("pages.createMonitor.form.dockerAlerts.description")}
|
||||
rightContent={
|
||||
<Stack gap={theme.spacing(LAYOUT.MD)}>
|
||||
<FormSwitchField
|
||||
name="dockerAlertOnStopped"
|
||||
label={t(
|
||||
"pages.createMonitor.form.dockerAlerts.option.onStopped.label"
|
||||
)}
|
||||
/>
|
||||
<FormSwitchField
|
||||
name="dockerAlertOnUnhealthy"
|
||||
label={t(
|
||||
"pages.createMonitor.form.dockerAlerts.option.onUnhealthy.label"
|
||||
)}
|
||||
/>
|
||||
</Stack>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{showStep(2) &&
|
||||
(watchedType === "http" ||
|
||||
watchedType === "grpc" ||
|
||||
@@ -989,7 +1002,6 @@ const CreateMonitorPage = () => {
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
||||
{showStep(2) && watchedType === "http" && (
|
||||
<ConfigBox
|
||||
title={t("pages.createMonitor.form.advanced.title")}
|
||||
@@ -1089,7 +1101,6 @@ const CreateMonitorPage = () => {
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
||||
{showStep(2) && supportsGeoCheck(watchedType) && (
|
||||
<ConfigBox
|
||||
title={t("pages.createMonitor.form.geoChecks.title")}
|
||||
@@ -1122,7 +1133,6 @@ const CreateMonitorPage = () => {
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
||||
<Stack
|
||||
direction="row"
|
||||
justifyContent={!isEditMode ? "space-between" : "flex-end"}
|
||||
|
||||
@@ -169,6 +169,8 @@ export interface Monitor {
|
||||
geoCheckLocations?: GeoContinent[];
|
||||
geoCheckInterval?: number;
|
||||
dockerLogsEnabled?: boolean;
|
||||
dockerAlertOnStopped?: boolean;
|
||||
dockerAlertOnUnhealthy?: boolean;
|
||||
dockerTlsCa?: string;
|
||||
dockerTlsCert?: string;
|
||||
dockerTlsKeySet?: boolean;
|
||||
|
||||
@@ -152,6 +152,8 @@ const dockerSchema = baseSchema.extend({
|
||||
// Read only mirror of the server flag, stripped on submit
|
||||
dockerTlsKeySet: z.boolean(),
|
||||
dockerLogsEnabled: z.boolean().register(monitorStepRegistry, { step: 1 }),
|
||||
dockerAlertOnStopped: z.boolean().register(monitorStepRegistry, { step: 1 }),
|
||||
dockerAlertOnUnhealthy: z.boolean().register(monitorStepRegistry, { step: 1 }),
|
||||
});
|
||||
|
||||
// Game server monitor schema
|
||||
|
||||
@@ -827,6 +827,18 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"dockerAlerts": {
|
||||
"title": "Container alerts",
|
||||
"description": "Mark this host as breached while any container on it is stopped or failing its health check, and notify on the change. Containers that exit with code 0 do not count as stopped. Capture does not report exit codes, so on Capture hosts every stopped container counts.",
|
||||
"option": {
|
||||
"onStopped": {
|
||||
"label": "Alert when a container is stopped"
|
||||
},
|
||||
"onUnhealthy": {
|
||||
"label": "Alert when a container is unhealthy"
|
||||
}
|
||||
}
|
||||
},
|
||||
"stats": {
|
||||
"title": "Monitor history",
|
||||
"description": "Clear all monitoring history and statistics for your team. This action is irreversible.",
|
||||
|
||||
Reference in new issue
Block a user