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, drillDownPanelTypeMapping,
entityType, entityType,
entityDetailTags, entityDetailTags,
psiphon3IpType, tagValueLabelMapping,
riskLevelMapping, riskLevelMapping,
entityDefaultColor entityDefaultColor
} from '@/utils/constants' } from '@/utils/constants'
@@ -92,16 +92,9 @@ export default {
}, },
methods: { methods: {
getTagColor, getTagColor,
tagValueHandler (k, k2, value) { tagValueHandler (value) {
if (k === 'psiphon3Ip') { const find = tagValueLabelMapping.find(t => t.value === value)
if (k2 === 'type') { return find ? find.name : value
const find = psiphon3IpType.find(t => t.value === value)
if (find) {
return find.name
}
}
}
return value
}, },
getData () { getData () {
this.toggleLoading(true) this.toggleLoading(true)
@@ -122,7 +115,7 @@ export default {
Object.keys(res.data[k]).forEach(k2 => { Object.keys(res.data[k]).forEach(k2 => {
const find = entityDetailTags[this.entity.entityType].find(t => t.name === k2) const find = entityDetailTags[this.entity.entityType].find(t => t.name === k2)
if (find) { 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 { useRoute } from 'vue-router'
import axios from 'axios' import axios from 'axios'
import { api } from '@/utils/api' import { api } from '@/utils/api'
import {tagValueLabelMapping} from '../../../../utils/constants'
export default { export default {
name: 'EntityDetailTabs', name: 'EntityDetailTabs',
@@ -136,7 +137,7 @@ export default {
Object.keys(r[k]).forEach(k2 => { Object.keys(r[k]).forEach(k2 => {
const find = entityDetailTags[this.entity.entityType].find(t => t.name === k2) const find = entityDetailTags[this.entity.entityType].find(t => t.name === k2)
if (find) { 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 case 'app': return api.entity.openPortOfApp
} }
}, },
tagValueHandler (k, k2, value) { tagValueHandler (value) {
if (k === 'psiphon3Ip') { const find = tagValueLabelMapping.find(t => t.value === value)
if (k2 === 'type') { return find ? find.name : value
const find = psiphon3IpType.find(t => t.value === value)
if (find) {
return find.name
}
}
}
return value
} }
}, },
beforeUnmount () { beforeUnmount () {

View File

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