From aee521d5bc52ea9cd1e9b9b4ada144bf94b04242 Mon Sep 17 00:00:00 2001 From: "@changcode" Date: Tue, 15 Nov 2022 11:13:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20npm=E4=B8=8B=E9=92=BBtab=E4=B8=BAclient?= =?UTF-8?q?=20ip=E5=92=8Cserver=20ip=E6=8E=A5=E5=8F=A3=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/charts2/Panel.vue | 8 +++++++- .../charts2/charts/npm/NpmNetworkQuantity.vue | 16 ++++++++++++++-- src/views/charts2/charts/npm/NpmTrafficLine.vue | 8 +++++++- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/views/charts2/Panel.vue b/src/views/charts2/Panel.vue index 1d3c4938..725363da 100644 --- a/src/views/charts2/Panel.vue +++ b/src/views/charts2/Panel.vue @@ -349,7 +349,13 @@ export default { cycle: 0 } if (condition && (typeof condition !== 'object') && type) { - params.q = condition + if (type === 'clientIp') { + params.q = `ip='${condition.split(/'(.*?)'/)[1]}' and side='client'` + } else if (type === 'serverIp') { + params.q = `ip='${condition.split(/'(.*?)'/)[1]}' and side='server'` + } else { + params.q = condition + } params.type = type } else if (condition.length > 1 && type && type === 'ip') { params.q = `${type}='${condition[1]}'` diff --git a/src/views/charts2/charts/npm/NpmNetworkQuantity.vue b/src/views/charts2/charts/npm/NpmNetworkQuantity.vue index 3a227d81..f6d28086 100644 --- a/src/views/charts2/charts/npm/NpmNetworkQuantity.vue +++ b/src/views/charts2/charts/npm/NpmNetworkQuantity.vue @@ -77,7 +77,13 @@ export default { this.side = 'server' } if (condition && (typeof condition !== 'object') && type) { - params.q = condition + if (type === 'clientIp') { + params.q = `ip='${condition.split(/'(.*?)'/)[1]}' and side='client'` + } else if (type === 'serverIp') { + params.q = `ip='${condition.split(/'(.*?)'/)[1]}' and side='server'` + } else { + params.q = condition + } params.type = type } else if (condition.length > 1 && type && type === 'ip') { params.q = `${type}='${condition[1]}' and side='${this.side}'` @@ -143,7 +149,13 @@ export default { this.side = 'server' } if (condition && (typeof condition !== 'object') && type) { - params.q = condition + if (type === 'clientIp') { + params.q = `ip='${condition.split(/'(.*?)'/)[1]}' and side='client'` + } else if (type === 'serverIp') { + params.q = `ip='${condition.split(/'(.*?)'/)[1]}' and side='server'` + } else { + params.q = condition + } params.type = type } else if (condition.length > 1 && type && type === 'ip') { params.q = `${type}='${condition[1]}' and side='${this.side}'` diff --git a/src/views/charts2/charts/npm/NpmTrafficLine.vue b/src/views/charts2/charts/npm/NpmTrafficLine.vue index e2c0e4c0..09be9929 100644 --- a/src/views/charts2/charts/npm/NpmTrafficLine.vue +++ b/src/views/charts2/charts/npm/NpmTrafficLine.vue @@ -157,7 +157,13 @@ export default { params.type = type } if (condition && (typeof condition !== 'object') && type) { - params.q = condition + if (type === 'clientIp') { + params.q = `ip='${condition.split(/'(.*?)'/)[1]}' and side='client'` + } else if (type === 'serverIp') { + params.q = `ip='${condition.split(/'(.*?)'/)[1]}' and side='server'` + } else { + params.q = condition + } } else if (condition.length > 1 && type && type === 'ip') { params.q = `${type}='${condition[1]}' and side='${this.side}'` } else if (condition.length > 1 && type && type !== 'ip') {