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>
<script>
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 unitConvert from '@/utils/unit-convert'
import { getChainRatio, computeScore, urlParamsHandler, overwriteUrl, readDrilldownTableConfigByUser, combineDrilldownTableWithUserConfig, getDnsMapData, handleSpecialValue, getConfigVersion } from '@/utils/tools'
@@ -1462,7 +1473,23 @@ export default {
}
},
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) {
if (isNumber) {

View File

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

View File

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