CN-1273 fix: 调整内置tag字典

This commit is contained in:
chenjinsong
2023-10-18 10:52:25 +08:00
parent c2de6c853c
commit 19747cf326
4 changed files with 16 additions and 45 deletions

File diff suppressed because one or more lines are too long

View File

@@ -60,7 +60,7 @@ import {
drillDownPanelTypeMapping,
entityType,
entityDetailTags,
psiphon3IpType,
tagValueLabelMapping,
riskLevelMapping,
entityDefaultColor
} from '@/utils/constants'
@@ -92,16 +92,9 @@ export default {
},
methods: {
getTagColor,
tagValueHandler (k, k2, value) {
if (k === 'psiphon3Ip') {
if (k2 === 'type') {
const find = psiphon3IpType.find(t => t.value === value)
if (find) {
return find.name
}
}
}
return value
tagValueHandler (value) {
const find = tagValueLabelMapping.find(t => t.value === value)
return find ? find.name : value
},
getData () {
this.toggleLoading(true)
@@ -122,7 +115,7 @@ export default {
Object.keys(res.data[k]).forEach(k2 => {
const find = entityDetailTags[this.entity.entityType].find(t => t.name === k2)
if (find) {
this.levelTwoTags.push({ key: k2, value: this.tagValueHandler(k, k2, res.data[k][k2]), type: find.type })
this.levelTwoTags.push({ key: k2, value: this.tagValueHandler(res.data[k][k2]), type: find.type })
}
})
}

View File

@@ -40,6 +40,7 @@ import { overwriteUrl, urlParamsHandler } from '@/utils/tools'
import { useRoute } from 'vue-router'
import axios from 'axios'
import { api } from '@/utils/api'
import {tagValueLabelMapping} from '../../../../utils/constants'
export default {
name: 'EntityDetailTabs',
@@ -136,7 +137,7 @@ export default {
Object.keys(r[k]).forEach(k2 => {
const find = entityDetailTags[this.entity.entityType].find(t => t.name === k2)
if (find) {
aggregation.intelligenceContent.push({ key: k2, value: this.tagValueHandler(k, k2, r[k][k2]), type: find.type })
aggregation.intelligenceContent.push({ key: k2, value: this.tagValueHandler(r[k][k2]), type: find.type })
}
})
}
@@ -251,16 +252,9 @@ export default {
case 'app': return api.entity.openPortOfApp
}
},
tagValueHandler (k, k2, value) {
if (k === 'psiphon3Ip') {
if (k2 === 'type') {
const find = psiphon3IpType.find(t => t.value === value)
if (find) {
return find.name
}
}
}
return value
tagValueHandler (value) {
const find = tagValueLabelMapping.find(t => t.value === value)
return find ? find.name : value
}
},
beforeUnmount () {

View File

@@ -187,7 +187,7 @@ import relatedServer from '@/mixins/relatedServer'
import Loading from '@/components/common/Loading'
import axios from 'axios'
import { api } from '@/utils/api'
import { entityDefaultColor, entityDetailTags, psiphon3IpType } from '@/utils/constants'
import { entityDefaultColor, entityDetailTags, tagValueLabelMapping } from '@/utils/constants'
import _ from 'lodash'
import { getTagColor } from '@/utils/tools'
@@ -292,7 +292,7 @@ export default {
Object.keys(res.data[k]).forEach(k2 => {
const find = entityDetailTags[this.entity.entityType].find(t => t.name === k2)
if (find) {
this.levelTwoTags.push({ key: k2, value: this.tagValueHandler(k, k2, res.data[k][k2]), type: find.type })
this.levelTwoTags.push({ key: k2, value: this.tagValueHandler(res.data[k][k2]), type: find.type })
}
})
}
@@ -304,16 +304,9 @@ export default {
}
})
},
tagValueHandler (k, k2, value) {
if (k === 'psiphon3Ip') {
if (k2 === 'type') {
const find = psiphon3IpType.find(t => t.value === value)
if (find) {
return find.name
}
}
}
return value
tagValueHandler (value) {
const find = tagValueLabelMapping.find(t => t.value === value)
return find ? find.name : value
},
/* 切换折叠状态 */
switchCollapse () {