fix:删除脏数据
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div style="" class="panel-variables-box">
|
||||
<div v-for="(item,index) in labelArr" :key="index" v-if="item.show" class="panel-variables-content" style="display: flex">
|
||||
<div v-for="(item,index) in labelArr" :key="index" v-if="item.show && labelValue[item.name].length" class="panel-variables-content" style="display: flex">
|
||||
<div class="variable-key">{{item.name}}</div>
|
||||
<el-popover
|
||||
width="220"
|
||||
@@ -174,7 +174,7 @@ export default {
|
||||
arr.filter(item => item.value)
|
||||
response = arr
|
||||
}
|
||||
this.labelValue[this.labelArr[index].name] = response
|
||||
this.labelValue[this.labelArr[index].name] = response.filter(item => item.value)
|
||||
}
|
||||
})
|
||||
this.setLabelArrDefault()
|
||||
@@ -189,6 +189,10 @@ export default {
|
||||
const url = '/prom/api/v1/labels'
|
||||
return new Promise(resolve => {
|
||||
this.$get(url, params).then(res => {
|
||||
if (res.status === 'error') {
|
||||
resolve([])
|
||||
return
|
||||
}
|
||||
let arr = res.data.map(item => {
|
||||
return {
|
||||
value: item,
|
||||
@@ -214,6 +218,10 @@ export default {
|
||||
url = `/prom/api/v1/label/${label}/values`
|
||||
return new Promise(resolve => {
|
||||
this.$get(url, params).then(res => {
|
||||
if (res.status === 'error') {
|
||||
resolve([])
|
||||
return
|
||||
}
|
||||
let arr = res.data.map(item => {
|
||||
return {
|
||||
value: item,
|
||||
@@ -221,7 +229,7 @@ export default {
|
||||
}
|
||||
})
|
||||
arr = this.$loadsh.uniqBy(arr, 'value')
|
||||
arr.filter(item => item.value)
|
||||
arr = arr.filter(item => item.value)
|
||||
resolve(arr)
|
||||
})
|
||||
})
|
||||
@@ -234,6 +242,10 @@ export default {
|
||||
url = '/prom/api/v1/series'
|
||||
return new Promise(resolve => {
|
||||
this.$get(url, params).then(res => {
|
||||
if (res.status === 'error') {
|
||||
resolve([])
|
||||
return
|
||||
}
|
||||
let arr = res.data.map(item => {
|
||||
return {
|
||||
value: item[label],
|
||||
@@ -257,6 +269,10 @@ export default {
|
||||
const url = '/prom/api/v1/label/__name__/values'
|
||||
return new Promise(resolve => {
|
||||
this.$get(url, params).then(res => {
|
||||
if (res.status === 'error') {
|
||||
resolve([])
|
||||
return
|
||||
}
|
||||
let arr = res.data
|
||||
arr.filter((metricName) => {
|
||||
const r = new RegExp(metricFilterPattern)
|
||||
@@ -282,6 +298,10 @@ export default {
|
||||
query: encodeURIComponent(query)
|
||||
}
|
||||
this.$get(url, params).then(res => {
|
||||
if (res.status === 'error') {
|
||||
resolve([])
|
||||
return
|
||||
}
|
||||
const arr = res.data.result.map((metricData) => {
|
||||
let text = metricData.metric.__name__ || ''
|
||||
delete metricData.metric.__name__
|
||||
@@ -314,6 +334,10 @@ export default {
|
||||
const url = '/prom/api/v1/series'
|
||||
return new Promise(resolve => {
|
||||
this.$get(url, params).then(res => {
|
||||
if (res.status === 'error') {
|
||||
resolve([])
|
||||
return
|
||||
}
|
||||
const arr = res.data.map(metric => {
|
||||
return {
|
||||
label: this.getOriginalMetricName(metric),
|
||||
|
||||
@@ -348,68 +348,6 @@ export default {
|
||||
this.filter.searchName = ''
|
||||
// this.$refs.searchInput.select();
|
||||
this.showPanel = val
|
||||
this.showPanel.param = {
|
||||
report:
|
||||
{ enable: true, range: { type: 'previous', interval: 1, unit: 'day' }, schedule: { type: 2, repeat: 1, nums: [], stime: '2022-06-07 15:00:00', etime: '2022-06-19 15:00:00' }, receivers: [1] },
|
||||
chartShare: 'none',
|
||||
variables: [
|
||||
{ show: true, type: 'custom', multi: true, allOption: true, name: 'mazy', customOptions: 'z:1, z:z:1, a', expression: '', regex: '' },
|
||||
{ show: true, type: 'custom', multi: true, allOption: false, name: 'mzy', customOptions: 'z:1, z:z:1, a', expression: '', regex: '' },
|
||||
{ show: true, type: 'custom', multi: false, allOption: false, name: 'zy', customOptions: 'z:1, z:z:1, a', expression: '', regex: '' },
|
||||
{ show: true, type: 'custom', multi: false, allOption: true, name: 'azy', customOptions: 'z:1, z:z:1, a', expression: '', regex: '' }
|
||||
]
|
||||
}
|
||||
this.showPanel.param.variables = [
|
||||
{ show: true, type: 'custom', multi: true, allOption: true, name: 'mazy', customOptions: 'z:1, b:z:1, a,c:123', expression: '', regex: '' },
|
||||
{ show: true, type: 'custom', multi: true, allOption: false, name: 'mzy', customOptions: 'z:1, b:z:1, a,c:123', expression: '', regex: '' },
|
||||
{ show: true, type: 'custom', multi: false, allOption: false, name: 'zy', customOptions: 'z:1, b:z:1, a,c:123', expression: '', regex: '' },
|
||||
{ show: true, type: 'custom', multi: false, allOption: true, name: 'azy', customOptions: 'z:1, b:z:1, a,c:123', expression: '', regex: '' },
|
||||
{
|
||||
name: 'bbb',
|
||||
type: 'query',
|
||||
multi: false,
|
||||
allOption: true,
|
||||
expression: 'label_names()',
|
||||
regex: '/a\.*/',
|
||||
show: true
|
||||
},
|
||||
{
|
||||
name: 'ccc',
|
||||
type: 'query',
|
||||
multi: false,
|
||||
allOption: true,
|
||||
expression: 'label_values(up, asset)',
|
||||
regex: '',
|
||||
show: true
|
||||
},
|
||||
{
|
||||
name: 'ddd',
|
||||
type: 'query',
|
||||
multi: true,
|
||||
allOption: true,
|
||||
expression: 'label_values(asset)',
|
||||
regex: '',
|
||||
show: true
|
||||
},
|
||||
{
|
||||
name: 'eeee',
|
||||
type: 'query',
|
||||
multi: false,
|
||||
allOption: true,
|
||||
expression: 'label_values(up, endpoint)',
|
||||
regex: '/.*-(?<text>.*)-(?<value>.*)-.*/',
|
||||
show: true
|
||||
},
|
||||
{
|
||||
name: 'fff',
|
||||
type: 'query',
|
||||
multi: false,
|
||||
allOption: true,
|
||||
expression: 'query_result(node_filefd_allocated{module="OLAP-Node-Exporter"})',
|
||||
regex: '/asset="(?<text>[^"]+)\.*\asset_id="(?<value>[^"]+)/',
|
||||
show: true
|
||||
}
|
||||
]
|
||||
this.variables = this.showPanel.param.variables
|
||||
this.showPanel.type = 'dashboard'
|
||||
this.filter.panelId = this.showPanel.id
|
||||
@@ -847,68 +785,6 @@ export default {
|
||||
this.$message.error(response)
|
||||
}
|
||||
}
|
||||
this.showPanel.param = {
|
||||
report:
|
||||
{ enable: true, range: { type: 'previous', interval: 1, unit: 'day' }, schedule: { type: 2, repeat: 1, nums: [], stime: '2022-06-07 15:00:00', etime: '2022-06-19 15:00:00' }, receivers: [1] },
|
||||
chartShare: 'none',
|
||||
variables: [
|
||||
{ show: true, type: 'custom', multi: true, allOption: true, name: 'mazy', customOptions: 'z:1, b:z:1, a,c:123', expression: '', regex: '' },
|
||||
{ show: true, type: 'custom', multi: true, allOption: false, name: 'mzy', customOptions: 'z:1, b:z:1, a,c:123', expression: '', regex: '' },
|
||||
{ show: true, type: 'custom', multi: false, allOption: false, name: 'zy', customOptions: 'z:1, b:z:1, a,c:123', expression: '', regex: '' },
|
||||
{ show: true, type: 'custom', multi: false, allOption: true, name: 'azy', customOptions: 'z:1, b:z:1, a,c:123', expression: '', regex: '' }
|
||||
]
|
||||
}
|
||||
this.showPanel.param.variables = [
|
||||
{ show: true, type: 'custom', multi: true, allOption: true, name: 'mazy', customOptions: 'z:1, b:z:1, a,c:123', expression: '', regex: '' },
|
||||
{ show: true, type: 'custom', multi: true, allOption: false, name: 'mzy', customOptions: 'z:1, b:z:1, a,c:123', expression: '', regex: '' },
|
||||
{ show: true, type: 'custom', multi: false, allOption: false, name: 'zy', customOptions: 'z:1, b:z:1, a,c:123', expression: '', regex: '' },
|
||||
{ show: true, type: 'custom', multi: false, allOption: true, name: 'azy', customOptions: 'z:1, b:z:1, a,c:123', expression: '', regex: '' },
|
||||
{
|
||||
name: 'bbb',
|
||||
type: 'query',
|
||||
multi: false,
|
||||
allOption: true,
|
||||
expression: 'label_names()',
|
||||
regex: '/a\.*/',
|
||||
show: true
|
||||
},
|
||||
{
|
||||
name: 'ccc',
|
||||
type: 'query',
|
||||
multi: false,
|
||||
allOption: true,
|
||||
expression: 'label_values(up, asset)',
|
||||
regex: '',
|
||||
show: true
|
||||
},
|
||||
{
|
||||
name: 'ddd',
|
||||
type: 'query',
|
||||
multi: true,
|
||||
allOption: true,
|
||||
expression: 'label_values(asset)',
|
||||
regex: '',
|
||||
show: true
|
||||
},
|
||||
{
|
||||
name: 'eeee',
|
||||
type: 'query',
|
||||
multi: false,
|
||||
allOption: true,
|
||||
expression: 'label_values(up, endpoint)',
|
||||
regex: '/.*-(?<text>.*)-(?<value>.*)-.*/',
|
||||
show: true
|
||||
},
|
||||
{
|
||||
name: 'fff',
|
||||
type: 'query',
|
||||
multi: false,
|
||||
allOption: true,
|
||||
expression: 'query_result(node_filefd_allocated{module="OLAP-Node-Exporter"})',
|
||||
regex: '/asset="(?<text>[^"]+)\.*\asset_id="(?<value>[^"]+)/',
|
||||
show: true
|
||||
}
|
||||
]
|
||||
this.variables = this.showPanel.param.variables
|
||||
}).catch((error) => {
|
||||
// console.log('error................'+JSON.stringify(error));
|
||||
|
||||
Reference in New Issue
Block a user