From e1a26b60ae37db2922eb6ba90cfecb0ebef71dee Mon Sep 17 00:00:00 2001 From: chenjinsong <523037378@qq.com> Date: Mon, 11 Dec 2023 17:48:38 +0800 Subject: [PATCH] =?UTF-8?q?CN-1440=20fix:=20policy=E7=9A=84library?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=BC=A0=E6=A0=87=E6=82=AC=E6=B5=AE=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/detections/detection-table.scss | 31 +++++++++++- .../setting/KnowledgeBaseTableForRow.vue | 22 ++------- src/utils/constants.js | 24 ++++++++-- .../detectionPolicies/PolicyDrawer.vue | 48 +++++++++++++++++-- .../detectionPolicies/PolicyTable.vue | 44 ++++++++++++++++- src/views/setting/KnowledgeBaseForm.vue | 22 ++------- 6 files changed, 141 insertions(+), 50 deletions(-) diff --git a/src/assets/css/components/views/detections/detection-table.scss b/src/assets/css/components/views/detections/detection-table.scss index 5093c1ee..c65a0eea 100644 --- a/src/assets/css/components/views/detections/detection-table.scss +++ b/src/assets/css/components/views/detections/detection-table.scss @@ -1,4 +1,3 @@ - .detection-table { .el-table th > .cell, .el-table .cell { padding-left: 0 !important; @@ -32,7 +31,37 @@ height: 32px !important; } } +.policy-library-tip { + max-width: 180px; + padding: 4px; + .tip__header { + color: #353636; + font-weight: bold; + font-size: 14px; + } + .tip__tags { + display: flex; + margin-top: 8px; + + .tip__tag { + margin-right: 10px; + padding: 2px 10px; + background-color: #EBF7FA; + color: #046ECA; + box-shadow: 0 2px 4px 0 rgba(51,51,51,0.02); + border-radius: 12px; + } + } + .tip__description { + margin-top: 14px; + color: #666; + + &.tip__description--non { + color: #999; + } + } +} .detection-tag-blue, .detection-tag-red, .detection-tag-gray, .detection-tag-status0, .detection-tag-status1 { display: inline-block; border-radius: 10px; diff --git a/src/components/table/setting/KnowledgeBaseTableForRow.vue b/src/components/table/setting/KnowledgeBaseTableForRow.vue index 3855c659..8d492ca2 100644 --- a/src/components/table/setting/KnowledgeBaseTableForRow.vue +++ b/src/components/table/setting/KnowledgeBaseTableForRow.vue @@ -129,7 +129,7 @@ - - diff --git a/src/views/detections/detectionPolicies/PolicyTable.vue b/src/views/detections/detectionPolicies/PolicyTable.vue index 8d80c39a..9110b011 100644 --- a/src/views/detections/detectionPolicies/PolicyTable.vue +++ b/src/views/detections/detectionPolicies/PolicyTable.vue @@ -65,7 +65,36 @@ {{ scope.row[item.prop] }} - {{ scope.row[item.prop] }} + + {{ scope.row[item.prop] }} + + + {{scope.row[item.prop]}} + + + {{ + knowledgeBaseSource.find(s => s.value === $_.get(scope.row.ruleConfigObj, 'knowledgeBase.source')) && + knowledgeBaseSource.find(s => s.value === $_.get(scope.row.ruleConfigObj, 'knowledgeBase.source')).name + }} + {{colorText($_.get(scope.row.ruleConfigObj, 'knowledgeBase.color'))}} + + + + {{$_.get(scope.row.ruleConfigObj, 'knowledgeBase.description')}} + + {{$t('tip.noDescription')}} + + + + {{ scope.row[item.prop] || '-' }} @@ -83,7 +112,7 @@ import table from '@/mixins/table' import { dateFormatByAppearance } from '@/utils/date-util' import { switchStatus } from '@/utils/tools' import _ from 'lodash' -import { detectionUnitList } from '@/utils/constants' +import { detectionUnitList, knowledgeBaseSource, knowledgeBaseColor } from '@/utils/constants' import { useRoute } from 'vue-router' export default { @@ -100,6 +129,8 @@ export default { mixins: [table], data () { return { + knowledgeBaseColor, + knowledgeBaseSource, tableTitle: [ { label: this.$t('knowledge.status'), @@ -163,6 +194,15 @@ export default { }, 400) } }, + computed: { + colorText () { + const vm = this + return function (color) { + const t = vm.knowledgeBaseColor.find(t => t.value === color) + return t ? vm.$t(t.label) : vm.$t(vm.knowledgeBaseColor[0].label) + } + } + }, watch: { tableData: { immediate: true, diff --git a/src/views/setting/KnowledgeBaseForm.vue b/src/views/setting/KnowledgeBaseForm.vue index e4bd607c..d5db21d4 100644 --- a/src/views/setting/KnowledgeBaseForm.vue +++ b/src/views/setting/KnowledgeBaseForm.vue @@ -45,7 +45,7 @@ - + {{$t(color.label)}} @@ -236,7 +236,7 @@ import { useRoute } from 'vue-router' import { nextTick, reactive, ref } from 'vue' import _ from 'lodash' -import { knowledgeBaseType, storageKey, unitTypes, knowledgeSourceValue, itemListHeight, knowledgeCategoryValue } from '@/utils/constants' +import { knowledgeBaseType, storageKey, unitTypes, knowledgeSourceValue, itemListHeight, knowledgeCategoryValue, knowledgeBaseColor } from '@/utils/constants' import Pagination from '@/components/common/Pagination' import ChartNoData from '@/views/charts/charts/ChartNoData' import axios from 'axios' @@ -515,23 +515,7 @@ export default { status: 1, oldItemIds: [], oldTagItem: {}, - knowledgeBaseColor: [ - { - label: this.$t('knowledge.info'), - value: 'rgb(119,131,145)', - name: 'info' - }, - { - label: this.$t('knowledge.benign'), - value: 'rgb(116,159,77)', - name: 'benign' - }, - { - label: this.$t('knowledge.malicious'), - value: 'rgb(226,97,84)', - name: 'malicious' - } - ] + knowledgeBaseColor } }, methods: {