// 节点IP阈值 Vue.component("node-ip-address-thresholds-box", { props: ["v-thresholds"], data: function () { let thresholds = this.vThresholds if (thresholds == null) { thresholds = [] } let avgRequests = { duration: "", operator: "lte", value: "" } let avgTrafficOut = { duration: "", operator: "lte", value: "" } let avgTrafficIn = { duration: "", operator: "lte", value: "" } thresholds.forEach(function (v) { switch (v.item) { case "avgRequests": avgRequests.duration = v.duration avgRequests.operator = v.operator avgRequests.value = v.value.toString() break case "avgTrafficOut": avgTrafficOut.duration = v.duration avgTrafficOut.operator = v.operator avgTrafficOut.value = v.value.toString() break case "avgTrafficIn": avgTrafficIn.duration = v.duration avgTrafficIn.operator = v.operator avgTrafficIn.value = v.value.toString() break } }) return { thresholds: thresholds, avgRequests: avgRequests, avgTrafficOut: avgTrafficOut, avgTrafficIn: avgTrafficIn } }, watch: { "avgRequests.duration": function () { this.compose() }, "avgRequests.operator": function () { this.compose() }, "avgRequests.value": function () { this.compose() }, "avgTrafficOut.duration": function () { this.compose() }, "avgTrafficOut.operator": function () { this.compose() }, "avgTrafficOut.value": function () { this.compose() }, "avgTrafficIn.duration": function () { this.compose() }, "avgTrafficIn.operator": function () { this.compose() }, "avgTrafficIn.value": function () { this.compose() } }, methods: { compose: function () { let thresholds = [] // avg requests { let duration = parseInt(this.avgRequests.duration) let value = parseInt(this.avgRequests.value) if (!isNaN(duration) && duration > 0 && !isNaN(value) && value > 0) { thresholds.push({ item: "avgRequests", operator: this.avgRequests.operator, duration: duration, durationUnit: "minute", value: value }) } } // avg traffic out { let duration = parseInt(this.avgTrafficOut.duration) let value = parseInt(this.avgTrafficOut.value) if (!isNaN(duration) && duration > 0 && !isNaN(value) && value > 0) { thresholds.push({ item: "avgTrafficOut", operator: this.avgTrafficOut.operator, duration: duration, durationUnit: "minute", value: value }) } } // avg requests { let duration = parseInt(this.avgTrafficIn.duration) let value = parseInt(this.avgTrafficIn.value) if (!isNaN(duration) && duration > 0 && !isNaN(value) && value > 0) { thresholds.push({ item: "avgTrafficIn", operator: this.avgTrafficIn.operator, duration: duration, durationUnit: "minute", value: value }) } } this.thresholds = thresholds } }, template: `
统计项目 统计周期 操作符 对比值
平均请求数/秒
分钟
平均下行流量/秒
分钟
MB
平均上行流量/秒
分钟
MB

满足所有阈值条件时IP才会上线,否则下线。统计周期和对比值设置为0表示没有限制。各个输入项只支持整数数字。

` })