From 668c5a77d6731c4defd38970528a2415cef3c603 Mon Sep 17 00:00:00 2001 From: Bert Verhelst Date: Wed, 6 Oct 2021 20:10:39 +0200 Subject: [PATCH] fix(edit-monitor): add default http status check for http monitors --- src/pages/EditMonitor.vue | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index b408549..a1a5597 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -10,7 +10,7 @@
- @@ -206,7 +206,7 @@ import CopyableInput from "../components/CopyableInput.vue"; import MonitorCheckEditor from "../components/MonitorCheckEditor.vue"; import { useToast } from "vue-toastification"; import VueMultiselect from "vue-multiselect"; -import { genSecret, isDev } from "../util.ts"; +import { genSecret, HTTP_STATUS_CODE_SHOULD_EQUAL, isDev } from "../util.ts"; const toast = useToast(); export default { @@ -331,7 +331,10 @@ export default { ignoreTls: false, upsideDown: false, maxredirects: 10, - checks: [], + checks: [{ + type: HTTP_STATUS_CODE_SHOULD_EQUAL, + value: ["200-299"], + }], dns_resolve_type: "A", dns_resolve_server: "1.1.1.1", }; @@ -357,6 +360,18 @@ export default { } }, + changeMonitorType(type) { + this.monitor.type = type; + if (type === 'http') { + this.monitor.checks = [{ + type: HTTP_STATUS_CODE_SHOULD_EQUAL, + value: ["200-299"], + }]; + } else { + delete this.monitor.checks; + } + }, + addMonitorCheck() { this.monitor.checks = [...(this.monitor.checks || []), { type: null,