NEZ-997 fix:NEZHA 搜索框 删除子选项时 会导致其他选项重复 以及 alertMeaasge dc不显示详情的问题

This commit is contained in:
zhangyu
2021-09-14 15:36:55 +08:00
parent e6a35e3fc9
commit 37e95e1518
4 changed files with 16 additions and 13 deletions

View File

@@ -117,7 +117,7 @@
</div> </div>
</div> </div>
<div class="alert-label-info" v-if="type==='datacenter'" v-loading="loading"> <div class="alert-label-info" v-if="type==='dc'" v-loading="loading">
<div class="alert-label-box"> <div class="alert-label-box">
<div class="alert-label-title">ID</div> <div class="alert-label-title">ID</div>
<div class="alert-label-value">{{alertLabelData && alertLabelData.id ? alertLabelData.id : '--'}}</div> <div class="alert-label-value">{{alertLabelData && alertLabelData.id ? alertLabelData.id : '--'}}</div>
@@ -302,7 +302,7 @@ export default {
} }
}) })
} }
if (this.type === 'datacenter') { if (this.type === 'dc') {
this.$get('dc/' + this.id).then((res) => { this.$get('dc/' + this.id).then((res) => {
if (res.msg === 'success') { if (res.msg === 'success') {
this.loading = false this.loading = false

View File

@@ -1157,6 +1157,7 @@ export default {
}, },
// 删除要搜索的条件 // 删除要搜索的条件
close_selcet_list (ind, e) { close_selcet_list (ind, e) {
console.log(this.searchMsg.searchLabelList,this.searchLabelList)
if (e) { if (e) {
this.stop_click(e) this.stop_click(e)
} }
@@ -1176,7 +1177,7 @@ export default {
} }
} */ } */
this.searchMsg.searchLabelList.forEach((val, key) => { this.searchMsg.searchLabelList.forEach((val, key) => {
if (this.select_list[ind].id == val.id) { if (this.select_list[ind].label == val.label) {
this.searchLabelList.splice(key + 1, 0, val) this.searchLabelList.splice(key + 1, 0, val)
this.Iskeywords(ind) this.Iskeywords(ind)
} }

View File

@@ -90,7 +90,7 @@
</nz-alert-tag> </nz-alert-tag>
</span> </span>
<alertLabel <alertLabel
v-if="(item.label === 'asset' ||item.label === 'module' || item.label === 'project' || item.label === 'datacenter' ||item.label === 'endpoint' ||item.label === 'cpu' ||item.label === 'user' ||item.label === 'parent_asset') && scope.row[item.label] && scope.row[item.label].loading" v-if="(item.label === 'asset' ||item.label === 'module' || item.label === 'project' || item.label === 'dc' ||item.label === 'endpoint' ||item.label === 'cpu' ||item.label === 'user' ||item.label === 'parent_asset') && scope.row[item.label] && scope.row[item.label].loading"
:id="scope.row[item.label].id" :id="scope.row[item.label].id"
:that="scope.row[item.label]" :that="scope.row[item.label]"
:type="item.label" :type="item.label"
@@ -164,7 +164,7 @@ export default {
// 详情相关 // 详情相关
graphShow: false, graphShow: false,
chartDatas: [], chartDatas: [],
sameLabels: ['instance', 'module', 'project', 'asset', 'endpoint', 'datacenter'], sameLabels: ['instance', 'module', 'project', 'asset', 'endpoint', 'dc'],
exclusiveLabels: ['_id', 'severity', '__name__'], exclusiveLabels: ['_id', 'severity', '__name__'],
legend: [], legend: [],
searchTime: [new Date().setHours(new Date().getHours() - 1), new Date()], searchTime: [new Date().setHours(new Date().getHours() - 1), new Date()],
@@ -227,7 +227,7 @@ export default {
computed: { computed: {
tagType () { tagType () {
return (key) => { return (key) => {
if (key == 'asset' || key == 'module' || key == 'project' || key == 'datacenter' || key == 'endpoint') { if (key == 'asset' || key == 'module' || key == 'project' || key == 'dc' || key == 'endpoint') {
return 'normal' return 'normal'
} else { } else {
return 'info' return 'info'
@@ -269,7 +269,7 @@ export default {
}) })
}, },
labelsSort (obj) { labelsSort (obj) {
const buildIn = ['asset', 'endpoint', 'module', 'cpu', 'project', 'datacenter', 'parent_asset', 'user'] const buildIn = ['asset', 'endpoint', 'module', 'cpu', 'datacenter', 'project', 'parent_asset', 'user']
if (typeof obj === 'string') obj = JSON.parse(obj) if (typeof obj === 'string') obj = JSON.parse(obj)
const labels = JSON.parse(JSON.stringify(obj)) const labels = JSON.parse(JSON.stringify(obj))
const result = [] const result = []
@@ -282,7 +282,12 @@ export default {
} }
for (const key of buildIn) { for (const key of buildIn) {
if (key in labels) { if (key in labels) {
if (key === 'datacenter') {
result.push({ label: 'dc', value: labels.datacenter })
delete labels.datacenter
} else {
result.push({ label: key, value: labels[key] }) result.push({ label: key, value: labels[key] })
}
delete labels[key] delete labels[key]
} }
} }
@@ -542,7 +547,7 @@ export default {
case 'module': case 'module':
case 'endpoint': case 'endpoint':
case 'project': case 'project':
case 'datacenter': case 'dc':
return false return false
default: return true default: return true
} }
@@ -566,9 +571,6 @@ export default {
if (e) { if (e) {
const dom = e.currentTarget const dom = e.currentTarget
const position = dom.getBoundingClientRect() const position = dom.getBoundingClientRect()
if (type === 'datacenter') {
item[type] = item.dc
}
this.$set(item[type], 'position', position) this.$set(item[type], 'position', position)
} }
this.$set(item[type], 'loading', loading) this.$set(item[type], 'loading', loading)

View File

@@ -1,6 +1,6 @@
<template> <template>
<span class="nz-alert-tag" :class="['nz-alert-tag_' + type]" :style="{cursor: cursorPoint ? 'pointer' : 'default'}" @click="$emit('click')"> <span class="nz-alert-tag" :class="['nz-alert-tag_' + type]" :style="{cursor: cursorPoint ? 'pointer' : 'default'}" @click="$emit('click')">
<span class="nz-alert-tag__label"> {{label}}</span> <span class="nz-alert-tag__label"> {{label=='dc'?'datacenter':label}}</span>
<span class="nz-alert-tag__content"><span v-if="!!regex"> ~ </span> <slot></slot></span> <span class="nz-alert-tag__content"><span v-if="!!regex"> ~ </span> <slot></slot></span>
</span> </span>
</template> </template>