fix: 修复曲线图在数据所有tab的max都为0的情况下会重复请求的问题
This commit is contained in:
@@ -174,6 +174,9 @@ export default {
|
||||
if (res.status === 200) {
|
||||
this.showError = false
|
||||
this.isNoData = res.data.data.result.length === 0
|
||||
if (!active) {
|
||||
this.tabs = _.cloneDeep(dataForDnsTrafficLine.tabs)
|
||||
}
|
||||
if (this.isNoData) {
|
||||
this.lineTab = ''
|
||||
this.tabs = _.cloneDeep(dataForDnsTrafficLine.tabs)
|
||||
@@ -445,6 +448,7 @@ export default {
|
||||
this.legendSelectChange(e, 0)
|
||||
})
|
||||
this.tabs = tabs
|
||||
this.lineRefer = 'Average'
|
||||
this.echartsInit(this.tabs, true)
|
||||
} else {
|
||||
const unit = 'bps'
|
||||
@@ -477,10 +481,15 @@ export default {
|
||||
if (parseFloat(e.analysis.max) <= 0) {
|
||||
this.lineTab = ''
|
||||
this.lineRefer = ''
|
||||
this.init()
|
||||
// this.init() // 后续多关注
|
||||
}
|
||||
}
|
||||
})
|
||||
const emptyData = dnsData.filter(d => parseFloat(d.analysis.max) === 0)
|
||||
this.isNoData = emptyData.length === dnsData.length
|
||||
if (this.isNoData) {
|
||||
return true
|
||||
}
|
||||
|
||||
this.tabs = dnsData
|
||||
// 如果三者avg都为0时,至少保证total显示
|
||||
|
||||
@@ -226,6 +226,9 @@ export default {
|
||||
if (response.status === 200) {
|
||||
this.isNoData = res.data.result.length === 0
|
||||
this.showError = false
|
||||
if (!active) {
|
||||
this.tabs = _.cloneDeep(this.tabsTemplate)
|
||||
}
|
||||
if (this.isNoData) {
|
||||
this.lineTab = ''
|
||||
this.tabs = _.cloneDeep(this.tabsTemplate)
|
||||
@@ -545,6 +548,7 @@ export default {
|
||||
})
|
||||
this.tabs = tabs
|
||||
this.$nextTick(() => {
|
||||
this.lineRefer = 'Average'
|
||||
this.echartsInit(this.tabs, true)
|
||||
})
|
||||
} else {
|
||||
@@ -575,10 +579,15 @@ export default {
|
||||
if (parseFloat(e.analysis.max) <= 0) {
|
||||
self.lineTab = ''
|
||||
self.lineRefer = ''
|
||||
self.init()
|
||||
// self.init() // 后续多测试关注
|
||||
}
|
||||
}
|
||||
})
|
||||
const emptyData = tabs.filter(d => parseFloat(d.analysis.max) === 0)
|
||||
this.isNoData = emptyData.length === tabs.length
|
||||
if (this.isNoData) {
|
||||
return true
|
||||
}
|
||||
this.tabs = tabs
|
||||
if (num === 5) {
|
||||
tabs[0].invertTab = false
|
||||
|
||||
@@ -168,6 +168,9 @@ export default {
|
||||
if (response.status === 200) {
|
||||
this.showError = false
|
||||
this.isNoData = res.data.result.length === 0
|
||||
if (!active) {
|
||||
this.tabs = dataForLinkTrafficLine.tabs
|
||||
}
|
||||
if (this.isNoData) {
|
||||
this.lineTab = ''
|
||||
this.tabs = dataForLinkTrafficLine.tabs
|
||||
@@ -400,10 +403,15 @@ export default {
|
||||
if (parseFloat(e.analysis.max) <= 0) {
|
||||
this.lineTab = ''
|
||||
this.lineRefer = ''
|
||||
this.init()
|
||||
// this.init() // 暂时注掉,后续观察
|
||||
}
|
||||
}
|
||||
})
|
||||
const emptyData = linkData.filter(d => parseFloat(d.analysis.max) === 0)
|
||||
this.isNoData = emptyData.length === linkData.length
|
||||
if (this.isNoData) {
|
||||
return true
|
||||
}
|
||||
this.tabs = linkData
|
||||
// 如果三者avg都为0时,至少保证total显示
|
||||
const ingressObj = linkData.find(d => d.name === 'linkMonitor.ingress')
|
||||
|
||||
@@ -192,6 +192,9 @@ export default {
|
||||
if (response.status === 200) {
|
||||
this.isNoData = res.data.result.length === 0
|
||||
this.showError = false
|
||||
if (!active) {
|
||||
this.tabs = _.cloneDeep(this.tabsTemplate)
|
||||
}
|
||||
if (this.isNoData) {
|
||||
this.lineTab = ''
|
||||
this.tabs = _.cloneDeep(this.tabsTemplate)
|
||||
@@ -512,6 +515,7 @@ export default {
|
||||
})
|
||||
this.tabs = tabs
|
||||
this.$nextTick(() => {
|
||||
this.lineRefer = 'Average'
|
||||
this.echartsInit(this.tabs, true)
|
||||
})
|
||||
} else {
|
||||
@@ -542,10 +546,15 @@ export default {
|
||||
if (parseFloat(e.analysis.max) <= 0) {
|
||||
self.lineTab = ''
|
||||
self.lineRefer = ''
|
||||
self.init()
|
||||
// self.init()
|
||||
}
|
||||
}
|
||||
})
|
||||
const emptyData = tabs.filter(d => parseFloat(d.analysis.max) === 0)
|
||||
this.isNoData = emptyData.length === tabs.length
|
||||
if (this.isNoData) {
|
||||
return true
|
||||
}
|
||||
this.tabs = tabs
|
||||
if (num === 5) {
|
||||
tabs[0].invertTab = false
|
||||
|
||||
@@ -167,15 +167,16 @@ describe('views/charts2/charts/linkMonitor/LinkTrafficLine.vue测试', () => {
|
||||
})
|
||||
test('Metric=Bits/s:数值为0', async () => {
|
||||
const data = mockData.boundary.zero.data1
|
||||
// 三个max都为0,则显示nodata,tab显示'-'
|
||||
axiosPostAndMounted(query2, data)
|
||||
const textNode0 = await wrapper.get('[test-id="tabContent0"]')
|
||||
const textNode1 = await wrapper.get('[test-id="tabContent1"]')
|
||||
const textNode2 = await wrapper.get('[test-id="tabContent2"]')
|
||||
|
||||
await new Promise(resolve => setTimeout(() => {
|
||||
expect(textNode0.text()).toEqual('<0.01bps')
|
||||
expect(textNode1.text()).toEqual('<0.01bps')
|
||||
expect(textNode2.text()).toEqual('<0.01bps')
|
||||
expect(textNode0.text()).toEqual('-')
|
||||
expect(textNode1.text()).toEqual('-')
|
||||
expect(textNode2.text()).toEqual('-')
|
||||
resolve()
|
||||
}, 200))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user