CN-834 fix: 修复npm下钻ip过滤未生效的问题

This commit is contained in:
chenjinsong
2022-12-29 21:43:13 +08:00
parent 823da09f69
commit 5714e3b97a
3 changed files with 48 additions and 12 deletions

View File

@@ -198,7 +198,18 @@
</template> </template>
<script> <script>
import { ref } from 'vue' import { ref } from 'vue'
import { operationType, unitTypes, networkTable, tableColumnType, networkDefaultLimit, curTabState, storageKey, dbDrilldownTableConfig, fromRoute } from '@/utils/constants' import {
operationType,
unitTypes,
networkTable,
tableColumnType,
networkDefaultLimit,
curTabState,
storageKey,
dbDrilldownTableConfig,
fromRoute,
drillDownPanelTypeMapping
} from '@/utils/constants'
import { get } from '@/utils/http' import { get } from '@/utils/http'
import unitConvert from '@/utils/unit-convert' import unitConvert from '@/utils/unit-convert'
import { getChainRatio, computeScore, urlParamsHandler, overwriteUrl, readDrilldownTableConfigByUser, combineDrilldownTableWithUserConfig, getDnsMapData, handleSpecialValue, getConfigVersion } from '@/utils/tools' import { getChainRatio, computeScore, urlParamsHandler, overwriteUrl, readDrilldownTableConfigByUser, combineDrilldownTableWithUserConfig, getDnsMapData, handleSpecialValue, getConfigVersion } from '@/utils/tools'
@@ -1462,7 +1473,23 @@ export default {
} }
}, },
getQueryCondition () { getQueryCondition () {
return this.$route.query.queryCondition ? this.$route.query.queryCondition : '' const queryCondition = this.getUrlParam('queryCondition')
const fourthPanel = this.getUrlParam('fourthPanel', -1, true)
const dimensionType = this.getUrlParam('dimensionType', '')
const fourthMenu = this.getUrlParam('fourthMenu', '')
const tabIndex = this.getUrlParam('tabIndex', 0, true)
if (fourthPanel === drillDownPanelTypeMapping.npmOverviewIp) {
if (dimensionType === 'clientIp' || dimensionType === 'serverIp' || dimensionType === 'ip') {
if (tabIndex === 0) {
return `common_client_ip='${fourthMenu}'`
} else if (tabIndex === 1) {
return `common_server_ip='${fourthMenu}'`
}
}
}
return queryCondition
}, },
getUrlParam (param, defaultValue, isNumber) { getUrlParam (param, defaultValue, isNumber) {
if (isNumber) { if (isNumber) {

View File

@@ -73,7 +73,7 @@ export default {
} else { } else {
condition = this.queryCondition condition = this.queryCondition
} }
const type = this.dimensionType || this.networkOverviewBeforeTab let type = this.dimensionType || this.networkOverviewBeforeTab
const params = { const params = {
startTime: getSecond(this.timeFilter.startTime), startTime: getSecond(this.timeFilter.startTime),
endTime: getSecond(this.timeFilter.endTime), endTime: getSecond(this.timeFilter.endTime),
@@ -85,10 +85,13 @@ export default {
this.side = 'server' this.side = 'server'
} }
if (condition && (typeof condition !== 'object') && type) { if (condition && (typeof condition !== 'object') && type) {
if (type === 'clientIp') { if (type === 'clientIp' || type === 'serverIp') {
params.q = `ip='${condition.split(/'(.*?)'/)[1]}' and side='client'` if (parseFloat(this.tabIndex) === 0) {
} else if (type === 'serverIp') { type = 'clientIp'
params.q = `ip='${condition.split(/'(.*?)'/)[1]}' and side='server'` } else if (parseFloat(this.tabIndex) === 1) {
type = 'serverIp'
}
params.q = `ip='${condition.split(/'(.*?)'/)[1]}'`
} else if (type === 'clientCity') { } else if (type === 'clientCity') {
params.q = `client_city='${condition.split(/'(.*?)'/)[1]}'` params.q = `client_city='${condition.split(/'(.*?)'/)[1]}'`
} else if (type === 'serverCity') { } else if (type === 'serverCity') {

View File

@@ -145,7 +145,7 @@ export default {
} }
// const conditionStr = this.$route.query.queryCondition ? this.$route.query.queryCondition : '' // const conditionStr = this.$route.query.queryCondition ? this.$route.query.queryCondition : ''
let condition = '' let condition = ''
const type = this.dimensionType let type = this.dimensionType
if (this.queryCondition.indexOf(' OR ') > -1) { if (this.queryCondition.indexOf(' OR ') > -1) {
condition = this.queryCondition.split(/["|'](.*?)["|']/) condition = this.queryCondition.split(/["|'](.*?)["|']/)
} else { } else {
@@ -161,13 +161,19 @@ export default {
endTime: getSecond(this.timeFilter.endTime) endTime: getSecond(this.timeFilter.endTime)
} }
if (type) { if (type) {
if (type === 'clientIp' || type === 'serverIp') {
if (parseFloat(this.tabIndex) === 0) {
type = 'clientIp'
} else if (parseFloat(this.tabIndex) === 1) {
type = 'serverIp'
}
params.q = `ip='${condition.split(/'(.*?)'/)[1]}'`
}
params.type = type params.type = type
} }
if (condition && (typeof condition !== 'object') && type) { if (condition && (typeof condition !== 'object') && type) {
if (type === 'clientIp') { if (type === 'clientIp' || type === 'serverIp') {
params.q = `ip='${condition.split(/'(.*?)'/)[1]}' and side='client'` params.q = `ip='${condition.split(/'(.*?)'/)[1]}'`
} else if (type === 'serverIp') {
params.q = `ip='${condition.split(/'(.*?)'/)[1]}' and side='server'`
} else if (type === 'clientCity') { } else if (type === 'clientCity') {
params.q = `client_city='${condition.split(/'(.*?)'/)[1]}'` params.q = `client_city='${condition.split(/'(.*?)'/)[1]}'`
} else if (type === 'serverCity') { } else if (type === 'serverCity') {