fix: 优化 chartTepm的显示 以及 旧数据 的 valueMapping无法展开的问题

This commit is contained in:
zhangyu
2022-01-06 17:42:38 +08:00
parent 3a7233162c
commit 39302d4c46
2 changed files with 28 additions and 0 deletions

View File

@@ -161,6 +161,18 @@ export default {
switch (this.chartInfo.datasource) { switch (this.chartInfo.datasource) {
case 'metrics': case 'metrics':
case 'logs': { case 'logs': {
if (this.from === fromRoute.chartTemp) {
setTimeout(() => {
this.chartData = [chartTempData.data.result]
this.chartData.forEach(item => {
item.forEach(children => {
children.elements = elements[0]
})
})
this.loading = false
}, 100)
return
}
let urlPre = '' let urlPre = ''
if (this.chartInfo.datasource === 'metrics') { if (this.chartInfo.datasource === 'metrics') {
urlPre += '/prom' urlPre += '/prom'
@@ -210,6 +222,7 @@ export default {
if (rIndex < elements.length) { if (rIndex < elements.length) {
if (r.status === 'success') { if (r.status === 'success') {
r.data.result.forEach(item => { r.data.result.forEach(item => {
item.elements = elements[rIndex]
this.allDataLength++ this.allDataLength++
}) })
chartData.push(r.data.result) chartData.push(r.data.result)
@@ -245,6 +258,13 @@ export default {
} }
case 'system': { case 'system': {
this.chartInfo.elements = this.chartInfo.param.datasource this.chartInfo.elements = this.chartInfo.param.datasource
if (this.from === fromRoute.chartTemp) {
setTimeout(() => {
this.chartData = [chartTempData.data.result]
this.loading = false
}, 100)
return
}
if (this.chartInfo.type === 'assetInfo') { if (this.chartInfo.type === 'assetInfo') {
this.$get('asset/asset/' + this.chartDetailInfo.id).then(res => { this.$get('asset/asset/' + this.chartDetailInfo.id).then(res => {
this.chartData = res.data this.chartData = res.data

View File

@@ -458,12 +458,20 @@ export default {
valueMapping: false valueMapping: false
} }
} }
// this.editChart.varType = 1
if (this.editChart.param.enable.legend && !this.editChart.param.legend) { if (this.editChart.param.enable.legend && !this.editChart.param.legend) {
this.editChart.param.legend = { placement: 'bottom', values: [], show: true } this.editChart.param.legend = { placement: 'bottom', values: [], show: true }
} }
if (this.editChart.param.datasource && !this.editChart.param.datasource[0].legend) { if (this.editChart.param.datasource && !this.editChart.param.datasource[0].legend) {
this.editChart.param.datasource[0].legend = '' this.editChart.param.datasource[0].legend = ''
} }
if (this.editChart.param.valueMapping) {
this.editChart.param.valueMapping.forEach(item => {
if (!item.show) {
item.show = false
}
})
}
} }
} }
}, },