fix:修复 projectTopo metrics 删除会删除节点的问题
This commit is contained in:
@@ -195,7 +195,7 @@ export default {
|
|||||||
<div class="partition"></div>
|
<div class="partition"></div>
|
||||||
<div class="legend-value legend-value-agent">
|
<div class="legend-value legend-value-agent">
|
||||||
<div class="map-asset">
|
<div class="map-asset">
|
||||||
<div class="progress-title">${self.$t('config.agent.agent.agent')} ${self.$t('overall.normal')}</div>
|
<div class="progress-title">${self.$t('guide.agent')} ${self.$t('overall.normal')}</div>
|
||||||
<div class="success-progress progress-box">
|
<div class="success-progress progress-box">
|
||||||
<div class="top-progress" style="width: ${(dcStat.agent.up / (dcStat.agent.up + dcStat.agent.down)) * 100}%"></div>
|
<div class="top-progress" style="width: ${(dcStat.agent.up / (dcStat.agent.up + dcStat.agent.down)) * 100}%"></div>
|
||||||
<div style="width: 100%" class="bottom-progress"></div>
|
<div style="width: 100%" class="bottom-progress"></div>
|
||||||
@@ -203,7 +203,7 @@ export default {
|
|||||||
<div class="success-progress progress-content">${dcStat.agent.up}</div>
|
<div class="success-progress progress-content">${dcStat.agent.up}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="map-asset">
|
<div class="map-asset">
|
||||||
<div class="progress-title">${self.$t('config.agent.agent.agent')} ${self.$t('overall.unusual')}</div>
|
<div class="progress-title">${self.$t('guide.agent')} ${self.$t('overall.unusual')}</div>
|
||||||
<div class="error-progress progress-box">
|
<div class="error-progress progress-box">
|
||||||
<div class="top-progress" style="width: ${(dcStat.agent.down / (dcStat.agent.up + dcStat.agent.down)) * 100}%"></div>
|
<div class="top-progress" style="width: ${(dcStat.agent.down / (dcStat.agent.up + dcStat.agent.down)) * 100}%"></div>
|
||||||
<div style="width: 100%" class="bottom-progress"></div>
|
<div style="width: 100%" class="bottom-progress"></div>
|
||||||
|
|||||||
@@ -63,7 +63,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<div class="tag-search__add cursor-pointer" @click="addCondition()">{{$t('project.topology.add')}}</div>
|
<div class="tag-search__add cursor-pointer" @click="addCondition()">{{$t('buttons.add')}}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ export default {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
route: '/agent',
|
route: '/agent',
|
||||||
title: this.$t('config.agent.agent.agent'),
|
title: this.$t('guide.agent'),
|
||||||
icon: 'nz-icon nz-icon-agent',
|
icon: 'nz-icon nz-icon-agent',
|
||||||
tip: this.$t('guide.agentTip'),
|
tip: this.$t('guide.agentTip'),
|
||||||
permissionCode: 'agent_view'
|
permissionCode: 'agent_view'
|
||||||
|
|||||||
@@ -53,6 +53,7 @@
|
|||||||
:ref="'promql-'+'-1'"
|
:ref="'promql-'+'-1'"
|
||||||
:expression-list="selection.pen.data.expressArr"
|
:expression-list="selection.pen.data.expressArr"
|
||||||
:index="index"
|
:index="index"
|
||||||
|
type="metric"
|
||||||
:plugins="['metric-selector', 'metric-input', 'remove']"
|
:plugins="['metric-selector', 'metric-input', 'remove']"
|
||||||
:showRemove="false"
|
:showRemove="false"
|
||||||
:styleType="2"
|
:styleType="2"
|
||||||
@@ -1500,43 +1501,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
queryMetrics () {
|
|
||||||
this.metricOptions = []
|
|
||||||
this.$get('prom/api/v1/label/__name__/values').then(response => {
|
|
||||||
if (response.status == 'success') {
|
|
||||||
const metrics = response.data.sort()
|
|
||||||
const metricMap = new Map()
|
|
||||||
metrics.forEach((item) => {
|
|
||||||
let key = ''
|
|
||||||
if (/^[a-zA-Z]+?_[a-zA-Z]*/.test(item)) {
|
|
||||||
key = item.split('_')[0]
|
|
||||||
} else if (/^_\w*/.test(item)) {
|
|
||||||
key = ' '
|
|
||||||
} else {
|
|
||||||
key = item
|
|
||||||
}
|
|
||||||
if (metricMap.get(key)) {
|
|
||||||
const values = metricMap.get(key)
|
|
||||||
values.push({ label: item, value: item })
|
|
||||||
} else {
|
|
||||||
const values = [{ label: item, value: item }]
|
|
||||||
metricMap.set(key, values)
|
|
||||||
}
|
|
||||||
// this.metricStore.push({label:item,value:item,insertText:item})
|
|
||||||
})
|
|
||||||
for (const key of metricMap.keys()) {
|
|
||||||
const option = {
|
|
||||||
label: key,
|
|
||||||
value: key
|
|
||||||
}
|
|
||||||
if (metricMap.get(key) && metricMap.get(key).length > 1) {
|
|
||||||
option.children = metricMap.get(key)
|
|
||||||
}
|
|
||||||
this.metricOptions.push(option)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
tabClick (n) {
|
tabClick (n) {
|
||||||
},
|
},
|
||||||
moduleIdChange (n) {
|
moduleIdChange (n) {
|
||||||
|
|||||||
@@ -373,7 +373,10 @@ const canvasOptions = {
|
|||||||
disableEmptyLine: true,
|
disableEmptyLine: true,
|
||||||
autoExpandDistance: 0,
|
autoExpandDistance: 0,
|
||||||
minScale: 0.2,
|
minScale: 0.2,
|
||||||
scaleKey: -1
|
scaleKey: -1,
|
||||||
|
keyCode: {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
export default {
|
export default {
|
||||||
name: 'topologyL5',
|
name: 'topologyL5',
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<el-input :disabled="true" v-model="dc.name" id="traffic-setting-name"></el-input>
|
<el-input :disabled="true" v-model="dc.name" id="traffic-setting-name"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<traffic-setting-tab ref="trafficSetting" :post-asset-list="assetList" v-for="(item,index) in traffic.setting" :index="index" :asset-setting="item" :key="uuids[index]" :id="uuids[index]" @delSelf="delAssetSetting" :validate-repeat-func="valiateRepeatFunc"></traffic-setting-tab>
|
<traffic-setting-tab ref="trafficSetting" :post-asset-list="assetList" v-for="(item,index) in traffic.setting" :index="index" :asset-setting="item" :key="uuids[index]" :id="uuids[index]" @delSelf="delAssetSetting" :validate-repeat-func="valiateRepeatFunc"></traffic-setting-tab>
|
||||||
<button @click="addAssetSetting" class="nz-btn nz-btn-size-normal nz-btn-style-light" id="traffic-setting-add" style="margin:15px 1px 15px 15px" type="button">{{$t('project.topology.add')}}</button>
|
<button @click="addAssetSetting" class="nz-btn nz-btn-size-normal nz-btn-style-light" id="traffic-setting-add" style="margin:15px 1px 15px 15px" type="button">{{$t('buttons.add')}}</button>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ const searchSelectInfo = { // value: 传给后台的值;label:显示给用
|
|||||||
operation: [
|
operation: [
|
||||||
{
|
{
|
||||||
value: 'add',
|
value: 'add',
|
||||||
label: i18n.t('config.operationlog.operations.add')
|
label: i18n.t('buttons.add')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'update',
|
value: 'update',
|
||||||
|
|||||||
@@ -887,7 +887,7 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else if (data.children && !data.children.length && this.type !== 'log') {
|
} else if (data.children && (!data.children.length || data.children.length > 100) && this.type !== 'log') {
|
||||||
this.metricOptions.forEach(item => {
|
this.metricOptions.forEach(item => {
|
||||||
if (!item.temp && item.children && item.value != data.value) {
|
if (!item.temp && item.children && item.value != data.value) {
|
||||||
item.children = []
|
item.children = []
|
||||||
@@ -898,7 +898,7 @@ export default {
|
|||||||
const children = this.$store.state.metricsList.find(item => item.value === data.value).children
|
const children = this.$store.state.metricsList.find(item => item.value === data.value).children
|
||||||
resolve(children)
|
resolve(children)
|
||||||
}).then((children) => {
|
}).then((children) => {
|
||||||
let childrenCopy = JSON.parse(JSON.stringify(children))
|
const childrenCopy = JSON.parse(JSON.stringify(children))
|
||||||
const findChild = this.metricOptions.find(item => item.label === data.label)
|
const findChild = this.metricOptions.find(item => item.label === data.label)
|
||||||
|
|
||||||
if (childrenCopy.length > 100) {
|
if (childrenCopy.length > 100) {
|
||||||
@@ -927,7 +927,7 @@ export default {
|
|||||||
childrenCopy = childrenCopy.splice(findChild.children.length, findChild.children.length + 101)
|
childrenCopy = childrenCopy.splice(findChild.children.length, findChild.children.length + 101)
|
||||||
findChild.children.splice(findChild.children.length - 1, 1)
|
findChild.children.splice(findChild.children.length - 1, 1)
|
||||||
findChild.children.push(...childrenCopy)
|
findChild.children.push(...childrenCopy)
|
||||||
if (findChild.children.length < children.length) {
|
if (findChild.children.length < children.length - 1) {
|
||||||
findChild.children.push({
|
findChild.children.push({
|
||||||
label: 'More',
|
label: 'More',
|
||||||
value: false,
|
value: false,
|
||||||
|
|||||||
@@ -652,7 +652,7 @@ export default {
|
|||||||
{ name: vm.$t('config.agent.up'), value: data.agent.up ? data.agent.up : 0 },
|
{ name: vm.$t('config.agent.up'), value: data.agent.up ? data.agent.up : 0 },
|
||||||
{ name: vm.$t('asset.down'), value: data.agent.down ? data.agent.down : 0 }
|
{ name: vm.$t('asset.down'), value: data.agent.down ? data.agent.down : 0 }
|
||||||
]
|
]
|
||||||
prometheusOption.title.text = vm.$t('config.agent.agent.agent')
|
prometheusOption.title.text = vm.$t('guide.agent')
|
||||||
prometheusOption.legend.data = [vm.$t('config.agent.up'), vm.$t('asset.down')]
|
prometheusOption.legend.data = [vm.$t('config.agent.up'), vm.$t('asset.down')]
|
||||||
tooltipEndpointChart && tooltipEndpointChart.setOption(endpointOption, true)
|
tooltipEndpointChart && tooltipEndpointChart.setOption(endpointOption, true)
|
||||||
tooltipPrometheusChart && tooltipPrometheusChart.setOption(prometheusOption, true)
|
tooltipPrometheusChart && tooltipPrometheusChart.setOption(prometheusOption, true)
|
||||||
|
|||||||
Reference in New Issue
Block a user