From d8cf82c07d7df139e0210176e9e78643c9efbd35 Mon Sep 17 00:00:00 2001
From: chenjinsong <523037378@qq.com>
Date: Thu, 21 Sep 2023 19:30:07 +0800
Subject: [PATCH] =?UTF-8?q?CN-1337=20fix:=20=E4=BF=AE=E5=A4=8D=E9=93=BE?=
=?UTF-8?q?=E8=B7=AF=E5=9B=9B=E5=85=83=E7=BB=84=E5=9B=BE=E6=8E=A5=E5=8F=A3?=
=?UTF-8?q?=E8=BF=94=E5=9B=9E=E6=95=B0=E6=8D=AE=E7=9A=84rate=3D0=E6=97=B6?=
=?UTF-8?q?=EF=BC=8C=E5=9B=BE=E8=A1=A8=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8?=
=?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../charts/linkMonitor/LinkTrafficSankey.vue | 49 ++++++++++++-------
1 file changed, 30 insertions(+), 19 deletions(-)
diff --git a/src/views/charts2/charts/linkMonitor/LinkTrafficSankey.vue b/src/views/charts2/charts/linkMonitor/LinkTrafficSankey.vue
index d1042300..f77b8ec6 100644
--- a/src/views/charts2/charts/linkMonitor/LinkTrafficSankey.vue
+++ b/src/views/charts2/charts/linkMonitor/LinkTrafficSankey.vue
@@ -3,22 +3,22 @@
-
+
-
+
-
+
External Locations
Next-Hop Internets
Links
Internal Locations
-
+
Internal Locations
Links
Next-Hop Internets
@@ -41,6 +41,7 @@ import { overwriteUrl, urlParamsHandler } from '@/utils/tools'
import unitConvert from '@/utils/unit-convert'
import { storageKey, unitTypes } from '@/utils/constants'
import ChartError from '@/components/common/Error'
+import _ from 'lodash'
export default {
name: 'LinksTrafficSankey',
@@ -63,13 +64,14 @@ export default {
data () {
return {
timer: null,
- ingress: false,
- egress: false,
+ ingressNoData: false,
+ egressNoData: false,
unitConvert,
unitTypes,
cnLinkInfo: JSON.parse(localStorage.getItem(storageKey.linkInfo)),
showError: false,
- errorMsg: ''
+ errorMsg: '',
+ chartOption: null
}
},
watch: {
@@ -116,20 +118,32 @@ export default {
const res = response.data
if (response.status === 200) {
this.showError = false
- if (n === 0) {
- this.ingress = res.data.result.length === 0
+ let noData
+ if (res.data.result.length === 0) {
+ noData = true
} else {
- this.egress = res.data.result.length === 0
+ if (n === 0) {
+ noData = !res.data.result.some(d => d.inBitsRate > 0)
+ } else {
+ noData = !res.data.result.some(d => d.outBitsRate > 0)
+ }
+ }
+ if (n === 0) {
+ this.ingressNoData = noData
+ } else {
+ this.egressNoData = noData
+ }
+ if (!noData) {
+ this.dataProcessing(res.data.result, parseInt(n))
}
- this.dataProcessing(res.data.result, parseInt(n))
} else {
this.showError = true
this.errorMsg = this.errorMsgHandler(res)
}
}).catch(e => {
console.error(e)
- this.egress = false
- this.ingress = false
+ this.egressNoData = false
+ this.ingressNoData = false
this.showError = true
this.errorMsg = this.errorMsgHandler(e)
}).finally(() => {
@@ -144,7 +158,7 @@ export default {
t.linkId = e.linkId
t.linkDirection = e.nextHop
t.bandwidth = e.bandwidth
- t.value = parseInt(t.inBitsRate)
+ t.value = _.round(Number(t.inBitsRate), 2)
t.external = `e_${t.externalLocation}`
t.internal = `i_${t.internalLocation}`
}
@@ -157,7 +171,7 @@ export default {
t.linkId = e.linkId
t.bandwidth = e.bandwidth
t.linkDirection = e.nextHop
- t.value = parseInt(t.outBitsRate)
+ t.value = _.round(Number(t.outBitsRate), 2)
t.external = `e_${t.externalLocation}`
t.internal = `i_${t.internalLocation}`
}
@@ -448,12 +462,9 @@ export default {
}
},
mounted () {
- this.myChart = null
- this.myChart2 = null
- this.chartOption = null
this.timer = setTimeout(() => {
this.linkTrafficSankeyDataRequest(this.tab)
- }, 100)
+ }, 200)
window.addEventListener('resize', this.resize)
},
beforeUnmount () {