CN-1713 feat: 增加subscriber tag的处理

This commit is contained in:
chenjinsong
2024-10-28 14:09:35 +08:00
parent f36a925591
commit 3afe4647c2
5 changed files with 12 additions and 6 deletions

View File

@@ -498,6 +498,11 @@ export const tagType = [
label: 'Domain', label: 'Domain',
value: 'Domain', value: 'Domain',
name: 'domain' name: 'domain'
},
{
label: 'overall.subscriber',
value: 'Subscriber',
name: 'subscriber'
} }
] ]

View File

@@ -186,6 +186,7 @@ export default {
} }
}, },
mounted () { mounted () {
console.info(this.node)
this.handleDetailData(this.node) this.handleDetailData(this.node)
}, },
setup (props) { setup (props) {

View File

@@ -1,5 +1,5 @@
import _ from 'lodash' import _ from 'lodash'
import { entityDefaultColor, entityType } from '@/utils/constants' import {entityDefaultColor, entityType, intentColor } from '@/utils/constants'
import { formatTags } from '@/utils/tools' import { formatTags } from '@/utils/tools'
import { generateLabel, builtTooltip, queryEntityBasicInfo, queryTags, queryRelatedEntityCount } from '@/views/entityExplorer/entityGraph/utils' import { generateLabel, builtTooltip, queryEntityBasicInfo, queryTags, queryRelatedEntityCount } from '@/views/entityExplorer/entityGraph/utils'
import { api } from '@/utils/api' import { api } from '@/utils/api'
@@ -57,8 +57,8 @@ export default class Node {
const tags = await queryTags(entityType, entityName) const tags = await queryTags(entityType, entityName)
let _tags = [] let _tags = []
formatTags(tags, entityType, _tags) formatTags(tags, entityType, _tags)
if (_.isArray(tags.userDefinedTags)) { if (_.isArray(tags.tags)) {
_tags = _.concat(_tags, tags.userDefinedTags.map(tag => ({ value: tag.tagValue, color: tag.knowledgeBase ? tag.knowledgeBase.color : entityDefaultColor }))) _tags = _.concat(_tags, tags.tags.map(tag => ({ value: tag.name, color: intentColor[tag.intent] || entityDefaultColor })))
} }
this.data.tags = _tags this.data.tags = _tags

View File

@@ -300,7 +300,7 @@ export default {
break break
} }
} }
if (this.entity.entityType === 'domain' || this.entity.entityType === 'ip') { if (this.entity.entityType === 'domain' || this.entity.entityType === 'ip' || this.entity.entityType === 'subscriber') {
axios.get(`${url}?resource=${this.entity.entityValue}`).then(responese => { axios.get(`${url}?resource=${this.entity.entityValue}`).then(responese => {
const res = responese.data const res = responese.data
if (responese.status === 200) { if (responese.status === 200) {

View File

@@ -39,7 +39,7 @@
:disabled="!!editObject.id || (uploaded && !importedDataNoData)" :disabled="!!editObject.id || (uploaded && !importedDataNoData)"
> >
<template v-for="type in tagType" :key="type.name"> <template v-for="type in tagType" :key="type.name">
<el-option :label="type.label" :value="type.value"></el-option> <el-option :label="$t(type.label)" :value="type.value"></el-option>
</template> </template>
</el-select> </el-select>
</el-form-item> </el-form-item>
@@ -167,7 +167,7 @@
@blur="onBlurTagItem(i)" @blur="onBlurTagItem(i)"
> >
<template v-for="type in tagType" :key="type.name"> <template v-for="type in tagType" :key="type.name">
<el-option :label="type.label" :value="type.value"></el-option> <el-option :label="$t(type.label)" :value="type.value"></el-option>
</template> </template>
</el-select> </el-select>
</el-form-item> </el-form-item>