fix: 修复实体详情InformationAggregation的测试用例报错的问题

This commit is contained in:
刘洪洪
2024-04-15 16:22:16 +08:00
parent 6e6e5dcff3
commit a5e70bb2f0
2 changed files with 11 additions and 18 deletions

View File

@@ -12,7 +12,7 @@ import {
ZH,
EN,
securityLevel,
entityDetailTags, entityDefaultColor, tagValueLabelMapping
entityDetailTags, entityDefaultColor, tagValueLabelMapping, intentColor
} from '@/utils/constants'
import { getIso36112JsonData, getDictList } from '@/utils/api'
import { format } from 'echarts'
@@ -1529,16 +1529,7 @@ export const changeTimestampToTime = (timestamp) => {
export const formatTags = (data, type, list) => {
Object.keys(data).forEach(k => {
if (k !== 'tags' && data[k]) {
if (_.isArray(data[k])) {
data[k].forEach(k3 => {
const find = entityDetailTags[type].find(t => t.name === 'vpnServiceName')
if (find) {
list.push({ key: 'vpnServiceName', value: tagValueHandler(k3.vpnServiceName), type: find.type })
} else {
list.push({ key: 'vpnServiceName', value: tagValueHandler(k3.vpnServiceName), color: k3.knowledgeBase ? (k3.knowledgeBase.color || entityDefaultColor) : entityDefaultColor })
}
})
} else {
if (!_.isArray(data[k])) {
Object.keys(data[k]).forEach(k2 => {
const find = entityDetailTags[type].find(t => t.name === k2)
if (find) {
@@ -1563,7 +1554,7 @@ export const formatTagsOfDetails = (data, type, list) => {
intelligenceContent: []
}
if (k === 'tags') {
aggregation.intelligenceContent.push({ key: k, value: r[k].tagValue, type: 'normal', color: r[k].knowledgeBase ? (r[k].knowledgeBase.color || entityDefaultColor) : entityDefaultColor })
aggregation.intelligenceContent.push({ key: k, value: r[k].name, type: 'normal', color: intentColor[r[k].intent] || entityDefaultColor })
} else if (!_.isArray(r[k])) {
Object.keys(r[k]).forEach(k2 => {
const find = entityDetailTags[type].find(t => t.name === k2)

View File

@@ -59,21 +59,23 @@ const mockData = {
}
},
{
userDefinedTag: {
tags: {
id: 1,
tagValue: '门户网站',
name: '门户网站',
updateTime: 1685696500,
createTime: 1685696500,
isValid: 1
isValid: 1,
intent: 'Unknow'
}
},
{
userDefinedTag: {
tags: {
id: 1,
tagValue: '用户tag',
name: '用户tag',
updateTime: 1685696500,
createTime: 1685696500,
isValid: 1
isValid: 1,
intent: 'Benign'
}
}
]