From 7dcff6dd5beace7eb55d0140f812de5a6583f7fe Mon Sep 17 00:00:00 2001 From: Alexi Doak <109488926+doakalexi@users.noreply.github.com> Date: Mon, 26 Jun 2023 15:21:00 -0400 Subject: [PATCH 1/3] =?UTF-8?q?Revert=20"[ResponseOps][Alerting]=20Flaky?= =?UTF-8?q?=20test=20x-pack/test/alerting=5Fapi=5Fintegration/security=5Fa?= =?UTF-8?q?nd=5Fspaces/group2/tests/telemetry/index=C2=B7ts"=20(#160558)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reverts elastic/kibana#159818 --- .../security_and_spaces/group2/tests/telemetry/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/telemetry/index.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/telemetry/index.ts index 915bac5b26899..829de0e1c6e71 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/telemetry/index.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/telemetry/index.ts @@ -11,7 +11,8 @@ import { setupSpacesAndUsers, tearDown } from '../../../setup'; // eslint-disable-next-line import/no-default-export export default function telemetryTests({ loadTestFile, getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); - describe('Alerting and Actions Telemetry', () => { + // FLAKY: https://github.com/elastic/kibana/issues/136153 + describe.skip('Alerting and Actions Telemetry', () => { before(async () => { await esArchiver.load('x-pack/test/functional/es_archives/event_log_telemetry'); // reset the state in the telemetry task From bb5437a8fcba0b9471448a450d6ac4c647c39baa Mon Sep 17 00:00:00 2001 From: Julia Rechkunova Date: Mon, 26 Jun 2023 21:21:12 +0200 Subject: [PATCH 2/3] [Discover] Make theme availalbe in kibana context (#160358) - For https://github.com/elastic/kibana/pull/159638 - Also closes https://github.com/elastic/kibana/issues/160432 ## Summary This PR makes `theme` available in kibana context which is necessary for supporting dark mode in `CodeEditor`. Also fixed Inspect on Search Sessions page: it was blank because of missing `settings`. Shall we backport? --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> --- .../components/actions/inspect_button.tsx | 48 +++++++++++++++---- .../public/open_editor.tsx | 3 +- .../with_discover_services.tsx | 23 +++------ .../discover/public/__mocks__/services.ts | 15 +++--- src/plugins/discover/public/build_services.ts | 4 +- .../get_render_cell_value.test.tsx | 4 ++ .../public/__mocks__/services.ts | 5 -- src/plugins/unified_histogram/public/types.ts | 2 - src/plugins/unified_histogram/tsconfig.json | 1 - 9 files changed, 63 insertions(+), 42 deletions(-) diff --git a/src/plugins/data/public/search/session/sessions_mgmt/components/actions/inspect_button.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/inspect_button.tsx index 6776acff20151..a918982368b7e 100644 --- a/src/plugins/data/public/search/session/sessions_mgmt/components/actions/inspect_button.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/inspect_button.tsx @@ -22,14 +22,9 @@ import { SearchSessionsMgmtAPI } from '../../lib/api'; interface InspectFlyoutProps { searchSession: UISession; - uiSettings: CoreStart['uiSettings']; } -const InspectFlyout = ({ uiSettings, searchSession }: InspectFlyoutProps) => { - const { Provider: KibanaReactContextProvider } = createKibanaReactContext({ - uiSettings, - }); - +const InspectFlyout: React.FC = ({ searchSession }) => { const renderInfo = () => { return ( @@ -54,7 +49,7 @@ const InspectFlyout = ({ uiSettings, searchSession }: InspectFlyoutProps) => { }; return ( - + <>

@@ -79,6 +74,32 @@ const InspectFlyout = ({ uiSettings, searchSession }: InspectFlyoutProps) => { {renderInfo()} + + ); +}; + +interface InspectFlyoutWrapperProps { + searchSession: UISession; + uiSettings: CoreStart['uiSettings']; + settings: CoreStart['settings']; + theme: CoreStart['theme']; +} + +const InspectFlyoutWrapper: React.FC = ({ + searchSession, + uiSettings, + settings, + theme, +}) => { + const { Provider: KibanaReactContextProvider } = createKibanaReactContext({ + uiSettings, + settings, + theme, + }); + + return ( + + ); }; @@ -97,8 +118,17 @@ export const createInspectActionDescriptor = ( /> ), onClick: async () => { - const flyout = ; - const overlay = core.overlays.openFlyout(toMountPoint(flyout, { theme$: core.theme.theme$ })); + const flyoutWrapper = ( + + ); + const overlay = core.overlays.openFlyout( + toMountPoint(flyoutWrapper, { theme$: core.theme.theme$ }) + ); await overlay.onClose; }, }); diff --git a/src/plugins/data_view_field_editor/public/open_editor.tsx b/src/plugins/data_view_field_editor/public/open_editor.tsx index a23e281460827..865f5f498d727 100644 --- a/src/plugins/data_view_field_editor/public/open_editor.tsx +++ b/src/plugins/data_view_field_editor/public/open_editor.tsx @@ -72,12 +72,13 @@ export const getFieldEditorOpener = apiService, }: Dependencies) => (options: OpenFieldEditorOptions): CloseEditor => { - const { uiSettings, overlays, docLinks, notifications, settings } = core; + const { uiSettings, overlays, docLinks, notifications, settings, theme } = core; const { Provider: KibanaReactContextProvider } = createKibanaReactContext({ uiSettings, docLinks, http: core.http, settings, + theme, }); let overlayRef: OverlayRef | null = null; diff --git a/src/plugins/discover/public/__mocks__/__storybook_mocks__/with_discover_services.tsx b/src/plugins/discover/public/__mocks__/__storybook_mocks__/with_discover_services.tsx index 975317e918cb3..57dc4e55651ff 100644 --- a/src/plugins/discover/public/__mocks__/__storybook_mocks__/with_discover_services.tsx +++ b/src/plugins/discover/public/__mocks__/__storybook_mocks__/with_discover_services.tsx @@ -8,8 +8,7 @@ import React, { FunctionComponent } from 'react'; import { action } from '@storybook/addon-actions'; -import { EUI_CHARTS_THEME_LIGHT } from '@elastic/eui/dist/eui_charts_theme'; -import { LIGHT_THEME } from '@elastic/charts'; +import { BehaviorSubject, Observable, of } from 'rxjs'; import { FieldFormat } from '@kbn/field-formats-plugin/common'; import { identity } from 'lodash'; import { CoreStart, IUiSettingsClient, PluginInitializerContext } from '@kbn/core/public'; @@ -29,7 +28,6 @@ import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; import { Plugin as NavigationPublicPlugin } from '@kbn/navigation-plugin/public'; import { SearchBar, UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; import { SavedQuery } from '@kbn/data-plugin/public'; -import { BehaviorSubject, Observable } from 'rxjs'; const NavigationPlugin = new NavigationPublicPlugin({} as PluginInitializerContext); @@ -64,11 +62,16 @@ const filterManager = { getFetches$: () => new Observable(), }; +const theme = { + theme$: of({ darkMode: false }), +}; + export const services = { core: { http: { basePath: { prepend: () => void 0 } }, notifications: { toasts: {} }, docLinks: { links: { discover: {} } }, + theme, }, storage: new LocalStorageMock({ [SIDEBAR_CLOSED_KEY]: false, @@ -146,19 +149,7 @@ export const services = { ui: { SearchBar, AggregateQuerySearchBar: SearchBar }, } as unknown as UnifiedSearchPublicPluginStart, }), - theme: { - useChartsTheme: () => ({ - ...EUI_CHARTS_THEME_LIGHT.theme, - chartPaddings: { - top: 0, - left: 0, - bottom: 0, - right: 0, - }, - heatmap: { xAxisLabel: { rotation: {} } }, - }), - useChartsBaseTheme: () => LIGHT_THEME, - }, + theme, capabilities: { visualize: { show: true, diff --git a/src/plugins/discover/public/__mocks__/services.ts b/src/plugins/discover/public/__mocks__/services.ts index 764b1dcd566ba..745059cc1be23 100644 --- a/src/plugins/discover/public/__mocks__/services.ts +++ b/src/plugins/discover/public/__mocks__/services.ts @@ -6,7 +6,6 @@ * Side Public License, v 1. */ import { Observable, of } from 'rxjs'; -import { EUI_CHARTS_THEME_LIGHT } from '@elastic/eui/dist/eui_charts_theme'; import { DiscoverServices } from '../build_services'; import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; import { uiActionsPluginMock } from '@kbn/ui-actions-plugin/public/mocks'; @@ -93,8 +92,15 @@ export function createDiscoverServicesMock(): DiscoverServices { return searchSource; }); + const theme = { + theme$: of({ darkMode: false }), + }; + return { - core: coreMock.createStart(), + core: { + ...coreMock.createStart(), + theme, + }, charts: chartPluginMock.createSetupContract(), chrome: chromeServiceMock.createStartContract(), history: () => ({ @@ -174,10 +180,7 @@ export function createDiscoverServicesMock(): DiscoverServices { metadata: { branch: 'test', }, - theme: { - useChartsTheme: jest.fn(() => EUI_CHARTS_THEME_LIGHT.theme), - useChartsBaseTheme: jest.fn(() => EUI_CHARTS_THEME_LIGHT.theme), - }, + theme, storage: new LocalStorageMock({}) as unknown as Storage, addBasePath: jest.fn(), toastNotifications: { diff --git a/src/plugins/discover/public/build_services.ts b/src/plugins/discover/public/build_services.ts index 895c1f72257ac..5553a8ad3b23c 100644 --- a/src/plugins/discover/public/build_services.ts +++ b/src/plugins/discover/public/build_services.ts @@ -75,7 +75,7 @@ export interface DiscoverServices { docLinks: DocLinksStart; embeddable: EmbeddableStart; history: () => History; - theme: ChartsPluginStart['theme']; + theme: CoreStart['theme']; filterManager: FilterManager; fieldFormats: FieldFormatsStart; dataViews: DataViewsContract; @@ -130,7 +130,7 @@ export const buildServices = memoize(function ( data: plugins.data, docLinks: core.docLinks, embeddable: plugins.embeddable, - theme: plugins.charts.theme, + theme: core.theme, fieldFormats: plugins.fieldFormats, filterManager: plugins.data.query.filterManager, history: getHistory, diff --git a/src/plugins/discover/public/components/discover_grid/get_render_cell_value.test.tsx b/src/plugins/discover/public/components/discover_grid/get_render_cell_value.test.tsx index 387e1474f3034..e2be59c78a333 100644 --- a/src/plugins/discover/public/components/discover_grid/get_render_cell_value.test.tsx +++ b/src/plugins/discover/public/components/discover_grid/get_render_cell_value.test.tsx @@ -7,6 +7,7 @@ */ import React from 'react'; +import { of } from 'rxjs'; import { shallow } from 'enzyme'; import { findTestSubject } from '@elastic/eui/lib/test'; import { mountWithIntl } from '@kbn/test-jest-helpers'; @@ -28,6 +29,9 @@ const mockServices = { fieldFormats: { getDefaultInstance: jest.fn(() => ({ convert: (value: unknown) => (value ? value : '-') })), }, + theme: { + theme$: of({ darkMode: false }), + }, }; jest.mock('../../hooks/use_discover_services', () => { diff --git a/src/plugins/unified_histogram/public/__mocks__/services.ts b/src/plugins/unified_histogram/public/__mocks__/services.ts index 24e603ced1aaf..71058be4f634f 100644 --- a/src/plugins/unified_histogram/public/__mocks__/services.ts +++ b/src/plugins/unified_histogram/public/__mocks__/services.ts @@ -6,7 +6,6 @@ * Side Public License, v 1. */ -import { EUI_CHARTS_THEME_LIGHT } from '@elastic/eui/dist/eui_charts_theme'; import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; import { expressionsPluginMock } from '@kbn/expressions-plugin/public/mocks'; import { fieldFormatsMock } from '@kbn/field-formats-plugin/common/mocks'; @@ -26,10 +25,6 @@ export const unifiedHistogramServicesMock = { get: jest.fn(), isDefault: jest.fn(() => true), }, - theme: { - useChartsTheme: jest.fn(() => EUI_CHARTS_THEME_LIGHT.theme), - useChartsBaseTheme: jest.fn(() => EUI_CHARTS_THEME_LIGHT.theme), - }, lens: { EmbeddableComponent: jest.fn(() => null), navigateToPrefilledEditor: jest.fn(), diff --git a/src/plugins/unified_histogram/public/types.ts b/src/plugins/unified_histogram/public/types.ts index 9543b9c5880ab..803c74304a3a6 100644 --- a/src/plugins/unified_histogram/public/types.ts +++ b/src/plugins/unified_histogram/public/types.ts @@ -6,7 +6,6 @@ * Side Public License, v 1. */ -import type { Theme } from '@kbn/charts-plugin/public/plugin'; import type { IUiSettingsClient, Capabilities } from '@kbn/core/public'; import type { DataPublicPluginStart } from '@kbn/data-plugin/public'; import type { FieldFormatsStart } from '@kbn/field-formats-plugin/public'; @@ -35,7 +34,6 @@ export enum UnifiedHistogramFetchStatus { */ export interface UnifiedHistogramServices { data: DataPublicPluginStart; - theme: Theme; uiActions: UiActionsStart; uiSettings: IUiSettingsClient; fieldFormats: FieldFormatsStart; diff --git a/src/plugins/unified_histogram/tsconfig.json b/src/plugins/unified_histogram/tsconfig.json index 0e0f18ff9dd56..2e5109b79fb3e 100644 --- a/src/plugins/unified_histogram/tsconfig.json +++ b/src/plugins/unified_histogram/tsconfig.json @@ -6,7 +6,6 @@ "include": [ "../../../typings/**/*", "common/**/*", "public/**/*", "server/**/*"], "kbn_references": [ "@kbn/core", - "@kbn/charts-plugin", "@kbn/data-plugin", "@kbn/data-views-plugin", "@kbn/lens-plugin", From efb7edc624f25d846e1a56a951f52868c49c9481 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Mon, 26 Jun 2023 20:28:41 +0100 Subject: [PATCH 3/3] skip flaky suite (#140973) --- .../group2/tests/telemetry/alerting_and_actions_telemetry.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/telemetry/alerting_and_actions_telemetry.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/telemetry/alerting_and_actions_telemetry.ts index 324459823d943..7925bfe6f2eb9 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/telemetry/alerting_and_actions_telemetry.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/telemetry/alerting_and_actions_telemetry.ts @@ -20,7 +20,8 @@ export default function createAlertingAndActionsTelemetryTests({ getService }: F const esTestIndexTool = new ESTestIndexTool(es, retry); const supertestWithoutAuth = getService('supertestWithoutAuth'); - describe('telemetry', () => { + // FLAKY: https://github.com/elastic/kibana/issues/140973 + describe.skip('telemetry', () => { const alwaysFiringRuleId: { [key: string]: string } = {}; beforeEach(async () => {