From 0f26c965bf2af848ea71d3908df508241afcc01c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B4=AA=E6=B4=AA?= <2498601771@qq.com> Date: Mon, 12 Aug 2024 18:31:19 +0800 Subject: [PATCH] =?UTF-8?q?CN-1676=20fix:=201=E3=80=81=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E4=B8=BAindicator=E6=97=B6=E4=B8=8B=E6=8B=89=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E7=9A=84=E5=AD=97=E6=AE=B5=E5=90=8D=E6=9B=B4=E6=94=B9=EF=BC=9B?= =?UTF-8?q?2=E3=80=81=E7=B1=BB=E5=9E=8B=E4=B8=BAthreshold=E6=97=B6?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E8=AF=A6=E6=83=85=EF=BC=8C=E6=8A=98=E7=BA=BF?= =?UTF-8?q?=E5=9B=BE=E9=A2=9C=E8=89=B2=E5=9B=A0severity=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=8F=98=E5=8A=A8=E8=80=8C=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/detections/options/detectionOptions.js | 12 ++++++++++++ .../detections/overview/IndicatorMatchOverview.vue | 12 ++++++------ .../detections/overview/detectionDetailMixin.js | 4 ++-- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/views/detections/options/detectionOptions.js b/src/views/detections/options/detectionOptions.js index be2bbcbf..ea7be2e5 100644 --- a/src/views/detections/options/detectionOptions.js +++ b/src/views/detections/options/detectionOptions.js @@ -41,12 +41,24 @@ const severityColorMappings = [ { value: 'low', color: '#ffdd4a' }, { value: 'info', color: '#d7c668' } ] +const severityNumberColorMappings = [ + { value: 5, color: '#d84c4c' }, + { value: 4, color: '#ff9a79' }, + { value: 3, color: '#ffb65a' }, + { value: 2, color: '#ffdd4a' }, + { value: 1, color: '#d7c668' } +] export function getSeverityColor (type) { const mapping = severityColorMappings.find(m => m.value === type) return mapping && mapping.color ? _.cloneDeep(mapping.color) : null } +export function getSeverityNumberColor (type) { + const mapping = severityNumberColorMappings.find(m => m.value === type) + return mapping && mapping.color ? _.cloneDeep(mapping.color) : null +} + export const multipleBarOption = { legend: { icon: 'circle', diff --git a/src/views/detections/overview/IndicatorMatchOverview.vue b/src/views/detections/overview/IndicatorMatchOverview.vue index 8a8baaa4..e9e41638 100644 --- a/src/views/detections/overview/IndicatorMatchOverview.vue +++ b/src/views/detections/overview/IndicatorMatchOverview.vue @@ -30,10 +30,10 @@
{{ $t('npm.clientLocation') }}
- - + +
- {{ myDetection.client_country_region || '-' }}, {{ myDetection.client_super_admin_area || '-' }} + {{ myDetection.clientCountryRegion || '-' }}, {{ myDetection.clientSuperAdminArea || '-' }}
@@ -44,10 +44,10 @@
{{ $t('detection.detail.serverLocation') }}
- - + +
- {{ myDetection.server_country_region || '-' }}, {{ myDetection.server_super_admin_area || '-' }} + {{ myDetection.serverCountryRegion || '-' }}, {{ myDetection.serverSuperAdminArea || '-' }}
diff --git a/src/views/detections/overview/detectionDetailMixin.js b/src/views/detections/overview/detectionDetailMixin.js index 1e555d34..aa928e4b 100644 --- a/src/views/detections/overview/detectionDetailMixin.js +++ b/src/views/detections/overview/detectionDetailMixin.js @@ -2,7 +2,7 @@ import { detectionEventType, detectionRuleType } from '@/utils/constants' import { getMillisecond, getSecond } from '@/utils/date-util' import axios from 'axios' import { api } from '@/utils/api' -import { getSeverityColor, lineOption } from '@/views/detections/options/detectionOptions' +import { getSeverityNumberColor, lineOption } from '@/views/detections/options/detectionOptions' import { markRaw } from 'vue' import * as echarts from 'echarts' @@ -73,7 +73,7 @@ export default { seriesData.push([getMillisecond(JSON.parse(item.statTime)), item.recordsNums]) }) this.lineOption.series[0].data = seriesData - this.lineOption.series[0].color = getSeverityColor(res.data.data.result[0].severity) || '#ff9a79' + this.lineOption.series[0].color = getSeverityNumberColor(res.data.data.result[0].severity) || '#ff9a79' this.seriesDataNum = seriesData.length if (this.seriesDataNum <= 1) {