From abda31c89aa9dd9f9cebb2b45fdf06f32b3a3a04 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Thu, 18 Nov 2021 14:47:48 +0800 Subject: [PATCH] =?UTF-8?q?IP=E5=9C=B0=E5=9D=80=E2=80=9C=E5=81=A5=E5=BA=B7?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E5=A4=B1=E8=B4=A5=E2=80=9D=E9=98=88=E5=80=BC?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E2=80=9C=E5=81=A5=E5=BA=B7=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../node/node-ip-address-thresholds-box.js | 56 +++++++++++++++---- .../node/node-ip-address-thresholds-view.js | 9 ++- 2 files changed, 52 insertions(+), 13 deletions(-) diff --git a/web/public/js/components/node/node-ip-address-thresholds-box.js b/web/public/js/components/node/node-ip-address-thresholds-box.js index 99e8d418..f32ce50d 100644 --- a/web/public/js/components/node/node-ip-address-thresholds-box.js +++ b/web/public/js/components/node/node-ip-address-thresholds-box.js @@ -128,12 +128,26 @@ Vue.component("node-ip-address-thresholds-box", { }, confirmItem: function () { // 特殊阈值快速添加 - if (["nodeHealthCheckFailed"].$contains(this.itemCode)) { + if (["nodeHealthCheck"].$contains(this.itemCode)) { + if (this.itemValue.toString().length == 0) { + teaweb.warn("请选择检查结果") + return + } + + let value = parseInt(this.itemValue) + if (isNaN(value)) { + value = 0 + } else if (value < 0) { + value = 0 + } else if (value > 1) { + value = 1 + } + // 添加 this.addingThreshold.items.push({ item: this.itemCode, operator: this.itemOperator, - value: 0, + value: value, duration: 0, durationUnit: "minute", options: {} @@ -307,7 +321,7 @@ Vue.component("node-ip-address-thresholds-box", { } break case "webHook": - if (this.actionWebHookURL.length ==0) { + if (this.actionWebHookURL.length == 0) { teaweb.warn("请输入WebHook URL", function () { that.$refs.webHookURL.focus() }) @@ -351,12 +365,17 @@ Vue.component("node-ip-address-thresholds-box", {
- + [{{item.duration}}{{itemDurationUnitName(item.durationUnit)}}] {{itemName(item.item)}} - + + + 成功 + 失败 + + [{{group.name}}   ] @@ -389,12 +408,17 @@ Vue.component("node-ip-address-thresholds-box", {
- + [{{item.duration}}{{itemDurationUnitName(item.durationUnit)}}] {{itemName(item.item)}} - + + + 成功 + 失败 + + [{{group.name}}   ] [{{itemOperatorName(item.operator)}}] {{item.value}}{{itemUnitName(item.item)}} @@ -413,10 +437,10 @@ Vue.component("node-ip-address-thresholds-box", { -

{{item.description}}

+

{{item.description}}

- + 统计周期
@@ -425,7 +449,7 @@ Vue.component("node-ip-address-thresholds-box", {
- + 操作符 - + 对比值
@@ -442,6 +466,16 @@ Vue.component("node-ip-address-thresholds-box", {
+ + 检查结果 + + +

只有状态发生改变的时候才会触发。

+ + diff --git a/web/public/js/components/node/node-ip-address-thresholds-view.js b/web/public/js/components/node/node-ip-address-thresholds-view.js index 5844a1af..c84b3318 100644 --- a/web/public/js/components/node/node-ip-address-thresholds-view.js +++ b/web/public/js/components/node/node-ip-address-thresholds-view.js @@ -101,12 +101,17 @@ Vue.component("node-ip-address-thresholds-view", {
- + [{{item.duration}}{{itemDurationUnitName(item.durationUnit)}}] {{itemName(item.item)}} - + + + 成功 + 失败 + + [{{group.name}}   ]