From 79fb9babfffe47cb410096b51c01b3295d414fb8 Mon Sep 17 00:00:00 2001 From: hyx Date: Tue, 9 Apr 2024 22:50:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20CN-1592=20UI=20=E6=96=B0=E5=A2=9ETag?= =?UTF-8?q?=E6=A3=80=E7=B4=A2=E7=95=8C=E9=9D=A2=EF=BC=88=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=83=A8=E5=88=86=EF=BC=8C=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=83=A8=E5=88=86=E6=9C=AA=E5=AE=8C=E6=88=90?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/tagTemplate.zip | Bin 0 -> 489 bytes src/assets/css/components/views/tag/tag.scss | 6 +- src/components/table/tag/TagTable.vue | 2 +- src/mock/tag.js | 60 + src/permission.js | 13 +- src/utils/api.js | 2 +- src/utils/constants.js | 34 + src/views/tag/Tag.vue | 26 +- src/views/tag/TagForm.vue | 1540 ++++++++++++++++++ 9 files changed, 1669 insertions(+), 14 deletions(-) create mode 100644 public/assets/tagTemplate.zip create mode 100644 src/views/tag/TagForm.vue diff --git a/public/assets/tagTemplate.zip b/public/assets/tagTemplate.zip new file mode 100644 index 0000000000000000000000000000000000000000..18b5be126b9b41d64cd82423b41608b93d3fe672 GIT binary patch literal 489 zcmWIWW@Zs#U|`^2h}zN_ky-XiHU!A40b+I_E=f$+OD-uXxlt=eq|{5vS&=U!UrD}Fy5XjAO7{y-#m<;d#lps)OF~YaKK*r) zka4ir*GZp?A0CRTTIpcL9?8ZK0JnGw(Bhy+?72EX3vGdz7hS-8BUo=MBW15Mw<9(2XS4 zM?kX~nM4?HhZfKR21W)25CsI#utU~_&8Hxx5KWa3O$dJ@YsKapgw_iXtq{Kjc(byB Oq?mzlIgr+21n~eqc8oIs literal 0 HcmV?d00001 diff --git a/src/assets/css/components/views/tag/tag.scss b/src/assets/css/components/views/tag/tag.scss index 9180e78a..c2694cd4 100644 --- a/src/assets/css/components/views/tag/tag.scss +++ b/src/assets/css/components/views/tag/tag.scss @@ -286,15 +286,15 @@ box-shadow: 0 2px 4px 0 rgba(51,51,51,0.02); border-radius: 12px; } -.unknow { +.unknow-list { background-color:rgba(119,131,145,0.1) !important; color:rgb(119,131,145) } -.benign { +.benign-list { background-color:rgba(116,159,77,0.1) !important; color:rgb(116,159,77) } -.malicious { +.malicious-list { background-color:rgba(226,97,84,0.1) !important; color:rgb(226,97,84) } diff --git a/src/components/table/tag/TagTable.vue b/src/components/table/tag/TagTable.vue index 967213da..1ce3b566 100644 --- a/src/components/table/tag/TagTable.vue +++ b/src/components/table/tag/TagTable.vue @@ -289,7 +289,7 @@ export default { const vm = this return function (intent) { const t = vm.tagIntentColor.find(t => t.intent === intent) - return t ? t.name : vm.tagIntentColor[0].name + return t ? t.name+'-list' : vm.tagIntentColor[0].name+'-list' } } }, diff --git a/src/mock/tag.js b/src/mock/tag.js index b402e25b..d320fcf8 100644 --- a/src/mock/tag.js +++ b/src/mock/tag.js @@ -14,6 +14,24 @@ if (openMock) { } } }) + Mock.mock(new RegExp(BASE_CONFIG.baseUrl + 'v1/tag/.*'), 'post', function (requestObj) { + return { + "msg": "success", + "code": 200, + "data": { + "id": "标签UUID" + } + } + }) + Mock.mock(new RegExp(BASE_CONFIG.baseUrl + 'v1/tag/.*'), 'put', function (requestObj) { + return { + "msg": "success", + "code": 200, + "data": { + "id": "标签UUID" + } + } + }) Mock.mock(new RegExp(BASE_CONFIG.baseUrl + 'v1/tag/list.*'), 'get', function (requestObj) { return { msg: 'success', @@ -171,4 +189,46 @@ if (openMock) { } } }) + Mock.mock(new RegExp(BASE_CONFIG.baseUrl + 'v1/tag/.*'), 'get', function (requestObj) { + return { + "code": 200, + "message": "success", + "data": { + "pageNo": 1, + "pageSize": 10, + "total": 5, + "id": "08b2a4cd-1c38-4be1-b641-8e5b607e2075", + "name": "tag???", + "category": "categoty1", + "indicatorType": "Domain", + "intent": "Benign", + "description": " tag1 description", + "isBuiltIn": 1, + "createdTime": 1685412014, + "updatedTime": 1685412014, + "itemList": [ + { + "id": 1, + "EntityType": "Domain", + "EntityValue": "www.baidu.com" + }, + { + "id": 1, + "EntityType": "IP", + "EntityValue": "172.0.0.0/8" + }, + { + "id": 1, + "EntityType": "IP", + "EntityValue": "192.168.44.12" + }, + { + "id": 1, + "EntityType": "IP", + "EntityValue": "192.168.44.13-192.168.44.14" + } + ] + } + } + }) } diff --git a/src/permission.js b/src/permission.js index 8ed954f2..6e0afd2d 100644 --- a/src/permission.js +++ b/src/permission.js @@ -164,13 +164,18 @@ export function handleComponent (code) { return () => import('@/views/report/Report') case 'tag': return () => import('@/views/tag/Tag') + case 'createUserDefinedLibrary': + case 'editUserDefinedLibrary': + return () => import('@/views/tag/TagForm') case 'knowledgeBase': return () => import('@/views/setting/KnowledgeBase') case 'userDefinedLibrary': - return () => import('@/views/setting/KnowledgeBaseUserDefinedList') - case 'createUserDefinedLibrary': - case 'editUserDefinedLibrary': - return () => import('@/views/setting/KnowledgeBaseForm') + return () => import('@/views/tag/Tag') + //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/api.js b/src/utils/api.js index 8ec523a3..2d4f6298 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -62,7 +62,7 @@ export const api = { reportView: '/report/job/view', // tag 相关 tagList: '/v1/tag/list', - tagDelete: '/v1/tag/', + tag: '/v1/tag', tagIndicatorStatistics: '/v1/tag/{{name}}/indicator/statistics', tagIndicatorTrend: '/v1/tag/{{name}}/indicator/trend', tagTrafficEntityStatistics: '/v1/tag/{{name}}/trafficEntity/statistics', diff --git a/src/utils/constants.js b/src/utils/constants.js index 79a0aa70..39c5467b 100644 --- a/src/utils/constants.js +++ b/src/utils/constants.js @@ -432,6 +432,19 @@ export const itemListHeight = { noData: 250 } +export const tagType = [ + { + label: 'IP', + value: 'IP', + name: 'ip' + }, + { + label: 'Domain', + value: 'Domain', + name: 'domain' + } +] + export const knowledgeBaseType = [ { label: 'IP', @@ -483,6 +496,24 @@ export const tagIntentColor = [ } ] +export const tagIntent = [ + { + label: 'tag.intent.unknown', + value: 'Unknow', + name: 'info' + }, + { + label: 'tag.intent.benign', + value: 'Benign', + name: 'benign' + }, + { + label: 'tag.intent.malicious', + value: 'Malicious', + name: 'malicious' + } +] + export const knowledgeBaseColor = [ { label: 'knowledge.info', @@ -505,6 +536,9 @@ export const knowledgeCategoryValue = { aiTagging: 'ai_tagging', userDefined: 'user_defined' } +export const tagCategoryValue = { + userDefined: 'user_defined' +} export const knowledgeSourceValue = { fqdnCategory: 'cn_fqdn_category_built_in', iocMalware: 'cn_ioc_malware', diff --git a/src/views/tag/Tag.vue b/src/views/tag/Tag.vue index ee30508e..7ebc0bf4 100644 --- a/src/views/tag/Tag.vue +++ b/src/views/tag/Tag.vue @@ -191,7 +191,7 @@ export default { type: 'warning' }).then(() => { this.toggleLoading(true) - axios.delete(api.tagDelete + ids).then(response => { + axios.delete(api.tag + ids).then(response => { if (response.status === 200) { this.delFlag = true this.$message({ duration: 2000, type: 'success', message: this.$t('tip.deleteSuccess') }) @@ -260,6 +260,14 @@ export default { } this.isInit = false }, + add () { + this.$router.push({ + path: '/tag/userDefined/create', + query: { + t: +new Date() + } + }) + }, edit (u) { this.initConfig(u) this.object = u @@ -272,12 +280,20 @@ export default { type: 'warning' }).catch(() => {}) } else { - const curRecord = this.batchDeleteObjs[0] - this.initConfig(curRecord) - this.object = curRecord - this.rightBox.show = true + this.jumpToEditPage(this.batchDeleteObjs[0].id) } }, + jumpToEditPage (id) { + const pageNo = this.$router.currentRoute.value.query.pageNo + this.$router.push({ + path: '/tag/userDefined/edit', + query: { + t: +new Date(), + pageNoForTable: pageNo || 1, + id: id + } + }) + }, initConfig (u) { if (!u.config) { u.config = { diff --git a/src/views/tag/TagForm.vue b/src/views/tag/TagForm.vue new file mode 100644 index 00000000..aa5b96ac --- /dev/null +++ b/src/views/tag/TagForm.vue @@ -0,0 +1,1540 @@ + + + +