CN-421 fix: 解析域名更改列名

This commit is contained in:
chenjinsong
2022-03-31 16:44:16 +08:00
parent d933966def
commit 6afdcc0cad
3 changed files with 57 additions and 56 deletions

View File

@@ -138,6 +138,7 @@ export const chartTableColumnMapping = {
serverIp: 'overall.serverIp', serverIp: 'overall.serverIp',
domain: 'overall.domain', domain: 'overall.domain',
appName: 'overall.appName', appName: 'overall.appName',
dnsQname: 'QName',
queryRate: 'dns.queryRate', queryRate: 'dns.queryRate',
queryCount: 'dns.queryCount', queryCount: 'dns.queryCount',
dnsLatency: 'dns.averageResolveLatency', dnsLatency: 'dns.averageResolveLatency',

View File

@@ -25,7 +25,7 @@ import {
ipHostedDomain ipHostedDomain
} from '@/views/charts/charts/options/pie' } from '@/views/charts/charts/options/pie'
import chartEchartMixin from './chart-echart-mixin' import chartEchartMixin from './chart-echart-mixin'
import { get,post } from '@/utils/http' import { get, post } from '@/utils/http'
import { reverseSortBy } from '@/utils/tools' import { reverseSortBy } from '@/utils/tools'
export default { export default {
@@ -42,63 +42,63 @@ export default {
this.initDom(id, 2) this.initDom(id, 2)
const chartParams = this.chartInfo.params const chartParams = this.chartInfo.params
const domains = this.chartData.toString() const domains = this.chartData.toString()
//const domains = "office.com,dbank.com" // const domains = "office.com,dbank.com"
this.$emit('showLoading', true) this.$emit('showLoading', true)
let typeUrl = chartParams.byCategoryUrl.slice(0,chartParams.byCategoryUrl.indexOf('?')) const typeUrl = chartParams.byCategoryUrl.slice(0, chartParams.byCategoryUrl.indexOf('?'))
let reputationUrlUrl = chartParams.byReputationUrl.slice(0,chartParams.byReputationUrl.indexOf('?')) const reputationUrlUrl = chartParams.byReputationUrl.slice(0, chartParams.byReputationUrl.indexOf('?'))
const byType = new Promise(resolve => { const byType = new Promise(resolve => {
post(typeUrl, { domains: domains }).then(response => { get(typeUrl, { domains: domains }).then(response => {
//post(replaceUrlPlaceholder(chartParams.byCategoryUrl, { domains: domains })).then(response => { // post(replaceUrlPlaceholder(chartParams.byCategoryUrl, { domains: domains })).then(response => {
if (response.code === 200) { if (response.code === 200) {
if (this.$_.isEmpty(response.data.result)) { if (this.$_.isEmpty(response.data.result)) {
// this.noData0 = true // this.noData0 = true
} else { } else {
// this.noData0 = false // this.noData0 = false
//const chartOption = this.$_.cloneDeep(this.chartOption) // const chartOption = this.$_.cloneDeep(this.chartOption)
const data = response.data.result.sort(reverseSortBy('uniqDomains')).map(d => { const data = response.data.result.sort(reverseSortBy('uniqDomains')).map(d => {
return { return {
data: d, data: d,
name: d.categoryName, name: d.categoryName,
value: parseInt(d.uniqDomains), value: parseInt(d.uniqDomains),
unitType: chartParams.unitType unitType: chartParams.unitType
}
})
this.chartOption.series[0].data = data
} }
} })
}).finally(() =>{ this.chartOption.series[0].data = data
resolve() }
}) }
}) }).finally(() => {
const byReputation = new Promise(resolve => { resolve()
post(reputationUrlUrl, { domains: domains }).then(response => { })
if (response.code === 200) { })
if (this.$_.isEmpty(response.data.result)) { const byReputation = new Promise(resolve => {
// this.noData1 = true get(reputationUrlUrl, { domains: domains }).then(response => {
} else { if (response.code === 200) {
// this.noData1 = false if (this.$_.isEmpty(response.data.result)) {
//const chartOption = this.$_.cloneDeep(this.chartOption) // this.noData1 = true
const data = response.data.result.sort(reverseSortBy('uniqDomains')).map(d => { } else {
return { // this.noData1 = false
data: d, // const chartOption = this.$_.cloneDeep(this.chartOption)
name: d.reputationLevel, const data = response.data.result.sort(reverseSortBy('uniqDomains')).map(d => {
value: parseInt(d.uniqDomains), return {
unitType: chartParams.unitType data: d,
} name: d.reputationLevel,
}) value: parseInt(d.uniqDomains),
this.chartOption2.series[0].data = data unitType: chartParams.unitType
//this.myChart2.setOption(chartOption)
} }
} })
}).finally(() =>{ this.chartOption2.series[0].data = data
resolve() // this.myChart2.setOption(chartOption)
}) }
}) }
Promise.all([byType, byReputation]).finally(response => { }).finally(() => {
this.loadEchart(2) resolve()
}) })
})
Promise.all([byType, byReputation]).finally(response => {
this.loadEchart(2)
})
} }
} }
} }

View File

@@ -12,7 +12,7 @@
v-for="(c, i) in table.tableColumns.common" v-for="(c, i) in table.tableColumns.common"
show-overflow-tooltip show-overflow-tooltip
:key="i" :key="i"
:label="$t(chartTableColumnMapping[c])" :label="$t(chartTableColumnMapping[c] || c)"
:prop="c" :prop="c"
> >
</el-table-column> </el-table-column>
@@ -20,10 +20,10 @@
v-for="(c, i) in table.tableColumns.order" v-for="(c, i) in table.tableColumns.order"
show-overflow-tooltip show-overflow-tooltip
:key="i" :key="i"
:label="$t(chartTableColumnMapping[c])" :label="$t(chartTableColumnMapping[c] || c)"
:prop="c" :prop="c"
> >
<template #header>{{$t(chartTableColumnMapping[c])}}</template> <template #header>{{$t(chartTableColumnMapping[c] || c)}}</template>
<template #default="{ row }"> <template #default="{ row }">
<span v-if="c === 'bytes'"> <span v-if="c === 'bytes'">
{{unitConvert(row[c], unitTypes.byte).join(' ')}} {{unitConvert(row[c], unitTypes.byte).join(' ')}}