From ded5277b26c5b7bba8b3d01ad8989a146b7a22e2 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Wed, 3 Jul 2024 16:40:58 +0200 Subject: [PATCH 1/7] [8.14] [ci] Use org wide PR status bot (#187386) (#187476) # Backport This will backport the following commits from `main` to `8.14`: - [[ci] Use org wide PR status bot (#187386)](https://github.com/elastic/kibana/pull/187386) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Jon --- .buildkite/pipeline-resource-definitions/kibana-on-merge.yml | 2 +- .buildkite/pipeline-resource-definitions/kibana-pr.yml | 4 ++-- .buildkite/scripts/lifecycle/post_build.sh | 2 +- .buildkite/scripts/lifecycle/pre_build.sh | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.buildkite/pipeline-resource-definitions/kibana-on-merge.yml b/.buildkite/pipeline-resource-definitions/kibana-on-merge.yml index da2086bacb3ee..09ba2a2bde667 100644 --- a/.buildkite/pipeline-resource-definitions/kibana-on-merge.yml +++ b/.buildkite/pipeline-resource-definitions/kibana-on-merge.yml @@ -20,7 +20,7 @@ spec: spec: env: SLACK_NOTIFICATIONS_CHANNEL: '#kibana-operations-alerts' - GITHUB_BUILD_COMMIT_STATUS_ENABLED: 'true' + ELASTIC_GITHUB_BUILD_COMMIT_STATUS_ENABLED: 'true' GITHUB_COMMIT_STATUS_CONTEXT: buildkite/on-merge REPORT_FAILED_TESTS_TO_GITHUB: 'true' ELASTIC_SLACK_NOTIFICATIONS_ENABLED: 'true' diff --git a/.buildkite/pipeline-resource-definitions/kibana-pr.yml b/.buildkite/pipeline-resource-definitions/kibana-pr.yml index af697452130fc..4d6275843327e 100644 --- a/.buildkite/pipeline-resource-definitions/kibana-pr.yml +++ b/.buildkite/pipeline-resource-definitions/kibana-pr.yml @@ -20,9 +20,9 @@ spec: spec: env: ELASTIC_PR_COMMENTS_ENABLED: 'true' - GITHUB_BUILD_COMMIT_STATUS_ENABLED: 'true' + ELASTIC_GITHUB_BUILD_COMMIT_STATUS_ENABLED: 'true' + ELASTIC_GITHUB_STEP_COMMIT_STATUS_ENABLED: 'true' GITHUB_BUILD_COMMIT_STATUS_CONTEXT: kibana-ci - GITHUB_STEP_COMMIT_STATUS_ENABLED: 'true' allow_rebuilds: true branch_configuration: '' cancel_intermediate_builds: true diff --git a/.buildkite/scripts/lifecycle/post_build.sh b/.buildkite/scripts/lifecycle/post_build.sh index 3ca36e9d04b78..c0fb7edde1b0a 100755 --- a/.buildkite/scripts/lifecycle/post_build.sh +++ b/.buildkite/scripts/lifecycle/post_build.sh @@ -5,7 +5,7 @@ set -euo pipefail BUILD_SUCCESSFUL=$(ts-node "$(dirname "${0}")/build_status.ts") export BUILD_SUCCESSFUL -if [[ "${GITHUB_BUILD_COMMIT_STATUS_ENABLED:-}" != "true" ]]; then +if [[ "${ELASTIC_GITHUB_BUILD_COMMIT_STATUS_ENABLED:-}" != "true" ]]; then "$(dirname "${0}")/commit_status_complete.sh" fi diff --git a/.buildkite/scripts/lifecycle/pre_build.sh b/.buildkite/scripts/lifecycle/pre_build.sh index b8ccaf04f9bb9..91d8adda85eb1 100755 --- a/.buildkite/scripts/lifecycle/pre_build.sh +++ b/.buildkite/scripts/lifecycle/pre_build.sh @@ -4,7 +4,7 @@ set -euo pipefail source .buildkite/scripts/common/util.sh -if [[ "${GITHUB_BUILD_COMMIT_STATUS_ENABLED:-}" != "true" ]]; then +if [[ "${ELASTIC_GITHUB_BUILD_COMMIT_STATUS_ENABLED:-}" != "true" ]]; then "$(dirname "${0}")/commit_status_start.sh" fi From cfd36e1877cca231b2ca32536a819fd989a37367 Mon Sep 17 00:00:00 2001 From: Mark Hopkin Date: Thu, 4 Jul 2024 10:10:01 +0100 Subject: [PATCH 2/7] [8.14] [Entity Analytics] Flaky Cypress test fixes (#186081) (#187472) # Backport closes https://github.com/elastic/kibana/pull/187472 This will backport the following commits from `main` to `8.14`: - [[Entity Analytics] Flaky Cypress test fixes (#186081)](https://github.com/elastic/kibana/pull/186081) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Elastic Machine --- .../components/risk_score_preview_section.tsx | 1 + .../dashboards/entity_analytics/new_risk_score.cy.ts | 2 ++ .../entity_analytics/entity_analytics_management_page.cy.ts | 6 +++--- .../cypress/screens/entity_analytics_management.ts | 3 +++ .../cypress/tasks/entity_analytics.ts | 6 +++--- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_preview_section.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_preview_section.tsx index c927a12f48a64..695143fe7a4a3 100644 --- a/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_preview_section.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_preview_section.tsx @@ -227,6 +227,7 @@ const RiskEnginePreview = () => { showDatePicker={true} displayStyle={'inPage'} submitButtonStyle={'iconOnly'} + dataTestSubj="risk-score-preview-search-bar-input" /> )} diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/dashboards/entity_analytics/new_risk_score.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/dashboards/entity_analytics/new_risk_score.cy.ts index 894248f9ff716..da59afaec941c 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/dashboards/entity_analytics/new_risk_score.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/dashboards/entity_analytics/new_risk_score.cy.ts @@ -103,6 +103,7 @@ describe('Entity Analytics Dashboard', { tags: ['@ess', '@serverless'] }, () => describe('With host risk data', () => { before(() => { + cy.task('esArchiverUnload', { archiveName: 'risk_scores_new' }); cy.task('esArchiverLoad', { archiveName: 'risk_scores_new' }); }); @@ -145,6 +146,7 @@ describe('Entity Analytics Dashboard', { tags: ['@ess', '@serverless'] }, () => describe('With alerts data', () => { before(() => { + deleteAlertsAndRules(); createRule(getNewRule()); }); diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/entity_analytics_management_page.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/entity_analytics_management_page.cy.ts index f23480e52d0d1..b8d222471c87e 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/entity_analytics_management_page.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/entity_analytics_management_page.cy.ts @@ -15,6 +15,7 @@ import { LOCAL_QUERY_BAR_SELECTOR, RISK_SCORE_ERROR_PANEL, RISK_SCORE_STATUS, + LOCAL_QUERY_BAR_SEARCH_INPUT_SELECTOR, } from '../../screens/entity_analytics_management'; import { deleteRiskScore, installRiskScoreModule } from '../../tasks/api_calls/risk_scores'; @@ -31,7 +32,7 @@ import { interceptRiskInitError, } from '../../tasks/api_calls/risk_engine'; import { updateDateRangeInLocalDatePickers } from '../../tasks/date_picker'; -import { fillLocalSearchBar, submitLocalSearch } from '../../tasks/search_bar'; +import { submitLocalSearch } from '../../tasks/search_bar'; import { riskEngineStatusChange, upgradeRiskEngine, @@ -80,8 +81,7 @@ describe( it('risk scores reacts on change in search bar query', () => { cy.get(HOST_RISK_PREVIEW_TABLE_ROWS).should('have.length', 5); cy.get(USER_RISK_PREVIEW_TABLE_ROWS).should('have.length', 5); - - fillLocalSearchBar('host.name: "test-host1"'); + cy.get(LOCAL_QUERY_BAR_SEARCH_INPUT_SELECTOR).type('host.name: "test-host1"'); submitLocalSearch(LOCAL_QUERY_BAR_SELECTOR); cy.get(HOST_RISK_PREVIEW_TABLE_ROWS).should('have.length', 1); diff --git a/x-pack/test/security_solution_cypress/cypress/screens/entity_analytics_management.ts b/x-pack/test/security_solution_cypress/cypress/screens/entity_analytics_management.ts index 481c12fd9232e..e1d62ffb420c8 100644 --- a/x-pack/test/security_solution_cypress/cypress/screens/entity_analytics_management.ts +++ b/x-pack/test/security_solution_cypress/cypress/screens/entity_analytics_management.ts @@ -23,6 +23,9 @@ export const RISK_PREVIEW_ERROR_BUTTON = '[data-test-subj="risk-preview-error-bu export const LOCAL_QUERY_BAR_SELECTOR = getDataTestSubjectSelector('risk-score-preview-search-bar'); +export const LOCAL_QUERY_BAR_SEARCH_INPUT_SELECTOR = + '[data-test-subj="risk-score-preview-search-bar-input"]'; + export const RISK_SCORE_ERROR_PANEL = '[data-test-subj="risk-score-error-panel"]'; export const RISK_SCORE_UPDATE_CANCEL = '[data-test-subj="risk-score-update-cancel"]'; diff --git a/x-pack/test/security_solution_cypress/cypress/tasks/entity_analytics.ts b/x-pack/test/security_solution_cypress/cypress/tasks/entity_analytics.ts index bb02c196ac92e..5d84c28100fee 100644 --- a/x-pack/test/security_solution_cypress/cypress/tasks/entity_analytics.ts +++ b/x-pack/test/security_solution_cypress/cypress/tasks/entity_analytics.ts @@ -26,13 +26,13 @@ import { } from '../screens/entity_analytics_management'; import { visitWithTimeRange } from './navigation'; import { GET_DATE_PICKER_APPLY_BUTTON, GLOBAL_FILTERS_CONTAINER } from '../screens/date_picker'; -import { LOADING_SPINNER } from '../screens/loading'; +import { REFRESH_BUTTON } from '../screens/security_header'; export const updateDashboardTimeRange = () => { // eslint-disable-next-line cypress/no-force cy.get(GET_DATE_PICKER_APPLY_BUTTON(GLOBAL_FILTERS_CONTAINER)).click({ force: true }); // Force to fix global timerange flakiness - cy.get(LOADING_SPINNER).should('exist'); - cy.get(LOADING_SPINNER).should('not.exist'); + cy.get(REFRESH_BUTTON).click(); + cy.get(REFRESH_BUTTON).should('not.have.attr', 'aria-label', 'Needs updating'); }; export const waitForAnomaliesToBeLoaded = () => { From 86899c64a0cbd7f7d02ec19862f6cab3abacc25a Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 4 Jul 2024 14:26:25 +0200 Subject: [PATCH 3/7] [8.14] [Search] Fix search index rerendering unnecessarily (#186412) (#187558) # Backport This will backport the following commits from `main` to `8.14`: - [[Search] Fix search index rerendering unnecessarily (#186412)](https://github.com/elastic/kibana/pull/186412) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Sander Philipse <94373878+sphilipse@users.noreply.github.com> --- .../components/search_index/search_index.tsx | 81 ++++++++++++------- 1 file changed, 54 insertions(+), 27 deletions(-) diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/search_index.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/search_index.tsx index a6e59f8e8e747..7ee2209310ba3 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/search_index.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/search_index.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import React, { useEffect } from 'react'; +import React, { useEffect, useMemo } from 'react'; import { useParams } from 'react-router-dom'; @@ -15,12 +15,15 @@ import { EuiTabbedContent, EuiTabbedContentTab } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; +import { ClientConfigType } from '../../../../../common/types'; + import { generateEncodedPath } from '../../../shared/encode_path_params'; import { ErrorStatePrompt } from '../../../shared/error_state'; import { HttpLogic } from '../../../shared/http'; import { KibanaLogic } from '../../../shared/kibana'; import { SEARCH_INDEX_PATH, SEARCH_INDEX_TAB_PATH } from '../../routes'; +import { ElasticsearchViewIndex } from '../../types'; import { isConnectorIndex, isCrawlerIndex } from '../../utils/indices'; import { ConnectorConfiguration } from '../connector_detail/connector_configuration'; import { EnterpriseSearchContentPageTemplate } from '../layout/page_template'; @@ -207,20 +210,6 @@ export const SearchIndex: React.FC = () => { ...(hasDefaultIngestPipeline ? [PIPELINES_TAB] : []), ]; - const selectedTab = tabs.find((tab) => tab.id === tabId); - - const onTabClick = (tab: EuiTabbedContentTab) => { - KibanaLogic.values.navigateToUrl( - generateEncodedPath( - tab.id === SearchIndexTabId.OVERVIEW ? SEARCH_INDEX_PATH : SEARCH_INDEX_TAB_PATH, - { - indexName, - tabId: tab.id, - } - ) - ); - }; - return ( { rightSideItems: getHeaderActions(index), }} > - {isCrawlerIndex(index) && !index.connector ? ( - - ) : isCrawlerIndex(index) && (Boolean(errorConnectingMessage) || !config.host) ? ( - - ) : ( - <> - {indexName === index?.name && ( - - )} - {isCrawlerIndex(index) && } - - )} + ); }; + +interface ContentProps { + config?: ClientConfigType; + errorConnectingMessage: string; + index?: ElasticsearchViewIndex; + tabId?: string; + tabs: EuiTabbedContentTab[]; +} + +const Content: React.FC = ({ + config, + errorConnectingMessage, + index, + tabs, + tabId, +}) => { + const selectedTab = useMemo(() => tabs.find((tab) => tab.id === tabId), [tabId]); + + const onTabClick = (tab: EuiTabbedContentTab) => { + KibanaLogic.values.navigateToUrl( + generateEncodedPath( + tab.id === SearchIndexTabId.OVERVIEW ? SEARCH_INDEX_PATH : SEARCH_INDEX_TAB_PATH, + { + indexName: index?.name || '', + tabId: tab.id, + } + ) + ); + }; + + if (isCrawlerIndex(index) && !index.connector) { + return ; + } + if (isCrawlerIndex(index) && (Boolean(errorConnectingMessage) || !config?.host)) { + return ; + } + return ( + <> + + {isCrawlerIndex(index) && } + + ); +}; From 9e99d635137bef1dedc4ddf1f50d51cc7c4e7c8b Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 4 Jul 2024 19:15:33 +0200 Subject: [PATCH 4/7] [8.14] [Lens] Fix telemetry for annotation layers (#187281) (#187588) # Backport This will backport the following commits from `main` to `8.14`: - [[Lens] Fix telemetry for annotation layers (#187281)](https://github.com/elastic/kibana/pull/187281) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Marco Liberati --- .../expression_xy/common/__mocks__/index.ts | 41 +++- .../expression_renderers/telemetry.test.ts | 190 ++++++++++++++++++ .../xy_chart_renderer.tsx | 6 +- 3 files changed, 232 insertions(+), 5 deletions(-) create mode 100644 src/plugins/chart_expressions/expression_xy/public/expression_renderers/telemetry.test.ts diff --git a/src/plugins/chart_expressions/expression_xy/common/__mocks__/index.ts b/src/plugins/chart_expressions/expression_xy/common/__mocks__/index.ts index 3c71b238d64b2..79a481ec3d99f 100644 --- a/src/plugins/chart_expressions/expression_xy/common/__mocks__/index.ts +++ b/src/plugins/chart_expressions/expression_xy/common/__mocks__/index.ts @@ -10,7 +10,14 @@ import { Position } from '@elastic/charts'; import type { PaletteOutput } from '@kbn/coloring'; import { Datatable, DatatableRow } from '@kbn/expressions-plugin/common'; import { LayerTypes } from '../constants'; -import { DataLayerConfig, ExtendedDataLayerConfig, XYProps } from '../types'; +import { + AnnotationLayerConfig, + CommonXYLayerConfig, + DataLayerConfig, + ExtendedDataLayerConfig, + ReferenceLineLayerConfig, + XYProps, +} from '../types'; export const mockPaletteOutput: PaletteOutput = { type: 'palette', @@ -46,6 +53,36 @@ export const createSampleDatatableWithRows = (rows: DatatableRow[]): Datatable = rows, }); +export const sampleAnnotationLayer: AnnotationLayerConfig = { + layerId: 'first', + type: 'annotationLayer', + layerType: LayerTypes.ANNOTATIONS, + annotations: [ + { + type: 'manual_point_event_annotation', + id: 'ann1', + time: '2021-01-01T00:00:00.000Z', + label: 'Manual annotation point', + }, + { + type: 'query_point_event_annotation', + id: 'ann2', + filter: { type: 'kibana_query', language: 'kql', query: 'a: *' }, + label: 'Query annotation point', + }, + ], +}; + +export const sampleReferenceLineLayer: ReferenceLineLayerConfig = { + layerId: 'first', + type: 'referenceLineLayer', + layerType: LayerTypes.REFERENCELINE, + accessors: ['b', 'c'], + columnToLabel: '{"b": "Label B", "c": "Label C"}', + decorations: [], + table: createSampleDatatableWithRows([]), +}; + export const sampleLayer: DataLayerConfig = { layerId: 'first', type: 'dataLayer', @@ -84,7 +121,7 @@ export const sampleExtendedLayer: ExtendedDataLayerConfig = { }; export const createArgsWithLayers = ( - layers: DataLayerConfig | DataLayerConfig[] = sampleLayer + layers: CommonXYLayerConfig | CommonXYLayerConfig[] = sampleLayer ): XYProps => ({ showTooltip: true, minBarHeight: 1, diff --git a/src/plugins/chart_expressions/expression_xy/public/expression_renderers/telemetry.test.ts b/src/plugins/chart_expressions/expression_xy/public/expression_renderers/telemetry.test.ts new file mode 100644 index 0000000000000..a4b0692b09e4f --- /dev/null +++ b/src/plugins/chart_expressions/expression_xy/public/expression_renderers/telemetry.test.ts @@ -0,0 +1,190 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { CommonXYLayerConfig, LayerTypes } from '../../common'; +import { AnnotationLayerConfig, DataLayerConfig, XYProps } from '../../common/types'; +import { + createArgsWithLayers, + sampleAnnotationLayer, + sampleLayer, + sampleReferenceLineLayer, +} from '../../common/__mocks__'; +import { getDataLayers } from '../helpers'; +import { extractCounterEvents } from './xy_chart_renderer'; + +type PossibleLayerTypes = + | typeof LayerTypes.DATA + | typeof LayerTypes.ANNOTATIONS + | typeof LayerTypes.REFERENCELINE; + +function createLayer(type: PossibleLayerTypes) { + switch (type) { + case LayerTypes.ANNOTATIONS: { + return { ...sampleAnnotationLayer }; + } + case LayerTypes.REFERENCELINE: { + return { ...sampleReferenceLineLayer }; + } + case LayerTypes.DATA: + default: { + return { ...sampleLayer }; + } + } +} +function createLayers( + layerConfigs: Partial> +): CommonXYLayerConfig[] { + const layers = []; + for (const [type, { count }] of Object.entries(layerConfigs)) { + layers.push( + ...Array.from({ length: count }, () => createLayer(type as CommonXYLayerConfig['layerType'])) + ); + } + return layers; +} + +function createAnnotations(count: number) { + return Array.from({ length: count }, () => createLayer('annotations') as AnnotationLayerConfig); +} + +function getXYProps( + layersConfig: CommonXYLayerConfig[], + annotations?: AnnotationLayerConfig[] +): XYProps { + const args = createArgsWithLayers(layersConfig); + if (annotations?.length) { + if (!args.annotations) { + args.annotations = { + type: 'event_annotations_result', + layers: [], + datatable: { + type: 'datatable', + columns: [], + rows: [], + }, + }; + } + args.annotations!.layers = annotations; + } + return args; +} + +describe('should emit the right telemetry events', () => { + it('should emit the telemetry event for a single data layer', () => { + expect( + extractCounterEvents('lens', getXYProps(createLayers({ data: { count: 1 } })), false, { + getDataLayers, + }) + ).toMatchInlineSnapshot(` + Array [ + "render_lens_line", + ] + `); + }); + + it('should emit the telemetry event for multiple data layers', () => { + expect( + extractCounterEvents('lens', getXYProps(createLayers({ data: { count: 2 } })), false, { + getDataLayers, + }) + ).toMatchInlineSnapshot(` + Array [ + "render_lens_line", + "render_lens_multiple_data_layers", + ] + `); + }); + + it('should emit the telemetry event for multiple data layers with mixed types', () => { + const layers = createLayers({ data: { count: 2 } }); + // change layer 2 to be bar stacked + (layers[1] as DataLayerConfig).seriesType = 'bar'; + (layers[1] as DataLayerConfig).isStacked = true; + expect( + extractCounterEvents('lens', getXYProps(layers), false, { + getDataLayers, + }) + ).toMatchInlineSnapshot(` + Array [ + "render_lens_line", + "render_lens_multiple_data_layers", + "render_lens_mixed_xy", + ] + `); + }); + + it('should emit the telemetry dedicated event for percentage charts', () => { + const layers = createLayers({ data: { count: 1 } }); + // change layer 2 to be bar stacked + (layers[0] as DataLayerConfig).seriesType = 'bar'; + (layers[0] as DataLayerConfig).isPercentage = true; + (layers[0] as DataLayerConfig).isStacked = true; + expect( + extractCounterEvents('lens', getXYProps(layers), false, { + getDataLayers, + }) + ).toMatchInlineSnapshot(` + Array [ + "render_lens_vertical_bar_percentage_stacked", + ] + `); + }); + + it('should emit the telemetry event for a data layer and an additonal reference line layer', () => { + expect( + extractCounterEvents( + 'lens', + getXYProps(createLayers({ data: { count: 1 }, referenceLine: { count: 1 } })), + false, + { getDataLayers } + ) + ).toMatchInlineSnapshot(` + Array [ + "render_lens_line", + "render_lens_reference_layer", + ] + `); + }); + + it('should emit the telemetry event for a data layer and an additional annotations layer', () => { + expect( + extractCounterEvents( + 'lens', + getXYProps(createLayers({ data: { count: 1 } }), createAnnotations(1)), + false, + { getDataLayers } + ) + ).toMatchInlineSnapshot(` + Array [ + "render_lens_line", + "render_lens_annotation_layer", + ] + `); + }); + + it('should emit the telemetry event for a scenario with the navigate to lens feature', () => { + expect( + extractCounterEvents( + 'lens', + getXYProps( + createLayers({ data: { count: 1 }, referenceLine: { count: 1 } }), + createAnnotations(1) + ), + true, + { getDataLayers } + ) + ).toMatchInlineSnapshot(` + Array [ + "render_lens_line", + "render_lens_reference_layer", + "render_lens_annotation_layer", + "render_lens_render_line_convertable", + ] + `); + }); +}); diff --git a/src/plugins/chart_expressions/expression_xy/public/expression_renderers/xy_chart_renderer.tsx b/src/plugins/chart_expressions/expression_xy/public/expression_renderers/xy_chart_renderer.tsx index 53091eb47acb5..0616bc90931a4 100644 --- a/src/plugins/chart_expressions/expression_xy/public/expression_renderers/xy_chart_renderer.tsx +++ b/src/plugins/chart_expressions/expression_xy/public/expression_renderers/xy_chart_renderer.tsx @@ -61,9 +61,9 @@ interface XyChartRendererDeps { getStartDeps: GetStartDepsFn; } -const extractCounterEvents = ( +export const extractCounterEvents = ( originatingApp: string, - { layers, yAxisConfigs }: XYChartProps['args'], + { annotations, layers, yAxisConfigs }: XYChartProps['args'], canNavigateToLens: boolean, services: { getDataLayers: typeof getDataLayers; @@ -78,7 +78,7 @@ const extractCounterEvents = ( ? `${dataLayer.isHorizontal ? 'horizontal_bar' : 'vertical_bar'}` : dataLayer.seriesType; - const byTypes = layers.reduce( + const byTypes = layers.concat(annotations?.layers || []).reduce( (acc, item) => { if ( !acc.mixedXY && From eb8ed213cbe4a8b45cf1c6af3903444b77214a9e Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Thu, 4 Jul 2024 20:42:14 +0100 Subject: [PATCH 5/7] chore(NA): bump version to 8.14.3 (#187600) Usually bump from 8.14.2 to 8.14.3 Co-authored-by: Elastic Machine --- package.json | 2 +- x-pack/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 6dd2670425dc3..7d8aa6afb0898 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "dashboarding" ], "private": true, - "version": "8.14.2", + "version": "8.14.3", "branch": "8.14", "types": "./kibana.d.ts", "tsdocMetadata": "./build/tsdoc-metadata.json", diff --git a/x-pack/package.json b/x-pack/package.json index d8f5eb8a23458..e15130bf11361 100644 --- a/x-pack/package.json +++ b/x-pack/package.json @@ -1,6 +1,6 @@ { "name": "x-pack", - "version": "8.14.2", + "version": "8.14.3", "author": "Elastic", "private": true, "license": "Elastic-License", From 2f141d97f36311823d4eed8a6e05bbb9cea6c47e Mon Sep 17 00:00:00 2001 From: Hannah Mudge Date: Fri, 5 Jul 2024 16:00:24 -0600 Subject: [PATCH 6/7] [8.14] [Dashboard] [Controls] Fix controls getting overwritten on navigation (#187509) (#187694) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Backport This will backport the following commits from `main` to `8.14`: - [[Dashboard] [Controls] Fix controls getting overwritten on navigation (#187509)](https://github.com/elastic/kibana/pull/187509) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Elastic Machine --- .../embeddable/create/create_dashboard.test.ts | 4 +--- .../dashboard_container/embeddable/create/create_dashboard.ts | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/plugins/dashboard/public/dashboard_container/embeddable/create/create_dashboard.test.ts b/src/plugins/dashboard/public/dashboard_container/embeddable/create/create_dashboard.test.ts index 12eebe31da173..30c81fe0d22f1 100644 --- a/src/plugins/dashboard/public/dashboard_container/embeddable/create/create_dashboard.test.ts +++ b/src/plugins/dashboard/public/dashboard_container/embeddable/create/create_dashboard.test.ts @@ -420,12 +420,11 @@ test('creates new embeddable with specified size if size is provided', async () expect(dashboard!.getState().explicitInput.panels.new_panel.gridData.h).toBe(1); }); -test('creates a control group from the control group factory and waits for it to be initialized', async () => { +test('creates a control group from the control group factory', async () => { const mockControlGroupContainer = { destroy: jest.fn(), render: jest.fn(), updateInput: jest.fn(), - untilInitialized: jest.fn(), getInput: jest.fn().mockReturnValue({}), getInput$: jest.fn().mockReturnValue(new Observable()), getOutput: jest.fn().mockReturnValue({}), @@ -455,7 +454,6 @@ test('creates a control group from the control group factory and waits for it to undefined, { lastSavedInput: expect.objectContaining({ controlStyle: 'oneLine' }) } ); - expect(mockControlGroupContainer.untilInitialized).toHaveBeenCalled(); }); /* diff --git a/src/plugins/dashboard/public/dashboard_container/embeddable/create/create_dashboard.ts b/src/plugins/dashboard/public/dashboard_container/embeddable/create/create_dashboard.ts index 483de4df70577..ea67c45a1fc11 100644 --- a/src/plugins/dashboard/public/dashboard_container/embeddable/create/create_dashboard.ts +++ b/src/plugins/dashboard/public/dashboard_container/embeddable/create/create_dashboard.ts @@ -427,7 +427,6 @@ export const initializeDashboard = async ({ dashboardContainer.controlGroup = controlGroup; startSyncingDashboardControlGroup.bind(dashboardContainer)(); }); - await controlGroup.untilInitialized(); } // -------------------------------------------------------------------------------------- From 465f50087cd040ef03e6ccec1cb7737427a713ce Mon Sep 17 00:00:00 2001 From: Jatin Kathuria Date: Mon, 8 Jul 2024 09:00:25 +0200 Subject: [PATCH 7/7] [8.14] [Security Solution][Alert table] Fix alert table refresh with bulk action (#183674) (#187722) # Backport This will backport the following commits from `main` to `8.14`: - [[Security Solution][Alert table] Fix alert table refresh with bulk action (#183674)](https://github.com/elastic/kibana/pull/183674) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: christineweng <18648970+christineweng@users.noreply.github.com> --- .../use_bulk_actions.tsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/security_solution/public/detections/hooks/trigger_actions_alert_table/use_bulk_actions.tsx b/x-pack/plugins/security_solution/public/detections/hooks/trigger_actions_alert_table/use_bulk_actions.tsx index 03e2655ff4047..aa798b00dc969 100644 --- a/x-pack/plugins/security_solution/public/detections/hooks/trigger_actions_alert_table/use_bulk_actions.tsx +++ b/x-pack/plugins/security_solution/public/detections/hooks/trigger_actions_alert_table/use_bulk_actions.tsx @@ -10,7 +10,7 @@ import type { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/type import type { SerializableRecord } from '@kbn/utility-types'; import { isEqual } from 'lodash'; import type { Filter } from '@kbn/es-query'; -import { useMemo } from 'react'; +import { useMemo, useCallback } from 'react'; import type { TableId } from '@kbn/securitysolution-data-table'; import { useBulkAlertAssigneesItems } from '../../../common/components/toolbar/bulk_actions/use_bulk_alert_assignees_items'; import { useBulkAlertTagsItems } from '../../../common/components/toolbar/bulk_actions/use_bulk_alert_tags_items'; @@ -18,6 +18,9 @@ import { SourcererScopeName } from '../../../common/store/sourcerer/model'; import { useGlobalTime } from '../../../common/containers/use_global_time'; import { useAddBulkToTimelineAction } from '../../components/alerts_table/timeline_actions/use_add_bulk_to_timeline'; import { useBulkAlertActionItems } from './use_alert_actions'; +import { useDeepEqualSelector } from '../../../common/hooks/use_selector'; +import type { inputsModel } from '../../../common/store'; +import { inputsSelectors } from '../../../common/store'; // check to see if the query is a known "empty" shape export function isKnownEmptyQuery(query: QueryDslQueryContainer) { @@ -82,6 +85,14 @@ export const getBulkActionHook = }; }, [filters, from, to]); + const getGlobalQueriesSelector = useMemo(() => inputsSelectors.globalQuery(), []); + const globalQueries = useDeepEqualSelector(getGlobalQueriesSelector); + + const refetch = useCallback(() => { + refresh(); + globalQueries.forEach((q) => q.refetch && (q.refetch as inputsModel.Refetch)()); + }, [globalQueries, refresh]); + const alertActionParams = useMemo(() => { return { scopeId: SourcererScopeName.detections, @@ -89,9 +100,9 @@ export const getBulkActionHook = from, to, tableId, - refetch: refresh, + refetch, }; - }, [from, to, filters, refresh]); + }, [from, to, filters, refetch]); const bulkAlertTagParams = useMemo(() => { return {