Skip to content

Commit

Permalink
[8.18] [Security Solution][threat hunting explore] EUI refresh: Remov…
Browse files Browse the repository at this point in the history
…e custom color hex (#204631) (#210566)

# Backport

This will backport the following commits from `main` to `8.18`:
- [[Security Solution][threat hunting explore] EUI refresh: Remove
custom color hex
(#204631)](#204631)

<!--- Backport version: 9.6.4 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Angela
Chuang","email":"6295984+angorayc@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-01-09T12:46:55Z","message":"[Security
Solution][threat hunting explore] EUI refresh: Remove custom color hex
(#204631)\n\n##
Summary\r\n\r\nhttps://github.com//issues/202498\r\nhttps://github.com//issues/202503\r\n\r\n1.
This PR does **Not** include the severity color change. It will
be\r\nimplemented in a follow up PR once color tokens have been
decided.\r\n2. This PR updates the type `GetLensAttributes` to accept
`euiTheme`, so\r\nall the functions in this type are updated
accordingly.\r\n\r\nhttps://github.com//pull/204631/files#diff-abe20658865cad59eadcff945552b40832d96da0264ed89ddd5ab25ded1420a3R30\r\n\r\n----\r\n\r\n##
To test:\r\n\r\nPlease verify if visualizations are displayed
properly.\r\n\r\n### Running Kibana with the Borealis theme\r\nIn order
to run Kibana with `Borealis`, you'll need to do the
following:\r\n\r\n1. Set the following in
kibana.dev.yml:\r\n`uiSettings.experimental.themeSwitcherEnabled:
true`\r\n4. Run Kibana with the following environment variable set:
\r\n```KBN_OPTIMIZER_THEMES=\"borealislight,borealisdark,v8light,v8dark\"
yarn start```\r\n\r\n5. This will expose a toggle under Stack Management
> Advanced Settings > Theme version, which you can use to toggle between
Amsterdam and
Borealis.\r\n\r\n\r\n![Image](https://github.com/user-attachments/assets/78d64946-43fc-4400-bbb1-229d900b7f05)\r\n\r\n----\r\n\r\n\r\n###
Explore\r\n\r\n\r\n<img width=\"2557\" alt=\"host_after\"
src=\"https://github.com/user-attachments/assets/f69b6e2a-58f6-4ed4-9f38-dcdbcf9919ed\"
/>\r\n<img width=\"1281\" alt=\"users_after\"
src=\"https://github.com/user-attachments/assets/0eec8e9c-e678-4a66-83ee-4b8d11380b8e\"
/>\r\n<img width=\"2552\" alt=\"network_dns\"
src=\"https://github.com/user-attachments/assets/19f06d2a-6e51-419b-9f89-233bfa5727ba\"
/>\r\n<img width=\"2557\" alt=\"network_after\"
src=\"https://github.com/user-attachments/assets/3b90c5e2-23a1-4f15-a2d0-f9290a39af30\"
/>\r\n\r\n----\r\n\r\n### Dashboards\r\n\r\n<img width=\"2557\"
alt=\"dashboard_overview\"
src=\"https://github.com/user-attachments/assets/c1873359-fee9-42c6-addd-fe2bc1c98aee\"
/>\r\n<img width=\"2558\" alt=\"dashboard_detection_response_2\"
src=\"https://github.com/user-attachments/assets/f6853710-0938-402b-b326-fa00d586b5d6\"
/>\r\n<img width=\"2559\" alt=\"dashboard_detection_response_1\"
src=\"https://github.com/user-attachments/assets/4eb75526-9a57-46e9-b090-b53353956ea1\"
/>\r\n\r\n----\r\n\r\n\r\n### Alerts\r\n<img width=\"2555\"
alt=\"alerts_chart_collapsed\"
src=\"https://github.com/user-attachments/assets/6ecf5dd5-a785-4701-900b-0454f024b36d\"
/>\r\n<img width=\"2554\" alt=\"summary\"
src=\"https://github.com/user-attachments/assets/1731a6ea-ef2b-4d7d-bf21-4041e59f0ad4\"
/>\r\n<img width=\"2559\" alt=\"trend\"
src=\"https://github.com/user-attachments/assets/b9a741d1-a359-4273-9555-850cdcbc8932\"
/>\r\n<img width=\"2557\" alt=\"counts\"
src=\"https://github.com/user-attachments/assets/a6193ccc-86b8-4974-ad9f-9417e200e859\"
/>\r\n<img width=\"1281\" alt=\"treemap\"
src=\"https://github.com/user-attachments/assets/7b6e163a-a660-4bb1-a6de-88e21934b98a\"
/>\r\n\r\n----\r\n\r\n### Rules preview\r\n<img width=\"2556\"
alt=\"Screenshot 2024-12-18 at 13 45 33\"
src=\"https://github.com/user-attachments/assets/47099c18-86ee-455a-a5af-ebd6a29904a5\"
/>\r\n\r\n\r\n----\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"78dfe5f81e8307aea2233a109401489828840b85","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:skip","v9.0.0","ci:cloud-deploy","EUI
Visual Refresh"],"title":"[Security Solution][threat hunting explore]
EUI refresh: Remove custom color
hex","number":204631,"url":"https://github.com/elastic/kibana/pull/204631","mergeCommit":{"message":"[Security
Solution][threat hunting explore] EUI refresh: Remove custom color hex
(#204631)\n\n##
Summary\r\n\r\nhttps://github.com//issues/202498\r\nhttps://github.com//issues/202503\r\n\r\n1.
This PR does **Not** include the severity color change. It will
be\r\nimplemented in a follow up PR once color tokens have been
decided.\r\n2. This PR updates the type `GetLensAttributes` to accept
`euiTheme`, so\r\nall the functions in this type are updated
accordingly.\r\n\r\nhttps://github.com//pull/204631/files#diff-abe20658865cad59eadcff945552b40832d96da0264ed89ddd5ab25ded1420a3R30\r\n\r\n----\r\n\r\n##
To test:\r\n\r\nPlease verify if visualizations are displayed
properly.\r\n\r\n### Running Kibana with the Borealis theme\r\nIn order
to run Kibana with `Borealis`, you'll need to do the
following:\r\n\r\n1. Set the following in
kibana.dev.yml:\r\n`uiSettings.experimental.themeSwitcherEnabled:
true`\r\n4. Run Kibana with the following environment variable set:
\r\n```KBN_OPTIMIZER_THEMES=\"borealislight,borealisdark,v8light,v8dark\"
yarn start```\r\n\r\n5. This will expose a toggle under Stack Management
> Advanced Settings > Theme version, which you can use to toggle between
Amsterdam and
Borealis.\r\n\r\n\r\n![Image](https://github.com/user-attachments/assets/78d64946-43fc-4400-bbb1-229d900b7f05)\r\n\r\n----\r\n\r\n\r\n###
Explore\r\n\r\n\r\n<img width=\"2557\" alt=\"host_after\"
src=\"https://github.com/user-attachments/assets/f69b6e2a-58f6-4ed4-9f38-dcdbcf9919ed\"
/>\r\n<img width=\"1281\" alt=\"users_after\"
src=\"https://github.com/user-attachments/assets/0eec8e9c-e678-4a66-83ee-4b8d11380b8e\"
/>\r\n<img width=\"2552\" alt=\"network_dns\"
src=\"https://github.com/user-attachments/assets/19f06d2a-6e51-419b-9f89-233bfa5727ba\"
/>\r\n<img width=\"2557\" alt=\"network_after\"
src=\"https://github.com/user-attachments/assets/3b90c5e2-23a1-4f15-a2d0-f9290a39af30\"
/>\r\n\r\n----\r\n\r\n### Dashboards\r\n\r\n<img width=\"2557\"
alt=\"dashboard_overview\"
src=\"https://github.com/user-attachments/assets/c1873359-fee9-42c6-addd-fe2bc1c98aee\"
/>\r\n<img width=\"2558\" alt=\"dashboard_detection_response_2\"
src=\"https://github.com/user-attachments/assets/f6853710-0938-402b-b326-fa00d586b5d6\"
/>\r\n<img width=\"2559\" alt=\"dashboard_detection_response_1\"
src=\"https://github.com/user-attachments/assets/4eb75526-9a57-46e9-b090-b53353956ea1\"
/>\r\n\r\n----\r\n\r\n\r\n### Alerts\r\n<img width=\"2555\"
alt=\"alerts_chart_collapsed\"
src=\"https://github.com/user-attachments/assets/6ecf5dd5-a785-4701-900b-0454f024b36d\"
/>\r\n<img width=\"2554\" alt=\"summary\"
src=\"https://github.com/user-attachments/assets/1731a6ea-ef2b-4d7d-bf21-4041e59f0ad4\"
/>\r\n<img width=\"2559\" alt=\"trend\"
src=\"https://github.com/user-attachments/assets/b9a741d1-a359-4273-9555-850cdcbc8932\"
/>\r\n<img width=\"2557\" alt=\"counts\"
src=\"https://github.com/user-attachments/assets/a6193ccc-86b8-4974-ad9f-9417e200e859\"
/>\r\n<img width=\"1281\" alt=\"treemap\"
src=\"https://github.com/user-attachments/assets/7b6e163a-a660-4bb1-a6de-88e21934b98a\"
/>\r\n\r\n----\r\n\r\n### Rules preview\r\n<img width=\"2556\"
alt=\"Screenshot 2024-12-18 at 13 45 33\"
src=\"https://github.com/user-attachments/assets/47099c18-86ee-455a-a5af-ebd6a29904a5\"
/>\r\n\r\n\r\n----\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"78dfe5f81e8307aea2233a109401489828840b85"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/204631","number":204631,"mergeCommit":{"message":"[Security
Solution][threat hunting explore] EUI refresh: Remove custom color hex
(#204631)\n\n##
Summary\r\n\r\nhttps://github.com//issues/202498\r\nhttps://github.com//issues/202503\r\n\r\n1.
This PR does **Not** include the severity color change. It will
be\r\nimplemented in a follow up PR once color tokens have been
decided.\r\n2. This PR updates the type `GetLensAttributes` to accept
`euiTheme`, so\r\nall the functions in this type are updated
accordingly.\r\n\r\nhttps://github.com//pull/204631/files#diff-abe20658865cad59eadcff945552b40832d96da0264ed89ddd5ab25ded1420a3R30\r\n\r\n----\r\n\r\n##
To test:\r\n\r\nPlease verify if visualizations are displayed
properly.\r\n\r\n### Running Kibana with the Borealis theme\r\nIn order
to run Kibana with `Borealis`, you'll need to do the
following:\r\n\r\n1. Set the following in
kibana.dev.yml:\r\n`uiSettings.experimental.themeSwitcherEnabled:
true`\r\n4. Run Kibana with the following environment variable set:
\r\n```KBN_OPTIMIZER_THEMES=\"borealislight,borealisdark,v8light,v8dark\"
yarn start```\r\n\r\n5. This will expose a toggle under Stack Management
> Advanced Settings > Theme version, which you can use to toggle between
Amsterdam and
Borealis.\r\n\r\n\r\n![Image](https://github.com/user-attachments/assets/78d64946-43fc-4400-bbb1-229d900b7f05)\r\n\r\n----\r\n\r\n\r\n###
Explore\r\n\r\n\r\n<img width=\"2557\" alt=\"host_after\"
src=\"https://github.com/user-attachments/assets/f69b6e2a-58f6-4ed4-9f38-dcdbcf9919ed\"
/>\r\n<img width=\"1281\" alt=\"users_after\"
src=\"https://github.com/user-attachments/assets/0eec8e9c-e678-4a66-83ee-4b8d11380b8e\"
/>\r\n<img width=\"2552\" alt=\"network_dns\"
src=\"https://github.com/user-attachments/assets/19f06d2a-6e51-419b-9f89-233bfa5727ba\"
/>\r\n<img width=\"2557\" alt=\"network_after\"
src=\"https://github.com/user-attachments/assets/3b90c5e2-23a1-4f15-a2d0-f9290a39af30\"
/>\r\n\r\n----\r\n\r\n### Dashboards\r\n\r\n<img width=\"2557\"
alt=\"dashboard_overview\"
src=\"https://github.com/user-attachments/assets/c1873359-fee9-42c6-addd-fe2bc1c98aee\"
/>\r\n<img width=\"2558\" alt=\"dashboard_detection_response_2\"
src=\"https://github.com/user-attachments/assets/f6853710-0938-402b-b326-fa00d586b5d6\"
/>\r\n<img width=\"2559\" alt=\"dashboard_detection_response_1\"
src=\"https://github.com/user-attachments/assets/4eb75526-9a57-46e9-b090-b53353956ea1\"
/>\r\n\r\n----\r\n\r\n\r\n### Alerts\r\n<img width=\"2555\"
alt=\"alerts_chart_collapsed\"
src=\"https://github.com/user-attachments/assets/6ecf5dd5-a785-4701-900b-0454f024b36d\"
/>\r\n<img width=\"2554\" alt=\"summary\"
src=\"https://github.com/user-attachments/assets/1731a6ea-ef2b-4d7d-bf21-4041e59f0ad4\"
/>\r\n<img width=\"2559\" alt=\"trend\"
src=\"https://github.com/user-attachments/assets/b9a741d1-a359-4273-9555-850cdcbc8932\"
/>\r\n<img width=\"2557\" alt=\"counts\"
src=\"https://github.com/user-attachments/assets/a6193ccc-86b8-4974-ad9f-9417e200e859\"
/>\r\n<img width=\"1281\" alt=\"treemap\"
src=\"https://github.com/user-attachments/assets/7b6e163a-a660-4bb1-a6de-88e21934b98a\"
/>\r\n\r\n----\r\n\r\n### Rules preview\r\n<img width=\"2556\"
alt=\"Screenshot 2024-12-18 at 13 45 33\"
src=\"https://github.com/user-attachments/assets/47099c18-86ee-455a-a5af-ebd6a29904a5\"
/>\r\n\r\n\r\n----\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"78dfe5f81e8307aea2233a109401489828840b85"}}]}]
BACKPORT-->
  • Loading branch information
angorayc authored Feb 13, 2025
1 parent 47fc438 commit 224f945
Show file tree
Hide file tree
Showing 70 changed files with 1,824 additions and 1,657 deletions.
1 change: 0 additions & 1 deletion packages/kbn-babel-preset/styled_components_files.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,6 @@ describe.each(chartDataSets)('BarChart with stackByField', () => {
},
];

const expectedColors = ['#1EA593', '#2B70F7', '#CE0060'];

const stackByField = 'process.name';

beforeAll(() => {
Expand All @@ -369,12 +367,6 @@ describe.each(chartDataSets)('BarChart with stackByField', () => {
expect(wrapper.find('[data-test-subj="draggable-legend"]').exists()).toBe(true);
});

expectedColors.forEach((color, i) => {
test(`it renders the expected legend color ${color} for legend item ${i}`, () => {
expect(wrapper.find(`div [color="${color}"]`).exists()).toBe(true);
});
});

data.forEach((datum) => {
test(`it renders the expected draggable legend text for datum ${datum.key}`, () => {
const dataProviderId = `draggableId.content.draggable-legend-item-uuid_v4()-${escapeDataProviderId(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import deepEqual from 'fast-deep-equal';

import { escapeDataProviderId } from '../drag_and_drop/helpers';
import { useTimeZone } from '../../lib/kibana';
import { defaultLegendColors } from '../matrix_histogram/utils';
import { useThrottledResizeObserver } from '../utils';
import { hasValueToDisplay } from '../../utils/validators';
import { EMPTY_VALUE_LABEL } from './translation';
Expand Down Expand Up @@ -192,8 +191,8 @@ export const BarChartComponent: React.FC<BarChartComponentProps> = ({
const legendItems: LegendItem[] = useMemo(
() =>
barChart != null && stackByField != null
? barChart.map((d, i) => ({
color: d.color ?? (i < defaultLegendColors.length ? defaultLegendColors[i] : undefined),
? barChart.map((d) => ({
color: d.color,
dataProviderId: escapeDataProviderId(
`draggable-legend-item-${uuidv4()}-${stackByField}-${d.key}`
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,54 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import type { EuiThemeComputed } from '@elastic/eui';
import { useEuiTheme } from '@elastic/eui';
import { css } from '@emotion/react';
import React from 'react';
import styled from 'styled-components';
import { useEuiBackgroundColor } from '@elastic/eui';

interface DonutChartEmptyProps {
size?: number;
donutWidth?: number;
}

/*
** @deprecated use getEmptyDonutColor instead
*/
export const emptyDonutColor = '#FAFBFD';

const BigRing = styled.div<DonutChartEmptyProps>`
border-radius: 50%;
${({ size }) =>
`height: ${size}px;
width: ${size}px;
background-color: ${emptyDonutColor};
text-align: center;
line-height: ${size}px;`}
`;

const SmallRing = styled.div<DonutChartEmptyProps>`
border-radius: 50%;
${({ size }) => `
height: ${size}px;
width: ${size}px;
background-color: ${useEuiBackgroundColor('plain')};
display: inline-block;
vertical-align: middle;`}
`;
export const getEmptyDonutColor = (euiTheme: EuiThemeComputed) => euiTheme.colors.textSubdued;

const EmptyDonutChartComponent: React.FC<DonutChartEmptyProps> = ({ size = 90, donutWidth = 20 }) =>
size - donutWidth > 0 ? (
<BigRing size={size} data-test-subj="empty-donut">
<SmallRing size={size - donutWidth} data-test-subj="empty-donut-small" />
</BigRing>
const EmptyDonutChartComponent: React.FC<DonutChartEmptyProps> = ({
size = 90,
donutWidth = 20,
}) => {
const { euiTheme } = useEuiTheme();
const middleSize = size - donutWidth;
return size - donutWidth > 0 ? (
<div
data-test-subj="empty-donut"
css={css`
border-radius: 50%;
height: ${size}px;
width: ${size}px;
background-color: ${euiTheme.colors.backgroundBaseSubdued};
text-align: center;
line-height: ${size}px;
`}
>
<div
data-test-subj="empty-donut-small"
css={css`
border-radius: 50%;
height: ${middleSize}px;
width: ${middleSize}px;
background-color: ${euiTheme.colors.backgroundBasePlain};
display: inline-block;
vertical-align: middle;
`}
/>
</div>
) : null;
};

export const DonutChartEmpty = React.memo(EmptyDonutChartComponent);

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ import { useLensAttributes } from '../../../use_lens_attributes';
import { getAlertsByStatusAttributes } from './alerts_by_status_donut';

jest.mock('uuid', () => ({
v4: jest.fn().mockReturnValue('b9b43606-7ff7-46ae-a47c-85bed80fab9a'),
v4: jest
.fn()
.mockReturnValueOnce('b9b43606-7ff7-46ae-a47c-85bed80fab9a')
.mockReturnValueOnce('a9b43606-7ff7-46ae-a47c-85bed80fab9a')
.mockReturnValueOnce('21cc4a49-3780-4b1a-be28-f02fa5303d24'),
}));

jest.mock('../../../../../../sourcerer/containers', () => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
import { v4 as uuidv4 } from 'uuid';
import type { GetLensAttributes } from '../../../types';
const layerId = uuidv4();
const columnSeverity = uuidv4();
const columnRecord = uuidv4();

export const getAlertsByStatusAttributes: GetLensAttributes = (
export const getAlertsByStatusAttributes: GetLensAttributes = ({
stackByField = 'kibana.alert.workflow_status',
extraOptions
) => {
extraOptions,
}) => {
return {
title: 'Alerts',
description: '',
Expand All @@ -22,8 +24,8 @@ export const getAlertsByStatusAttributes: GetLensAttributes = (
layers: [
{
layerId,
primaryGroups: ['a9b43606-7ff7-46ae-a47c-85bed80fab9a'],
metrics: ['21cc4a49-3780-4b1a-be28-f02fa5303d24'],
primaryGroups: [columnSeverity],
metrics: [columnRecord],
numberDisplay: 'value',
categoryDisplay: 'hide',
legendDisplay: 'hide',
Expand Down Expand Up @@ -69,7 +71,7 @@ export const getAlertsByStatusAttributes: GetLensAttributes = (
layers: {
[layerId]: {
columns: {
'a9b43606-7ff7-46ae-a47c-85bed80fab9a': {
[columnSeverity]: {
label: 'Filters',
dataType: 'string',
operationType: 'filters',
Expand Down Expand Up @@ -108,7 +110,7 @@ export const getAlertsByStatusAttributes: GetLensAttributes = (
],
},
},
'21cc4a49-3780-4b1a-be28-f02fa5303d24': {
[columnRecord]: {
label: 'Count of records',
dataType: 'number',
operationType: 'count',
Expand All @@ -124,10 +126,7 @@ export const getAlertsByStatusAttributes: GetLensAttributes = (
},
},
},
columnOrder: [
'a9b43606-7ff7-46ae-a47c-85bed80fab9a',
'21cc4a49-3780-4b1a-be28-f02fa5303d24',
],
columnOrder: [columnSeverity, columnRecord],
sampling: 1,
incompleteColumns: {},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ import { useLensAttributes } from '../../../use_lens_attributes';
import { getAlertsHistogramLensAttributes } from './alerts_histogram';

jest.mock('uuid', () => ({
v4: jest.fn().mockReturnValue('0039eb0c-9a1a-4687-ae54-0f4e239bec75'),
v4: jest
.fn()
.mockReturnValueOnce('0039eb0c-9a1a-4687-ae54-0f4e239bec75')
.mockReturnValueOnce('e09e0380-0740-4105-becc-0a4ca12e3944')
.mockReturnValueOnce('34919782-4546-43a5-b668-06ac934d3acd')
.mockReturnValueOnce('aac9d7d0-13a3-480a-892b-08207a787926'),
}));

jest.mock('../../../../../../sourcerer/containers', () => ({
Expand Down
Loading

0 comments on commit 224f945

Please sign in to comment.