From 5d2430ee5ca8aaf6ad5e8cb14cf58243285ec298 Mon Sep 17 00:00:00 2001 From: Arturo Castillo Delgado Date: Mon, 7 Jul 2025 20:12:46 +0200 Subject: [PATCH 01/14] chore: update eui packages --- package.json | 4 ++-- src/dev/license_checker/config.ts | 4 ++-- yarn.lock | 27 ++++++++++++++++++--------- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 5b0804f9cf6ab..6082535f9dda0 100644 --- a/package.json +++ b/package.json @@ -127,9 +127,9 @@ "@elastic/ecs": "^8.11.5", "@elastic/elasticsearch": "9.0.3", "@elastic/ems-client": "8.6.3", - "@elastic/eui": "104.1.0", + "@elastic/eui": "105.0.0", "@elastic/eui-amsterdam": "npm:@elastic/eui@104.1.0-amsterdam.0", - "@elastic/eui-theme-borealis": "3.1.0", + "@elastic/eui-theme-borealis": "3.2.0", "@elastic/filesaver": "1.1.2", "@elastic/monaco-esql": "^3.1.5", "@elastic/node-crypto": "^1.2.3", diff --git a/src/dev/license_checker/config.ts b/src/dev/license_checker/config.ts index 78ef41377d97c..b5ea9ac761716 100644 --- a/src/dev/license_checker/config.ts +++ b/src/dev/license_checker/config.ts @@ -88,11 +88,11 @@ export const LICENSE_OVERRIDES = { 'jsts@1.6.2': ['Eclipse Distribution License - v 1.0'], // cf. https://github.com/bjornharrtell/jsts '@mapbox/jsonlint-lines-primitives@2.0.2': ['MIT'], // license in readme https://github.com/tmcw/jsonlint '@elastic/ems-client@8.6.3': ['Elastic License 2.0'], - '@elastic/eui@104.1.0': ['Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0'], + '@elastic/eui@105.0.0': ['Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0'], '@elastic/eui-amsterdam@104.1.0-amsterdam.0': [ 'Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0', ], - '@elastic/eui-theme-borealis@3.1.0': ['Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0'], + '@elastic/eui-theme-borealis@3.2.0': ['Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0'], 'language-subtag-registry@0.3.21': ['CC-BY-4.0'], // retired ODC‑By license https://github.com/mattcg/language-subtag-registry 'buffers@0.1.1': ['MIT'], // license in importing module https://www.npmjs.com/package/binary '@bufbuild/protobuf@2.5.2': ['Apache-2.0'], // license (Apache-2.0 AND BSD-3-Clause) diff --git a/yarn.lock b/yarn.lock index 35246135bd827..d38d78286e932 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2208,10 +2208,10 @@ uuid "^8.3.0" vfile "^4.2.1" -"@elastic/eui-theme-borealis@3.1.0": - version "3.1.0" - resolved "https://registry.yarnpkg.com/@elastic/eui-theme-borealis/-/eui-theme-borealis-3.1.0.tgz#548d55460e1d7339eac66ca1e6ac302bbd0b3946" - integrity sha512-TKek3OcMlUA2dmOhIm+SUHM0rTA4irltcHQl5tmlrKCdh51sxSfP+a91VSYlfQFZt8rpZaZAxKq6Z+eGHy52mQ== +"@elastic/eui-theme-borealis@3.2.0": + version "3.2.0" + resolved "https://registry.yarnpkg.com/@elastic/eui-theme-borealis/-/eui-theme-borealis-3.2.0.tgz#be8b294c8f9fbd20b46eb3f6587adb770a1c4a7f" + integrity sha512-9Sh4szzjKIOchpW8uOl+6E35OyrVFLB4e0ikW8wivxjxeHHc1QVQSCVwFoU1Lfh9wFNVRVw3P1qdMVEnrjKetg== "@elastic/eui-theme-common@2.1.0": version "2.1.0" @@ -2222,12 +2222,21 @@ chroma-js "^2.4.2" lodash "^4.17.21" -"@elastic/eui@104.1.0": - version "104.1.0" - resolved "https://registry.yarnpkg.com/@elastic/eui/-/eui-104.1.0.tgz#59a2468d24bf0c9d5449750d2f623a44363cb15a" - integrity sha512-exxfm7aOPO1iJD7F7QKZROghFjJh0AuvaV65rR/evNEv52QxbF7zvpGmeQZiUC0fSlAhLbDGPoTbjzPjYTWDIg== +"@elastic/eui-theme-common@2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@elastic/eui-theme-common/-/eui-theme-common-2.2.0.tgz#d46d0f4f557fe573902ef72b1a69f94acdee0b7f" + integrity sha512-8IUs6foUaUs3LrR7ocveUCnm2WpWX3Nu5ivoXaB6HccNWN7g2JujmTgTle/vP+IbQFXEZ/EXvi763hEdf164VA== dependencies: - "@elastic/eui-theme-common" "2.1.0" + "@types/lodash" "^4.14.202" + chroma-js "^2.4.2" + lodash "^4.17.21" + +"@elastic/eui@105.0.0": + version "105.0.0" + resolved "https://registry.yarnpkg.com/@elastic/eui/-/eui-105.0.0.tgz#db199d09172095ba7b4696178ed5084321000149" + integrity sha512-iPSwfQxmF5sDj9c2iWuewdaYaibz0o/DUtzjNg7jTVrjnhcwCKeHUVkPpZLRUrhPmt8x+MwtKHSWo9J9/SRLtA== + dependencies: + "@elastic/eui-theme-common" "2.2.0" "@elastic/prismjs-esql" "^1.1.0" "@hello-pangea/dnd" "^16.6.0" "@types/lodash" "^4.14.202" From e39d7850a40ae2e37ed90b4f712740831f96879f Mon Sep 17 00:00:00 2001 From: Arturo Castillo Delgado Date: Tue, 8 Jul 2025 14:45:14 +0200 Subject: [PATCH 02/14] chore: update amsterdam package --- package.json | 2 +- src/dev/license_checker/config.ts | 2 +- yarn.lock | 19 +++++-------------- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 6082535f9dda0..8b26d74f4bc38 100644 --- a/package.json +++ b/package.json @@ -128,7 +128,7 @@ "@elastic/elasticsearch": "9.0.3", "@elastic/ems-client": "8.6.3", "@elastic/eui": "105.0.0", - "@elastic/eui-amsterdam": "npm:@elastic/eui@104.1.0-amsterdam.0", + "@elastic/eui-amsterdam": "npm:@elastic/eui@105.0.0-amsterdam.0", "@elastic/eui-theme-borealis": "3.2.0", "@elastic/filesaver": "1.1.2", "@elastic/monaco-esql": "^3.1.5", diff --git a/src/dev/license_checker/config.ts b/src/dev/license_checker/config.ts index b5ea9ac761716..e2e30a26d49fb 100644 --- a/src/dev/license_checker/config.ts +++ b/src/dev/license_checker/config.ts @@ -89,7 +89,7 @@ export const LICENSE_OVERRIDES = { '@mapbox/jsonlint-lines-primitives@2.0.2': ['MIT'], // license in readme https://github.com/tmcw/jsonlint '@elastic/ems-client@8.6.3': ['Elastic License 2.0'], '@elastic/eui@105.0.0': ['Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0'], - '@elastic/eui-amsterdam@104.1.0-amsterdam.0': [ + '@elastic/eui-amsterdam@105.0.0-amsterdam.0': [ 'Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0', ], '@elastic/eui-theme-borealis@3.2.0': ['Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0'], diff --git a/yarn.lock b/yarn.lock index d38d78286e932..718508b052aaf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2167,12 +2167,12 @@ resolved "https://registry.yarnpkg.com/@elastic/eslint-plugin-eui/-/eslint-plugin-eui-2.0.0.tgz#dba9f302c3a611440c88d7c34371a86e6f2285ae" integrity sha512-AIhCyMfRNz80CdKZEllVW4VgqfXQgv3wE875lt228MAmwd3tAwNh0mROp8++kWb0WJoLAYW4vypw873AMWqyEw== -"@elastic/eui-amsterdam@npm:@elastic/eui@104.1.0-amsterdam.0": - version "104.1.0-amsterdam.0" - resolved "https://registry.yarnpkg.com/@elastic/eui/-/eui-104.1.0-amsterdam.0.tgz#f33bebccc49bc45741bafe21339d11cdca6a6ff9" - integrity sha512-o4yeyJnk5qaS61E781MQcgaCdc0ZB64fg08Ml2mTfnmKG/ekznSXpGdq2lAtNcfXDtdT0qDu2+A9yMSMPIlS6A== +"@elastic/eui-amsterdam@npm:@elastic/eui@105.0.0-amsterdam.0": + version "105.0.0-amsterdam.0" + resolved "https://registry.yarnpkg.com/@elastic/eui/-/eui-105.0.0-amsterdam.0.tgz#acbabca4f50e42ac4679fe797703e7b7d2a27709" + integrity sha512-QH9x02EH+pPC8gZjcrIgfNPjfEvdfu0zjkici56eLsptLugDsu2k6toyYAp8c3dimNLfLwjS0mWODbAvSLUeTQ== dependencies: - "@elastic/eui-theme-common" "2.1.0" + "@elastic/eui-theme-common" "2.2.0" "@elastic/prismjs-esql" "^1.1.0" "@hello-pangea/dnd" "^16.6.0" "@types/lodash" "^4.14.202" @@ -2213,15 +2213,6 @@ resolved "https://registry.yarnpkg.com/@elastic/eui-theme-borealis/-/eui-theme-borealis-3.2.0.tgz#be8b294c8f9fbd20b46eb3f6587adb770a1c4a7f" integrity sha512-9Sh4szzjKIOchpW8uOl+6E35OyrVFLB4e0ikW8wivxjxeHHc1QVQSCVwFoU1Lfh9wFNVRVw3P1qdMVEnrjKetg== -"@elastic/eui-theme-common@2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@elastic/eui-theme-common/-/eui-theme-common-2.1.0.tgz#e48807a867e987543de14af0d6c3d99f57da5c2e" - integrity sha512-cKLuflczikSoUQkFViLjv9NBCoti/b8UNc6+sEDK7uuAgA5aYX5jUqH1x4A5dwZ3dBed0ekz23pL5Hv+C65bxQ== - dependencies: - "@types/lodash" "^4.14.202" - chroma-js "^2.4.2" - lodash "^4.17.21" - "@elastic/eui-theme-common@2.2.0": version "2.2.0" resolved "https://registry.yarnpkg.com/@elastic/eui-theme-common/-/eui-theme-common-2.2.0.tgz#d46d0f4f557fe573902ef72b1a69f94acdee0b7f" From 5635608bdd3b77852609b74a2fae2b90f616e8ef Mon Sep 17 00:00:00 2001 From: Arturo Castillo Delgado Date: Thu, 10 Jul 2025 14:09:00 +0200 Subject: [PATCH 03/14] [Security Solution] Update jest test to handle EuiProgress markup --- .../alerts_progress_bar_row.test.tsx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/x-pack/solutions/security/plugins/security_solution/public/detections/components/alerts_kpis/alerts_progress_bar_panel/alerts_progress_bar_row.test.tsx b/x-pack/solutions/security/plugins/security_solution/public/detections/components/alerts_kpis/alerts_progress_bar_panel/alerts_progress_bar_row.test.tsx index aa061b1e5e077..9ac1c0ec238c1 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/detections/components/alerts_kpis/alerts_progress_bar_panel/alerts_progress_bar_row.test.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/detections/components/alerts_kpis/alerts_progress_bar_panel/alerts_progress_bar_row.test.tsx @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { render } from '@testing-library/react'; +import { render, within } from '@testing-library/react'; import React from 'react'; import { ProgressBarRow } from './alerts_progress_bar_row'; import type { AlertsProgressBarData } from './types'; @@ -19,10 +19,12 @@ describe('ProgressBarRow', () => { label: 'label', }; - const { getByText } = render(); + const { container } = render(); + // target only the visible label/value, skip the one for screen readers + const data = within(container.querySelector('.euiProgress__data')!); - expect(getByText('percentageLabel')).toBeInTheDocument(); - expect(getByText('label')).toBeInTheDocument(); + expect(data.getByText('percentageLabel')).toBeInTheDocument(); + expect(data.getByText('label')).toBeInTheDocument(); }); it('should render key value when key is not Other', () => { @@ -34,9 +36,11 @@ describe('ProgressBarRow', () => { label: 'label', }; - const { getByText } = render(); + const { container } = render(); + // target only the visible label/value, skip the one for screen readers + const data = within(container.querySelector('.euiProgress__data')!); - expect(getByText('percentageLabel')).toBeInTheDocument(); - expect(getByText('key')).toBeInTheDocument(); + expect(data.getByText('percentageLabel')).toBeInTheDocument(); + expect(data.getByText('key')).toBeInTheDocument(); }); }); From ac942de9172b86a826f5e809c22f79ff0c858f60 Mon Sep 17 00:00:00 2001 From: Arturo Castillo Delgado Date: Thu, 10 Jul 2025 14:53:21 +0200 Subject: [PATCH 04/14] [UnifiedFieldList] Update jest test after EuiProgress changes The markup now includes screen reader-only output, see https://github.com/elastic/eui/pull/8839 --- .../src/components/field_stats/field_stats.test.tsx | 8 +++++--- .../components/field_stats/field_top_values.test.tsx | 10 +++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_stats.test.tsx b/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_stats.test.tsx index beb0e1f05e1b8..55a5cadf3835d 100644 --- a/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_stats.test.tsx +++ b/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_stats.test.tsx @@ -434,7 +434,8 @@ describe('UnifiedFieldList FieldStats', () => { ); expect(wrapper.text()).toBe( - 'Top values"success"41.5%"info"37.1%"security"10.1%"warning"5.0%"error"3.4%"login"2.7%Calculated from 1624 records.' + // eslint-disable-next-line prettier/prettier + 'Top values\"success\"41.5%0.41533251231527096\"info\"37.1%0.3713054187192118\"security\"10.1%0.10129310344827586\"warning\"5.0%0.050492610837438424\"error\"3.4%0.03417487684729064\"login\"2.7%0.027401477832512317Calculated from 1624 records.' ); }); @@ -507,7 +508,8 @@ describe('UnifiedFieldList FieldStats', () => { expect(loadFieldStats).toHaveBeenCalledTimes(1); expect(wrapper.text()).toBe( - 'Examples"success"41.5%"info"37.1%"security"10.1%"warning"5.0%"error"3.4%"login"2.7%Calculated from 1624 records.' + // eslint-disable-next-line prettier/prettier + 'Examples\"success\"41.5%0.41533251231527096\"info\"37.1%0.3713054187192118\"security\"10.1%0.10129310344827586\"warning\"5.0%0.050492610837438424\"error\"3.4%0.03417487684729064\"login\"2.7%0.027401477832512317Calculated from 1624 records.' ); }); @@ -695,7 +697,7 @@ describe('UnifiedFieldList FieldStats', () => { expect(loadFieldStats).toHaveBeenCalledTimes(1); expect(wrapper.text()).toBe( - 'Toggle either theTop valuesDistribution1273.9%1326.1%Calculated from 23 sample records.' + 'Toggle either theTop valuesDistribution1273.9%0.73913043478260861326.1%0.2608695652173913Calculated from 23 sample records.' ); }); diff --git a/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_top_values.test.tsx b/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_top_values.test.tsx index edb38d4610864..b6f624afdd3ba 100644 --- a/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_top_values.test.tsx +++ b/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_top_values.test.tsx @@ -67,7 +67,7 @@ describe('UnifiedFieldList ', () => { it('should render correctly without filter actions', async () => { const wrapper = mountWithIntl(); - expect(wrapper.text()).toBe('sourceA10.0%sourceB0.0%Other90.0%'); + expect(wrapper.text()).toBe('sourceA10.0%0.1sourceB0.0%0.0002Other90.0%0.8998'); expect(wrapper.find(EuiProgress)).toHaveLength(3); expect(wrapper.find(EuiButtonIcon)).toHaveLength(0); }); @@ -76,7 +76,7 @@ describe('UnifiedFieldList ', () => { const mockAddFilter = jest.fn(); const wrapper = mountWithIntl(); - expect(wrapper.text()).toBe('sourceA10.0%sourceB0.0%Other90.0%'); + expect(wrapper.text()).toBe('sourceA10.0%0.1sourceB0.0%0.0002Other90.0%0.8998'); expect(wrapper.find(EuiProgress)).toHaveLength(3); expect(wrapper.find(EuiButtonIcon)).toHaveLength(4); @@ -106,7 +106,7 @@ describe('UnifiedFieldList ', () => { /> ); - expect(wrapper.text()).toBe('sourceA60.0%sourceB30.0%sourceC10.0%'); + expect(wrapper.text()).toBe('sourceA60.0%0.6sourceB30.0%0.3sourceC10.0%0.1'); }); it('should render correctly with empty strings', async () => { @@ -130,7 +130,7 @@ describe('UnifiedFieldList ', () => { /> ); - expect(wrapper.text()).toBe('(empty)60.0%sourceA30.0%sourceB0.4%Other9.6%'); + expect(wrapper.text()).toBe('(empty)60.0%0.6sourceA30.0%0.3sourceB0.4%0.004Other9.6%0.096'); }); it('should render correctly without floating point', async () => { @@ -146,6 +146,6 @@ describe('UnifiedFieldList ', () => { /> ); - expect(wrapper.text()).toBe('sourceA100%'); + expect(wrapper.text()).toBe('sourceA100%1'); }); }); From 99e3566ba190647d68792163902b0ca1488cf226 Mon Sep 17 00:00:00 2001 From: Arturo Castillo Delgado Date: Thu, 10 Jul 2025 14:56:35 +0200 Subject: [PATCH 05/14] [Security Solution] Update snapshots --- .../__snapshots__/index.test.tsx.snap | 200 ++++++++++++++++-- .../__snapshots__/index.test.tsx.snap | 120 +++++++++-- 2 files changed, 288 insertions(+), 32 deletions(-) diff --git a/x-pack/solutions/security/plugins/security_solution/public/overview/components/overview_host_stats/__snapshots__/index.test.tsx.snap b/x-pack/solutions/security/plugins/security_solution/public/overview/components/overview_host_stats/__snapshots__/index.test.tsx.snap index daf313db384bb..dd068f3623760 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/overview/components/overview_host_stats/__snapshots__/index.test.tsx.snap +++ b/x-pack/solutions/security/plugins/security_solution/public/overview/components/overview_host_stats/__snapshots__/index.test.tsx.snap @@ -73,8 +73,16 @@ exports[`Overview Host Stat Data rendering it renders the default OverviewHostSt
+
+ + 246351 + +
+
+ + 73847 + +
+
+ + 107307 + +
+
+ + 60015 + +
+
+ + 2003 + +
+
+ + 1200 + +
+
+ + 1979 + +
+
+ + 156714735 + +
+
+ + 39123 + +
+
+ + 39456 + +
+
+ + 39789 + +
+
+ + 39101112 + +
+
+ + 39131415 + +
+
+ + 39161718 + +
+
+ + 39202122 + +
+
+ + 568 + +
+
+ + 568 + +
+
+ + 296999 + +
+
+ + 195929 + +
+
+ + 101070 + +
+
+ + 12 + +
+
+ + 12 + +
+
+ + 70860 + +
+
+ + 999 + +
+
+ + 7777 + +
+
+ + 66 + +
+
+ + 60015 + +
+
+ + 2003 + +
+
+ + 13677323 + +
+
+ + 10277307 + +
+
+ + 16 + +
+
+ + 3400000 + +
Date: Thu, 10 Jul 2025 14:59:33 +0200 Subject: [PATCH 06/14] [Security Solution] Force click in Cypress task (not good) --- .../security_solution_cypress/cypress/tasks/rule_details.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/x-pack/test/security_solution_cypress/cypress/tasks/rule_details.ts b/x-pack/test/security_solution_cypress/cypress/tasks/rule_details.ts index aaaf37b9c5afc..bac02df097850 100644 --- a/x-pack/test/security_solution_cypress/cypress/tasks/rule_details.ts +++ b/x-pack/test/security_solution_cypress/cypress/tasks/rule_details.ts @@ -132,7 +132,9 @@ export const goToAlertsTab = () => { }; export const goToExceptionsTab = () => { - cy.get(EXCEPTIONS_TAB).click(); + // TODO if cannot fix this now, create an issue to track (see https://github.com/elastic/kibana/commit/ba084f290be949238058f261f553bb4ad6280b0b) + // eslint-disable-next-line cypress/no-force + cy.get(EXCEPTIONS_TAB).click({ force: true }); }; export const goToExecutionLogTab = () => { From bbd58aa3efb900a080cca8135cc21b8b7c344541 Mon Sep 17 00:00:00 2001 From: Arturo Castillo Delgado Date: Thu, 10 Jul 2025 22:27:59 +0200 Subject: [PATCH 07/14] [Security Solution] Update Cypress test after EuiProgress update --- .../cypress/e2e/explore/overview/overview.cy.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/explore/overview/overview.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/explore/overview/overview.cy.ts index 0248f403b6107..3ddf03b9a0293 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/explore/overview/overview.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/explore/overview/overview.cy.ts @@ -36,7 +36,7 @@ describe('Overview Page', { tags: ['@ess', '@serverless'] }, () => { expandHostStats(); HOST_STATS.forEach((stat) => { - cy.get(stat.domId).should('have.text', stat.value); + cy.get(stat.domId).should('contain.text', stat.value); }); }); @@ -44,7 +44,7 @@ describe('Overview Page', { tags: ['@ess', '@serverless'] }, () => { expandNetworkStats(); NETWORK_STATS.forEach((stat) => { - cy.get(stat.domId).should('have.text', stat.value); + cy.get(stat.domId).should('contain.text', stat.value); }); }); From e0a90cd162d351856f5ec6e5196508921f107476 Mon Sep 17 00:00:00 2001 From: Arturo Castillo Delgado Date: Thu, 10 Jul 2025 22:49:56 +0200 Subject: [PATCH 08/14] [Security Solution] Improve comment in Cypress test --- .../security_solution_cypress/cypress/tasks/rule_details.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/x-pack/test/security_solution_cypress/cypress/tasks/rule_details.ts b/x-pack/test/security_solution_cypress/cypress/tasks/rule_details.ts index bac02df097850..412bfef1f3144 100644 --- a/x-pack/test/security_solution_cypress/cypress/tasks/rule_details.ts +++ b/x-pack/test/security_solution_cypress/cypress/tasks/rule_details.ts @@ -131,8 +131,10 @@ export const goToAlertsTab = () => { cy.get(ALERTS_TAB).click(); }; +// TODO remove the `{ force: true }` option +// see https://github.com/elastic/eui/pull/8771 +// https://github.com/orgs/elastic/projects/1079/views/2?pane=issue&itemId=119405120 export const goToExceptionsTab = () => { - // TODO if cannot fix this now, create an issue to track (see https://github.com/elastic/kibana/commit/ba084f290be949238058f261f553bb4ad6280b0b) // eslint-disable-next-line cypress/no-force cy.get(EXCEPTIONS_TAB).click({ force: true }); }; From 1fbe978ccd6bee8beac2b9516278626bc882bb85 Mon Sep 17 00:00:00 2001 From: Arturo Castillo Delgado Date: Fri, 11 Jul 2025 17:22:11 +0200 Subject: [PATCH 09/14] [UnifiedFieldList] Refactor FieldTopValuesBucket to use built-in labels from EuiProgress, while keeping the interface intact, including tooltips; tests are also updated --- .../field_stats/field_stats.test.tsx | 44 ++++++-- .../field_stats/field_top_values.test.tsx | 16 ++- .../field_stats/field_top_values_bucket.tsx | 103 +++++++++--------- 3 files changed, 97 insertions(+), 66 deletions(-) diff --git a/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_stats.test.tsx b/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_stats.test.tsx index 55a5cadf3835d..c8030f1b2c401 100644 --- a/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_stats.test.tsx +++ b/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_stats.test.tsx @@ -34,6 +34,18 @@ const mockedServices = { uiSettings: coreMock.createStart().uiSettings, }; +// Similar to wrapper.text() but filtered by a selector +export const getChildrenTextBySelector = (wrapper: ReactWrapper, selector: string) => { + let text = ''; + const children = wrapper.find(selector); + + children.forEach((element) => { + text += element.text(); + }); + + return text; +}; + describe('UnifiedFieldList FieldStats', () => { let defaultProps: FieldStatsWithKbnQuery; let dataView: DataView; @@ -433,9 +445,12 @@ describe('UnifiedFieldList FieldStats', () => { 'Calculated from 1624 records.' ); - expect(wrapper.text()).toBe( - // eslint-disable-next-line prettier/prettier - 'Top values\"success\"41.5%0.41533251231527096\"info\"37.1%0.3713054187192118\"security\"10.1%0.10129310344827586\"warning\"5.0%0.050492610837438424\"error\"3.4%0.03417487684729064\"login\"2.7%0.027401477832512317Calculated from 1624 records.' + expect(wrapper.text()).toContain('Top values'); + + const text = getChildrenTextBySelector(wrapper, 'div.euiProgress__data'); + + expect(text).toBe( + '"success"41.5%"info"37.1%"security"10.1%"warning"5.0%"error"3.4%"login"2.7%' ); }); @@ -507,9 +522,16 @@ describe('UnifiedFieldList FieldStats', () => { expect(loadFieldStats).toHaveBeenCalledTimes(1); - expect(wrapper.text()).toBe( - // eslint-disable-next-line prettier/prettier - 'Examples\"success\"41.5%0.41533251231527096\"info\"37.1%0.3713054187192118\"security\"10.1%0.10129310344827586\"warning\"5.0%0.050492610837438424\"error\"3.4%0.03417487684729064\"login\"2.7%0.027401477832512317Calculated from 1624 records.' + expect(wrapper.text()).toContain('Examples'); + + const text = getChildrenTextBySelector(wrapper, 'div.euiProgress__data'); + + expect(text).toBe( + '"success"41.5%"info"37.1%"security"10.1%"warning"5.0%"error"3.4%"login"2.7%' + ); + + expect(wrapper.find('[data-test-subj="testing-statsFooter"]').first().text()).toBe( + 'Calculated from 1624 records.' ); }); @@ -696,8 +718,14 @@ describe('UnifiedFieldList FieldStats', () => { expect(loadFieldStats).toHaveBeenCalledTimes(1); - expect(wrapper.text()).toBe( - 'Toggle either theTop valuesDistribution1273.9%0.73913043478260861326.1%0.2608695652173913Calculated from 23 sample records.' + expect(wrapper.text()).toContain('Toggle either theTop valuesDistribution'); + + const text = getChildrenTextBySelector(wrapper, 'div.euiProgress__data'); + + expect(text).toBe('1273.9%1326.1%'); + + expect(wrapper.find('[data-test-subj="testing-statsFooter"]').first().text()).toBe( + 'Calculated from 23 sample records.' ); }); diff --git a/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_top_values.test.tsx b/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_top_values.test.tsx index b6f624afdd3ba..035a08ba6ed19 100644 --- a/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_top_values.test.tsx +++ b/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_top_values.test.tsx @@ -12,6 +12,7 @@ import { EuiProgress, EuiButtonIcon } from '@elastic/eui'; import { mountWithIntl } from '@kbn/test-jest-helpers'; import type { DataView } from '@kbn/data-views-plugin/common'; import { FieldTopValues, FieldTopValuesProps } from './field_top_values'; +import { getChildrenTextBySelector } from './field_stats.test'; import { fieldFormatsServiceMock } from '@kbn/field-formats-plugin/public/mocks'; import { ES_FIELD_TYPES, KBN_FIELD_TYPES } from '@kbn/field-types'; @@ -66,8 +67,9 @@ describe('UnifiedFieldList ', () => { it('should render correctly without filter actions', async () => { const wrapper = mountWithIntl(); + const text = getChildrenTextBySelector(wrapper, 'div.euiProgress__data'); - expect(wrapper.text()).toBe('sourceA10.0%0.1sourceB0.0%0.0002Other90.0%0.8998'); + expect(text).toBe('sourceA10.0%sourceB0.0%Other90.0%'); expect(wrapper.find(EuiProgress)).toHaveLength(3); expect(wrapper.find(EuiButtonIcon)).toHaveLength(0); }); @@ -75,8 +77,9 @@ describe('UnifiedFieldList ', () => { it('should render correctly with filter actions', async () => { const mockAddFilter = jest.fn(); const wrapper = mountWithIntl(); + const text = getChildrenTextBySelector(wrapper, 'div.euiProgress__data'); - expect(wrapper.text()).toBe('sourceA10.0%0.1sourceB0.0%0.0002Other90.0%0.8998'); + expect(text).toBe('sourceA10.0%sourceB0.0%Other90.0%'); expect(wrapper.find(EuiProgress)).toHaveLength(3); expect(wrapper.find(EuiButtonIcon)).toHaveLength(4); @@ -105,8 +108,9 @@ describe('UnifiedFieldList ', () => { ]} /> ); + const text = getChildrenTextBySelector(wrapper, 'div.euiProgress__data'); - expect(wrapper.text()).toBe('sourceA60.0%0.6sourceB30.0%0.3sourceC10.0%0.1'); + expect(text).toBe('sourceA60.0%sourceB30.0%sourceC10.0%'); }); it('should render correctly with empty strings', async () => { @@ -129,8 +133,9 @@ describe('UnifiedFieldList ', () => { ]} /> ); + const text = getChildrenTextBySelector(wrapper, 'div.euiProgress__data'); - expect(wrapper.text()).toBe('(empty)60.0%0.6sourceA30.0%0.3sourceB0.4%0.004Other9.6%0.096'); + expect(text).toBe('(empty)60.0%sourceA30.0%sourceB0.4%Other9.6%'); }); it('should render correctly without floating point', async () => { @@ -145,7 +150,8 @@ describe('UnifiedFieldList ', () => { ]} /> ); + const text = getChildrenTextBySelector(wrapper, 'div.euiProgress__data'); - expect(wrapper.text()).toBe('sourceA100%1'); + expect(text).toBe('sourceA100%'); }); }); diff --git a/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_top_values_bucket.tsx b/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_top_values_bucket.tsx index 64d4c75e228ce..fb6f38d05c0a0 100755 --- a/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_top_values_bucket.tsx +++ b/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_top_values_bucket.tsx @@ -99,64 +99,61 @@ const FieldTopValuesBucket: React.FC = ({ min-width: 0; `} > - - - {(formattedFieldValue?.length ?? 0) > 0 ? ( - - - - {formattedFieldValue} - - - - ) : ( - - {type === 'other' - ? i18n.translate('unifiedFieldList.fieldStats.otherDocsLabel', { - defaultMessage: 'Other', - }) - : formattedFieldValue === '' - ? i18n.translate('unifiedFieldList.fieldStats.emptyStringValueLabel', { - defaultMessage: '(empty)', - }) - : '-'} - - )} - - - - - - {formattedPercentage} - - - - + + + {formattedPercentage} + + +
+ } + label={ +
+ {(formattedFieldValue?.length ?? 0) > 0 ? ( + + + + {formattedFieldValue} + + + + ) : ( + + {type === 'other' + ? i18n.translate('unifiedFieldList.fieldStats.otherDocsLabel', { + defaultMessage: 'Other', + }) + : formattedFieldValue === '' + ? i18n.translate('unifiedFieldList.fieldStats.emptyStringValueLabel', { + defaultMessage: '(empty)', + }) + : '-'} + + )} +
+ } /> {onAddFilter && field.filterable && ( From 1b31b3a9c5421e00a094a27365fcfe42702acb74 Mon Sep 17 00:00:00 2001 From: Arturo Castillo Delgado Date: Fri, 11 Jul 2025 18:29:27 +0200 Subject: [PATCH 10/14] Remove leftover comment --- .../src/components/field_stats/field_top_values_bucket.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_top_values_bucket.tsx b/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_top_values_bucket.tsx index fb6f38d05c0a0..74f359923c3ab 100755 --- a/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_top_values_bucket.tsx +++ b/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_top_values_bucket.tsx @@ -104,7 +104,6 @@ const FieldTopValuesBucket: React.FC = ({ max={1} size="s" color={type === 'other' ? 'subdued' : color} - // aria-label={`${formattedFieldValue} (${formattedPercentage})`} valueText={
Date: Fri, 11 Jul 2025 19:28:22 +0200 Subject: [PATCH 11/14] [UnifiedFieldList] Remove title attr from label in FieldTopValuesBucket --- .../src/components/field_stats/field_top_values_bucket.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_top_values_bucket.tsx b/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_top_values_bucket.tsx index 74f359923c3ab..f23d2f29266bf 100755 --- a/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_top_values_bucket.tsx +++ b/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_top_values_bucket.tsx @@ -153,6 +153,9 @@ const FieldTopValuesBucket: React.FC = ({ )}
} + labelProps={{ + title: undefined, + }} /> {onAddFilter && field.filterable && ( From 8ceddd7f91a774592a904536d1a41201dbc1e976 Mon Sep 17 00:00:00 2001 From: Lene Gadewoll Date: Mon, 14 Jul 2025 12:13:10 +0200 Subject: [PATCH 12/14] refactor: unset truncated progress label wrapping --- .../src/components/data_table_summary_column_header.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform/packages/shared/kbn-unified-data-table/src/components/data_table_summary_column_header.tsx b/src/platform/packages/shared/kbn-unified-data-table/src/components/data_table_summary_column_header.tsx index 4523484bebe13..041c7b95b5876 100644 --- a/src/platform/packages/shared/kbn-unified-data-table/src/components/data_table_summary_column_header.tsx +++ b/src/platform/packages/shared/kbn-unified-data-table/src/components/data_table_summary_column_header.tsx @@ -54,7 +54,7 @@ export const UnifiedDataTableSummaryColumnHeader = ({ From 162a734f4aa1a5d9a638ae79e6832bee38b8d5ad Mon Sep 17 00:00:00 2001 From: Lene Gadewoll Date: Mon, 14 Jul 2025 12:13:33 +0200 Subject: [PATCH 13/14] refactor: update renamed icon --- .../src/components/field_stats/field_top_values_bucket.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_top_values_bucket.tsx b/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_top_values_bucket.tsx index f23d2f29266bf..9a057a5d760a9 100755 --- a/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_top_values_bucket.tsx +++ b/src/platform/packages/shared/kbn-unified-field-list/src/components/field_stats/field_top_values_bucket.tsx @@ -155,6 +155,9 @@ const FieldTopValuesBucket: React.FC = ({ } labelProps={{ title: undefined, + css: css` + white-space: unset !important; + `, }} /> From a569ad5d792dd357379a34f5600cb7353b381070 Mon Sep 17 00:00:00 2001 From: Lene Gadewoll Date: Mon, 14 Jul 2025 12:17:40 +0200 Subject: [PATCH 14/14] refactor: update renamed icon --- .../doc_viewer_attributes_overview/attributes_accordion.tsx | 2 +- .../query_rule_flyout/query_rule_metadata_editor.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/platform/plugins/shared/unified_doc_viewer/public/components/observability/attributes/doc_viewer_attributes_overview/attributes_accordion.tsx b/src/platform/plugins/shared/unified_doc_viewer/public/components/observability/attributes/doc_viewer_attributes_overview/attributes_accordion.tsx index 76502f4749469..15945d899c4aa 100644 --- a/src/platform/plugins/shared/unified_doc_viewer/public/components/observability/attributes/doc_viewer_attributes_overview/attributes_accordion.tsx +++ b/src/platform/plugins/shared/unified_doc_viewer/public/components/observability/attributes/doc_viewer_attributes_overview/attributes_accordion.tsx @@ -56,7 +56,7 @@ export const AttributesAccordion = ({ {title} = ( )} > = ( )} >