mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-07 07:10:27 +08:00
节点IP阈值增加节点健康检查失败
This commit is contained in:
@@ -127,6 +127,21 @@ Vue.component("node-ip-address-thresholds-box", {
|
|||||||
this.itemReportGroups = []
|
this.itemReportGroups = []
|
||||||
},
|
},
|
||||||
confirmItem: function () {
|
confirmItem: function () {
|
||||||
|
// 特殊阈值快速添加
|
||||||
|
if (["nodeHealthCheckFailed"].$contains(this.itemCode)) {
|
||||||
|
// 添加
|
||||||
|
this.addingThreshold.items.push({
|
||||||
|
item: this.itemCode,
|
||||||
|
operator: this.itemOperator,
|
||||||
|
value: 0,
|
||||||
|
duration: 0,
|
||||||
|
durationUnit: "minute",
|
||||||
|
options: {}
|
||||||
|
})
|
||||||
|
this.cancelItem()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (this.itemDuration.length == 0) {
|
if (this.itemDuration.length == 0) {
|
||||||
let that = this
|
let that = this
|
||||||
teaweb.warn("请输入统计周期", function () {
|
teaweb.warn("请输入统计周期", function () {
|
||||||
@@ -335,11 +350,20 @@ Vue.component("node-ip-address-thresholds-box", {
|
|||||||
<!-- 已有条件 -->
|
<!-- 已有条件 -->
|
||||||
<div v-if="thresholds.length > 0">
|
<div v-if="thresholds.length > 0">
|
||||||
<div class="ui label basic small" v-for="(threshold, index) in thresholds">
|
<div class="ui label basic small" v-for="(threshold, index) in thresholds">
|
||||||
<span v-for="(item, itemIndex) in threshold.items">[{{item.duration}}{{itemDurationUnitName(item.durationUnit)}}] {{itemName(item.item)}}
|
<span v-for="(item, itemIndex) in threshold.items">
|
||||||
|
<span v-if="item.item != 'nodeHealthCheckFailed'">
|
||||||
|
[{{item.duration}}{{itemDurationUnitName(item.durationUnit)}}]
|
||||||
|
</span>
|
||||||
|
{{itemName(item.item)}}
|
||||||
|
|
||||||
|
<span v-if="item.item != 'nodeHealthCheckFailed'">
|
||||||
<!-- 连通性 -->
|
<!-- 连通性 -->
|
||||||
<span v-if="item.item == 'connectivity' && item.options != null && item.options.groups != null && item.options.groups.length > 0">[<span v-for="(group, groupIndex) in item.options.groups">{{group.name}} <span v-if="groupIndex != item.options.groups.length - 1"> </span></span>]</span>
|
<span v-if="item.item == 'connectivity' && item.options != null && item.options.groups != null && item.options.groups.length > 0">[<span v-for="(group, groupIndex) in item.options.groups">{{group.name}} <span v-if="groupIndex != item.options.groups.length - 1"> </span></span>]</span>
|
||||||
|
|
||||||
<span class="grey">[{{itemOperatorName(item.operator)}}]</span> {{item.value}}{{itemUnitName(item.item)}} <span v-if="itemIndex != threshold.items.length - 1" style="font-style: italic">AND </span></span>
|
<span class="grey">[{{itemOperatorName(item.operator)}}]</span> {{item.value}}{{itemUnitName(item.item)}}
|
||||||
|
</span>
|
||||||
|
<span v-if="itemIndex != threshold.items.length - 1" style="font-style: italic">AND </span>
|
||||||
|
</span>
|
||||||
->
|
->
|
||||||
<span v-for="(action, actionIndex) in threshold.actions">{{actionName(action.action)}}
|
<span v-for="(action, actionIndex) in threshold.actions">{{actionName(action.action)}}
|
||||||
<span v-if="action.action == 'switch'">到{{action.options.ips.join(", ")}}</span>
|
<span v-if="action.action == 'switch'">到{{action.options.ips.join(", ")}}</span>
|
||||||
@@ -365,10 +389,17 @@ Vue.component("node-ip-address-thresholds-box", {
|
|||||||
<!-- 已经添加的项目 -->
|
<!-- 已经添加的项目 -->
|
||||||
<div>
|
<div>
|
||||||
<div v-for="(item, index) in addingThreshold.items" class="ui label basic small" style="margin-bottom: 0.5em;">
|
<div v-for="(item, index) in addingThreshold.items" class="ui label basic small" style="margin-bottom: 0.5em;">
|
||||||
[{{item.duration}}{{itemDurationUnitName(item.durationUnit)}}] {{itemName(item.item)}}
|
<span v-if="item.item != 'nodeHealthCheckFailed'">
|
||||||
|
[{{item.duration}}{{itemDurationUnitName(item.durationUnit)}}]
|
||||||
|
</span>
|
||||||
|
{{itemName(item.item)}}
|
||||||
|
|
||||||
|
<span v-if="item.item != 'nodeHealthCheckFailed'">
|
||||||
<!-- 连通性 -->
|
<!-- 连通性 -->
|
||||||
<span v-if="item.item == 'connectivity' && item.options != null && item.options.groups != null && item.options.groups.length > 0">[<span v-for="(group, groupIndex) in item.options.groups">{{group.name}} <span v-if="groupIndex != item.options.groups.length - 1"> </span></span>]</span>
|
<span v-if="item.item == 'connectivity' && item.options != null && item.options.groups != null && item.options.groups.length > 0">[<span v-for="(group, groupIndex) in item.options.groups">{{group.name}} <span v-if="groupIndex != item.options.groups.length - 1"> </span></span>]</span>
|
||||||
<span class="grey">[{{itemOperatorName(item.operator)}}]</span> {{item.value}}{{itemUnitName(item.item)}}
|
<span class="grey">[{{itemOperatorName(item.operator)}}]</span> {{item.value}}{{itemUnitName(item.item)}}
|
||||||
|
</span>
|
||||||
|
|
||||||
<a href="" title="删除" @click.prevent="removeItem(index)"><i class="icon remove small"></i></a>
|
<a href="" title="删除" @click.prevent="removeItem(index)"><i class="icon remove small"></i></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -385,7 +416,7 @@ Vue.component("node-ip-address-thresholds-box", {
|
|||||||
<p class="comment" v-for="item in allItems" v-if="item.code == itemCode">{{item.description}}</p>
|
<p class="comment" v-for="item in allItems" v-if="item.code == itemCode">{{item.description}}</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr v-show="itemCode != 'nodeHealthCheckFailed'">
|
||||||
<td>统计周期</td>
|
<td>统计周期</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="ui input right labeled">
|
<div class="ui input right labeled">
|
||||||
@@ -394,7 +425,7 @@ Vue.component("node-ip-address-thresholds-box", {
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr v-show="itemCode != 'nodeHealthCheckFailed'">
|
||||||
<td>操作符</td>
|
<td>操作符</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="ui dropdown auto-width" v-model="itemOperator">
|
<select class="ui dropdown auto-width" v-model="itemOperator">
|
||||||
@@ -402,7 +433,7 @@ Vue.component("node-ip-address-thresholds-box", {
|
|||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr v-show="itemCode != 'nodeHealthCheckFailed'">
|
||||||
<td>对比值</td>
|
<td>对比值</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="ui input right labeled">
|
<div class="ui input right labeled">
|
||||||
|
|||||||
@@ -98,17 +98,29 @@ Vue.component("node-ip-address-thresholds-view", {
|
|||||||
template: `<div>
|
template: `<div>
|
||||||
<!-- 已有条件 -->
|
<!-- 已有条件 -->
|
||||||
<div v-if="thresholds.length > 0">
|
<div v-if="thresholds.length > 0">
|
||||||
<div class="ui label basic small" v-for="(threshold, index) in thresholds" style="margin-bottom: 0.5em">
|
<div class="ui label basic small" v-for="(threshold, index) in thresholds" style="margin-bottom: 0.8em">
|
||||||
<span v-for="(item, itemIndex) in threshold.items">[{{item.duration}}{{itemDurationUnitName(item.durationUnit)}}] {{itemName(item.item)}}
|
<span v-for="(item, itemIndex) in threshold.items">
|
||||||
|
<span>
|
||||||
|
<span v-if="item.item != 'nodeHealthCheckFailed'">
|
||||||
|
[{{item.duration}}{{itemDurationUnitName(item.durationUnit)}}]
|
||||||
|
</span>
|
||||||
|
{{itemName(item.item)}}
|
||||||
|
|
||||||
|
<span v-if="item.item != 'nodeHealthCheckFailed'">
|
||||||
<!-- 连通性 -->
|
<!-- 连通性 -->
|
||||||
<span v-if="item.item == 'connectivity' && item.options != null && item.options.groups != null && item.options.groups.length > 0">[<span v-for="(group, groupIndex) in item.options.groups">{{group.name}} <span v-if="groupIndex != item.options.groups.length - 1"> </span></span>]</span>
|
<span v-if="item.item == 'connectivity' && item.options != null && item.options.groups != null && item.options.groups.length > 0">[<span v-for="(group, groupIndex) in item.options.groups">{{group.name}} <span v-if="groupIndex != item.options.groups.length - 1"> </span></span>]</span>
|
||||||
|
|
||||||
<span class="grey">[{{itemOperatorName(item.operator)}}]</span> {{item.value}}{{itemUnitName(item.item)}} <span v-if="itemIndex != threshold.items.length - 1" style="font-style: italic">AND </span></span>
|
<span class="grey">[{{itemOperatorName(item.operator)}}]</span> {{item.value}}{{itemUnitName(item.item)}}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<span v-if="itemIndex != threshold.items.length - 1" style="font-style: italic">AND </span></span>
|
||||||
->
|
->
|
||||||
<span v-for="(action, actionIndex) in threshold.actions">{{actionName(action.action)}}
|
<span v-for="(action, actionIndex) in threshold.actions">{{actionName(action.action)}}
|
||||||
<span v-if="action.action == 'switch'">到{{action.options.ips.join(", ")}}</span>
|
<span v-if="action.action == 'switch'">到{{action.options.ips.join(", ")}}</span>
|
||||||
<span v-if="action.action == 'webHook'" class="small grey">({{action.options.url}})</span>
|
<span v-if="action.action == 'webHook'" class="small grey">({{action.options.url}})</span>
|
||||||
<span v-if="actionIndex != threshold.actions.length - 1" style="font-style: italic">AND </span></span>
|
|
||||||
|
<span v-if="actionIndex != threshold.actions.length - 1" style="font-style: italic">AND </span>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>`
|
</div>`
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ Tea.context(function () {
|
|||||||
|
|
||||||
this.updateUp = function (addrId, isUp) {
|
this.updateUp = function (addrId, isUp) {
|
||||||
let status = isUp ? "在线" : "离线"
|
let status = isUp ? "在线" : "离线"
|
||||||
teaweb.confirm("确定要手动将节点设置为" + status + "吗?", function () {
|
teaweb.confirm("确定要手动将此IP设置为" + status + "吗?", function () {
|
||||||
this.$post(".up")
|
this.$post(".up")
|
||||||
.params({
|
.params({
|
||||||
addrId: addrId,
|
addrId: addrId,
|
||||||
|
|||||||
Reference in New Issue
Block a user