From 4975f2425d02b064bdc4aefa6601dc462df07369 Mon Sep 17 00:00:00 2001 From: "@changcode" Date: Thu, 17 Nov 2022 15:55:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=201.npm=E5=9C=B0=E5=9B=BE=E5=88=86?= =?UTF-8?q?=E6=95=B0=E8=A1=A5=E5=85=85=E5=8D=A0=E4=BD=8D=E5=A4=8D2.npm?= =?UTF-8?q?=E4=B8=8B=E9=92=BB3=E7=BA=A7=E8=8F=9C=E5=8D=95=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=AF=B7=E6=B1=82=E9=94=99=E8=AF=AF=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/charts2/Panel.vue | 18 +++++---- src/views/charts2/charts/npm/NpmMap.vue | 2 +- .../charts2/charts/npm/NpmNetworkQuantity.vue | 39 ++++++++++++++----- .../charts2/charts/npm/NpmTrafficLine.vue | 4 +- 4 files changed, 43 insertions(+), 20 deletions(-) diff --git a/src/views/charts2/Panel.vue b/src/views/charts2/Panel.vue index 42caf4b8..7e8cc0ac 100644 --- a/src/views/charts2/Panel.vue +++ b/src/views/charts2/Panel.vue @@ -3,7 +3,7 @@
{{panelName?panelName:(panel.i18n ? $t(panel.i18n) : panel.name)}}
-
+
Score:{{score}} @@ -184,7 +184,7 @@ export default { return chart }) }) - if (this.$route.path === '/panel/networkAppPerformance' && this.queryCondition) { + if (this.$route.path === '/panel/networkAppPerformance' && (this.queryCondition || this.networkOverviewBeforeTab)) { this.scoreCalculation() } }, @@ -255,7 +255,7 @@ export default { const queryCondition = ref(query.queryCondition || '') const dimensionType = ref(query.dimensionType || '') - + const networkOverviewBeforeTab = ref(query.networkOverviewBeforeTab || '') return { panelType, panel, @@ -264,7 +264,8 @@ export default { metric, path, queryCondition, - dimensionType + dimensionType, + networkOverviewBeforeTab } }, methods: { @@ -342,7 +343,7 @@ export default { } else { condition = this.queryCondition } - const type = this.dimensionType + const type = this.dimensionType || this.networkOverviewBeforeTab const params = { startTime: getSecond(this.timeFilter.startTime), endTime: getSecond(this.timeFilter.endTime), @@ -354,9 +355,9 @@ export default { } else if (type === 'serverIp') { params.q = `ip='${condition.split(/'(.*?)'/)[1]}' and side='server'` } else if (type === 'clientCity') { - params.q = `client_city='${condition.split(/'(.*?)'/)[1]}' and side='client'` + params.q = `client_city='${condition.split(/'(.*?)'/)[1]}'` } else if (type === 'serverCity') { - params.q = `server_city='${condition.split(/'(.*?)'/)[1]}' and side='server'` + params.q = `server_city='${condition.split(/'(.*?)'/)[1]}'` } else { params.q = condition } @@ -376,7 +377,8 @@ export default { params.type = type } } - if (type && condition) { + if ((type && condition) || type) { + params.type = params.type || type get(api.npm.overview.networkAnalysis, params).then(res => { if (res.code === 200) { const data = { diff --git a/src/views/charts2/charts/npm/NpmMap.vue b/src/views/charts2/charts/npm/NpmMap.vue index ec58c69a..8182db42 100644 --- a/src/views/charts2/charts/npm/NpmMap.vue +++ b/src/views/charts2/charts/npm/NpmMap.vue @@ -162,7 +162,7 @@ export default { }, loadMarkerData (imageSeries, data) { imageSeries.data = data.map(r => ({ - score: r.score, + score: r.score || '–', name: r.province || r.country, throughput: valueToRangeValue(r.throughBitsRate, unitTypes.bps).join(' '), id: r.serverId, diff --git a/src/views/charts2/charts/npm/NpmNetworkQuantity.vue b/src/views/charts2/charts/npm/NpmNetworkQuantity.vue index 30c5a9ec..8dc908d3 100644 --- a/src/views/charts2/charts/npm/NpmNetworkQuantity.vue +++ b/src/views/charts2/charts/npm/NpmNetworkQuantity.vue @@ -26,10 +26,12 @@ export default { const queryCondition = ref(query.queryCondition || '') const dimensionType = ref(query.dimensionType || '') const tabIndex = ref(query.tabIndex) + const networkOverviewBeforeTab = ref(query.networkOverviewBeforeTab || '') return { queryCondition, dimensionType, - tabIndex + tabIndex, + networkOverviewBeforeTab } }, data () { @@ -65,7 +67,7 @@ export default { } else { condition = this.queryCondition } - const type = this.dimensionType + const type = this.dimensionType || this.networkOverviewBeforeTab const params = { startTime: getSecond(this.timeFilter.startTime), endTime: getSecond(this.timeFilter.endTime), @@ -82,9 +84,9 @@ export default { } else if (type === 'serverIp') { params.q = `ip='${condition.split(/'(.*?)'/)[1]}' and side='server'` } else if (type === 'clientCity') { - params.q = `client_city='${condition.split(/'(.*?)'/)[1]}' and side='client'` + params.q = `client_city='${condition.split(/'(.*?)'/)[1]}'` } else if (type === 'serverCity') { - params.q = `server_city='${condition.split(/'(.*?)'/)[1]}' and side='server'` + params.q = `server_city='${condition.split(/'(.*?)'/)[1]}'` } else { params.q = condition } @@ -104,7 +106,8 @@ export default { params.type = type } } - if (type && condition) { + if ((type && condition) || type) { + params.type = params.type || type this.toggleLoading(true) get(api.npm.overview.networkAnalysis, params).then(res => { if (res.code === 200) { @@ -141,7 +144,7 @@ export default { } else { condition = this.queryCondition } - const type = this.dimensionType + const type = this.dimensionType || this.networkOverviewBeforeTab const params = { startTime: getSecond(this.timeFilter.startTime), endTime: getSecond(this.timeFilter.endTime), @@ -158,9 +161,9 @@ export default { } else if (type === 'serverIp') { params.q = `ip='${condition.split(/'(.*?)'/)[1]}' and side='server'` } else if (type === 'clientCity') { - params.q = `client_city='${condition.split(/'(.*?)'/)[1]}' and side='client'` + params.q = `client_city='${condition.split(/'(.*?)'/)[1]}'` } else if (type === 'serverCity') { - params.q = `server_city='${condition.split(/'(.*?)'/)[1]}' and side='server'` + params.q = `server_city='${condition.split(/'(.*?)'/)[1]}'` } else { params.q = condition } @@ -180,7 +183,8 @@ export default { params.type = type } } - if (type && condition) { + if ((type && condition) || type) { + params.type = params.type || type this.toggleLoading(true) get(api.npm.overview.networkAnalysis, params).then(res => { if (res.code === 200) { @@ -196,6 +200,23 @@ export default { }).finally(() => { this.toggleLoading(false) }) + } else if (!type && !condition && this.networkOverviewBeforeTab) { + this.toggleLoading(true) + params.type = this.networkOverviewBeforeTab + get(api.npm.overview.networkAnalysis, params).then(res => { + if (res.code === 200) { + this.npmNetworkLastCycleData = res.data.result + let timer = null + if (timer) { + clearTimeout(timer) + } + timer = setTimeout(() => { + this.npmNetworkQuantity(this.npmNetworkCycleData, this.npmNetworkLastCycleData, 0) + }, 300) + } + }).finally(() => { + this.toggleLoading(false) + }) } else { const tcp = get(api.npm.overview.tcpSessionDelay, params) const http = get(api.npm.overview.httpResponseDelay, params) diff --git a/src/views/charts2/charts/npm/NpmTrafficLine.vue b/src/views/charts2/charts/npm/NpmTrafficLine.vue index f01cc879..660fa767 100644 --- a/src/views/charts2/charts/npm/NpmTrafficLine.vue +++ b/src/views/charts2/charts/npm/NpmTrafficLine.vue @@ -162,9 +162,9 @@ export default { } else if (type === 'serverIp') { params.q = `ip='${condition.split(/'(.*?)'/)[1]}' and side='server'` } else if (type === 'clientCity') { - params.q = `client_city='${condition.split(/'(.*?)'/)[1]}' and side='client'` + params.q = `client_city='${condition.split(/'(.*?)'/)[1]}'` } else if (type === 'serverCity') { - params.q = `server_city='${condition.split(/'(.*?)'/)[1]}' and side='server'` + params.q = `server_city='${condition.split(/'(.*?)'/)[1]}'` } else { params.q = condition }