diff --git a/public/config.js b/public/config.js index 055580a9..cd910adc 100644 --- a/public/config.js +++ b/public/config.js @@ -21,5 +21,6 @@ const DEFAULT_TIME_FILTER_RANGE = { performanceEvent: 60 * 24 * 7, // 实体详情--通用--性能事件 behaviorPattern: 60 * 24 * 7 // 实体详情--IP--行为模式 }, - detection: 60 // 事件日志列表 + detection: 60, // 事件日志列表 + tag:60//标签列表 } diff --git a/src/assets/css/components/views/tag/tagForm.scss b/src/assets/css/components/views/tag/tagForm.scss index 873e8ace..f484c389 100644 --- a/src/assets/css/components/views/tag/tagForm.scss +++ b/src/assets/css/components/views/tag/tagForm.scss @@ -309,6 +309,9 @@ $color-mousemove-cursor: #D3D0D8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; + .el-form-item { + margin-bottom: 0; + } } .imported-data-item-edit__input { @@ -1183,7 +1186,7 @@ $color-mousemove-cursor: #D3D0D8; } } -.info { +.unknow { background-color: rgb(119, 131, 145) // 需要与js里的knowledgeBaseColor进行匹配,故保留 } diff --git a/src/components/table/tag/TagTable.vue b/src/components/table/tag/TagTable.vue index f4af3b44..e7a29668 100644 --- a/src/components/table/tag/TagTable.vue +++ b/src/components/table/tag/TagTable.vue @@ -90,7 +90,7 @@ {{ getIsBuiltIn(scope.row.isBuiltIn) }} - {{scope.row[item.prop]}} + {{intentText(scope.row[item.prop])}} {{ scope.row[item.prop] || '-' }} @@ -107,10 +107,10 @@ import table from '@/mixins/table' import Loading from '@/components/common/Loading' import axios from 'axios' import { api } from '@/utils/api' -import { storageKey, tagIntentColor, chartColor3 } from '@/utils/constants' +import { storageKey, tagIntent, chartColor3 } from '@/utils/constants' import { urlParamsHandler, overwriteUrl, headerCellClass } from '@/utils/tools' import { ref, shallowRef } from 'vue' -import { dateFormatToUTC, getNowTime } from '@/utils/date-util' +import { dateFormatToUTC, getNowTime, getSecond } from '@/utils/date-util' import chartDetectionPagination from '@/views/charts/charts/chartDetectionPagination' import ChartNoData from '@/views/charts/charts/ChartNoData' import { useRoute } from 'vue-router' @@ -194,7 +194,7 @@ export default { myChartArray: [], observedCount: 0, disableToEntity: false, - tagIntentColor + tagIntent } }, /** @@ -284,11 +284,18 @@ export default { } }, computed: { + intentText () { + const vm = this + return function (intent) { + const t = vm.tagIntent.find(t => t.value === intent) + return this.$t(t.label) + } + }, colorIntent () { const vm = this return function (intent) { - const t = vm.tagIntentColor.find(t => t.intent === intent) - return t ? t.name + '-list' : vm.tagIntentColor[0].name + '-list' + const t = vm.tagIntent.find(t => t.value === intent) + return t ? t.name + '-list' : vm.tagIntent[0].name + '-list' } } }, @@ -525,9 +532,11 @@ export default { overwriteUrl(newUrl) }, initLine (item, lineUrl) { + const dateRangeValue = DEFAULT_TIME_FILTER_RANGE.dashboard || 60 + const { startTime, endTime } = getNowTime(dateRangeValue) const params = { - // startTime: getSecond(this.timeFilter.startTime), - // endTime: getSecond(this.timeFilter.endTime) + startTime: getSecond(startTime), + endTime: getSecond(endTime) } lineUrl = lineUrl || api.tagTrafficEntityTrend lineUrl = lineUrl.replace('{{name}}', item.name) @@ -537,10 +546,7 @@ export default { if (response.status === 200) { this.showError = false this.isNoData = res.data.result.length === 0 - - if (!this.isNoData) { - this.echartsInit(res.data.result, item, '') - } + this.echartsInit(res.data.result, item, '') } else { this.isNoData = false this.showError = true @@ -556,9 +562,11 @@ export default { }) }, initStatistics (item, statisticsUrl) { + const dateRangeValue = DEFAULT_TIME_FILTER_RANGE.dashboard || 60 + const { startTime, endTime } = getNowTime(dateRangeValue) const params = { - // startTime: getSecond(this.timeFilter.startTime), - // endTime: getSecond(this.timeFilter.endTime) + startTime: getSecond(startTime), + endTime: getSecond(endTime) } statisticsUrl = statisticsUrl || api.tagTrafficEntityStatistics statisticsUrl = statisticsUrl.replace('{{name}}', item.name) diff --git a/src/permission.js b/src/permission.js index e19b9d27..3ab84a97 100644 --- a/src/permission.js +++ b/src/permission.js @@ -171,11 +171,11 @@ export function handleComponent (code) { return () => import('@/views/setting/KnowledgeBase') case 'userDefinedLibrary': return () => import('@/views/tag/Tag') - //case 'userDefinedLibrary': - //return () => import('@/views/setting/KnowledgeBaseUserDefinedList') - //case 'createUserDefinedLibrary': - //case 'editUserDefinedLibrary': - //return () => import('@/views/setting/KnowledgeBaseForm') + // case 'userDefinedLibrary': + // return () => import('@/views/setting/KnowledgeBaseUserDefinedList') + // case 'createUserDefinedLibrary': + // case 'editUserDefinedLibrary': + // return () => import('@/views/setting/KnowledgeBaseForm') case 'administration': return () => import('@/views/administration/Index') case 'user': diff --git a/src/utils/constants.js b/src/utils/constants.js index 8dfc3ea1..6c5db25f 100644 --- a/src/utils/constants.js +++ b/src/utils/constants.js @@ -322,7 +322,7 @@ export const tagIntentOptions = [ label: 'tag.intent.benign' }, { - value: 'Unknown', + value: 'Unknow', label: 'tag.intent.unknown' } ] @@ -498,29 +498,11 @@ export const knowledgeBaseCategory = [ } ] -export const tagIntentColor = [ - { - label: 'tag.intent.unknown', - name: 'unknow', - intent: 'Unknow' - }, - { - label: 'tag.intent.benign', - name: 'benign', - intent: 'Benign' - }, - { - label: 'tag.intent.malicious', - name: 'malicious', - intent: 'Malicious' - } -] - export const tagIntent = [ { label: 'tag.intent.unknown', value: 'Unknow', - name: 'info' + name: 'unknow' }, { label: 'tag.intent.benign', diff --git a/src/views/tag/Tag.vue b/src/views/tag/Tag.vue index d7e4336e..9bcda9a1 100644 --- a/src/views/tag/Tag.vue +++ b/src/views/tag/Tag.vue @@ -160,13 +160,14 @@ export default { this.getTableData(params) }, search (params) { + this.name = params.q + params = { name: this.name } if (this.intent) { params = { ...params, intent: this.intent } } if (this.category) { params = { ...params, category: this.category } } - this.name = params.q this.pageObj.pageNo = 1 this.getTableData(params) }, diff --git a/src/views/tag/TagForm.vue b/src/views/tag/TagForm.vue index dbb7f162..af4fa069 100644 --- a/src/views/tag/TagForm.vue +++ b/src/views/tag/TagForm.vue @@ -162,14 +162,28 @@ - - - + + + {{ d.entityType }} -   {{(d.isValid === 1 && (d.msg==='' || !d.msg) )? $t('overall.success'): d.msg }} + + + + + + + {{(d.isValid === 1 && (d.msg==='' || !d.msg) )? $t('overall.success'): d.msg }} @@ -1255,6 +1269,11 @@ export default { if (!response.data.data) { throw new Error('No data found, id: ' + this.id) } + if (response.data.data.itemList) { + response.data.data.itemList.forEach(item => { + item.isValid = 1 + }) + } this.editObject = response.data.data if (response.data.data.intent) { const curIntentObj = this.tagIntent.find(item => item.value === response.data.data.intent)