From 24c6e234d6e27b92f6adecfff32a3ab5c3c00a89 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Wed, 3 May 2023 08:03:52 -0400 Subject: [PATCH] [8.8] [Security Solution] Fix color coding of severities is different at Entity analytics (#156383) (#156508) # Backport This will backport the following commits from `main` to `8.8`: - [[Security Solution] Fix color coding of severities is different at Entity analytics (#156383)](https://github.com/elastic/kibana/pull/156383) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Pablo Machado --- .../components/risk_score/severity/common/index.test.tsx | 9 +++++---- .../components/risk_score/severity/common/index.tsx | 9 +++++---- .../components/entity_analytics/header/index.tsx | 3 ++- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/severity/common/index.test.tsx b/x-pack/plugins/security_solution/public/explore/components/risk_score/severity/common/index.test.tsx index 5823c5a3be1591..5041d0866b16b0 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/severity/common/index.test.tsx +++ b/x-pack/plugins/security_solution/public/explore/components/risk_score/severity/common/index.test.tsx @@ -16,6 +16,7 @@ import { EuiHealth } from '@elastic/eui'; import { euiThemeVars } from '@kbn/ui-theme'; import { RiskSeverity } from '../../../../../../common/search_strategy'; import { RiskScore } from '.'; +import { SEVERITY_COLOR } from '../../../../../overview/components/detection_response/utils'; jest.mock('@elastic/eui', () => { const original = jest.requireActual('@elastic/eui'); @@ -37,7 +38,7 @@ describe('RiskScore', () => { expect(container).toHaveTextContent(RiskSeverity.critical); expect(EuiHealth as jest.Mock).toHaveBeenLastCalledWith( - expect.objectContaining({ color: euiThemeVars.euiColorDanger }), + expect.objectContaining({ color: SEVERITY_COLOR.critical }), context ); }); @@ -52,7 +53,7 @@ describe('RiskScore', () => { expect(container).toHaveTextContent(RiskSeverity.high); expect(EuiHealth as jest.Mock).toHaveBeenLastCalledWith( - expect.objectContaining({ color: euiThemeVars.euiColorVis9_behindText }), + expect.objectContaining({ color: SEVERITY_COLOR.high }), context ); }); @@ -67,7 +68,7 @@ describe('RiskScore', () => { expect(container).toHaveTextContent(RiskSeverity.moderate); expect(EuiHealth as jest.Mock).toHaveBeenLastCalledWith( - expect.objectContaining({ color: euiThemeVars.euiColorWarning }), + expect.objectContaining({ color: SEVERITY_COLOR.medium }), context ); }); @@ -82,7 +83,7 @@ describe('RiskScore', () => { expect(container).toHaveTextContent(RiskSeverity.low); expect(EuiHealth as jest.Mock).toHaveBeenLastCalledWith( - expect.objectContaining({ color: euiThemeVars.euiColorVis0 }), + expect.objectContaining({ color: SEVERITY_COLOR.low }), context ); }); diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/severity/common/index.tsx b/x-pack/plugins/security_solution/public/explore/components/risk_score/severity/common/index.tsx index d074f173b0da40..8ba146b825aaf3 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/severity/common/index.tsx +++ b/x-pack/plugins/security_solution/public/explore/components/risk_score/severity/common/index.tsx @@ -14,13 +14,14 @@ import { euiLightVars } from '@kbn/ui-theme'; import { WithHoverActions } from '../../../../../common/components/with_hover_actions'; import { RiskSeverity } from '../../../../../../common/search_strategy'; +import { SEVERITY_COLOR } from '../../../../../overview/components/detection_response/utils'; export const RISK_SEVERITY_COLOUR: { [k in RiskSeverity]: string } = { [RiskSeverity.unknown]: euiLightVars.euiColorMediumShade, - [RiskSeverity.low]: euiLightVars.euiColorVis0, - [RiskSeverity.moderate]: euiLightVars.euiColorWarning, - [RiskSeverity.high]: euiLightVars.euiColorVis9_behindText, - [RiskSeverity.critical]: euiLightVars.euiColorDanger, + [RiskSeverity.low]: SEVERITY_COLOR.low, + [RiskSeverity.moderate]: SEVERITY_COLOR.medium, + [RiskSeverity.high]: SEVERITY_COLOR.high, + [RiskSeverity.critical]: SEVERITY_COLOR.critical, }; const RiskBadge = styled.div<{ $severity: RiskSeverity; $hideBackgroundColor: boolean }>` diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/header/index.tsx b/x-pack/plugins/security_solution/public/overview/components/entity_analytics/header/index.tsx index 46d37f15a6f689..088c5851ca2902 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/header/index.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/entity_analytics/header/index.tsx @@ -32,9 +32,10 @@ import { useQueryInspector } from '../../../../common/components/page/manage_que import { ENTITY_ANALYTICS_ANOMALIES_PANEL } from '../anomalies'; import { isJobStarted } from '../../../../../common/machine_learning/helpers'; import { FormattedCount } from '../../../../common/components/formatted_number'; +import { SEVERITY_COLOR } from '../../detection_response/utils'; const StyledEuiTitle = styled(EuiTitle)` - color: ${({ theme: { eui } }) => eui.euiColorDanger}; + color: ${({ theme: { eui } }) => SEVERITY_COLOR.critical}; `; const HOST_RISK_QUERY_ID = 'hostRiskScoreKpiQuery';