From 5957d313e0a4d15c1b9c4a079362e3c64ffc5967 Mon Sep 17 00:00:00 2001 From: Tim Sullivan Date: Thu, 19 Aug 2021 09:12:06 -0700 Subject: [PATCH 01/44] remove layout.selectors from job parameters (#109010) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- x-pack/plugins/reporting/common/index.ts | 9 --------- x-pack/plugins/reporting/common/types.ts | 8 -------- x-pack/plugins/reporting/public/index.ts | 4 +--- x-pack/plugins/reporting/public/mocks.ts | 2 -- x-pack/plugins/reporting/public/plugin.ts | 3 +-- ...screen_capture_panel_content.test.tsx.snap | 6 +++--- .../screen_capture_panel_content.test.tsx | 2 +- .../screen_capture_panel_content.tsx | 12 +++--------- .../export_types/common/generate_png.ts | 2 +- .../reporting/server/lib/layouts/index.ts | 19 ++++++++++--------- .../server/lib/layouts/preserve_layout.ts | 13 ++++--------- .../server/lib/layouts/print_layout.ts | 7 +++---- 12 files changed, 27 insertions(+), 60 deletions(-) diff --git a/x-pack/plugins/reporting/common/index.ts b/x-pack/plugins/reporting/common/index.ts index 00bba85152656..a45ef4cf2919d 100644 --- a/x-pack/plugins/reporting/common/index.ts +++ b/x-pack/plugins/reporting/common/index.ts @@ -5,15 +5,6 @@ * 2.0. */ -import { LayoutSelectorDictionary } from './types'; - export * as constants from './constants'; export { CancellationToken } from './cancellation_token'; export { Poller } from './poller'; - -export const getDefaultLayoutSelectors = (): LayoutSelectorDictionary => ({ - screenshot: '[data-shared-items-container]', - renderComplete: '[data-shared-item]', - itemsCountAttribute: 'data-shared-items-count', - timefilterDurationAttribute: 'data-shared-timefilter-duration', -}); diff --git a/x-pack/plugins/reporting/common/types.ts b/x-pack/plugins/reporting/common/types.ts index 8833453efecec..745bc11a8c855 100644 --- a/x-pack/plugins/reporting/common/types.ts +++ b/x-pack/plugins/reporting/common/types.ts @@ -16,13 +16,6 @@ export interface PageSizeParams { subheadingHeight: number; } -export interface LayoutSelectorDictionary { - screenshot: string; - renderComplete: string; - itemsCountAttribute: string; - timefilterDurationAttribute: string; -} - export interface PdfImageSize { width: number; height?: number; @@ -36,7 +29,6 @@ export interface Size { export interface LayoutParams { id: string; dimensions?: Size; - selectors?: LayoutSelectorDictionary; } export interface ReportDocumentHead { diff --git a/x-pack/plugins/reporting/public/index.ts b/x-pack/plugins/reporting/public/index.ts index 6acdd8fb048e8..2df236e6e3079 100644 --- a/x-pack/plugins/reporting/public/index.ts +++ b/x-pack/plugins/reporting/public/index.ts @@ -6,20 +6,18 @@ */ import { PluginInitializerContext } from 'src/core/public'; -import { getDefaultLayoutSelectors } from '../common'; import { ReportingAPIClient } from './lib/reporting_api_client'; import { ReportingPublicPlugin } from './plugin'; import { getSharedComponents } from './shared'; export interface ReportingSetup { - getDefaultLayoutSelectors: typeof getDefaultLayoutSelectors; usesUiCapabilities: () => boolean; components: ReturnType; } export type ReportingStart = ReportingSetup; -export { constants, getDefaultLayoutSelectors } from '../common'; +export { constants } from '../common'; export { ReportingAPIClient, ReportingPublicPlugin as Plugin }; export function plugin(initializerContext: PluginInitializerContext) { diff --git a/x-pack/plugins/reporting/public/mocks.ts b/x-pack/plugins/reporting/public/mocks.ts index 41b4d26dc5a59..83806455cbfd4 100644 --- a/x-pack/plugins/reporting/public/mocks.ts +++ b/x-pack/plugins/reporting/public/mocks.ts @@ -8,7 +8,6 @@ import { coreMock } from 'src/core/public/mocks'; import { ReportingAPIClient } from './lib/reporting_api_client'; import { ReportingSetup } from '.'; -import { getDefaultLayoutSelectors } from '../common'; import { getSharedComponents } from './shared'; type Setup = jest.Mocked; @@ -17,7 +16,6 @@ const createSetupContract = (): Setup => { const coreSetup = coreMock.createSetup(); const apiClient = new ReportingAPIClient(coreSetup.http, coreSetup.uiSettings, '7.15.0'); return { - getDefaultLayoutSelectors: jest.fn().mockImplementation(getDefaultLayoutSelectors), usesUiCapabilities: jest.fn().mockImplementation(() => true), components: getSharedComponents(coreSetup, apiClient), }; diff --git a/x-pack/plugins/reporting/public/plugin.ts b/x-pack/plugins/reporting/public/plugin.ts index 2529681a6901f..b010acd45c296 100644 --- a/x-pack/plugins/reporting/public/plugin.ts +++ b/x-pack/plugins/reporting/public/plugin.ts @@ -25,7 +25,7 @@ import { } from '../../../../src/plugins/home/public'; import { ManagementSetup, ManagementStart } from '../../../../src/plugins/management/public'; import { LicensingPluginSetup, LicensingPluginStart } from '../../licensing/public'; -import { constants, getDefaultLayoutSelectors } from '../common'; +import { constants } from '../common'; import { durationToNumber } from '../common/schema_utils'; import { JobId, JobSummarySet } from '../common/types'; import { ReportingSetup, ReportingStart } from './'; @@ -121,7 +121,6 @@ export class ReportingPublicPlugin private getContract(core?: CoreSetup) { if (core) { this.contract = { - getDefaultLayoutSelectors, usesUiCapabilities: () => this.config.roles?.enabled === false, components: getSharedComponents(core, this.getApiClient(core.http, core.uiSettings)), }; diff --git a/x-pack/plugins/reporting/public/share_context_menu/__snapshots__/screen_capture_panel_content.test.tsx.snap b/x-pack/plugins/reporting/public/share_context_menu/__snapshots__/screen_capture_panel_content.test.tsx.snap index 6f0fc18e90adc..969963fd3ca77 100644 --- a/x-pack/plugins/reporting/public/share_context_menu/__snapshots__/screen_capture_panel_content.test.tsx.snap +++ b/x-pack/plugins/reporting/public/share_context_menu/__snapshots__/screen_capture_panel_content.test.tsx.snap @@ -349,7 +349,7 @@ exports[`ScreenCapturePanelContent properly renders a view with "canvas" layout { dimensions = { height, width }; } - let selectors = outerLayout?.selectors; - if (!selectors) { - selectors = getDefaultLayoutSelectors(); - } - if (this.state.usePrintLayout) { - return { id: 'print', dimensions, selectors }; + return { id: 'print', dimensions }; } if (this.state.useCanvasLayout) { - return { id: 'canvas', dimensions, selectors }; + return { id: 'canvas', dimensions }; } - return { id: 'preserve_layout', dimensions, selectors }; + return { id: 'preserve_layout', dimensions }; }; private getJobParams = () => { diff --git a/x-pack/plugins/reporting/server/export_types/common/generate_png.ts b/x-pack/plugins/reporting/server/export_types/common/generate_png.ts index 1cc1b15dbdfba..b6f9c3fba8ea9 100644 --- a/x-pack/plugins/reporting/server/export_types/common/generate_png.ts +++ b/x-pack/plugins/reporting/server/export_types/common/generate_png.ts @@ -32,7 +32,7 @@ export async function generatePngObservableFactory(reporting: ReportingCore) { if (!layoutParams || !layoutParams.dimensions) { throw new Error(`LayoutParams.Dimensions is undefined.`); } - const layout = new PreserveLayout(layoutParams.dimensions, layoutParams.selectors); + const layout = new PreserveLayout(layoutParams.dimensions); if (apmLayout) apmLayout.end(); const apmScreenshots = apmTrans?.startSpan('screenshots_pipeline', 'setup'); diff --git a/x-pack/plugins/reporting/server/lib/layouts/index.ts b/x-pack/plugins/reporting/server/lib/layouts/index.ts index e7ded2c003e7a..9729508f955c7 100644 --- a/x-pack/plugins/reporting/server/lib/layouts/index.ts +++ b/x-pack/plugins/reporting/server/lib/layouts/index.ts @@ -6,21 +6,22 @@ */ import { LevelLogger } from '../'; -import { LayoutSelectorDictionary, Size } from '../../../common/types'; +import { Size } from '../../../common/types'; import { HeadlessChromiumDriver } from '../../browsers'; import type { Layout } from './layout'; -export { - LayoutParams, - LayoutSelectorDictionary, - PageSizeParams, - PdfImageSize, - Size, -} from '../../../common/types'; +export interface LayoutSelectorDictionary { + screenshot: string; + renderComplete: string; + itemsCountAttribute: string; + timefilterDurationAttribute: string; +} + +export { LayoutParams, PageSizeParams, PdfImageSize, Size } from '../../../common/types'; +export { CanvasLayout } from './canvas_layout'; export { createLayout } from './create_layout'; export type { Layout } from './layout'; export { PreserveLayout } from './preserve_layout'; -export { CanvasLayout } from './canvas_layout'; export { PrintLayout } from './print_layout'; export const LayoutTypes = { diff --git a/x-pack/plugins/reporting/server/lib/layouts/preserve_layout.ts b/x-pack/plugins/reporting/server/lib/layouts/preserve_layout.ts index 9b76b37f677a8..9833f340d47f3 100644 --- a/x-pack/plugins/reporting/server/lib/layouts/preserve_layout.ts +++ b/x-pack/plugins/reporting/server/lib/layouts/preserve_layout.ts @@ -7,33 +7,28 @@ import path from 'path'; import { CustomPageSize } from 'pdfmake/interfaces'; -import { getDefaultLayoutSelectors } from '../../../common'; import { LAYOUT_TYPES } from '../../../common/constants'; -import { LayoutSelectorDictionary, PageSizeParams, Size } from '../../../common/types'; -import type { LayoutInstance } from './'; +import { PageSizeParams, Size } from '../../../common/types'; +import { getDefaultLayoutSelectors, LayoutInstance } from './'; import { Layout } from './layout'; // We use a zoom of two to bump up the resolution of the screenshot a bit. const ZOOM: number = 2; export class PreserveLayout extends Layout implements LayoutInstance { - public readonly selectors: LayoutSelectorDictionary = getDefaultLayoutSelectors(); + public readonly selectors = getDefaultLayoutSelectors(); public readonly groupCount = 1; public readonly height: number; public readonly width: number; private readonly scaledHeight: number; private readonly scaledWidth: number; - constructor(size: Size, layoutSelectors?: LayoutSelectorDictionary) { + constructor(size: Size) { super(LAYOUT_TYPES.PRESERVE_LAYOUT); this.height = size.height; this.width = size.width; this.scaledHeight = size.height * ZOOM; this.scaledWidth = size.width * ZOOM; - - if (layoutSelectors) { - this.selectors = layoutSelectors; - } } public getCssOverridesPath() { diff --git a/x-pack/plugins/reporting/server/lib/layouts/print_layout.ts b/x-pack/plugins/reporting/server/lib/layouts/print_layout.ts index 77700cd085a52..03feb36496349 100644 --- a/x-pack/plugins/reporting/server/lib/layouts/print_layout.ts +++ b/x-pack/plugins/reporting/server/lib/layouts/print_layout.ts @@ -9,18 +9,17 @@ import path from 'path'; import { PageOrientation, PredefinedPageSize } from 'pdfmake/interfaces'; import { EvaluateFn, SerializableOrJSHandle } from 'puppeteer'; import { LevelLogger } from '../'; -import { getDefaultLayoutSelectors } from '../../../common'; import { LAYOUT_TYPES } from '../../../common/constants'; -import { LayoutSelectorDictionary, Size } from '../../../common/types'; +import { Size } from '../../../common/types'; import { HeadlessChromiumDriver } from '../../browsers'; import { CaptureConfig } from '../../types'; -import type { LayoutInstance } from './'; +import { getDefaultLayoutSelectors, LayoutInstance, LayoutSelectorDictionary } from './'; import { Layout } from './layout'; export class PrintLayout extends Layout implements LayoutInstance { public readonly selectors: LayoutSelectorDictionary = { ...getDefaultLayoutSelectors(), - screenshot: '[data-shared-item]', + screenshot: '[data-shared-item]', // override '[data-shared-items-container]' }; public readonly groupCount = 2; private captureConfig: CaptureConfig; From 9d4c062e6448943482890753a694f6cfc6ae41f4 Mon Sep 17 00:00:00 2001 From: Angela Chuang <6295984+angorayc@users.noreply.github.com> Date: Thu, 19 Aug 2021 17:35:28 +0100 Subject: [PATCH 02/44] [Security Solution] TopN chart styling issue (#109007) * fix topN style * add unit tests for topN * add unit tests * review --- .../hover_actions/actions/show_top_n.test.tsx | 166 ++++++++++++++++++ .../hover_actions/actions/show_top_n.tsx | 93 +++++++--- .../use_hover_action_items.test.tsx | 115 ++++++++++++ .../hover_actions/use_hover_action_items.tsx | 15 +- .../lib/cell_actions/default_cell_actions.tsx | 1 + .../hover_actions/actions/overflow.tsx | 8 +- 6 files changed, 361 insertions(+), 37 deletions(-) create mode 100644 x-pack/plugins/security_solution/public/common/components/hover_actions/actions/show_top_n.test.tsx create mode 100644 x-pack/plugins/security_solution/public/common/components/hover_actions/use_hover_action_items.test.tsx diff --git a/x-pack/plugins/security_solution/public/common/components/hover_actions/actions/show_top_n.test.tsx b/x-pack/plugins/security_solution/public/common/components/hover_actions/actions/show_top_n.test.tsx new file mode 100644 index 0000000000000..06b90a129136b --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/hover_actions/actions/show_top_n.test.tsx @@ -0,0 +1,166 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { EuiButtonEmpty, EuiContextMenuItem } from '@elastic/eui'; +import { mount } from 'enzyme'; +import React from 'react'; +import { TestProviders } from '../../../mock'; +import { ShowTopNButton } from './show_top_n'; + +describe('show topN button', () => { + const defaultProps = { + field: 'signal.rule.name', + onClick: jest.fn(), + ownFocus: false, + showTopN: false, + timelineId: 'timeline-1', + value: ['rule_name'], + }; + + describe('button', () => { + test('should show EuiButtonIcon by default', () => { + const wrapper = mount( + + + + ); + expect(wrapper.find('EuiButtonIcon').exists()).toBeTruthy(); + expect(wrapper.find('[data-test-subj="show-top-field"]').first().prop('iconType')).toEqual( + 'visBarVertical' + ); + }); + + test('should support EuiButtonEmpty', () => { + const testProps = { + ...defaultProps, + Component: EuiButtonEmpty, + }; + const wrapper = mount( + + + + ); + expect(wrapper.find('EuiButtonIcon').exists()).toBeFalsy(); + expect(wrapper.find('EuiButtonEmpty').exists()).toBeTruthy(); + expect(wrapper.find('[data-test-subj="show-top-field"]').first().prop('iconType')).toEqual( + 'visBarVertical' + ); + }); + + test('should support EuiContextMenuItem', () => { + const testProps = { + ...defaultProps, + Component: EuiContextMenuItem, + }; + const wrapper = mount( + + + + ); + expect(wrapper.find('EuiButtonIcon').exists()).toBeFalsy(); + expect(wrapper.find('EuiContextMenuItem').exists()).toBeTruthy(); + expect(wrapper.find('[data-test-subj="show-top-field"]').first().prop('icon')).toEqual( + 'visBarVertical' + ); + }); + }); + + describe('tooltip', () => { + test('should show tooltip by default', () => { + const wrapper = mount( + + + + ); + expect(wrapper.find('EuiToolTip').exists()).toBeTruthy(); + }); + + test('should hide tooltip when topN is showed', () => { + const testProps = { + ...defaultProps, + showTopN: true, + }; + const wrapper = mount( + + + + ); + expect(wrapper.find('EuiToolTip').exists()).toBeFalsy(); + }); + + test('should hide tooltip by setting showTooltip to false', () => { + const testProps = { + ...defaultProps, + showTooltip: false, + }; + const wrapper = mount( + + + + ); + expect(wrapper.find('EuiToolTip').exists()).toBeFalsy(); + }); + }); + + describe('popover', () => { + test('should be able to show topN without a popover', () => { + const testProps = { + ...defaultProps, + enablePopOver: false, + showTopN: true, + }; + const wrapper = mount( + + + + ); + expect(wrapper.find('[data-test-subj="top-n"]').exists()).toBeTruthy(); + expect(wrapper.find('[data-test-subj="showTopNContainer"]').exists()).toBeFalsy(); + }); + test('should be able to show topN within a popover', () => { + const testProps = { + ...defaultProps, + enablePopOver: true, + showTopN: true, + }; + const wrapper = mount( + + + + ); + expect(wrapper.find('[data-test-subj="top-n"]').exists()).toBeTruthy(); + expect(wrapper.find('[data-test-subj="showTopNContainer"]').exists()).toBeTruthy(); + }); + }); + + describe('topN', () => { + test('should render with correct props', () => { + const onFilterAdded = jest.fn(); + const testProps = { + ...defaultProps, + enablePopOver: true, + showTopN: true, + onFilterAdded, + }; + const wrapper = mount( + + + + ); + expect(wrapper.find('[data-test-subj="top-n"]').prop('field')).toEqual(testProps.field); + expect(wrapper.find('[data-test-subj="top-n"]').prop('value')).toEqual(testProps.value); + expect(wrapper.find('[data-test-subj="top-n"]').prop('toggleTopN')).toEqual( + testProps.onClick + ); + expect(wrapper.find('[data-test-subj="top-n"]').prop('timelineId')).toEqual( + testProps.timelineId + ); + expect(wrapper.find('[data-test-subj="top-n"]').prop('onFilterAdded')).toEqual( + testProps.onFilterAdded + ); + }); + }); +}); diff --git a/x-pack/plugins/security_solution/public/common/components/hover_actions/actions/show_top_n.tsx b/x-pack/plugins/security_solution/public/common/components/hover_actions/actions/show_top_n.tsx index dbb00eb90e2af..0d6e59483fbc4 100644 --- a/x-pack/plugins/security_solution/public/common/components/hover_actions/actions/show_top_n.tsx +++ b/x-pack/plugins/security_solution/public/common/components/hover_actions/actions/show_top_n.tsx @@ -6,7 +6,13 @@ */ import React, { useMemo } from 'react'; -import { EuiButtonEmpty, EuiButtonIcon, EuiContextMenuItem, EuiToolTip } from '@elastic/eui'; +import { + EuiButtonEmpty, + EuiPopover, + EuiButtonIcon, + EuiContextMenuItem, + EuiToolTip, +} from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { StatefulTopN } from '../../top_n'; import { TimelineId } from '../../../../../common/types/timeline'; @@ -23,8 +29,11 @@ const SHOW_TOP = (fieldName: string) => }); interface Props { - /** `Component` is only used with `EuiDataGrid`; the grid keeps a reference to `Component` for show / hide functionality */ + /** When `Component` is used with `EuiDataGrid`; the grid keeps a reference to `Component` for show / hide functionality. + * When `Component` is used with `EuiContextMenu`, we pass EuiContextMenuItem to render the right style. + */ Component?: typeof EuiButtonEmpty | typeof EuiButtonIcon | typeof EuiContextMenuItem; + enablePopOver?: boolean; field: string; onClick: () => void; onFilterAdded?: () => void; @@ -38,6 +47,7 @@ interface Props { export const ShowTopNButton: React.FC = React.memo( ({ Component, + enablePopOver, field, onClick, onFilterAdded, @@ -58,7 +68,7 @@ export const ShowTopNButton: React.FC = React.memo( : SourcererScopeName.default; const { browserFields, indexPattern } = useSourcererScope(activeScope); - const button = useMemo( + const basicButton = useMemo( () => Component ? ( = React.memo( [Component, field, onClick] ); + const button = useMemo( + () => + showTooltip && !showTopN ? ( + + } + > + {basicButton} + + ) : ( + basicButton + ), + [basicButton, field, ownFocus, showTooltip, showTopN, value] + ); + + const topNPannel = useMemo( + () => ( + + ), + [browserFields, field, indexPattern, onClick, onFilterAdded, timelineId, value] + ); + return showTopN ? ( - - ) : showTooltip ? ( - - } - > - {button} - + enablePopOver ? ( + + {topNPannel} + + ) : ( + topNPannel + ) ) : ( button ); diff --git a/x-pack/plugins/security_solution/public/common/components/hover_actions/use_hover_action_items.test.tsx b/x-pack/plugins/security_solution/public/common/components/hover_actions/use_hover_action_items.test.tsx new file mode 100644 index 0000000000000..2ef72571cf307 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/hover_actions/use_hover_action_items.test.tsx @@ -0,0 +1,115 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { useRef } from 'react'; +import { renderHook, act } from '@testing-library/react-hooks'; +import { useHoverActionItems, UseHoverActionItemsProps } from './use_hover_action_items'; +import { useDeepEqualSelector } from '../../hooks/use_selector'; +import { DataProvider } from '../../../../common/types/timeline'; + +jest.mock('../../lib/kibana'); +jest.mock('../../hooks/use_selector'); +jest.mock('../../containers/sourcerer', () => ({ + useSourcererScope: jest.fn().mockReturnValue({ browserFields: {} }), +})); + +describe('useHoverActionItems', () => { + const defaultProps: UseHoverActionItemsProps = ({ + dataProvider: [{} as DataProvider], + defaultFocusedButtonRef: null, + field: 'signal.rule.name', + handleHoverActionClicked: jest.fn(), + isObjectArray: true, + ownFocus: false, + showTopN: false, + stKeyboardEvent: undefined, + toggleColumn: jest.fn(), + toggleTopN: jest.fn(), + values: ['rule name'], + } as unknown) as UseHoverActionItemsProps; + + beforeEach(() => { + (useDeepEqualSelector as jest.Mock).mockImplementation((cb) => { + return cb(); + }); + }); + afterEach(() => { + (useDeepEqualSelector as jest.Mock).mockClear(); + }); + + test('should return allActionItems', async () => { + await act(async () => { + const { result, waitForNextUpdate } = renderHook(() => { + const defaultFocusedButtonRef = useRef(null); + const testProps = { + ...defaultProps, + defaultFocusedButtonRef, + }; + return useHoverActionItems(testProps); + }); + await waitForNextUpdate(); + + expect(result.current.allActionItems).toHaveLength(6); + expect(result.current.allActionItems[0].props['data-test-subj']).toEqual( + 'hover-actions-filter-for' + ); + expect(result.current.allActionItems[1].props['data-test-subj']).toEqual( + 'hover-actions-filter-out' + ); + expect(result.current.allActionItems[2].props['data-test-subj']).toEqual( + 'hover-actions-toggle-column' + ); + expect(result.current.allActionItems[3].props['data-test-subj']).toEqual( + 'hover-actions-add-timeline' + ); + expect(result.current.allActionItems[4].props['data-test-subj']).toEqual( + 'hover-actions-show-top-n' + ); + expect(result.current.allActionItems[5].props['data-test-subj']).toEqual( + 'hover-actions-copy-button' + ); + }); + }); + + test('should return overflowActionItems', async () => { + await act(async () => { + const { result, waitForNextUpdate } = renderHook(() => { + const defaultFocusedButtonRef = useRef(null); + const testProps = { + ...defaultProps, + defaultFocusedButtonRef, + enableOverflowButton: true, + }; + return useHoverActionItems(testProps); + }); + await waitForNextUpdate(); + + expect(result.current.overflowActionItems).toHaveLength(3); + expect(result.current.overflowActionItems[0].props['data-test-subj']).toEqual( + 'hover-actions-filter-for' + ); + expect(result.current.overflowActionItems[1].props['data-test-subj']).toEqual( + 'hover-actions-filter-out' + ); + expect(result.current.overflowActionItems[2].props['data-test-subj']).toEqual( + 'more-actions-signal.rule.name' + ); + expect(result.current.overflowActionItems[2].props.items[0].props['data-test-subj']).toEqual( + 'hover-actions-toggle-column' + ); + + expect(result.current.overflowActionItems[2].props.items[1].props['data-test-subj']).toEqual( + 'hover-actions-add-timeline' + ); + expect(result.current.overflowActionItems[2].props.items[2].props['data-test-subj']).toEqual( + 'hover-actions-show-top-n' + ); + expect(result.current.overflowActionItems[2].props.items[3].props['data-test-subj']).toEqual( + 'hover-actions-copy-button' + ); + }); + }); +}); diff --git a/x-pack/plugins/security_solution/public/common/components/hover_actions/use_hover_action_items.tsx b/x-pack/plugins/security_solution/public/common/components/hover_actions/use_hover_action_items.tsx index c8dc7b59b8a7d..a7e4a528ca1b8 100644 --- a/x-pack/plugins/security_solution/public/common/components/hover_actions/use_hover_action_items.tsx +++ b/x-pack/plugins/security_solution/public/common/components/hover_actions/use_hover_action_items.tsx @@ -21,7 +21,7 @@ import { useSourcererScope } from '../../containers/sourcerer'; import { timelineSelectors } from '../../../timelines/store/timeline'; import { ShowTopNButton } from './actions/show_top_n'; -interface UseHoverActionItemsProps { +export interface UseHoverActionItemsProps { dataProvider?: DataProvider | DataProvider[]; dataType?: string; defaultFocusedButtonRef: React.MutableRefObject; @@ -43,7 +43,7 @@ interface UseHoverActionItemsProps { values?: string[] | string | null; } -interface UseHoverActionItems { +export interface UseHoverActionItems { overflowActionItems: JSX.Element[]; allActionItems: JSX.Element[]; } @@ -116,7 +116,6 @@ export const useHoverActionItems = ({ */ const showFilters = values != null && (enableOverflowButton || (!showTopN && !enableOverflowButton)); - const allItems = useMemo( () => [ @@ -243,7 +242,7 @@ export const useHoverActionItems = ({ ] ) as JSX.Element[]; - const overflowBtn = useMemo( + const showTopNBtn = useMemo( () => ( (showTopN ? [overflowBtn] : allItems), [ + const allActionItems = useMemo(() => (showTopN ? [showTopNBtn] : allItems), [ allItems, - overflowBtn, + showTopNBtn, showTopN, ]); diff --git a/x-pack/plugins/security_solution/public/common/lib/cell_actions/default_cell_actions.tsx b/x-pack/plugins/security_solution/public/common/lib/cell_actions/default_cell_actions.tsx index 951d921653c15..085b2098cde35 100644 --- a/x-pack/plugins/security_solution/public/common/lib/cell_actions/default_cell_actions.tsx +++ b/x-pack/plugins/security_solution/public/common/lib/cell_actions/default_cell_actions.tsx @@ -140,6 +140,7 @@ export const defaultCellActions: TGridCellAction[] = [ }) && ( = React.memo( ({ closePopOver, @@ -91,9 +96,10 @@ const OverflowButton: React.FC = React.memo( isOpen={isOverflowPopoverOpen} closePopover={closePopOver} panelPaddingSize="none" + panelClassName="withHoverActions__popover" anchorPosition="downLeft" > - + ), [ From 7e2bd4fd54618be4e778d4bf6851b046d105f76e Mon Sep 17 00:00:00 2001 From: Spencer Date: Thu, 19 Aug 2021 09:40:23 -0700 Subject: [PATCH 03/44] [ftr] rework ciGroup validation to remove JOBS.yml and avoid duplication (#109149) Co-authored-by: spalger --- .ci/ci_groups.yml | 29 +++++++++++ .ci/jobs.yml | 41 --------------- .../lib/config/schema.ts | 1 + .../lib/mocha/decorate_mocha_ui.js | 10 +++- .../lib/mocha/load_test_files.js | 1 + .../src/functional_tests/lib/run_ftr.js | 4 +- .../kbn-test/src/functional_tests/tasks.js | 2 +- scripts/ensure_all_tests_in_ci_group.js | 2 +- src/dev/ensure_all_tests_in_ci_group.ts | 52 +++++++++++++++++++ src/dev/run_ensure_all_tests_in_ci_group.js | 50 ------------------ test/api_integration/config.js | 1 + test/examples/config.js | 1 + test/interpreter_functional/config.ts | 1 + test/plugin_functional/config.ts | 1 + test/scripts/jenkins_build_kibana.sh | 19 +------ test/scripts/jenkins_code_coverage.sh | 19 +------ 16 files changed, 101 insertions(+), 133 deletions(-) create mode 100644 .ci/ci_groups.yml delete mode 100644 .ci/jobs.yml create mode 100644 src/dev/ensure_all_tests_in_ci_group.ts delete mode 100644 src/dev/run_ensure_all_tests_in_ci_group.js diff --git a/.ci/ci_groups.yml b/.ci/ci_groups.yml new file mode 100644 index 0000000000000..6d1fb2234406c --- /dev/null +++ b/.ci/ci_groups.yml @@ -0,0 +1,29 @@ +root: + - ciGroup1 + - ciGroup2 + - ciGroup3 + - ciGroup4 + - ciGroup5 + - ciGroup6 + - ciGroup7 + - ciGroup8 + - ciGroup9 + - ciGroup10 + - ciGroup11 + - ciGroup12 + +xpack: + - ciGroup1 + - ciGroup2 + - ciGroup3 + - ciGroup4 + - ciGroup5 + - ciGroup6 + - ciGroup7 + - ciGroup8 + - ciGroup9 + - ciGroup10 + - ciGroup11 + - ciGroup12 + - ciGroup13 + - ciGroupDocker diff --git a/.ci/jobs.yml b/.ci/jobs.yml deleted file mode 100644 index 1440c6870a86d..0000000000000 --- a/.ci/jobs.yml +++ /dev/null @@ -1,41 +0,0 @@ -# This file is needed by node scripts/ensure_all_tests_in_ci_group for the list of ciGroups. That must be changed before this file can be removed - -JOB: - - kibana-intake - - kibana-firefoxSmoke - - kibana-ciGroup1 - - kibana-ciGroup2 - - kibana-ciGroup3 - - kibana-ciGroup4 - - kibana-ciGroup5 - - kibana-ciGroup6 - - kibana-ciGroup7 - - kibana-ciGroup8 - - kibana-ciGroup9 - - kibana-ciGroup10 - - kibana-ciGroup11 - - kibana-ciGroup12 - - kibana-accessibility - - kibana-visualRegression - - # make sure all x-pack-ciGroups are listed in test/scripts/jenkins_xpack_ci_group.sh - - x-pack-firefoxSmoke - - x-pack-ciGroup1 - - x-pack-ciGroup2 - - x-pack-ciGroup3 - - x-pack-ciGroup4 - - x-pack-ciGroup5 - - x-pack-ciGroup6 - - x-pack-ciGroup7 - - x-pack-ciGroup8 - - x-pack-ciGroup9 - - x-pack-ciGroup10 - - x-pack-ciGroup11 - - x-pack-ciGroup12 - - x-pack-ciGroup13 - - x-pack-ciGroupDocker - - x-pack-accessibility - - x-pack-visualRegression - -# `~` is yaml for `null` -exclude: ~ diff --git a/packages/kbn-test/src/functional_test_runner/lib/config/schema.ts b/packages/kbn-test/src/functional_test_runner/lib/config/schema.ts index 37bb465e8e5b7..7fae313c68bd3 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/config/schema.ts +++ b/packages/kbn-test/src/functional_test_runner/lib/config/schema.ts @@ -71,6 +71,7 @@ const defaultRelativeToConfigPath = (path: string) => { export const schema = Joi.object() .keys({ + rootTags: Joi.array().items(Joi.string()), testFiles: Joi.array().items(Joi.string()), testRunner: Joi.func(), diff --git a/packages/kbn-test/src/functional_test_runner/lib/mocha/decorate_mocha_ui.js b/packages/kbn-test/src/functional_test_runner/lib/mocha/decorate_mocha_ui.js index 3832dc7c59e19..c6693245da28b 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/mocha/decorate_mocha_ui.js +++ b/packages/kbn-test/src/functional_test_runner/lib/mocha/decorate_mocha_ui.js @@ -21,7 +21,7 @@ function split(arr, fn) { return [a, b]; } -export function decorateMochaUi(log, lifecycle, context, { isDockerGroup }) { +export function decorateMochaUi(log, lifecycle, context, { isDockerGroup, rootTags }) { // incremented at the start of each suite, decremented after // so that in each non-suite call we can know if we are within // a suite, or that when a suite is defined it is within a suite @@ -62,7 +62,13 @@ export function decorateMochaUi(log, lifecycle, context, { isDockerGroup }) { }); const relativeFilePath = relative(REPO_ROOT, this.file); - this._tags = isDockerGroup ? ['ciGroupDocker', relativeFilePath] : [relativeFilePath]; + this._tags = [ + ...(isDockerGroup ? ['ciGroupDocker', relativeFilePath] : [relativeFilePath]), + // we attach the "root tags" to all the child suites of the root suite, so that if they + // need to be excluded they can be removed from the root suite without removing the entire + // root suite + ...(this.parent.root ? [...(rootTags ?? [])] : []), + ]; this.suiteTag = relativeFilePath; // The tag that uniquely targets this suite/file this.tags = (tags) => { const newTags = Array.isArray(tags) ? tags : [tags]; diff --git a/packages/kbn-test/src/functional_test_runner/lib/mocha/load_test_files.js b/packages/kbn-test/src/functional_test_runner/lib/mocha/load_test_files.js index b6cc73cdb08c8..59f8f003004b6 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/mocha/load_test_files.js +++ b/packages/kbn-test/src/functional_test_runner/lib/mocha/load_test_files.js @@ -62,6 +62,7 @@ export const loadTestFiles = ({ const context = decorateMochaUi(log, lifecycle, global, { isDockerGroup, + rootTags: config.get('rootTags'), }); mocha.suite.emit('pre-require', context, path, mocha); diff --git a/packages/kbn-test/src/functional_tests/lib/run_ftr.js b/packages/kbn-test/src/functional_tests/lib/run_ftr.js index b84d01fbebbe1..40937b8b4fc2d 100644 --- a/packages/kbn-test/src/functional_tests/lib/run_ftr.js +++ b/packages/kbn-test/src/functional_tests/lib/run_ftr.js @@ -52,9 +52,9 @@ export async function assertNoneExcluded({ configPath, options }) { throw new CliError(` ${stats.excludedTests.length} tests in the ${configPath} config are excluded when filtering by the tags run on CI. Make sure that all suites are - tagged with one of the following tags, or extend the list of tags in test/scripts/jenkins_xpack.sh + tagged with one of the following tags: - tags: ${JSON.stringify(options.suiteTags)} + ${JSON.stringify(options.suiteTags)} - ${stats.excludedTests.join('\n - ')} `); diff --git a/packages/kbn-test/src/functional_tests/tasks.js b/packages/kbn-test/src/functional_tests/tasks.js index 00b04fcda26db..4d12fb5ea5ec1 100644 --- a/packages/kbn-test/src/functional_tests/tasks.js +++ b/packages/kbn-test/src/functional_tests/tasks.js @@ -55,7 +55,7 @@ const makeSuccessMessage = (options) => { * @property {string} options.esFrom Optionally run from source instead of snapshot */ export async function runTests(options) { - if (!process.env.KBN_NP_PLUGINS_BUILT) { + if (!process.env.KBN_NP_PLUGINS_BUILT && !options.assertNoneExcluded) { const log = options.createLogger(); log.warning('❗️❗️❗️'); log.warning('❗️❗️❗️'); diff --git a/scripts/ensure_all_tests_in_ci_group.js b/scripts/ensure_all_tests_in_ci_group.js index 757e2b28c75e3..7e382c4a20d17 100644 --- a/scripts/ensure_all_tests_in_ci_group.js +++ b/scripts/ensure_all_tests_in_ci_group.js @@ -7,4 +7,4 @@ */ require('../src/setup_node_env'); -require('../src/dev/run_ensure_all_tests_in_ci_group'); +require('../src/dev/ensure_all_tests_in_ci_group').runEnsureAllTestsInCiGroupsCli(); diff --git a/src/dev/ensure_all_tests_in_ci_group.ts b/src/dev/ensure_all_tests_in_ci_group.ts new file mode 100644 index 0000000000000..aeccefae05d2c --- /dev/null +++ b/src/dev/ensure_all_tests_in_ci_group.ts @@ -0,0 +1,52 @@ +/* + * 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 Path from 'path'; +import Fs from 'fs/promises'; + +import execa from 'execa'; +import { safeLoad } from 'js-yaml'; + +import { run, REPO_ROOT } from '@kbn/dev-utils'; +import { schema } from '@kbn/config-schema'; + +const RELATIVE_JOBS_YAML_PATH = '.ci/ci_groups.yml'; +const JOBS_YAML_PATH = Path.resolve(REPO_ROOT, RELATIVE_JOBS_YAML_PATH); +const SCHEMA = schema.object({ + root: schema.arrayOf(schema.string()), + xpack: schema.arrayOf(schema.string()), +}); + +export function runEnsureAllTestsInCiGroupsCli() { + run(async ({ log }) => { + const { root, xpack } = SCHEMA.validate(safeLoad(await Fs.readFile(JOBS_YAML_PATH, 'utf-8'))); + + log.info( + 'validating root tests directory contains all "root" ciGroups from', + RELATIVE_JOBS_YAML_PATH + ); + await execa(process.execPath, [ + 'scripts/functional_tests', + ...root.map((tag) => `--include-tag=${tag}`), + '--include-tag=runOutsideOfCiGroups', + '--assert-none-excluded', + ]); + + log.info( + 'validating x-pack/tests directory contains all "xpack" ciGroups from', + RELATIVE_JOBS_YAML_PATH + ); + await execa(process.execPath, [ + 'x-pack/scripts/functional_tests', + ...xpack.map((tag) => `--include-tag=${tag}`), + '--assert-none-excluded', + ]); + + log.success('all tests are in a valid ciGroup'); + }); +} diff --git a/src/dev/run_ensure_all_tests_in_ci_group.js b/src/dev/run_ensure_all_tests_in_ci_group.js deleted file mode 100644 index b5e4798d8d800..0000000000000 --- a/src/dev/run_ensure_all_tests_in_ci_group.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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 { readFileSync } from 'fs'; -import { resolve } from 'path'; - -import execa from 'execa'; -import { safeLoad } from 'js-yaml'; - -import { run } from '@kbn/dev-utils'; - -const JOBS_YAML = readFileSync(resolve(__dirname, '../../.ci/jobs.yml'), 'utf8'); -const TEST_TAGS = safeLoad(JOBS_YAML) - .JOB.filter((id) => id.startsWith('kibana-ciGroup')) - .map((id) => id.replace(/^kibana-/, '')); - -run(async ({ log }) => { - try { - const result = await execa(process.execPath, [ - 'scripts/functional_test_runner', - ...TEST_TAGS.map((tag) => `--include-tag=${tag}`), - '--config', - 'test/functional/config.js', - '--test-stats', - ]); - const stats = JSON.parse(result.stderr); - - if (stats.excludedTests.length > 0) { - log.error(` - ${stats.excludedTests.length} tests are excluded by the ciGroup tags, make sure that - all test suites have a "ciGroup{X}" tag and that "tasks/functional_test_groups.js" - knows about the tag that you are using. - - tags: ${JSON.stringify({ include: TEST_TAGS })} - - - ${stats.excludedTests.join('\n - ')} - `); - process.exitCode = 1; - return; - } - } catch (error) { - log.error(error.stack); - process.exitCode = 1; - } -}); diff --git a/test/api_integration/config.js b/test/api_integration/config.js index 84fb0b7907c3b..4988094dad7a2 100644 --- a/test/api_integration/config.js +++ b/test/api_integration/config.js @@ -13,6 +13,7 @@ export default async function ({ readConfigFile }) { const functionalConfig = await readConfigFile(require.resolve('../functional/config')); return { + rootTags: ['runOutsideOfCiGroups'], testFiles: [require.resolve('./apis')], services, servers: commonConfig.get('servers'), diff --git a/test/examples/config.js b/test/examples/config.js index 8f123e9e932dc..ee0c3b63b55c1 100644 --- a/test/examples/config.js +++ b/test/examples/config.js @@ -21,6 +21,7 @@ export default async function ({ readConfigFile }) { ); return { + rootTags: ['runOutsideOfCiGroups'], testFiles: [ require.resolve('./hello_world'), require.resolve('./embeddables'), diff --git a/test/interpreter_functional/config.ts b/test/interpreter_functional/config.ts index c0ec982fb98b6..3f9c846a51429 100644 --- a/test/interpreter_functional/config.ts +++ b/test/interpreter_functional/config.ts @@ -20,6 +20,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { ); return { + rootTags: ['runOutsideOfCiGroups'], testFiles: [require.resolve('./test_suites/run_pipeline')], services: functionalConfig.get('services'), pageObjects: functionalConfig.get('pageObjects'), diff --git a/test/plugin_functional/config.ts b/test/plugin_functional/config.ts index e371518ce7fc7..8ac1633e61e49 100644 --- a/test/plugin_functional/config.ts +++ b/test/plugin_functional/config.ts @@ -20,6 +20,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { ); return { + rootTags: ['runOutsideOfCiGroups'], testFiles: [ require.resolve('./test_suites/usage_collection'), require.resolve('./test_suites/telemetry'), diff --git a/test/scripts/jenkins_build_kibana.sh b/test/scripts/jenkins_build_kibana.sh index 4b4dcaa64cd32..0705cb1062d8e 100755 --- a/test/scripts/jenkins_build_kibana.sh +++ b/test/scripts/jenkins_build_kibana.sh @@ -11,24 +11,7 @@ fi export KBN_NP_PLUGINS_BUILT=true echo " -> Ensuring all functional tests are in a ciGroup" -node scripts/ensure_all_tests_in_ci_group; - -echo " -> Ensuring all x-pack functional tests are in a ciGroup" -node x-pack/scripts/functional_tests --assert-none-excluded \ - --include-tag ciGroup1 \ - --include-tag ciGroup2 \ - --include-tag ciGroup3 \ - --include-tag ciGroup4 \ - --include-tag ciGroup5 \ - --include-tag ciGroup6 \ - --include-tag ciGroup7 \ - --include-tag ciGroup8 \ - --include-tag ciGroup9 \ - --include-tag ciGroup10 \ - --include-tag ciGroup11 \ - --include-tag ciGroup12 \ - --include-tag ciGroup13 \ - --include-tag ciGroupDocker +node scripts/ensure_all_tests_in_ci_group # Do not build kibana for code coverage run if [[ -z "$CODE_COVERAGE" ]] ; then diff --git a/test/scripts/jenkins_code_coverage.sh b/test/scripts/jenkins_code_coverage.sh index 98805e1209ec9..0931da5f9c4af 100755 --- a/test/scripts/jenkins_code_coverage.sh +++ b/test/scripts/jenkins_code_coverage.sh @@ -11,21 +11,4 @@ fi export KBN_NP_PLUGINS_BUILT=true echo " -> Ensuring all functional tests are in a ciGroup" -node scripts/ensure_all_tests_in_ci_group; - -echo " -> Ensuring all x-pack functional tests are in a ciGroup" -node x-pack/scripts/functional_tests --assert-none-excluded \ ---include-tag ciGroup1 \ ---include-tag ciGroup2 \ ---include-tag ciGroup3 \ ---include-tag ciGroup4 \ ---include-tag ciGroup5 \ ---include-tag ciGroup6 \ ---include-tag ciGroup7 \ ---include-tag ciGroup8 \ ---include-tag ciGroup9 \ ---include-tag ciGroup10 \ ---include-tag ciGroup11 \ ---include-tag ciGroup12 \ ---include-tag ciGroup13 \ ---include-tag ciGroupDocker +node scripts/ensure_all_tests_in_ci_group From 91d117d095482e668407334339611da212a9264f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20C=C3=B4t=C3=A9?= Date: Thu, 19 Aug 2021 13:08:54 -0400 Subject: [PATCH 04/44] Add `legacyId` field and set to current rule id (#108196) * Initial commit * Rules client to set legacyId when creating a rule in < 8.0.0 * Set legacyId to null on export, change empty state of legacyId from undefined to null * Fix broken tests * Refactor create.test.ts to avoid increasing file size * Fix broken test --- .../server/rules_client/rules_client.ts | 32 +- .../server/rules_client/tests/create.test.ts | 288 ++++++++---------- .../tests/get_alert_instance_summary.test.ts | 1 + .../server/saved_objects/mappings.json | 3 + .../server/saved_objects/migrations.test.ts | 14 + .../server/saved_objects/migrations.ts | 20 ++ .../transform_rule_for_export.test.ts | 3 + .../transform_rule_for_export.ts | 1 + x-pack/plugins/alerting/server/types.ts | 1 + .../spaces_only/tests/alerting/migrations.ts | 21 ++ 10 files changed, 201 insertions(+), 183 deletions(-) diff --git a/x-pack/plugins/alerting/server/rules_client/rules_client.ts b/x-pack/plugins/alerting/server/rules_client/rules_client.ts index 4d191584592a2..486cf086b4a73 100644 --- a/x-pack/plugins/alerting/server/rules_client/rules_client.ts +++ b/x-pack/plugins/alerting/server/rules_client/rules_client.ts @@ -5,6 +5,7 @@ * 2.0. */ +import Semver from 'semver'; import Boom from '@hapi/boom'; import { omit, isEqual, map, uniq, pick, truncate, trim } from 'lodash'; import { i18n } from '@kbn/i18n'; @@ -297,11 +298,13 @@ export class RulesClient { ); const createTime = Date.now(); + const legacyId = Semver.lt(this.kibanaVersion, '8.0.0') ? id : null; const notifyWhen = getAlertNotifyWhenType(data.notifyWhen, data.throttle); const rawAlert: RawAlert = { ...data, ...this.apiKeyAsAlertAttributes(createdAPIKey, username), + legacyId, actions, createdBy: username, updatedBy: username, @@ -1539,36 +1542,29 @@ export class RulesClient { notifyWhen, scheduledTaskId, params, - ...rawAlert + legacyId, // exclude from result because it is an internal variable + executionStatus, + schedule, + actions, + ...partialRawAlert }: Partial, references: SavedObjectReference[] | undefined ): PartialAlert { - // Not the prettiest code here, but if we want to use most of the - // alert fields from the rawAlert using `...rawAlert` kind of access, we - // need to specifically delete the executionStatus as it's a different type - // in RawAlert and Alert. Probably next time we need to do something similar - // here, we should look at redesigning the implementation of this method. - const rawAlertWithoutExecutionStatus: Partial> = { - ...rawAlert, - }; - delete rawAlertWithoutExecutionStatus.executionStatus; - const executionStatus = alertExecutionStatusFromRaw(this.logger, id, rawAlert.executionStatus); - return { id, notifyWhen, - ...rawAlertWithoutExecutionStatus, + ...partialRawAlert, // we currently only support the Interval Schedule type // Once we support additional types, this type signature will likely change - schedule: rawAlert.schedule as IntervalSchedule, - actions: rawAlert.actions - ? this.injectReferencesIntoActions(id, rawAlert.actions, references || []) - : [], + schedule: schedule as IntervalSchedule, + actions: actions ? this.injectReferencesIntoActions(id, actions, references || []) : [], params: this.injectReferencesIntoParams(id, ruleType, params, references || []) as Params, ...(updatedAt ? { updatedAt: new Date(updatedAt) } : {}), ...(createdAt ? { createdAt: new Date(createdAt) } : {}), ...(scheduledTaskId ? { scheduledTaskId } : {}), - ...(executionStatus ? { executionStatus } : {}), + ...(executionStatus + ? { executionStatus: alertExecutionStatusFromRaw(this.logger, id, executionStatus) } + : {}), }; } diff --git a/x-pack/plugins/alerting/server/rules_client/tests/create.test.ts b/x-pack/plugins/alerting/server/rules_client/tests/create.test.ts index 944dcc29ff933..001604d68c46b 100644 --- a/x-pack/plugins/alerting/server/rules_client/tests/create.test.ts +++ b/x-pack/plugins/alerting/server/rules_client/tests/create.test.ts @@ -35,7 +35,7 @@ const authorization = alertingAuthorizationMock.create(); const actionsAuthorization = actionsAuthorizationMock.create(); const auditLogger = auditServiceMock.create().asScoped(httpServerMock.createKibanaRequest()); -const kibanaVersion = 'v7.10.0'; +const kibanaVersion = 'v8.0.0'; const rulesClientParams: jest.Mocked = { taskManager, ruleTypeRegistry, @@ -116,6 +116,19 @@ describe('create()', () => { isPreconfigured: false, }, ]); + taskManager.schedule.mockResolvedValue({ + id: 'task-123', + taskType: 'alerting:123', + scheduledAt: new Date(), + attempts: 1, + status: TaskStatus.Idle, + runAt: new Date(), + startedAt: null, + retryAt: null, + state: {}, + params: {}, + ownerId: null, + }); rulesClientParams.getActionsClient.mockResolvedValue(actionsClient); }); @@ -154,19 +167,6 @@ describe('create()', () => { }, ], }); - taskManager.schedule.mockResolvedValueOnce({ - id: 'task-123', - taskType: 'alerting:123', - scheduledAt: new Date(), - attempts: 1, - status: TaskStatus.Idle, - runAt: new Date(), - startedAt: null, - retryAt: null, - state: {}, - params: {}, - ownerId: null, - }); unsecuredSavedObjectsClient.create.mockResolvedValueOnce({ id: '1', type: 'alert', @@ -319,19 +319,6 @@ describe('create()', () => { }, ], }); - taskManager.schedule.mockResolvedValueOnce({ - id: 'task-123', - taskType: 'alerting:123', - scheduledAt: new Date(), - attempts: 1, - status: TaskStatus.Idle, - runAt: new Date(), - startedAt: null, - retryAt: null, - state: {}, - params: {}, - ownerId: null, - }); unsecuredSavedObjectsClient.create.mockResolvedValueOnce({ id: '1', type: 'alert', @@ -418,8 +405,9 @@ describe('create()', () => { "lastExecutionDate": "2019-02-12T21:01:22.479Z", "status": "pending", }, + "legacyId": null, "meta": Object { - "versionApiKeyLastmodified": "v7.10.0", + "versionApiKeyLastmodified": "v8.0.0", }, "muteAll": false, "mutedInstanceIds": Array [], @@ -524,19 +512,6 @@ describe('create()', () => { }, ], }); - taskManager.schedule.mockResolvedValueOnce({ - id: 'task-123', - taskType: 'alerting:123', - scheduledAt: new Date(), - attempts: 1, - status: TaskStatus.Idle, - runAt: new Date(), - startedAt: null, - retryAt: null, - state: {}, - params: {}, - ownerId: null, - }); const result = await rulesClient.create({ data, options: { id: '123' } }); expect(result.id).toEqual('123'); expect(unsecuredSavedObjectsClient.create.mock.calls[0][2]).toMatchInlineSnapshot(` @@ -553,6 +528,99 @@ describe('create()', () => { `); }); + test('sets legacyId when kibanaVersion is < 8.0.0', async () => { + const customrulesClient = new RulesClient({ + ...rulesClientParams, + kibanaVersion: 'v7.10.0', + }); + const data = getMockData(); + const createdAttributes = { + ...data, + legacyId: '123', + alertTypeId: '123', + schedule: { interval: '10s' }, + params: { + bar: true, + }, + createdAt: '2019-02-12T21:01:22.479Z', + createdBy: 'elastic', + updatedBy: 'elastic', + updatedAt: '2019-02-12T21:01:22.479Z', + muteAll: false, + mutedInstanceIds: [], + actions: [ + { + group: 'default', + actionRef: 'action_0', + actionTypeId: 'test', + params: { + foo: true, + }, + }, + ], + }; + unsecuredSavedObjectsClient.create.mockResolvedValueOnce({ + id: '123', + type: 'alert', + attributes: createdAttributes, + references: [ + { + name: 'action_0', + type: 'action', + id: '1', + }, + ], + }); + const result = await customrulesClient.create({ data, options: { id: '123' } }); + expect(result.id).toEqual('123'); + expect(unsecuredSavedObjectsClient.create.mock.calls[0][1]).toMatchInlineSnapshot(` + Object { + "actions": Array [ + Object { + "actionRef": "action_0", + "actionTypeId": "test", + "group": "default", + "params": Object { + "foo": true, + }, + }, + ], + "alertTypeId": "123", + "apiKey": null, + "apiKeyOwner": null, + "consumer": "bar", + "createdAt": "2019-02-12T21:01:22.479Z", + "createdBy": "elastic", + "enabled": true, + "executionStatus": Object { + "error": null, + "lastExecutionDate": "2019-02-12T21:01:22.479Z", + "status": "pending", + }, + "legacyId": "123", + "meta": Object { + "versionApiKeyLastmodified": "v7.10.0", + }, + "muteAll": false, + "mutedInstanceIds": Array [], + "name": "abc", + "notifyWhen": "onActiveAlert", + "params": Object { + "bar": true, + }, + "schedule": Object { + "interval": "10s", + }, + "tags": Array [ + "foo", + ], + "throttle": null, + "updatedAt": "2019-02-12T21:01:22.479Z", + "updatedBy": "elastic", + } + `); + }); + test('creates an alert with multiple actions', async () => { const data = getMockData({ actions: [ @@ -669,19 +737,6 @@ describe('create()', () => { }, ], }); - taskManager.schedule.mockResolvedValueOnce({ - id: 'task-123', - taskType: 'alerting:123', - scheduledAt: new Date(), - attempts: 1, - status: TaskStatus.Idle, - runAt: new Date(), - startedAt: null, - retryAt: null, - state: {}, - params: {}, - ownerId: null, - }); unsecuredSavedObjectsClient.create.mockResolvedValueOnce({ id: '1', type: 'alert', @@ -878,19 +933,6 @@ describe('create()', () => { }, ], }); - taskManager.schedule.mockResolvedValueOnce({ - id: 'task-123', - taskType: 'alerting:123', - scheduledAt: new Date(), - attempts: 1, - status: TaskStatus.Idle, - runAt: new Date(), - startedAt: null, - retryAt: null, - state: {}, - params: {}, - ownerId: null, - }); unsecuredSavedObjectsClient.create.mockResolvedValueOnce({ id: '1', type: 'alert', @@ -916,12 +958,13 @@ describe('create()', () => { createdAt: '2019-02-12T21:01:22.479Z', createdBy: 'elastic', enabled: true, + legacyId: null, executionStatus: { error: null, lastExecutionDate: '2019-02-12T21:01:22.479Z', status: 'pending', }, - meta: { versionApiKeyLastmodified: 'v7.10.0' }, + meta: { versionApiKeyLastmodified: kibanaVersion }, muteAll: false, mutedInstanceIds: [], name: 'abc', @@ -1055,19 +1098,6 @@ describe('create()', () => { }, ], }); - taskManager.schedule.mockResolvedValueOnce({ - id: 'task-123', - taskType: 'alerting:123', - scheduledAt: new Date(), - attempts: 1, - status: TaskStatus.Idle, - runAt: new Date(), - startedAt: null, - retryAt: null, - state: {}, - params: {}, - ownerId: null, - }); unsecuredSavedObjectsClient.create.mockResolvedValueOnce({ id: '1', type: 'alert', @@ -1089,6 +1119,7 @@ describe('create()', () => { alertTypeId: '123', apiKey: null, apiKeyOwner: null, + legacyId: null, consumer: 'bar', createdAt: '2019-02-12T21:01:22.479Z', createdBy: 'elastic', @@ -1098,7 +1129,7 @@ describe('create()', () => { lastExecutionDate: '2019-02-12T21:01:22.479Z', status: 'pending', }, - meta: { versionApiKeyLastmodified: 'v7.10.0' }, + meta: { versionApiKeyLastmodified: kibanaVersion }, muteAll: false, mutedInstanceIds: [], name: 'abc', @@ -1189,19 +1220,6 @@ describe('create()', () => { }, ], }); - taskManager.schedule.mockResolvedValueOnce({ - id: 'task-123', - taskType: 'alerting:123', - scheduledAt: new Date(), - attempts: 1, - status: TaskStatus.Idle, - runAt: new Date(), - startedAt: null, - retryAt: null, - state: {}, - params: {}, - ownerId: null, - }); await rulesClient.create({ data }); expect(rulesClientParams.createAPIKey).toHaveBeenCalledWith('Alerting: 123/my alert name'); @@ -1246,19 +1264,6 @@ describe('create()', () => { }, ], }); - taskManager.schedule.mockResolvedValueOnce({ - id: 'task-123', - taskType: 'alerting:123', - scheduledAt: new Date(), - attempts: 1, - status: TaskStatus.Idle, - runAt: new Date(), - startedAt: null, - retryAt: null, - state: {}, - params: {}, - ownerId: null, - }); const result = await rulesClient.create({ data }); expect(unsecuredSavedObjectsClient.create).toHaveBeenCalledWith( 'alert', @@ -1274,6 +1279,7 @@ describe('create()', () => { alertTypeId: '123', consumer: 'bar', name: 'abc', + legacyId: null, params: { bar: true }, apiKey: null, apiKeyOwner: null, @@ -1283,7 +1289,7 @@ describe('create()', () => { updatedAt: '2019-02-12T21:01:22.479Z', enabled: true, meta: { - versionApiKeyLastmodified: 'v7.10.0', + versionApiKeyLastmodified: kibanaVersion, }, schedule: { interval: '10s' }, throttle: '10m', @@ -1386,19 +1392,6 @@ describe('create()', () => { }, ], }); - taskManager.schedule.mockResolvedValueOnce({ - id: 'task-123', - taskType: 'alerting:123', - scheduledAt: new Date(), - attempts: 1, - status: TaskStatus.Idle, - runAt: new Date(), - startedAt: null, - retryAt: null, - state: {}, - params: {}, - ownerId: null, - }); const result = await rulesClient.create({ data }); expect(unsecuredSavedObjectsClient.create).toHaveBeenCalledWith( 'alert', @@ -1411,6 +1404,7 @@ describe('create()', () => { params: { foo: true }, }, ], + legacyId: null, alertTypeId: '123', consumer: 'bar', name: 'abc', @@ -1423,7 +1417,7 @@ describe('create()', () => { updatedAt: '2019-02-12T21:01:22.479Z', enabled: true, meta: { - versionApiKeyLastmodified: 'v7.10.0', + versionApiKeyLastmodified: kibanaVersion, }, schedule: { interval: '10s' }, throttle: '10m', @@ -1526,19 +1520,6 @@ describe('create()', () => { }, ], }); - taskManager.schedule.mockResolvedValueOnce({ - id: 'task-123', - taskType: 'alerting:123', - scheduledAt: new Date(), - attempts: 1, - status: TaskStatus.Idle, - runAt: new Date(), - startedAt: null, - retryAt: null, - state: {}, - params: {}, - ownerId: null, - }); const result = await rulesClient.create({ data }); expect(unsecuredSavedObjectsClient.create).toHaveBeenCalledWith( 'alert', @@ -1551,6 +1532,7 @@ describe('create()', () => { params: { foo: true }, }, ], + legacyId: null, alertTypeId: '123', consumer: 'bar', name: 'abc', @@ -1563,7 +1545,7 @@ describe('create()', () => { updatedAt: '2019-02-12T21:01:22.479Z', enabled: true, meta: { - versionApiKeyLastmodified: 'v7.10.0', + versionApiKeyLastmodified: kibanaVersion, }, schedule: { interval: '10s' }, throttle: null, @@ -1826,19 +1808,6 @@ describe('create()', () => { }, ], }); - taskManager.schedule.mockResolvedValueOnce({ - id: 'task-123', - taskType: 'alerting:123', - scheduledAt: new Date(), - attempts: 1, - status: TaskStatus.Idle, - runAt: new Date(), - startedAt: null, - retryAt: null, - state: {}, - params: {}, - ownerId: null, - }); unsecuredSavedObjectsClient.create.mockResolvedValueOnce({ id: '1', type: 'alert', @@ -1871,6 +1840,7 @@ describe('create()', () => { alertTypeId: '123', consumer: 'bar', name: 'abc', + legacyId: null, params: { bar: true }, apiKey: Buffer.from('123:abc').toString('base64'), apiKeyOwner: 'elastic', @@ -1880,7 +1850,7 @@ describe('create()', () => { updatedAt: '2019-02-12T21:01:22.479Z', enabled: true, meta: { - versionApiKeyLastmodified: 'v7.10.0', + versionApiKeyLastmodified: kibanaVersion, }, schedule: { interval: '10s' }, throttle: null, @@ -1937,19 +1907,6 @@ describe('create()', () => { }, ], }); - taskManager.schedule.mockResolvedValueOnce({ - id: 'task-123', - taskType: 'alerting:123', - scheduledAt: new Date(), - attempts: 1, - status: TaskStatus.Idle, - runAt: new Date(), - startedAt: null, - retryAt: null, - state: {}, - params: {}, - ownerId: null, - }); unsecuredSavedObjectsClient.create.mockResolvedValueOnce({ id: '1', type: 'alert', @@ -1979,6 +1936,7 @@ describe('create()', () => { params: { foo: true }, }, ], + legacyId: null, alertTypeId: '123', consumer: 'bar', name: 'abc', @@ -1991,7 +1949,7 @@ describe('create()', () => { updatedAt: '2019-02-12T21:01:22.479Z', enabled: false, meta: { - versionApiKeyLastmodified: 'v7.10.0', + versionApiKeyLastmodified: kibanaVersion, }, schedule: { interval: '10s' }, throttle: null, diff --git a/x-pack/plugins/alerting/server/rules_client/tests/get_alert_instance_summary.test.ts b/x-pack/plugins/alerting/server/rules_client/tests/get_alert_instance_summary.test.ts index d946c354872a7..f8414b08f191b 100644 --- a/x-pack/plugins/alerting/server/rules_client/tests/get_alert_instance_summary.test.ts +++ b/x-pack/plugins/alerting/server/rules_client/tests/get_alert_instance_summary.test.ts @@ -72,6 +72,7 @@ const BaseAlertInstanceSummarySavedObject: SavedObject = { tags: ['tag-1', 'tag-2'], alertTypeId: '123', consumer: 'alert-consumer', + legacyId: null, schedule: { interval: `${AlertInstanceSummaryIntervalSeconds}s` }, actions: [], params: {}, diff --git a/x-pack/plugins/alerting/server/saved_objects/mappings.json b/x-pack/plugins/alerting/server/saved_objects/mappings.json index 43292c6a54346..21d7a05f2a76d 100644 --- a/x-pack/plugins/alerting/server/saved_objects/mappings.json +++ b/x-pack/plugins/alerting/server/saved_objects/mappings.json @@ -28,6 +28,9 @@ "consumer": { "type": "keyword" }, + "legacyId": { + "type": "keyword" + }, "actions": { "type": "nested", "properties": { diff --git a/x-pack/plugins/alerting/server/saved_objects/migrations.test.ts b/x-pack/plugins/alerting/server/saved_objects/migrations.test.ts index b1460a5fe5cd8..c9a9d7c73a8a6 100644 --- a/x-pack/plugins/alerting/server/saved_objects/migrations.test.ts +++ b/x-pack/plugins/alerting/server/saved_objects/migrations.test.ts @@ -1416,6 +1416,20 @@ describe('successful migrations', () => { }); }); }); + + describe('7.16.0', () => { + test('add legacyId field to alert - set to SavedObject id attribute', () => { + const migration716 = getMigrations(encryptedSavedObjectsSetup)['7.16.0']; + const alert = getMockData({}, true); + expect(migration716(alert, migrationContext)).toEqual({ + ...alert, + attributes: { + ...alert.attributes, + legacyId: alert.id, + }, + }); + }); + }); }); describe('handles errors during migrations', () => { diff --git a/x-pack/plugins/alerting/server/saved_objects/migrations.ts b/x-pack/plugins/alerting/server/saved_objects/migrations.ts index 6823a9b9b20da..d53943991b215 100644 --- a/x-pack/plugins/alerting/server/saved_objects/migrations.ts +++ b/x-pack/plugins/alerting/server/saved_objects/migrations.ts @@ -99,6 +99,12 @@ export function getMigrations( pipeMigrations(addExceptionListsToReferences) ); + const migrateLegacyIds716 = createEsoMigration( + encryptedSavedObjects, + (doc): doc is SavedObjectUnsanitizedDoc => true, + pipeMigrations(setLegacyId) + ); + return { '7.10.0': executeMigrationWithErrorHandling(migrationWhenRBACWasIntroduced, '7.10.0'), '7.11.0': executeMigrationWithErrorHandling(migrationAlertUpdatedAtAndNotifyWhen, '7.11.0'), @@ -106,6 +112,7 @@ export function getMigrations( '7.13.0': executeMigrationWithErrorHandling(migrationSecurityRules713, '7.13.0'), '7.14.1': executeMigrationWithErrorHandling(migrationSecurityRules714, '7.14.1'), '7.15.0': executeMigrationWithErrorHandling(migrationSecurityRules715, '7.15.0'), + '7.16.0': executeMigrationWithErrorHandling(migrateLegacyIds716, '7.16.0'), }; } @@ -567,6 +574,19 @@ function removeMalformedExceptionsList( } } +function setLegacyId( + doc: SavedObjectUnsanitizedDoc +): SavedObjectUnsanitizedDoc { + const { id } = doc; + return { + ...doc, + attributes: { + ...doc.attributes, + legacyId: id, + }, + }; +} + function pipeMigrations(...migrations: AlertMigration[]): AlertMigration { return (doc: SavedObjectUnsanitizedDoc) => migrations.reduce((migratedDoc, nextMigration) => nextMigration(migratedDoc), doc); diff --git a/x-pack/plugins/alerting/server/saved_objects/transform_rule_for_export.test.ts b/x-pack/plugins/alerting/server/saved_objects/transform_rule_for_export.test.ts index 5997df2895761..8236c4455478c 100644 --- a/x-pack/plugins/alerting/server/saved_objects/transform_rule_for_export.test.ts +++ b/x-pack/plugins/alerting/server/saved_objects/transform_rule_for_export.test.ts @@ -35,6 +35,7 @@ describe('transform rule for export', () => { apiKey: '4tndskbuhewotw4klrhgjewrt9u', apiKeyOwner: 'me', throttle: null, + legacyId: '1', notifyWhen: 'onActionGroupChange', muteAll: false, mutedInstanceIds: [], @@ -66,6 +67,7 @@ describe('transform rule for export', () => { apiKey: null, apiKeyOwner: null, throttle: null, + legacyId: '2', notifyWhen: 'onActionGroupChange', muteAll: false, mutedInstanceIds: [], @@ -90,6 +92,7 @@ describe('transform rule for export', () => { apiKey: null, apiKeyOwner: null, scheduledTaskId: null, + legacyId: null, executionStatus: { status: 'pending', lastExecutionDate: '2020-08-20T19:23:38Z', diff --git a/x-pack/plugins/alerting/server/saved_objects/transform_rule_for_export.ts b/x-pack/plugins/alerting/server/saved_objects/transform_rule_for_export.ts index 707bd84e948bf..97fd226b49e8e 100644 --- a/x-pack/plugins/alerting/server/saved_objects/transform_rule_for_export.ts +++ b/x-pack/plugins/alerting/server/saved_objects/transform_rule_for_export.ts @@ -22,6 +22,7 @@ function transformRuleForExport( ...rule, attributes: { ...rule.attributes, + legacyId: null, enabled: false, apiKey: null, apiKeyOwner: null, diff --git a/x-pack/plugins/alerting/server/types.ts b/x-pack/plugins/alerting/server/types.ts index 8b8fce7a1bf62..67565271fedc8 100644 --- a/x-pack/plugins/alerting/server/types.ts +++ b/x-pack/plugins/alerting/server/types.ts @@ -198,6 +198,7 @@ export interface RawAlert extends SavedObjectAttributes { tags: string[]; alertTypeId: string; consumer: string; + legacyId: string | null; schedule: SavedObjectAttributes; actions: RawAlertAction[]; params: SavedObjectAttributes; diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/migrations.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/migrations.ts index 81b544ac97152..e5852d55e13c6 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/migrations.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/migrations.ts @@ -6,8 +6,10 @@ */ import expect from '@kbn/expect'; +import type { ApiResponse, estypes } from '@elastic/elasticsearch'; import { getUrlPrefix } from '../../../common/lib'; import { FtrProviderContext } from '../../../common/ftr_provider_context'; +import type { RawAlert } from '../../../../../plugins/alerting/server/types'; // eslint-disable-next-line import/no-default-export export default function createGetTests({ getService }: FtrProviderContext) { @@ -197,5 +199,24 @@ export default function createGetTests({ getService }: FtrProviderContext) { }, ]); }); + + it('7.16.0 migrates existing alerts to contain legacyId field', async () => { + const searchResult: ApiResponse> = await es.search({ + index: '.kibana', + body: { + query: { + term: { + _id: 'alert:74f3e6d7-b7bb-477d-ac28-92ee22728e6e', + }, + }, + }, + }); + expect(searchResult.statusCode).to.equal(200); + expect((searchResult.body.hits.total as estypes.SearchTotalHits).value).to.equal(1); + const hit = searchResult.body.hits.hits[0]; + expect((hit!._source!.alert! as RawAlert).legacyId).to.equal( + '74f3e6d7-b7bb-477d-ac28-92ee22728e6e' + ); + }); }); } From 25535e96829db52c9bade8d5a42cd95f83a63ad8 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Thu, 19 Aug 2021 18:21:14 +0100 Subject: [PATCH 05/44] skip flaky suite (#109260) --- x-pack/test/functional/apps/uptime/synthetics_integration.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/test/functional/apps/uptime/synthetics_integration.ts b/x-pack/test/functional/apps/uptime/synthetics_integration.ts index c4996299f0d43..6d468b32d7018 100644 --- a/x-pack/test/functional/apps/uptime/synthetics_integration.ts +++ b/x-pack/test/functional/apps/uptime/synthetics_integration.ts @@ -92,7 +92,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { host, }); - describe('displays custom UI', () => { + // FLAKY: https://github.com/elastic/kibana/issues/109260 + describe.skip('displays custom UI', () => { before(async () => { const version = await uptimeService.syntheticsPackage.getSyntheticsPackageVersion(); await uptimePage.syntheticsIntegration.navigateToPackagePage(version!); From 8d1ebea7db14fd437403bfe32ce8a1d675157a27 Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Thu, 19 Aug 2021 10:23:55 -0700 Subject: [PATCH 06/44] Migrate Stack Management apps to consume internal EuiCodeEditor (#108629) * Migrate Index Management to use internal EuiCodeEditor. * Migrate Rollup to use internal EuiCodeEditor. * Migrate Snapshot and Restore to use internal EuiCodeEditor. * Migrate Watcher to use internal EuiCodeEditor. * Add default setOptions values to EuiCodeEditor. --- .../components/authorization_provider.tsx | 2 +- .../components/code_editor/code_editor.tsx | 7 +++-- .../template_clone.test.tsx | 10 +------ .../template_create.test.tsx | 10 +------ .../template_edit.test.tsx | 10 +------ .../template_form.helpers.ts | 6 ++-- .../component_template_create.test.tsx | 10 +------ .../component_template_edit.test.tsx | 10 +------ .../component_template_form.helpers.ts | 6 ++-- .../components/wizard_steps/step_aliases.tsx | 3 +- .../components/wizard_steps/step_settings.tsx | 3 +- .../index_management/public/shared_imports.ts | 1 + .../index_management/test/global_mocks.tsx | 29 +++++++++++++++++++ .../components/job_details/tabs/tab_json.js | 2 +- .../plugins/rollup/public/shared_imports.ts | 1 + .../repository_edit.test.ts | 2 +- .../type_settings/hdfs_settings.tsx | 2 +- .../steps/step_review.tsx | 2 +- .../steps/step_settings.tsx | 2 +- .../policy_details/tabs/tab_history.tsx | 2 +- .../type_details/default_details.tsx | 3 +- .../snapshot_restore/public/shared_imports.ts | 1 + .../client_integration/watch_edit.test.ts | 2 +- .../json_watch_edit/json_watch_edit_form.tsx | 3 +- .../json_watch_edit_simulate.tsx | 3 +- .../action_fields/webhook_action_fields.tsx | 2 +- .../public/application/shared_imports.ts | 1 + 27 files changed, 66 insertions(+), 69 deletions(-) create mode 100644 x-pack/plugins/index_management/test/global_mocks.tsx diff --git a/src/plugins/es_ui_shared/__packages_do_not_import__/authorization/components/authorization_provider.tsx b/src/plugins/es_ui_shared/__packages_do_not_import__/authorization/components/authorization_provider.tsx index 1352081eaa30b..f29ab120013c6 100644 --- a/src/plugins/es_ui_shared/__packages_do_not_import__/authorization/components/authorization_provider.tsx +++ b/src/plugins/es_ui_shared/__packages_do_not_import__/authorization/components/authorization_provider.tsx @@ -9,7 +9,7 @@ import { HttpSetup } from 'kibana/public'; import React, { createContext, useContext } from 'react'; -import { useRequest } from '../../../public'; +import { useRequest } from '../../../public/request'; import { Privileges, Error as CustomError } from '../types'; diff --git a/src/plugins/es_ui_shared/public/components/code_editor/code_editor.tsx b/src/plugins/es_ui_shared/public/components/code_editor/code_editor.tsx index cae3210857543..6299b473f68df 100644 --- a/src/plugins/es_ui_shared/public/components/code_editor/code_editor.tsx +++ b/src/plugins/es_ui_shared/public/components/code_editor/code_editor.tsx @@ -46,7 +46,7 @@ export interface EuiCodeEditorProps extends SupportedAriaAttributes, Omit { static defaultProps = { - setOptions: {}, + setOptions: { + showLineNumbers: false, + tabSize: 2, + }, }; state: EuiCodeEditorState = { diff --git a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_clone.test.tsx b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_clone.test.tsx index 165a5b3dc8e31..31e65625cfdd0 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_clone.test.tsx +++ b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_clone.test.tsx @@ -8,6 +8,7 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; +import '../../../test/global_mocks'; import { getComposableTemplate } from '../../../test/fixtures'; import { setupEnvironment } from '../helpers'; @@ -30,15 +31,6 @@ jest.mock('@elastic/eui', () => { }} /> ), - // Mocking EuiCodeEditor, which uses React Ace under the hood - EuiCodeEditor: (props: any) => ( - { - props.onChange(syntheticEvent.jsonString); - }} - /> - ), }; }); diff --git a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_create.test.tsx b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_create.test.tsx index 77ce172f3e0db..67c9ed067227d 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_create.test.tsx +++ b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_create.test.tsx @@ -8,6 +8,7 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; +import '../../../test/global_mocks'; import { setupEnvironment } from '../helpers'; import { @@ -34,15 +35,6 @@ jest.mock('@elastic/eui', () => { }} /> ), - // Mocking EuiCodeEditor, which uses React Ace under the hood - EuiCodeEditor: (props: any) => ( - { - props.onChange(syntheticEvent.jsonString); - }} - /> - ), }; }); diff --git a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_edit.test.tsx b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_edit.test.tsx index efb9a8b62429b..98d361f0b9723 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_edit.test.tsx +++ b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_edit.test.tsx @@ -8,6 +8,7 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; +import '../../../test/global_mocks'; import * as fixtures from '../../../test/fixtures'; import { setupEnvironment, BRANCH } from '../helpers'; @@ -41,15 +42,6 @@ jest.mock('@elastic/eui', () => { }} /> ), - // Mocking EuiCodeEditor, which uses React Ace under the hood - EuiCodeEditor: (props: any) => ( - { - props.onChange(syntheticEvent.jsonString); - }} - /> - ), }; }); diff --git a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_form.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_form.helpers.ts index 01aeba31770db..3a8d34c341834 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_form.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_form.helpers.ts @@ -206,7 +206,7 @@ export const formSetup = async (initTestBed: SetupFunc) => { await act(async () => { if (settings) { - find('mockCodeEditor').simulate('change', { + find('settingsEditor').simulate('change', { jsonString: settings, }); // Using mocked EuiCodeEditor } @@ -241,7 +241,7 @@ export const formSetup = async (initTestBed: SetupFunc) => { if (aliases) { await act(async () => { - find('mockCodeEditor').simulate('change', { + find('aliasesEditor').simulate('change', { jsonString: aliases, }); // Using mocked EuiCodeEditor }); @@ -337,4 +337,6 @@ export type TestSubjects = | 'templateFormContainer' | 'testingEditor' | 'versionField' + | 'aliasesEditor' + | 'settingsEditor' | 'versionField.input'; diff --git a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/component_template_create.test.tsx b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/component_template_create.test.tsx index b07cd098e540d..f3957e0cc15c9 100644 --- a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/component_template_create.test.tsx +++ b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/component_template_create.test.tsx @@ -9,6 +9,7 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; import '../../../../../../../../../src/plugins/es_ui_shared/public/components/code_editor/jest_mock'; +import '../../../../../../test/global_mocks'; import { setupEnvironment } from './helpers'; import { setup, ComponentTemplateCreateTestBed } from './helpers/component_template_create.helpers'; @@ -27,15 +28,6 @@ jest.mock('@elastic/eui', () => { }} /> ), - // Mocking EuiCodeEditor, which uses React Ace under the hood - EuiCodeEditor: (props: any) => ( - { - props.onChange(syntheticEvent.jsonString); - }} - /> - ), }; }); diff --git a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/component_template_edit.test.tsx b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/component_template_edit.test.tsx index 60602bcd6dc30..a39baf59d1f05 100644 --- a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/component_template_edit.test.tsx +++ b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/component_template_edit.test.tsx @@ -8,6 +8,7 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; +import '../../../../../../test/global_mocks'; import { setupEnvironment } from './helpers'; import { setup, ComponentTemplateEditTestBed } from './helpers/component_template_edit.helpers'; @@ -26,15 +27,6 @@ jest.mock('@elastic/eui', () => { }} /> ), - // Mocking EuiCodeEditor, which uses React Ace under the hood - EuiCodeEditor: (props: any) => ( - { - props.onChange(syntheticEvent.jsonString); - }} - /> - ), }; }); diff --git a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_form.helpers.ts b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_form.helpers.ts index f8ade2285016c..578a124125107 100644 --- a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_form.helpers.ts +++ b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_form.helpers.ts @@ -65,7 +65,7 @@ export const getFormActions = (testBed: TestBed) => { await act(async () => { if (settings) { - find('mockCodeEditor').simulate('change', { + find('settingsEditor').simulate('change', { jsonString: JSON.stringify(settings), }); // Using mocked EuiCodeEditor } @@ -118,7 +118,7 @@ export const getFormActions = (testBed: TestBed) => { await act(async () => { if (aliases) { - find('mockCodeEditor').simulate('change', { + find('aliasesEditor').simulate('change', { jsonString: JSON.stringify(aliases), }); // Using mocked EuiCodeEditor } @@ -161,4 +161,6 @@ export type ComponentTemplateFormTestSubjects = | 'stepReview.summaryTab' | 'stepReview.requestTab' | 'versionField' + | 'aliasesEditor' + | 'settingsEditor' | 'versionField.input'; diff --git a/x-pack/plugins/index_management/public/application/components/shared/components/wizard_steps/step_aliases.tsx b/x-pack/plugins/index_management/public/application/components/shared/components/wizard_steps/step_aliases.tsx index 1099ecaa7949f..2d7be72056e18 100644 --- a/x-pack/plugins/index_management/public/application/components/shared/components/wizard_steps/step_aliases.tsx +++ b/x-pack/plugins/index_management/public/application/components/shared/components/wizard_steps/step_aliases.tsx @@ -15,12 +15,11 @@ import { EuiSpacer, EuiFormRow, EuiText, - EuiCodeEditor, EuiCode, } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import { Forms } from '../../../../../shared_imports'; +import { EuiCodeEditor, Forms } from '../../../../../shared_imports'; import { useJsonStep } from './use_json_step'; interface Props { diff --git a/x-pack/plugins/index_management/public/application/components/shared/components/wizard_steps/step_settings.tsx b/x-pack/plugins/index_management/public/application/components/shared/components/wizard_steps/step_settings.tsx index e6bec46805169..359e1091c1303 100644 --- a/x-pack/plugins/index_management/public/application/components/shared/components/wizard_steps/step_settings.tsx +++ b/x-pack/plugins/index_management/public/application/components/shared/components/wizard_steps/step_settings.tsx @@ -15,12 +15,11 @@ import { EuiSpacer, EuiFormRow, EuiText, - EuiCodeEditor, EuiCode, } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import { Forms } from '../../../../../shared_imports'; +import { EuiCodeEditor, Forms } from '../../../../../shared_imports'; import { useJsonStep } from './use_json_step'; interface Props { diff --git a/x-pack/plugins/index_management/public/shared_imports.ts b/x-pack/plugins/index_management/public/shared_imports.ts index fa27b22e502fa..275f8af818caf 100644 --- a/x-pack/plugins/index_management/public/shared_imports.ts +++ b/x-pack/plugins/index_management/public/shared_imports.ts @@ -22,6 +22,7 @@ export { PageError, Error, SectionLoading, + EuiCodeEditor, } from '../../../../src/plugins/es_ui_shared/public'; export { diff --git a/x-pack/plugins/index_management/test/global_mocks.tsx b/x-pack/plugins/index_management/test/global_mocks.tsx new file mode 100644 index 0000000000000..342d74bce853e --- /dev/null +++ b/x-pack/plugins/index_management/test/global_mocks.tsx @@ -0,0 +1,29 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; + +// NOTE: Import this file for its side-effects. You must import it before the code that it mocks +// is imported. Typically this means just importing above your other imports. +// See https://jestjs.io/docs/manual-mocks for more info. + +jest.mock('../../../../src/plugins/es_ui_shared/public', () => { + const original = jest.requireActual('../../../../src/plugins/es_ui_shared/public'); + + return { + ...original, + EuiCodeEditor: (props: any) => ( + { + props.onChange(syntheticEvent.jsonString); + }} + /> + ), + }; +}); diff --git a/x-pack/plugins/rollup/public/crud_app/sections/components/job_details/tabs/tab_json.js b/x-pack/plugins/rollup/public/crud_app/sections/components/job_details/tabs/tab_json.js index d57a7d8305d51..adfb9aafc444e 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/components/job_details/tabs/tab_json.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/components/job_details/tabs/tab_json.js @@ -7,7 +7,7 @@ import React from 'react'; -import { EuiCodeEditor } from '@elastic/eui'; +import { EuiCodeEditor } from '../../../../../shared_imports'; export const TabJson = ({ json }) => { const jsonString = JSON.stringify(json, null, 2); diff --git a/x-pack/plugins/rollup/public/shared_imports.ts b/x-pack/plugins/rollup/public/shared_imports.ts index c8d7f1d9f13f3..3478198dd9b68 100644 --- a/x-pack/plugins/rollup/public/shared_imports.ts +++ b/x-pack/plugins/rollup/public/shared_imports.ts @@ -9,4 +9,5 @@ export { extractQueryParams, indices, SectionLoading, + EuiCodeEditor, } from '../../../../src/plugins/es_ui_shared/public'; diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/repository_edit.test.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/repository_edit.test.ts index 2087325056649..8adf1e988ff1e 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/repository_edit.test.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/repository_edit.test.ts @@ -215,7 +215,7 @@ describe('', () => { ); expect(find('readOnlyToggle').props()['aria-checked']).toBe(settings.readonly); - const codeEditor = testBed.component.find('EuiCodeEditor'); + const codeEditor = testBed.component.find('EuiCodeEditor').at(1); expect(JSON.parse(codeEditor.props().value as string)).toEqual({ loadDefault: true, conf1: 'foo', diff --git a/x-pack/plugins/snapshot_restore/public/application/components/repository_form/type_settings/hdfs_settings.tsx b/x-pack/plugins/snapshot_restore/public/application/components/repository_form/type_settings/hdfs_settings.tsx index 5457e22d50b89..2cece7d6d396a 100644 --- a/x-pack/plugins/snapshot_restore/public/application/components/repository_form/type_settings/hdfs_settings.tsx +++ b/x-pack/plugins/snapshot_restore/public/application/components/repository_form/type_settings/hdfs_settings.tsx @@ -10,7 +10,6 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import { EuiCode, - EuiCodeEditor, EuiDescribedFormGroup, EuiFieldText, EuiFormRow, @@ -20,6 +19,7 @@ import { } from '@elastic/eui'; import { HDFSRepository, Repository, SourceRepository } from '../../../../../common/types'; +import { EuiCodeEditor } from '../../../../shared_imports'; import { RepositorySettingsValidation } from '../../../services/validation'; import { ChunkSizeField, MaxSnapshotsField, MaxRestoreField } from './common'; diff --git a/x-pack/plugins/snapshot_restore/public/application/components/restore_snapshot_form/steps/step_review.tsx b/x-pack/plugins/snapshot_restore/public/application/components/restore_snapshot_form/steps/step_review.tsx index 4210279363780..2974a7b686039 100644 --- a/x-pack/plugins/snapshot_restore/public/application/components/restore_snapshot_form/steps/step_review.tsx +++ b/x-pack/plugins/snapshot_restore/public/application/components/restore_snapshot_form/steps/step_review.tsx @@ -8,7 +8,6 @@ import React, { Fragment } from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; import { - EuiCodeEditor, EuiFlexGrid, EuiFlexGroup, EuiFlexItem, @@ -24,6 +23,7 @@ import { EuiToolTip, } from '@elastic/eui'; import { serializeRestoreSettings } from '../../../../../common/lib'; +import { EuiCodeEditor } from '../../../../shared_imports'; import { useServices } from '../../../app_context'; import { StepProps } from './'; import { CollapsibleIndicesList } from '../../collapsible_lists/collapsible_indices_list'; diff --git a/x-pack/plugins/snapshot_restore/public/application/components/restore_snapshot_form/steps/step_settings.tsx b/x-pack/plugins/snapshot_restore/public/application/components/restore_snapshot_form/steps/step_settings.tsx index c37be0907a27a..446e3f4c3c4ab 100644 --- a/x-pack/plugins/snapshot_restore/public/application/components/restore_snapshot_form/steps/step_settings.tsx +++ b/x-pack/plugins/snapshot_restore/public/application/components/restore_snapshot_form/steps/step_settings.tsx @@ -10,7 +10,6 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { EuiButtonEmpty, EuiCode, - EuiCodeEditor, EuiComboBox, EuiDescribedFormGroup, EuiFlexGroup, @@ -23,6 +22,7 @@ import { EuiCallOut, } from '@elastic/eui'; import { RestoreSettings } from '../../../../../common/types'; +import { EuiCodeEditor } from '../../../../shared_imports'; import { REMOVE_INDEX_SETTINGS_SUGGESTIONS } from '../../../constants'; import { useCore, useServices } from '../../../app_context'; import { StepProps } from './'; diff --git a/x-pack/plugins/snapshot_restore/public/application/sections/home/policy_list/policy_details/tabs/tab_history.tsx b/x-pack/plugins/snapshot_restore/public/application/sections/home/policy_list/policy_details/tabs/tab_history.tsx index 733fdc3d7b653..4944d9bde379a 100644 --- a/x-pack/plugins/snapshot_restore/public/application/sections/home/policy_list/policy_details/tabs/tab_history.tsx +++ b/x-pack/plugins/snapshot_restore/public/application/sections/home/policy_list/policy_details/tabs/tab_history.tsx @@ -9,7 +9,6 @@ import React, { Fragment } from 'react'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import { - EuiCodeEditor, EuiFlexGroup, EuiFlexItem, EuiLink, @@ -23,6 +22,7 @@ import { } from '@elastic/eui'; import { SlmPolicy } from '../../../../../../../common/types'; +import { EuiCodeEditor } from '../../../../../../shared_imports'; import { FormattedDateTime } from '../../../../../components'; import { linkToSnapshot } from '../../../../../services/navigation'; import { useServices } from '../../../../../app_context'; diff --git a/x-pack/plugins/snapshot_restore/public/application/sections/home/repository_list/repository_details/type_details/default_details.tsx b/x-pack/plugins/snapshot_restore/public/application/sections/home/repository_list/repository_details/type_details/default_details.tsx index a349853485e45..8cb86fd4952fa 100644 --- a/x-pack/plugins/snapshot_restore/public/application/sections/home/repository_list/repository_details/type_details/default_details.tsx +++ b/x-pack/plugins/snapshot_restore/public/application/sections/home/repository_list/repository_details/type_details/default_details.tsx @@ -9,9 +9,10 @@ import 'brace/theme/textmate'; import React, { Fragment } from 'react'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { EuiCodeEditor, EuiSpacer, EuiTitle } from '@elastic/eui'; +import { EuiSpacer, EuiTitle } from '@elastic/eui'; import { Repository } from '../../../../../../../common/types'; +import { EuiCodeEditor } from '../../../../../../shared_imports'; interface Props { repository: Repository; diff --git a/x-pack/plugins/snapshot_restore/public/shared_imports.ts b/x-pack/plugins/snapshot_restore/public/shared_imports.ts index 84c195a51950b..d1b9f37703c0c 100644 --- a/x-pack/plugins/snapshot_restore/public/shared_imports.ts +++ b/x-pack/plugins/snapshot_restore/public/shared_imports.ts @@ -22,6 +22,7 @@ export { useRequest, UseRequestConfig, WithPrivileges, + EuiCodeEditor, } from '../../../../src/plugins/es_ui_shared/public'; export { APP_WRAPPER_CLASS } from '../../../../src/core/public'; diff --git a/x-pack/plugins/watcher/__jest__/client_integration/watch_edit.test.ts b/x-pack/plugins/watcher/__jest__/client_integration/watch_edit.test.ts index b40388376d8d5..e8782edc829a4 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/watch_edit.test.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/watch_edit.test.ts @@ -66,7 +66,7 @@ describe('', () => { test('should populate the correct values', () => { const { find, exists, component } = testBed; const { watch } = WATCH; - const codeEditor = component.find('EuiCodeEditor'); + const codeEditor = component.find('EuiCodeEditor').at(1); expect(exists('jsonWatchForm')).toBe(true); expect(find('nameInput').props().value).toBe(watch.name); diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/json_watch_edit/json_watch_edit_form.tsx b/x-pack/plugins/watcher/public/application/sections/watch_edit/components/json_watch_edit/json_watch_edit_form.tsx index 0c1d643475566..b19d97f67d2e0 100644 --- a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/json_watch_edit/json_watch_edit_form.tsx +++ b/x-pack/plugins/watcher/public/application/sections/watch_edit/components/json_watch_edit/json_watch_edit_form.tsx @@ -10,7 +10,6 @@ import React, { Fragment, useContext, useState } from 'react'; import { EuiButton, EuiButtonEmpty, - EuiCodeEditor, EuiFieldText, EuiFlexGroup, EuiFlexItem, @@ -25,7 +24,7 @@ import { XJsonMode } from '@kbn/ace'; import { serializeJsonWatch } from '../../../../../../common/lib/serialization'; import { ErrableFormRow, SectionError, Error as ServerError } from '../../../../components'; -import { XJson } from '../../../../shared_imports'; +import { XJson, EuiCodeEditor } from '../../../../shared_imports'; import { onWatchSave } from '../../watch_edit_actions'; import { WatchContext } from '../../watch_context'; import { goToWatchList } from '../../../../lib/navigation'; diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/json_watch_edit/json_watch_edit_simulate.tsx b/x-pack/plugins/watcher/public/application/sections/watch_edit/components/json_watch_edit/json_watch_edit_simulate.tsx index fa5ae53b9c6fa..034c0080c852c 100644 --- a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/json_watch_edit/json_watch_edit_simulate.tsx +++ b/x-pack/plugins/watcher/public/application/sections/watch_edit/components/json_watch_edit/json_watch_edit_simulate.tsx @@ -10,7 +10,6 @@ import React, { Fragment, useContext, useState } from 'react'; import { EuiBasicTable, EuiButton, - EuiCodeEditor, EuiDescribedFormGroup, EuiFieldNumber, EuiFlexGroup, @@ -44,7 +43,7 @@ import { JsonWatchEditSimulateResults } from './json_watch_edit_simulate_results import { getTimeUnitLabel } from '../../../../lib/get_time_unit_label'; import { useAppContext } from '../../../../app_context'; -import { XJson } from '../../../../shared_imports'; +import { XJson, EuiCodeEditor } from '../../../../shared_imports'; const { useXJsonMode } = XJson; diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/action_fields/webhook_action_fields.tsx b/x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/action_fields/webhook_action_fields.tsx index 0199fce195279..bbe5449fa8732 100644 --- a/x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/action_fields/webhook_action_fields.tsx +++ b/x-pack/plugins/watcher/public/application/sections/watch_edit/components/threshold_watch_edit/action_fields/webhook_action_fields.tsx @@ -8,7 +8,6 @@ import React, { Fragment, useEffect } from 'react'; import { - EuiCodeEditor, EuiFieldNumber, EuiFieldPassword, EuiFieldText, @@ -19,6 +18,7 @@ import { EuiSpacer, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; +import { EuiCodeEditor } from '../../../../../shared_imports'; import { ErrableFormRow } from '../../../../../components/form_errors'; import { WebhookAction } from '../../../../../../../common/types/action_types'; diff --git a/x-pack/plugins/watcher/public/application/shared_imports.ts b/x-pack/plugins/watcher/public/application/shared_imports.ts index 44bef3b0c4f5f..977204c627e5c 100644 --- a/x-pack/plugins/watcher/public/application/shared_imports.ts +++ b/x-pack/plugins/watcher/public/application/shared_imports.ts @@ -13,4 +13,5 @@ export { useRequest, XJson, PageError, + EuiCodeEditor, } from '../../../../../src/plugins/es_ui_shared/public'; From 79e63cc6544978dce3e74177638ba59b1286742a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20S=C3=A1nchez?= Date: Thu, 19 Aug 2021 19:45:55 +0200 Subject: [PATCH 07/44] [Security solution] [Endpoint] Remove linked policy from trusted apps when removing endpoint integration (#108347) * Remove policy from trusted app when this is removed from fleet * Fleet: run package delete external callbacks when the Agent Policy is deleted --- .../fleet/register_fleet_policy_callbacks.ts | 9 ++- x-pack/plugins/fleet/common/mocks.ts | 13 +++- x-pack/plugins/fleet/server/mocks/index.ts | 5 +- .../server/routes/package_policy/handlers.ts | 1 + .../server/services/agent_policy.test.ts | 35 +++++++++ .../fleet/server/services/agent_policy.ts | 10 ++- .../server/services/package_policy.test.ts | 78 +++++++++++++++++++ .../fleet/server/services/package_policy.ts | 45 ++++++++--- .../plugins/fleet/server/types/extensions.ts | 6 +- .../endpoint/endpoint_app_context_services.ts | 6 ++ .../fleet_integration.test.ts | 72 ++++++++++++++++- .../fleet_integration/fleet_integration.ts | 23 ++++++ .../remove_policy_from_trusted_apps.ts | 61 +++++++++++++++ 13 files changed, 340 insertions(+), 24 deletions(-) create mode 100644 x-pack/plugins/security_solution/server/fleet_integration/handlers/remove_policy_from_trusted_apps.ts diff --git a/x-pack/plugins/apm/server/lib/fleet/register_fleet_policy_callbacks.ts b/x-pack/plugins/apm/server/lib/fleet/register_fleet_policy_callbacks.ts index 428378178afc8..6fcd0433e2e83 100644 --- a/x-pack/plugins/apm/server/lib/fleet/register_fleet_policy_callbacks.ts +++ b/x-pack/plugins/apm/server/lib/fleet/register_fleet_policy_callbacks.ts @@ -7,8 +7,7 @@ import { APMPlugin, APMRouteHandlerResources } from '../..'; import { - ExternalCallback, - PostPackagePolicyDeleteCallback, + PostPackagePolicyCreateCallback, PutPackagePolicyUpdateCallback, } from '../../../../fleet/server'; import { @@ -60,7 +59,9 @@ export async function registerFleetPolicyCallbacks({ }); } -type ExternalCallbackParams = Parameters; +type ExternalCallbackParams = + | Parameters + | Parameters; export type PackagePolicy = NewPackagePolicy | UpdatePackagePolicy; type Context = ExternalCallbackParams[1]; type Request = ExternalCallbackParams[2]; @@ -81,7 +82,7 @@ function registerPackagePolicyExternalCallback({ logger: NonNullable; }) { const callbackFn: - | PostPackagePolicyDeleteCallback + | PostPackagePolicyCreateCallback | PutPackagePolicyUpdateCallback = async ( packagePolicy: PackagePolicy, context: Context, diff --git a/x-pack/plugins/fleet/common/mocks.ts b/x-pack/plugins/fleet/common/mocks.ts index 7ea4be0ee35c6..eb81ea2d6a0ac 100644 --- a/x-pack/plugins/fleet/common/mocks.ts +++ b/x-pack/plugins/fleet/common/mocks.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { NewPackagePolicy, PackagePolicy } from './types'; +import type { NewPackagePolicy, PackagePolicy, DeletePackagePoliciesResponse } from './types'; export const createNewPackagePolicyMock = (): NewPackagePolicy => { return { @@ -45,3 +45,14 @@ export const createPackagePolicyMock = (): PackagePolicy => { ], }; }; + +export const deletePackagePolicyMock = (): DeletePackagePoliciesResponse => { + const newPackagePolicy = createNewPackagePolicyMock(); + return [ + { + id: 'c6d16e42-c32d-4dce-8a88-113cfe276ad1', + success: true, + package: newPackagePolicy.package, + }, + ]; +}; diff --git a/x-pack/plugins/fleet/server/mocks/index.ts b/x-pack/plugins/fleet/server/mocks/index.ts index 9f07dfac9670b..43b455045e72b 100644 --- a/x-pack/plugins/fleet/server/mocks/index.ts +++ b/x-pack/plugins/fleet/server/mocks/index.ts @@ -62,7 +62,7 @@ export const xpackMocks = { createRequestHandlerContext: createCoreRequestHandlerContextMock, }; -export const createPackagePolicyServiceMock = () => { +export const createPackagePolicyServiceMock = (): jest.Mocked => { return { compilePackagePolicyInputs: jest.fn(), buildPackagePolicyFromPackage: jest.fn(), @@ -75,10 +75,11 @@ export const createPackagePolicyServiceMock = () => { listIds: jest.fn(), update: jest.fn(), runExternalCallbacks: jest.fn(), + runDeleteExternalCallbacks: jest.fn(), upgrade: jest.fn(), getUpgradeDryRunDiff: jest.fn(), getUpgradePackagePolicyInfo: jest.fn(), - } as jest.Mocked; + }; }; /** diff --git a/x-pack/plugins/fleet/server/routes/package_policy/handlers.ts b/x-pack/plugins/fleet/server/routes/package_policy/handlers.ts index b9f0f6c69d4e7..77e7a2c4ede1a 100644 --- a/x-pack/plugins/fleet/server/routes/package_policy/handlers.ts +++ b/x-pack/plugins/fleet/server/routes/package_policy/handlers.ts @@ -181,6 +181,7 @@ export const deletePackagePolicyHandler: RequestHandler< } catch (error) { const logger = appContextService.getLogger(); logger.error(`An error occurred executing external callback: ${error}`); + logger.error(error); } return response.ok({ body, diff --git a/x-pack/plugins/fleet/server/services/agent_policy.test.ts b/x-pack/plugins/fleet/server/services/agent_policy.test.ts index a020b95ca3302..3267b2b7e2665 100644 --- a/x-pack/plugins/fleet/server/services/agent_policy.test.ts +++ b/x-pack/plugins/fleet/server/services/agent_policy.test.ts @@ -12,6 +12,9 @@ import type { AgentPolicy, NewAgentPolicy, Output } from '../types'; import { agentPolicyService } from './agent_policy'; import { agentPolicyUpdateEventHandler } from './agent_policy_update'; +import { getAgentsByKuery } from './agents'; +import { packagePolicyService } from './package_policy'; + function getSavedObjectMock(agentPolicyAttributes: any) { const mock = savedObjectsClientMock.create(); mock.get.mockImplementation(async (type: string, id: string) => { @@ -63,6 +66,8 @@ jest.mock('./output', () => { }); jest.mock('./agent_policy_update'); +jest.mock('./agents'); +jest.mock('./package_policy'); function getAgentPolicyUpdateMock() { return (agentPolicyUpdateEventHandler as unknown) as jest.Mock< @@ -123,6 +128,36 @@ describe('agent policy', () => { }); }); + describe('delete', () => { + let soClient: ReturnType; + let esClient: ReturnType['asInternalUser']; + + beforeEach(() => { + soClient = getSavedObjectMock({ revision: 1, package_policies: ['package-1'] }); + esClient = elasticsearchServiceMock.createClusterClient().asInternalUser; + + (getAgentsByKuery as jest.Mock).mockResolvedValue({ + agents: [], + total: 0, + page: 1, + perPage: 10, + }); + + (packagePolicyService.delete as jest.Mock).mockResolvedValue([ + { + id: 'package-1', + }, + ]); + }); + + it('should run package policy delete external callbacks', async () => { + await agentPolicyService.delete(soClient, esClient, 'mocked'); + expect(packagePolicyService.runDeleteExternalCallbacks).toHaveBeenCalledWith([ + { id: 'package-1' }, + ]); + }); + }); + describe('bumpRevision', () => { it('should call agentPolicyUpdateEventHandler with updated event once', async () => { const soClient = getSavedObjectMock({ diff --git a/x-pack/plugins/fleet/server/services/agent_policy.ts b/x-pack/plugins/fleet/server/services/agent_policy.ts index d3cccd4c07f3c..8539db05ffb54 100644 --- a/x-pack/plugins/fleet/server/services/agent_policy.ts +++ b/x-pack/plugins/fleet/server/services/agent_policy.ts @@ -45,6 +45,7 @@ import type { FleetServerPolicy, Installation, Output, + DeletePackagePoliciesResponse, } from '../../common'; import { AgentPolicyNameExistsError, HostedAgentPolicyRestrictionRelatedError } from '../errors'; import { @@ -616,7 +617,7 @@ class AgentPolicyService { } if (agentPolicy.package_policies && agentPolicy.package_policies.length) { - await packagePolicyService.delete( + const deletedPackagePolicies: DeletePackagePoliciesResponse = await packagePolicyService.delete( soClient, esClient, agentPolicy.package_policies as string[], @@ -624,6 +625,13 @@ class AgentPolicyService { skipUnassignFromAgentPolicies: true, } ); + try { + await packagePolicyService.runDeleteExternalCallbacks(deletedPackagePolicies); + } catch (error) { + const logger = appContextService.getLogger(); + logger.error(`An error occurred executing external callback: ${error}`); + logger.error(error); + } } if (agentPolicy.is_preconfigured) { diff --git a/x-pack/plugins/fleet/server/services/package_policy.test.ts b/x-pack/plugins/fleet/server/services/package_policy.test.ts index 66128c7e6c3e2..204650574e92a 100644 --- a/x-pack/plugins/fleet/server/services/package_policy.test.ts +++ b/x-pack/plugins/fleet/server/services/package_policy.test.ts @@ -20,6 +20,12 @@ import type { PutPackagePolicyUpdateCallback, PostPackagePolicyCreateCallback } import { createAppContextStartContractMock, xpackMocks } from '../mocks'; +import type { PostPackagePolicyDeleteCallback } from '../types'; + +import type { DeletePackagePoliciesResponse } from '../../common'; + +import { IngestManagerError } from '../errors'; + import { packagePolicyService } from './package_policy'; import { appContextService } from './app_context'; @@ -815,6 +821,78 @@ describe('Package policy service', () => { }); }); + describe('runDeleteExternalCallbacks', () => { + let callbackOne: jest.MockedFunction; + let callbackTwo: jest.MockedFunction; + let callingOrder: string[]; + let deletedPackagePolicies: DeletePackagePoliciesResponse; + + beforeEach(() => { + appContextService.start(createAppContextStartContractMock()); + callingOrder = []; + deletedPackagePolicies = [ + { id: 'a', success: true }, + { id: 'a', success: true }, + ]; + callbackOne = jest.fn(async (deletedPolicies) => { + callingOrder.push('one'); + }); + callbackTwo = jest.fn(async (deletedPolicies) => { + callingOrder.push('two'); + }); + appContextService.addExternalCallback('postPackagePolicyDelete', callbackOne); + appContextService.addExternalCallback('postPackagePolicyDelete', callbackTwo); + }); + + afterEach(() => { + appContextService.stop(); + }); + + it('should execute external callbacks', async () => { + await packagePolicyService.runDeleteExternalCallbacks(deletedPackagePolicies); + + expect(callbackOne).toHaveBeenCalledWith(deletedPackagePolicies); + expect(callbackTwo).toHaveBeenCalledWith(deletedPackagePolicies); + expect(callingOrder).toEqual(['one', 'two']); + }); + + it("should execute all external callbacks even if one throw's", async () => { + callbackOne.mockImplementation(async (deletedPolicies) => { + callingOrder.push('one'); + throw new Error('foo'); + }); + await expect( + packagePolicyService.runDeleteExternalCallbacks(deletedPackagePolicies) + ).rejects.toThrow(IngestManagerError); + expect(callingOrder).toEqual(['one', 'two']); + }); + + it('should provide an array of errors encountered by running external callbacks', async () => { + let error: IngestManagerError; + const callbackOneError = new Error('foo 1'); + const callbackTwoError = new Error('foo 2'); + + callbackOne.mockImplementation(async (deletedPolicies) => { + callingOrder.push('one'); + throw callbackOneError; + }); + callbackTwo.mockImplementation(async (deletedPolicies) => { + callingOrder.push('two'); + throw callbackTwoError; + }); + + await packagePolicyService.runDeleteExternalCallbacks(deletedPackagePolicies).catch((e) => { + error = e; + }); + + expect(error!.message).toEqual( + '2 encountered while executing package delete external callbacks' + ); + expect(error!.meta).toEqual([callbackOneError, callbackTwoError]); + expect(callingOrder).toEqual(['one', 'two']); + }); + }); + describe('runExternalCallbacks', () => { let context: ReturnType; let request: KibanaRequest; diff --git a/x-pack/plugins/fleet/server/services/package_policy.ts b/x-pack/plugins/fleet/server/services/package_policy.ts index 561cbef952f8d..61152b07f793b 100644 --- a/x-pack/plugins/fleet/server/services/package_policy.ts +++ b/x-pack/plugins/fleet/server/services/package_policy.ts @@ -428,9 +428,9 @@ class PackagePolicyService { name: packagePolicy.name, success: true, package: { - name: packagePolicy.name, - title: '', - version: packagePolicy.version || '', + name: packagePolicy.package?.name || '', + title: packagePolicy.package?.title || '', + version: packagePolicy.package?.version || '', }, }); } catch (error) { @@ -642,7 +642,9 @@ class PackagePolicyService { public async runExternalCallbacks( externalCallbackType: A, - packagePolicy: NewPackagePolicy | DeletePackagePoliciesResponse, + packagePolicy: A extends 'postPackagePolicyDelete' + ? DeletePackagePoliciesResponse + : NewPackagePolicy, context: RequestHandlerContext, request: KibanaRequest ): Promise; @@ -653,14 +655,7 @@ class PackagePolicyService { request: KibanaRequest ): Promise { if (externalCallbackType === 'postPackagePolicyDelete') { - const externalCallbacks = appContextService.getExternalCallbacks(externalCallbackType); - if (externalCallbacks && externalCallbacks.size > 0) { - for (const callback of externalCallbacks) { - if (Array.isArray(packagePolicy)) { - await callback(packagePolicy, context, request); - } - } - } + return await this.runDeleteExternalCallbacks(packagePolicy as DeletePackagePoliciesResponse); } else { if (!Array.isArray(packagePolicy)) { let newData = packagePolicy; @@ -682,6 +677,32 @@ class PackagePolicyService { } } } + + public async runDeleteExternalCallbacks( + deletedPackagePolicies: DeletePackagePoliciesResponse + ): Promise { + const externalCallbacks = appContextService.getExternalCallbacks('postPackagePolicyDelete'); + const errorsThrown: Error[] = []; + + if (externalCallbacks && externalCallbacks.size > 0) { + for (const callback of externalCallbacks) { + // Failures from an external callback should not prevent other external callbacks from being + // executed. Errors (if any) will be collected and `throw`n after processing the entire set + try { + await callback(deletedPackagePolicies); + } catch (error) { + errorsThrown.push(error); + } + } + + if (errorsThrown.length > 0) { + throw new IngestManagerError( + `${errorsThrown.length} encountered while executing package delete external callbacks`, + errorsThrown + ); + } + } + } } function assignStreamIdToInput(packagePolicyId: string, input: NewPackagePolicyInput) { diff --git a/x-pack/plugins/fleet/server/types/extensions.ts b/x-pack/plugins/fleet/server/types/extensions.ts index bca9cc016f828..a7f4a422cc2ae 100644 --- a/x-pack/plugins/fleet/server/types/extensions.ts +++ b/x-pack/plugins/fleet/server/types/extensions.ts @@ -7,6 +7,8 @@ import type { KibanaRequest, RequestHandlerContext } from 'kibana/server'; +import type { DeepReadonly } from 'utility-types'; + import type { DeletePackagePoliciesResponse, NewPackagePolicy, @@ -14,9 +16,7 @@ import type { } from '../../common'; export type PostPackagePolicyDeleteCallback = ( - deletedPackagePolicies: DeletePackagePoliciesResponse, - context: RequestHandlerContext, - request: KibanaRequest + deletedPackagePolicies: DeepReadonly ) => Promise; export type PostPackagePolicyCreateCallback = ( diff --git a/x-pack/plugins/security_solution/server/endpoint/endpoint_app_context_services.ts b/x-pack/plugins/security_solution/server/endpoint/endpoint_app_context_services.ts index 1a2e1a7c4ee6f..5a47c8a616c00 100644 --- a/x-pack/plugins/security_solution/server/endpoint/endpoint_app_context_services.ts +++ b/x-pack/plugins/security_solution/server/endpoint/endpoint_app_context_services.ts @@ -22,6 +22,7 @@ import { PluginStartContract as AlertsPluginStartContract } from '../../../alert import { getPackagePolicyCreateCallback, getPackagePolicyUpdateCallback, + getPackagePolicyDeleteCallback, } from '../fleet_integration/fleet_integration'; import { ManifestManager } from './services/artifacts'; import { AppClientFactory } from '../client'; @@ -102,6 +103,11 @@ export class EndpointAppContextService { 'packagePolicyUpdate', getPackagePolicyUpdateCallback(dependencies.logger, dependencies.licenseService) ); + + dependencies.registerIngestCallback( + 'postPackagePolicyDelete', + getPackagePolicyDeleteCallback(dependencies.exceptionListsClient, this.experimentalFeatures) + ); } } diff --git a/x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.test.ts b/x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.test.ts index 56c462de54c52..d0bbb3b346ea8 100644 --- a/x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.test.ts +++ b/x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.test.ts @@ -6,7 +6,7 @@ */ import { httpServerMock, loggingSystemMock } from 'src/core/server/mocks'; -import { createNewPackagePolicyMock } from '../../../fleet/common/mocks'; +import { createNewPackagePolicyMock, deletePackagePolicyMock } from '../../../fleet/common/mocks'; import { policyFactory, policyFactoryWithoutPaidFeatures, @@ -14,6 +14,7 @@ import { import { buildManifestManagerMock } from '../endpoint/services/artifacts/manifest_manager/manifest_manager.mock'; import { getPackagePolicyCreateCallback, + getPackagePolicyDeleteCallback, getPackagePolicyUpdateCallback, } from './fleet_integration'; import { KibanaRequest } from 'kibana/server'; @@ -28,6 +29,7 @@ import { EndpointDocGenerator } from '../../common/endpoint/generate_data'; import { ProtectionModes } from '../../common/endpoint/types'; import type { SecuritySolutionRequestHandlerContext } from '../types'; import { getExceptionListClientMock } from '../../../lists/server/services/exception_lists/exception_list_client.mock'; +import { getExceptionListSchemaMock } from '../../../lists/common/schemas/response/exception_list_schema.mock'; import { ExceptionListClient } from '../../../lists/server'; import { InternalArtifactCompleteSchema } from '../endpoint/schemas/artifacts'; import { ManifestManager } from '../endpoint/services/artifacts/manifest_manager'; @@ -35,6 +37,12 @@ import { getMockArtifacts, toArtifactRecords } from '../endpoint/lib/artifacts/m import { Manifest } from '../endpoint/lib/artifacts'; import { NewPackagePolicy } from '../../../fleet/common/types/models'; import { ManifestSchema } from '../../common/endpoint/schema/manifest'; +import { + allowedExperimentalValues, + ExperimentalFeatures, +} from '../../common/experimental_features'; +import { DeletePackagePoliciesResponse } from '../../../fleet/common'; +import { ExceptionListSchema } from '@kbn/securitysolution-io-ts-list-types'; describe('ingest_integration tests ', () => { let endpointAppContextMock: EndpointAppContextServiceStartContract; @@ -282,4 +290,66 @@ describe('ingest_integration tests ', () => { expect(updatedPolicyConfig.inputs[0]!.config!.policy.value).toEqual(mockPolicy); }); }); + + describe('package policy delete callback with trusted apps by policy enabled', () => { + const invokeDeleteCallback = async ( + experimentalFeatures?: ExperimentalFeatures + ): Promise => { + const callback = getPackagePolicyDeleteCallback(exceptionListClient, experimentalFeatures); + await callback(deletePackagePolicyMock()); + }; + + let removedPolicies: DeletePackagePoliciesResponse; + let policyId: string; + let fakeTA: ExceptionListSchema; + + beforeEach(() => { + removedPolicies = deletePackagePolicyMock(); + policyId = removedPolicies[0].id; + fakeTA = { + ...getExceptionListSchemaMock(), + tags: [`policy:${policyId}`], + }; + + exceptionListClient.findExceptionListItem = jest + .fn() + .mockResolvedValueOnce({ data: [fakeTA], total: 1 }); + exceptionListClient.updateExceptionListItem = jest + .fn() + .mockResolvedValueOnce({ ...fakeTA, tags: [] }); + }); + + it('removes policy from trusted app FF enabled', async () => { + await invokeDeleteCallback({ + ...allowedExperimentalValues, + trustedAppsByPolicyEnabled: true, // Needs to be enabled, it needs also a test with this disabled. + }); + + expect(exceptionListClient.findExceptionListItem).toHaveBeenCalledWith({ + filter: `exception-list-agnostic.attributes.tags:"policy:${policyId}"`, + listId: 'endpoint_trusted_apps', + namespaceType: 'agnostic', + page: 1, + perPage: 50, + sortField: undefined, + sortOrder: undefined, + }); + + expect(exceptionListClient.updateExceptionListItem).toHaveBeenCalledWith({ + ...fakeTA, + namespaceType: fakeTA.namespace_type, + osTypes: fakeTA.os_types, + tags: [], + }); + }); + + it("doesn't remove policy from trusted app FF disabled", async () => { + await invokeDeleteCallback({ + ...allowedExperimentalValues, + }); + + expect(exceptionListClient.findExceptionListItem).toHaveBeenCalledTimes(0); + expect(exceptionListClient.updateExceptionListItem).toHaveBeenCalledTimes(0); + }); + }); }); diff --git a/x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.ts b/x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.ts index 62c7b3719d6a6..09810a6c88c3d 100644 --- a/x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.ts +++ b/x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.ts @@ -11,9 +11,12 @@ import { PluginStartContract as AlertsStartContract } from '../../../alerting/se import { SecurityPluginStart } from '../../../security/server'; import { PostPackagePolicyCreateCallback, + PostPackagePolicyDeleteCallback, PutPackagePolicyUpdateCallback, } from '../../../fleet/server'; + import { NewPackagePolicy, UpdatePackagePolicy } from '../../../fleet/common'; + import { NewPolicyData, PolicyConfig } from '../../common/endpoint/types'; import { ManifestManager } from '../endpoint/services'; import { AppClientFactory } from '../client'; @@ -22,6 +25,8 @@ import { installPrepackagedRules } from './handlers/install_prepackaged_rules'; import { createPolicyArtifactManifest } from './handlers/create_policy_artifact_manifest'; import { createDefaultPolicy } from './handlers/create_default_policy'; import { validatePolicyAgainstLicense } from './handlers/validate_policy_against_license'; +import { removePolicyFromTrustedApps } from './handlers/remove_policy_from_trusted_apps'; +import { ExperimentalFeatures } from '../../common/experimental_features'; const isEndpointPackagePolicy = ( packagePolicy: T @@ -126,3 +131,21 @@ export const getPackagePolicyUpdateCallback = ( return newPackagePolicy; }; }; + +export const getPackagePolicyDeleteCallback = ( + exceptionsClient: ExceptionListClient | undefined, + experimentalFeatures: ExperimentalFeatures | undefined +): PostPackagePolicyDeleteCallback => { + return async (deletePackagePolicy): Promise => { + if (!exceptionsClient) { + return; + } + const policiesToRemove: Array> = []; + for (const policy of deletePackagePolicy) { + if (isEndpointPackagePolicy(policy) && experimentalFeatures?.trustedAppsByPolicyEnabled) { + policiesToRemove.push(removePolicyFromTrustedApps(exceptionsClient, policy)); + } + } + await Promise.all(policiesToRemove); + }; +}; diff --git a/x-pack/plugins/security_solution/server/fleet_integration/handlers/remove_policy_from_trusted_apps.ts b/x-pack/plugins/security_solution/server/fleet_integration/handlers/remove_policy_from_trusted_apps.ts new file mode 100644 index 0000000000000..88af71508f33a --- /dev/null +++ b/x-pack/plugins/security_solution/server/fleet_integration/handlers/remove_policy_from_trusted_apps.ts @@ -0,0 +1,61 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { ENDPOINT_TRUSTED_APPS_LIST_ID } from '@kbn/securitysolution-list-constants'; +import { ExceptionListClient } from '../../../../lists/server'; +import { PostPackagePolicyDeleteCallback } from '../../../../fleet/server'; + +/** + * Removes policy from trusted apps + */ +export const removePolicyFromTrustedApps = async ( + exceptionsClient: ExceptionListClient, + policy: Parameters[0][0] +) => { + let page = 1; + + const findTrustedAppsByPolicy = async (currentPage: number) => { + return exceptionsClient.findExceptionListItem({ + listId: ENDPOINT_TRUSTED_APPS_LIST_ID, + filter: `exception-list-agnostic.attributes.tags:"policy:${policy.id}"`, + namespaceType: 'agnostic', + page: currentPage, + perPage: 50, + sortField: undefined, + sortOrder: undefined, + }); + }; + + let findResponse = await findTrustedAppsByPolicy(page); + if (!findResponse) { + return; + } + const trustedApps = findResponse.data; + + while (findResponse && (trustedApps.length < findResponse.total || findResponse.data.length)) { + page += 1; + findResponse = await findTrustedAppsByPolicy(page); + if (findResponse) { + trustedApps.push(...findResponse.data); + } + } + + const updates = []; + for (const trustedApp of trustedApps) { + updates.push( + exceptionsClient.updateExceptionListItem({ + ...trustedApp, + itemId: trustedApp.item_id, + namespaceType: trustedApp.namespace_type, + osTypes: trustedApp.os_types, + tags: trustedApp.tags.filter((currentPolicy) => currentPolicy !== `policy:${policy.id}`), + }) + ); + } + + await Promise.all(updates); +}; From a7fe773bb81544f47d7138c9c9606ec412cd8d95 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Thu, 19 Aug 2021 19:13:33 +0100 Subject: [PATCH 08/44] chore(NA): moving @kbn/plugin-helpers to babel transpiler (#109085) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- packages/kbn-plugin-helpers/.babelrc | 3 +++ packages/kbn-plugin-helpers/BUILD.bazel | 25 +++++++++++++++++------ packages/kbn-plugin-helpers/package.json | 4 ++-- packages/kbn-plugin-helpers/tsconfig.json | 5 +++-- 4 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 packages/kbn-plugin-helpers/.babelrc diff --git a/packages/kbn-plugin-helpers/.babelrc b/packages/kbn-plugin-helpers/.babelrc new file mode 100644 index 0000000000000..7da72d1779128 --- /dev/null +++ b/packages/kbn-plugin-helpers/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["@kbn/babel-preset/node_preset"] +} diff --git a/packages/kbn-plugin-helpers/BUILD.bazel b/packages/kbn-plugin-helpers/BUILD.bazel index 9242701770a86..d7744aecac26e 100644 --- a/packages/kbn-plugin-helpers/BUILD.bazel +++ b/packages/kbn-plugin-helpers/BUILD.bazel @@ -1,6 +1,7 @@ load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project") load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm") +load("//src/dev/bazel:index.bzl", "jsts_transpiler") PKG_BASE_NAME = "kbn-plugin-helpers" PKG_REQUIRE_NAME = "@kbn/plugin-helpers" @@ -26,7 +27,7 @@ NPM_MODULE_EXTRA_FILES = [ "README.md" ] -SRC_DEPS = [ +RUNTIME_DEPS = [ "//packages/kbn-dev-utils", "//packages/kbn-optimizer", "//packages/kbn-utils", @@ -41,6 +42,13 @@ SRC_DEPS = [ ] TYPES_DEPS = [ + "//packages/kbn-dev-utils", + "//packages/kbn-optimizer", + "//packages/kbn-utils", + "@npm//del", + "@npm//execa", + "@npm//globby", + "@npm//load-json-file", "@npm//@types/extract-zip", "@npm//@types/gulp-zip", "@npm//@types/inquirer", @@ -49,7 +57,11 @@ TYPES_DEPS = [ "@npm//@types/vinyl-fs", ] -DEPS = SRC_DEPS + TYPES_DEPS +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) ts_config( name = "tsconfig", @@ -61,13 +73,14 @@ ts_config( ) ts_project( - name = "tsc", + name = "tsc_types", args = ['--pretty'], srcs = SRCS, - deps = DEPS, + deps = TYPES_DEPS, declaration = True, declaration_map = True, - out_dir = "target", + emit_declaration_only = True, + out_dir = "target_types", source_map = True, root_dir = "src", tsconfig = ":tsconfig", @@ -76,7 +89,7 @@ ts_project( js_library( name = PKG_BASE_NAME, srcs = NPM_MODULE_EXTRA_FILES, - deps = DEPS + [":tsc"], + deps = RUNTIME_DEPS + [":target_node", ":tsc_types"], package_name = PKG_REQUIRE_NAME, visibility = ["//visibility:public"], ) diff --git a/packages/kbn-plugin-helpers/package.json b/packages/kbn-plugin-helpers/package.json index 1f4df52a03304..21ed8f46f52fa 100644 --- a/packages/kbn-plugin-helpers/package.json +++ b/packages/kbn-plugin-helpers/package.json @@ -7,8 +7,8 @@ "kibana": { "devOnly": true }, - "main": "target/index.js", - "types": "target/index.d.ts", + "main": "target_node/index.js", + "types": "target_types/index.d.ts", "bin": { "plugin-helpers": "bin/plugin-helpers.js" } diff --git a/packages/kbn-plugin-helpers/tsconfig.json b/packages/kbn-plugin-helpers/tsconfig.json index 22adf020187ba..34f3ec5e67503 100644 --- a/packages/kbn-plugin-helpers/tsconfig.json +++ b/packages/kbn-plugin-helpers/tsconfig.json @@ -1,12 +1,13 @@ { "extends": "../../tsconfig.bazel.json", "compilerOptions": { - "outDir": "target", - "target": "ES2018", "declaration": true, "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "target_types", "sourceMap": true, "sourceRoot": "../../../../packages/kbn-plugin-helpers/src", + "target": "ES2018", "types": [ "jest", "node" From 91910dbecd195ec2be865b822cc73b094f01d519 Mon Sep 17 00:00:00 2001 From: Gloria Hornero Date: Thu, 19 Aug 2021 20:14:02 +0200 Subject: [PATCH 09/44] Bringing cypress tests back (#109129) * fixes threshold cypress tests * add ticket command * fixes threshold cypress tests * add ticket command * fixes 'Creates a new case with timeline and opens the timeline' test * unskips navigation tests * removes 'sets correct classes when the user starts dragging a host, but is not hovering over the data providers' test since we are not supporting drag and drop on timeline * removes drag and drop related tests from 'data_providers.spec.ts' * modifies todo on skipped exceptions tests to add more clarity * fixes 'attach' to case and local storage test Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../integration/cases/creation.spec.ts | 8 +-- .../detection_alerts/attach_to_case.spec.ts | 7 ++- .../detection_rules/threshold_rule.spec.ts | 3 +- .../integration/exceptions/from_alert.spec.ts | 2 +- .../integration/exceptions/from_rule.spec.ts | 2 +- .../integration/header/navigation.spec.ts | 4 +- .../timelines/data_providers.spec.ts | 50 +------------------ .../timelines/flyout_button.spec.ts | 13 +---- .../timelines/local_storage.spec.ts | 12 +++-- .../cypress/screens/hosts/all_hosts.ts | 2 - .../cypress/screens/hosts/external_events.ts | 8 --- .../cypress/screens/timeline.ts | 9 +--- .../cypress/tasks/create_new_rule.ts | 4 +- .../cypress/tasks/hosts/all_hosts.ts | 46 +---------------- .../cypress/tasks/timeline.ts | 17 ++++--- 15 files changed, 34 insertions(+), 153 deletions(-) delete mode 100644 x-pack/plugins/security_solution/cypress/screens/hosts/external_events.ts diff --git a/x-pack/plugins/security_solution/cypress/integration/cases/creation.spec.ts b/x-pack/plugins/security_solution/cypress/integration/cases/creation.spec.ts index 9e3b775156cab..028439ce6c3a4 100644 --- a/x-pack/plugins/security_solution/cypress/integration/cases/creation.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/cases/creation.spec.ts @@ -11,7 +11,6 @@ import { ALL_CASES_CLOSED_CASES_STATS, ALL_CASES_COMMENTS_COUNT, ALL_CASES_IN_PROGRESS_CASES_STATS, - ALL_CASES_ITEM_ACTIONS_BTN, ALL_CASES_NAME, ALL_CASES_OPEN_CASES_COUNT, ALL_CASES_OPEN_CASES_STATS, @@ -26,7 +25,6 @@ import { import { CASE_DETAILS_DESCRIPTION, CASE_DETAILS_PAGE_TITLE, - // CASE_DETAILS_PUSH_TO_EXTERNAL_SERVICE_BTN, CASE_DETAILS_STATUS, CASE_DETAILS_TAGS, CASE_DETAILS_USER_ACTION_DESCRIPTION_USERNAME, @@ -67,8 +65,8 @@ describe('Cases', () => { .as('mycase') ); }); - // TODO: enable once attach timeline to cases is re-enabled - it.skip('Creates a new case with timeline and opens the timeline', function () { + + it('Creates a new case with timeline and opens the timeline', function () { loginAndWaitForPageWithoutDateRange(CASES_URL); goToCreateNewCase(); fillCasesMandatoryfields(this.mycase); @@ -92,7 +90,6 @@ describe('Cases', () => { cy.get(ALL_CASES_COMMENTS_COUNT).should('have.text', '0'); cy.get(ALL_CASES_OPENED_ON).should('include.text', 'ago'); cy.get(ALL_CASES_SERVICE_NOW_INCIDENT).should('have.text', 'Not pushed'); - cy.get(ALL_CASES_ITEM_ACTIONS_BTN).should('exist'); goToCaseDetails(); @@ -108,7 +105,6 @@ describe('Cases', () => { cy.get(CASE_DETAILS_USERNAMES).eq(REPORTER).should('have.text', this.mycase.reporter); cy.get(CASE_DETAILS_USERNAMES).eq(PARTICIPANTS).should('have.text', this.mycase.reporter); cy.get(CASE_DETAILS_TAGS).should('have.text', expectedTags); - // cy.get(CASE_DETAILS_PUSH_TO_EXTERNAL_SERVICE_BTN).should('have.attr', 'disabled'); openCaseTimeline(); diff --git a/x-pack/plugins/security_solution/cypress/integration/detection_alerts/attach_to_case.spec.ts b/x-pack/plugins/security_solution/cypress/integration/detection_alerts/attach_to_case.spec.ts index 9ffade9abbb02..348b03b7f6399 100644 --- a/x-pack/plugins/security_solution/cypress/integration/detection_alerts/attach_to_case.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/detection_alerts/attach_to_case.spec.ts @@ -23,8 +23,7 @@ const loadDetectionsPage = (role: ROLES) => { waitForAlertsToPopulate(); }; -// TODO: This test may need changes in our UI based on RBAC -describe.skip('Alerts timeline', () => { +describe('Alerts timeline', () => { before(() => { // First we login as a privileged user to create alerts. cleanKibana(); @@ -45,7 +44,7 @@ describe.skip('Alerts timeline', () => { }); it('should not allow user with read only privileges to attach alerts to cases', () => { - cy.get(TIMELINE_CONTEXT_MENU_BTN).first().click(); + cy.get(TIMELINE_CONTEXT_MENU_BTN).first().click({ force: true }); cy.get(ATTACH_ALERT_TO_CASE_BUTTON).should('not.exist'); }); }); @@ -56,7 +55,7 @@ describe.skip('Alerts timeline', () => { }); it('should allow a user with crud privileges to attach alerts to cases', () => { - cy.get(TIMELINE_CONTEXT_MENU_BTN).first().click(); + cy.get(TIMELINE_CONTEXT_MENU_BTN).first().click({ force: true }); cy.get(ATTACH_ALERT_TO_CASE_BUTTON).first().should('not.be.disabled'); }); }); diff --git a/x-pack/plugins/security_solution/cypress/integration/detection_rules/threshold_rule.spec.ts b/x-pack/plugins/security_solution/cypress/integration/detection_rules/threshold_rule.spec.ts index 588642fb69d0e..7bfc9631f7269 100644 --- a/x-pack/plugins/security_solution/cypress/integration/detection_rules/threshold_rule.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/detection_rules/threshold_rule.spec.ts @@ -81,8 +81,7 @@ import { loginAndWaitForPageWithoutDateRange } from '../../tasks/login'; import { ALERTS_URL } from '../../urls/navigation'; -// TODO: Alert counts and preview results not showing correct values. Need to fix this test -describe.skip('Detection rules, threshold', () => { +describe('Detection rules, threshold', () => { let rule = getNewThresholdRule(); const expectedUrls = getNewThresholdRule().referenceUrls.join(''); const expectedFalsePositives = getNewThresholdRule().falsePositivesExamples.join(''); diff --git a/x-pack/plugins/security_solution/cypress/integration/exceptions/from_alert.spec.ts b/x-pack/plugins/security_solution/cypress/integration/exceptions/from_alert.spec.ts index 369e65ebf1bdd..002aa0bbc2b1e 100644 --- a/x-pack/plugins/security_solution/cypress/integration/exceptions/from_alert.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/exceptions/from_alert.spec.ts @@ -64,7 +64,7 @@ describe('From alert', () => { esArchiverUnload('auditbeat_for_exceptions2'); }); - // TODO: Looks like the signal is missing some fields. Need to update to make sure it shows up + // TODO: Unskip the test when `https://github.com/elastic/kibana/issues/108244` it is fixed it.skip('Creates an exception and deletes it', () => { addExceptionFromFirstAlert(); addsException(getException()); diff --git a/x-pack/plugins/security_solution/cypress/integration/exceptions/from_rule.spec.ts b/x-pack/plugins/security_solution/cypress/integration/exceptions/from_rule.spec.ts index 16863ab651353..c4e1d882d1853 100644 --- a/x-pack/plugins/security_solution/cypress/integration/exceptions/from_rule.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/exceptions/from_rule.spec.ts @@ -62,7 +62,7 @@ describe('From rule', () => { esArchiverUnload('auditbeat_for_exceptions2'); }); - // TODO: Looks like the signal is missing some fields. Need to update to make sure it shows up + // TODO: Unskip the test when `https://github.com/elastic/kibana/issues/108244` it is fixed it.skip('Creates an exception and deletes it', () => { goToExceptionsTab(); addsExceptionFromRuleSettings(getException()); diff --git a/x-pack/plugins/security_solution/cypress/integration/header/navigation.spec.ts b/x-pack/plugins/security_solution/cypress/integration/header/navigation.spec.ts index 16278c919a046..15982f1674351 100644 --- a/x-pack/plugins/security_solution/cypress/integration/header/navigation.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/header/navigation.spec.ts @@ -51,7 +51,7 @@ import { } from '../../screens/kibana_navigation'; import { cleanKibana } from '../../tasks/common'; -describe.skip('top-level navigation common to all pages in the Security app', () => { +describe('top-level navigation common to all pages in the Security app', () => { before(() => { cleanKibana(); loginAndWaitForPage(TIMELINES_URL); @@ -111,7 +111,7 @@ describe.skip('top-level navigation common to all pages in the Security app', () }); }); -describe.skip('Kibana navigation to all pages in the Security app ', () => { +describe('Kibana navigation to all pages in the Security app ', () => { before(() => { loginAndWaitForPage(KIBANA_HOME); }); diff --git a/x-pack/plugins/security_solution/cypress/integration/timelines/data_providers.spec.ts b/x-pack/plugins/security_solution/cypress/integration/timelines/data_providers.spec.ts index 5e851cecbd86b..de754f8602667 100644 --- a/x-pack/plugins/security_solution/cypress/integration/timelines/data_providers.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/timelines/data_providers.spec.ts @@ -6,23 +6,12 @@ */ import { - TIMELINE_DATA_PROVIDERS, - TIMELINE_DATA_PROVIDERS_EMPTY, TIMELINE_DROPPED_DATA_PROVIDERS, TIMELINE_DATA_PROVIDERS_ACTION_MENU, - IS_DRAGGING_DATA_PROVIDERS, TIMELINE_FLYOUT_HEADER, - TIMELINE_FLYOUT, } from '../../screens/timeline'; -import { HOSTS_NAMES_DRAGGABLE } from '../../screens/hosts/all_hosts'; -import { - dragAndDropFirstHostToTimeline, - dragFirstHostToEmptyTimelineDataProviders, - unDragFirstHostToEmptyTimelineDataProviders, - dragFirstHostToTimeline, - waitForAllHostsToBeLoaded, -} from '../../tasks/hosts/all_hosts'; +import { waitForAllHostsToBeLoaded } from '../../tasks/hosts/all_hosts'; import { loginAndWaitForPage } from '../../tasks/login'; import { openTimelineUsingToggle } from '../../tasks/security_main'; @@ -44,22 +33,6 @@ describe('timeline data providers', () => { closeTimeline(); }); - it.skip('renders the data provider of a host dragged from the All Hosts widget on the hosts page', () => { - dragAndDropFirstHostToTimeline(); - openTimelineUsingToggle(); - cy.get(`${TIMELINE_FLYOUT} ${TIMELINE_DROPPED_DATA_PROVIDERS}`) - .first() - .invoke('text') - .then((dataProviderText) => { - cy.get(HOSTS_NAMES_DRAGGABLE) - .first() - .invoke('text') - .should((hostname) => { - expect(dataProviderText).to.eq(`host.name: "${hostname}"AND`); - }); - }); - }); - it('displays the data provider action menu when Enter is pressed', (done) => { openTimelineUsingToggle(); addDataProvider({ field: 'host.name', operator: 'exists' }).then(() => { @@ -77,25 +50,4 @@ describe('timeline data providers', () => { done(); }); }); - - it.skip('sets correct classes when the user starts dragging a host, but is not hovering over the data providers', () => { - dragFirstHostToTimeline(); - - cy.get(IS_DRAGGING_DATA_PROVIDERS) - .find(TIMELINE_DATA_PROVIDERS) - .filter(':visible') - .should('have.class', 'drop-target-data-providers'); - }); - - it.skip('render an extra highlighted area in dataProvider when the user starts dragging a host AND is hovering over the data providers', () => { - dragFirstHostToEmptyTimelineDataProviders(); - - cy.get(IS_DRAGGING_DATA_PROVIDERS) - .find(TIMELINE_DATA_PROVIDERS_EMPTY) - .children() - .should('exist'); - - // Release the dragging item so the cursor can peform other action - unDragFirstHostToEmptyTimelineDataProviders(); - }); }); diff --git a/x-pack/plugins/security_solution/cypress/integration/timelines/flyout_button.spec.ts b/x-pack/plugins/security_solution/cypress/integration/timelines/flyout_button.spec.ts index ac34d65f0fd0a..2ee658c666665 100644 --- a/x-pack/plugins/security_solution/cypress/integration/timelines/flyout_button.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/timelines/flyout_button.spec.ts @@ -8,14 +8,12 @@ import { TIMELINE_BOTTOM_BAR_TOGGLE_BUTTON } from '../../screens/security_main'; import { CREATE_NEW_TIMELINE, - IS_DRAGGING_DATA_PROVIDERS, - TIMELINE_DATA_PROVIDERS, TIMELINE_FLYOUT_HEADER, TIMELINE_SETTINGS_ICON, } from '../../screens/timeline'; import { cleanKibana } from '../../tasks/common'; -import { dragFirstHostToTimeline, waitForAllHostsToBeLoaded } from '../../tasks/hosts/all_hosts'; +import { waitForAllHostsToBeLoaded } from '../../tasks/hosts/all_hosts'; import { loginAndWaitForPage } from '../../tasks/login'; import { closeTimelineUsingCloseButton, @@ -78,13 +76,4 @@ describe('timeline flyout button', () => { cy.get('[data-test-subj="nav-search-option"]').its('length').should('be.gte', 1); closeTimelineUsingCloseButton(); }); - - it.skip('sets correct classes when the user starts dragging a host, but is not hovering over the data providers', () => { - dragFirstHostToTimeline(); - - cy.get(IS_DRAGGING_DATA_PROVIDERS) - .find(TIMELINE_DATA_PROVIDERS) - .filter(':visible') - .should('have.class', 'drop-target-data-providers'); - }); }); diff --git a/x-pack/plugins/security_solution/cypress/integration/timelines/local_storage.spec.ts b/x-pack/plugins/security_solution/cypress/integration/timelines/local_storage.spec.ts index f6be213f59d7e..617f04697c951 100644 --- a/x-pack/plugins/security_solution/cypress/integration/timelines/local_storage.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/timelines/local_storage.spec.ts @@ -10,12 +10,11 @@ import { loginAndWaitForPage } from '../../tasks/login'; import { HOSTS_URL } from '../../urls/navigation'; import { openEvents } from '../../tasks/hosts/main'; import { DATAGRID_HEADERS } from '../../screens/timeline'; -import { TABLE_COLUMN_EVENTS_MESSAGE } from '../../screens/hosts/external_events'; import { waitsForEventsToBeLoaded } from '../../tasks/hosts/events'; import { removeColumn } from '../../tasks/timeline'; // TODO: Fix bug in persisting the columns of timeline -describe.skip('persistent timeline', () => { +describe('persistent timeline', () => { beforeEach(() => { cleanKibana(); loginAndWaitForPage(HOSTS_URL); @@ -27,8 +26,11 @@ describe.skip('persistent timeline', () => { }); it('persist the deletion of a column', function () { - cy.get(DATAGRID_HEADERS).eq(TABLE_COLUMN_EVENTS_MESSAGE).should('have.text', 'message'); - removeColumn(TABLE_COLUMN_EVENTS_MESSAGE); + const MESSAGE_COLUMN = 'message'; + const MESSAGE_COLUMN_POSITION = 2; + + cy.get(DATAGRID_HEADERS).eq(MESSAGE_COLUMN_POSITION).should('have.text', MESSAGE_COLUMN); + removeColumn(MESSAGE_COLUMN); cy.get(DATAGRID_HEADERS).should('have.length', this.expectedNumberOfTimelineColumns); @@ -36,6 +38,6 @@ describe.skip('persistent timeline', () => { waitsForEventsToBeLoaded(); cy.get(DATAGRID_HEADERS).should('have.length', this.expectedNumberOfTimelineColumns); - cy.get(DATAGRID_HEADERS).each(($el) => expect($el.text()).not.equal('message')); + cy.get(DATAGRID_HEADERS).each(($el) => expect($el.text()).not.equal(MESSAGE_COLUMN)); }); }); diff --git a/x-pack/plugins/security_solution/cypress/screens/hosts/all_hosts.ts b/x-pack/plugins/security_solution/cypress/screens/hosts/all_hosts.ts index cf1bac421b447..b76add918beaf 100644 --- a/x-pack/plugins/security_solution/cypress/screens/hosts/all_hosts.ts +++ b/x-pack/plugins/security_solution/cypress/screens/hosts/all_hosts.ts @@ -8,5 +8,3 @@ export const ALL_HOSTS_TABLE = '[data-test-subj="table-allHosts-loading-false"]'; export const HOSTS_NAMES = '[data-test-subj="render-content-host.name"] a.euiLink'; - -export const HOSTS_NAMES_DRAGGABLE = '[data-test-subj="render-content-host.name"]'; diff --git a/x-pack/plugins/security_solution/cypress/screens/hosts/external_events.ts b/x-pack/plugins/security_solution/cypress/screens/hosts/external_events.ts deleted file mode 100644 index 01f82f8944432..0000000000000 --- a/x-pack/plugins/security_solution/cypress/screens/hosts/external_events.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* - * 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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export const TABLE_COLUMN_EVENTS_MESSAGE = 2; diff --git a/x-pack/plugins/security_solution/cypress/screens/timeline.ts b/x-pack/plugins/security_solution/cypress/screens/timeline.ts index 0b9d39d6b0c21..4cf5d2f87f7a9 100644 --- a/x-pack/plugins/security_solution/cypress/screens/timeline.ts +++ b/x-pack/plugins/security_solution/cypress/screens/timeline.ts @@ -39,6 +39,8 @@ export const DATAGRID_HEADERS = export const FAVORITE_TIMELINE = '[data-test-subj="timeline-favorite-filled-star"]'; +export const FIELD_BROWSER = '[data-test-subj="show-field-browser"]'; + export const GRAPH_TAB_BUTTON = '[data-test-subj="timelineTabs-graph"]'; export const HEADER = '[data-test-subj="header"]'; @@ -143,12 +145,8 @@ export const TIMELINE_CORRELATION_INPUT = '[data-test-subj="eqlQueryBarTextInput export const TIMELINE_CORRELATION_TAB = '[data-test-subj="timelineTabs-eql"]'; -export const IS_DRAGGING_DATA_PROVIDERS = '.is-dragging'; - export const TIMELINE_BOTTOM_BAR_CONTAINER = '[data-test-subj="timeline-bottom-bar-container"]'; -export const TIMELINE_DATA_PROVIDERS = '[data-test-subj="dataProviders"]'; - export const TIMELINE_DATA_PROVIDERS_ACTION_MENU = '[data-test-subj="providerActions"]'; export const TIMELINE_ADD_FIELD_BUTTON = '[data-test-subj="addField"]'; @@ -161,9 +159,6 @@ export const TIMELINE_DATA_PROVIDER_VALUE = `[data-test-subj="value"]`; export const SAVE_DATA_PROVIDER_BTN = `[data-test-subj="save"]`; -export const TIMELINE_DATA_PROVIDERS_EMPTY = - '[data-test-subj="dataProviders"] [data-test-subj="empty"]'; - export const TIMELINE_DESCRIPTION = '[data-test-subj="timeline-description"]'; export const TIMELINE_DESCRIPTION_INPUT = '[data-test-subj="save-timeline-description"]'; diff --git a/x-pack/plugins/security_solution/cypress/tasks/create_new_rule.ts b/x-pack/plugins/security_solution/cypress/tasks/create_new_rule.ts index 9a500f81ec45f..63d1cbbc883b0 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/create_new_rule.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/create_new_rule.ts @@ -293,7 +293,8 @@ export const fillDefineThresholdRuleAndContinue = (rule: ThresholdRule) => { const thresholdField = 0; const threshold = 1; - const typeThresholdField = ($el: Cypress.ObjectLike) => cy.wrap($el).type(rule.thresholdField); + const typeThresholdField = ($el: Cypress.ObjectLike) => + cy.wrap($el).type(rule.thresholdField, { delay: 35 }); cy.get(IMPORT_QUERY_FROM_SAVED_TIMELINE_LINK).click(); cy.get(TIMELINE(rule.timeline.id!)).click(); @@ -301,6 +302,7 @@ export const fillDefineThresholdRuleAndContinue = (rule: ThresholdRule) => { cy.get(THRESHOLD_INPUT_AREA) .find(INPUT) .then((inputs) => { + cy.wrap(inputs[thresholdField]).click(); cy.wrap(inputs[thresholdField]).pipe(typeThresholdField); cy.get(THRESHOLD_FIELD_SELECTION).click({ force: true }); cy.wrap(inputs[threshold]).clear().type(rule.threshold); diff --git a/x-pack/plugins/security_solution/cypress/tasks/hosts/all_hosts.ts b/x-pack/plugins/security_solution/cypress/tasks/hosts/all_hosts.ts index 317a35708de57..cdae0437eb565 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/hosts/all_hosts.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/hosts/all_hosts.ts @@ -5,52 +5,8 @@ * 2.0. */ -import { ALL_HOSTS_TABLE, HOSTS_NAMES_DRAGGABLE, HOSTS_NAMES } from '../../screens/hosts/all_hosts'; -import { TIMELINE_DATA_PROVIDERS, TIMELINE_DATA_PROVIDERS_EMPTY } from '../../screens/timeline'; +import { ALL_HOSTS_TABLE, HOSTS_NAMES } from '../../screens/hosts/all_hosts'; -import { drag, dragWithoutDrop, drop } from '../../tasks/common'; - -export const dragAndDropFirstHostToTimeline = () => { - cy.get(HOSTS_NAMES_DRAGGABLE) - .first() - .then((firstHost) => drag(firstHost)); - cy.get(TIMELINE_DATA_PROVIDERS) - .filter(':visible') - .then((dataProvidersDropArea) => drop(dataProvidersDropArea)); -}; - -export const dragFirstHostToEmptyTimelineDataProviders = () => { - cy.get(HOSTS_NAMES_DRAGGABLE) - .first() - .then((host) => drag(host)); - - cy.get(TIMELINE_DATA_PROVIDERS_EMPTY) - .filter(':visible') - .then((dataProvidersDropArea) => dragWithoutDrop(dataProvidersDropArea)); -}; - -export const unDragFirstHostToEmptyTimelineDataProviders = () => { - cy.get(HOSTS_NAMES_DRAGGABLE) - .first() - .then((host) => { - cy.wrap(host) - .trigger('mousemove', { - button: 0, - clientX: host[0].getBoundingClientRect().left, - clientY: host[0].getBoundingClientRect().top, - force: true, - }) - .wait(300) - .trigger('mouseup', { force: true }) - .wait(300); - }); -}; - -export const dragFirstHostToTimeline = () => { - cy.get(HOSTS_NAMES_DRAGGABLE) - .first() - .then((host) => drag(host)); -}; export const openFirstHostDetails = () => { cy.get(HOSTS_NAMES).first().click({ force: true }); }; diff --git a/x-pack/plugins/security_solution/cypress/tasks/timeline.ts b/x-pack/plugins/security_solution/cypress/tasks/timeline.ts index 4a61a94e4acea..03ccb784bd259 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/timeline.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/timeline.ts @@ -8,6 +8,7 @@ import { Timeline, TimelineFilter } from '../objects/timeline'; import { ALL_CASES_CREATE_NEW_CASE_TABLE_BTN } from '../screens/all_cases'; +import { FIELDS_BROWSER_CHECKBOX } from '../screens/fields_browser'; import { LOADING_INDICATOR } from '../screens/security_header'; import { @@ -20,7 +21,7 @@ import { CLOSE_TIMELINE_BTN, COMBO_BOX, CREATE_NEW_TIMELINE, - DATAGRID_HEADERS, + FIELD_BROWSER, ID_FIELD, ID_HEADER_FIELD, ID_TOGGLE_FIELD, @@ -70,6 +71,8 @@ import { REFRESH_BUTTON, TIMELINE } from '../screens/timelines'; import { drag, drop } from '../tasks/common'; +import { closeFieldsBrowser, filterFieldsBrowser } from '../tasks/fields_browser'; + export const hostExistsQuery = 'host.name: *'; export const addDescriptionToTimeline = (description: string) => { @@ -327,13 +330,11 @@ export const dragAndDropIdToggleFieldToTimeline = () => { .then((headersDropArea) => drop(headersDropArea)); }; -export const removeColumn = (column: number) => { - cy.get(DATAGRID_HEADERS) - .eq(column) - .click() - .within(() => { - cy.get('button').eq(0).click({ force: true }); - }); +export const removeColumn = (columnName: string) => { + cy.get(FIELD_BROWSER).first().click(); + filterFieldsBrowser(columnName); + cy.get(FIELDS_BROWSER_CHECKBOX(columnName)).click(); + closeFieldsBrowser(); }; export const resetFields = () => { From 63db90b0c494b7e53451ae2c7560021c65110727 Mon Sep 17 00:00:00 2001 From: Melissa Alvarez Date: Thu, 19 Aug 2021 14:33:29 -0400 Subject: [PATCH 10/44] [ML] Anomaly detection: Adds functional test for delayed data chart flyout (#109026) * wip add delayed data functional test * adds delayed data functional test * add menu check for stability and reorganize functions * ensure describe block is self contained --- .../datafeed_chart_flyout.tsx | 245 +++++++++--------- .../apps/ml/anomaly_detection/annotations.ts | 23 ++ .../services/ml/job_annotations_table.ts | 46 ++++ 3 files changed, 193 insertions(+), 121 deletions(-) diff --git a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/datafeed_chart_flyout/datafeed_chart_flyout.tsx b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/datafeed_chart_flyout/datafeed_chart_flyout.tsx index 0879a657d7fa9..17ff5db2768d6 100644 --- a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/datafeed_chart_flyout/datafeed_chart_flyout.tsx +++ b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/datafeed_chart_flyout/datafeed_chart_flyout.tsx @@ -185,8 +185,9 @@ export const DatafeedChartFlyout: FC = ({ jobId, end, aria-label={i18n.translate('xpack.ml.jobsList.datafeedChart.datafeedChartFlyoutAriaLabel', { defaultMessage: 'Datafeed chart flyout', })} + data-test-subj="mlAnnotationsViewDatafeedFlyout" > - + @@ -308,143 +309,145 @@ export const DatafeedChartFlyout: FC = ({ jobId, end, - - - - - {showModelSnapshots ? ( - } - markerPosition={Position.Top} - style={{ - line: { - strokeWidth: 3, - stroke: euiTheme.euiColorVis1, - opacity: 0.5, +
+ + - ) : null} - {showAnnotations ? ( - <> - } - markerPosition={Position.Top} - style={{ - line: { - strokeWidth: 3, - stroke: euiTheme.euiColorDangerText, - opacity: 0.5, - }, - }} - /> - - - ) : null} - {messageData.length > 0 ? ( - <> + + + {showModelSnapshots ? ( } + dataValues={modelSnapshotData} + marker={} markerPosition={Position.Top} style={{ line: { strokeWidth: 3, - stroke: euiTheme.euiColorAccent, + stroke: euiTheme.euiColorVis1, opacity: 0.5, }, }} /> - - ) : null} - - - + ) : null} + {showAnnotations ? ( + <> + } + markerPosition={Position.Top} + style={{ + line: { + strokeWidth: 3, + stroke: euiTheme.euiColorDangerText, + opacity: 0.5, + }, + }} + /> + + + ) : null} + {messageData.length > 0 ? ( + <> + } + markerPosition={Position.Top} + style={{ + line: { + strokeWidth: 3, + stroke: euiTheme.euiColorAccent, + opacity: 0.5, + }, + }} + /> + + ) : null} + + + +
{ + await ml.api.indexAnnotation(annotation as Partial, annotationId); + }); + + it('displays delayed data chart for annotation', async () => { + await ml.testExecution.logTestStep( + 'should display delayed data action in annotations table' + ); + + await ml.navigation.navigateToMl(); + await ml.navigation.navigateToJobManagement(); + await ml.jobTable.waitForJobsToLoad(); + await ml.jobTable.filterWithSearchString(jobId, 1); + await ml.jobTable.openAnnotationsTab(jobId); + + await ml.jobAnnotations.openDatafeedChartFlyout(annotationId, jobId); + await ml.jobAnnotations.assertDelayedDataChartExists(); + }); + }); + describe('deleting', function () { const annotationId = `delete-annotation-id-${Date.now()}`; diff --git a/x-pack/test/functional/services/ml/job_annotations_table.ts b/x-pack/test/functional/services/ml/job_annotations_table.ts index 0acba253cb056..90b47e9f8b455 100644 --- a/x-pack/test/functional/services/ml/job_annotations_table.ts +++ b/x-pack/test/functional/services/ml/job_annotations_table.ts @@ -341,5 +341,51 @@ export function MachineLearningJobAnnotationsProvider({ getService }: FtrProvide await this.setAnnotationText(text); }); } + + public async assertAnnotationsDelayedDataChartActionExists() { + await retry.tryForTime(1000, async () => { + await testSubjects.existOrFail('mlAnnotationsActionViewDatafeed'); + }); + } + + public async ensureAllMenuPopoversClosed() { + await retry.tryForTime(5000, async () => { + await browser.pressKeys(browser.keys.ESCAPE); + const popoverExists = await find.existsByCssSelector('euiContextMenuPanel'); + expect(popoverExists).to.eql(false, 'All popovers should be closed'); + }); + } + + public async ensureAnnotationsActionsMenuOpen(annotationId: string) { + await retry.tryForTime(10 * 1000, async () => { + await this.ensureAllMenuPopoversClosed(); + await testSubjects.click( + `mlAnnotationsTableRow row-${annotationId} > euiCollapsedItemActionsButton`, + 30 * 1000 + ); + await find.existsByCssSelector('euiContextMenuPanel'); + }); + } + + public async openDatafeedChartFlyout(annotationId: string, jobId: string) { + await retry.tryForTime(10 * 1000, async () => { + await this.ensureAnnotationsActionsMenuOpen(annotationId); + await this.assertAnnotationsDelayedDataChartActionExists(); + + await testSubjects.clickWhenNotDisabled('mlAnnotationsActionViewDatafeed'); + await testSubjects.existOrFail('mlAnnotationsViewDatafeedFlyout'); + await testSubjects.existOrFail('mlAnnotationsViewDatafeedFlyoutTitle'); + + const title = await testSubjects.getVisibleText('mlAnnotationsViewDatafeedFlyoutTitle'); + expect(title).to.eql( + `Datafeed chart for ${jobId}`, + `Expected annotations flyout title to be 'Datafeed chart for ${jobId}' but got ${title}` + ); + }); + } + + public async assertDelayedDataChartExists() { + await testSubjects.existOrFail('mlAnnotationsViewDatafeedFlyoutChart'); + } })(); } From cfd5dad17404bfbac53d7b5d2f346f6b2904ebb8 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Thu, 19 Aug 2021 19:40:50 +0100 Subject: [PATCH 11/44] chore(NA): moving @kbn/optimizer to babel transpiler (#109231) * chore(NA): adds 7.16 into backportrc * chore(NA): moving @kbn/optimizer to babel transpiler --- packages/kbn-optimizer/.babelrc | 4 +++ packages/kbn-optimizer/BUILD.bazel | 34 +++++++++++++++---- packages/kbn-optimizer/babel.config.js | 12 ------- packages/kbn-optimizer/package.json | 4 +-- packages/kbn-optimizer/tsconfig.json | 3 +- .../kbn-test/src/jest/setup/babel_polyfill.js | 2 +- 6 files changed, 37 insertions(+), 22 deletions(-) create mode 100644 packages/kbn-optimizer/.babelrc delete mode 100644 packages/kbn-optimizer/babel.config.js diff --git a/packages/kbn-optimizer/.babelrc b/packages/kbn-optimizer/.babelrc new file mode 100644 index 0000000000000..1685d1644d94a --- /dev/null +++ b/packages/kbn-optimizer/.babelrc @@ -0,0 +1,4 @@ +{ + "presets": ["@kbn/babel-preset/node_preset"], + "ignore": ["**/*.test.js"] +} diff --git a/packages/kbn-optimizer/BUILD.bazel b/packages/kbn-optimizer/BUILD.bazel index ddf2a05519682..7f04aa4b262b0 100644 --- a/packages/kbn-optimizer/BUILD.bazel +++ b/packages/kbn-optimizer/BUILD.bazel @@ -1,5 +1,6 @@ load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project") load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm") +load("//src/dev/bazel:index.bzl", "jsts_transpiler") PKG_BASE_NAME = "kbn-optimizer" PKG_REQUIRE_NAME = "@kbn/optimizer" @@ -29,7 +30,7 @@ NPM_MODULE_EXTRA_FILES = [ "README.md" ] -SRC_DEPS = [ +RUNTIME_DEPS = [ "//packages/kbn-config", "//packages/kbn-dev-utils", "//packages/kbn-std", @@ -59,6 +60,22 @@ SRC_DEPS = [ ] TYPES_DEPS = [ + "//packages/kbn-config", + "//packages/kbn-dev-utils", + "//packages/kbn-std", + "//packages/kbn-ui-shared-deps", + "//packages/kbn-utils", + "@npm//chalk", + "@npm//clean-webpack-plugin", + "@npm//cpy", + "@npm//del", + "@npm//execa", + "@npm//jest-diff", + "@npm//lmdb-store", + "@npm//pirates", + "@npm//resize-observer-polyfill", + "@npm//rxjs", + "@npm//zlib", "@npm//@types/compression-webpack-plugin", "@npm//@types/jest", "@npm//@types/json-stable-stringify", @@ -72,7 +89,11 @@ TYPES_DEPS = [ "@npm//@types/webpack-sources", ] -DEPS = SRC_DEPS + TYPES_DEPS +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) ts_config( name = "tsconfig", @@ -84,13 +105,14 @@ ts_config( ) ts_project( - name = "tsc", + name = "tsc_types", args = ['--pretty'], srcs = SRCS, - deps = DEPS, + deps = TYPES_DEPS, declaration = True, declaration_map = True, - out_dir = "target", + emit_declaration_only = True, + out_dir = "target_types", source_map = True, root_dir = "src", tsconfig = ":tsconfig", @@ -99,7 +121,7 @@ ts_project( js_library( name = PKG_BASE_NAME, srcs = NPM_MODULE_EXTRA_FILES, - deps = DEPS + [":tsc"], + deps = RUNTIME_DEPS + [":target_node", ":tsc_types"], package_name = PKG_REQUIRE_NAME, visibility = ["//visibility:public"], ) diff --git a/packages/kbn-optimizer/babel.config.js b/packages/kbn-optimizer/babel.config.js deleted file mode 100644 index e3a412717fb6e..0000000000000 --- a/packages/kbn-optimizer/babel.config.js +++ /dev/null @@ -1,12 +0,0 @@ -/* - * 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. - */ - -module.exports = { - presets: ['@kbn/babel-preset/node_preset'], - ignore: ['**/*.test.js'], -}; diff --git a/packages/kbn-optimizer/package.json b/packages/kbn-optimizer/package.json index d23512f7c418d..488e1b5dbfde8 100644 --- a/packages/kbn-optimizer/package.json +++ b/packages/kbn-optimizer/package.json @@ -3,6 +3,6 @@ "version": "1.0.0", "private": true, "license": "SSPL-1.0 OR Elastic License 2.0", - "main": "./target/index.js", - "types": "./target/index.d.ts" + "main": "./target_node/index.js", + "types": "./target_types/index.d.ts" } \ No newline at end of file diff --git a/packages/kbn-optimizer/tsconfig.json b/packages/kbn-optimizer/tsconfig.json index 047c98db8a806..5fbd02106e777 100644 --- a/packages/kbn-optimizer/tsconfig.json +++ b/packages/kbn-optimizer/tsconfig.json @@ -1,9 +1,10 @@ { "extends": "../../tsconfig.bazel.json", "compilerOptions": { - "outDir": "./target/types", "declaration": true, "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "./target_types", "rootDir": "./src", "sourceMap": true, "sourceRoot": "../../../../packages/kbn-optimizer/src", diff --git a/packages/kbn-test/src/jest/setup/babel_polyfill.js b/packages/kbn-test/src/jest/setup/babel_polyfill.js index 7dda4cceec65c..7981eb668f38f 100644 --- a/packages/kbn-test/src/jest/setup/babel_polyfill.js +++ b/packages/kbn-test/src/jest/setup/babel_polyfill.js @@ -9,4 +9,4 @@ // Note: In theory importing the polyfill should not be needed, as Babel should // include the necessary polyfills when using `@babel/preset-env`, but for some // reason it did not work. See https://github.com/elastic/kibana/issues/14506 -import '@kbn/optimizer/target/node/polyfill'; +import '@kbn/optimizer/target_node/node/polyfill'; From 7f68ff269c4f996950136b94498f6ddd857042e4 Mon Sep 17 00:00:00 2001 From: Tre Date: Thu, 19 Aug 2021 19:48:26 +0100 Subject: [PATCH 12/44] [Archive Migration] x-pack..dashboard_view_mode (#108503) --- .../dashboard_mode/dashboard_view_mode.js | 85 ++--- .../dashboard_view_mode/data.json.gz | Bin 1938 -> 0 bytes .../dashboard_view_mode/mappings.json | 308 ------------------ .../kbn_archiver/dashboard_view_mode.json | 303 +++++++++++++++++ 4 files changed, 323 insertions(+), 373 deletions(-) delete mode 100644 x-pack/test/functional/es_archives/dashboard_view_mode/data.json.gz delete mode 100644 x-pack/test/functional/es_archives/dashboard_view_mode/mappings.json create mode 100644 x-pack/test/functional/fixtures/kbn_archiver/dashboard_view_mode.json diff --git a/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js b/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js index b3f15e2dffa0b..74f4dca06c717 100644 --- a/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js +++ b/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js @@ -15,7 +15,6 @@ export default function ({ getService, getPageObjects }) { const pieChart = getService('pieChart'); const security = getService('security'); const testSubjects = getService('testSubjects'); - const dashboardAddPanel = getService('dashboardAddPanel'); const dashboardPanelActions = getService('dashboardPanelActions'); const appsMenu = getService('appsMenu'); const filterBar = getService('filterBar'); @@ -30,7 +29,6 @@ export default function ({ getService, getPageObjects }) { 'share', ]); const dashboardName = 'Dashboard View Mode Test Dashboard'; - const savedSearchName = 'Saved search for dashboard'; describe('Dashboard View Mode', function () { this.tags(['skipFirefox']); @@ -38,83 +36,40 @@ export default function ({ getService, getPageObjects }) { before('initialize tests', async () => { log.debug('Dashboard View Mode:initTests'); await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional'); - await esArchiver.load('x-pack/test/functional/es_archives/dashboard_view_mode'); + await kibanaServer.importExport.load( + 'x-pack/test/functional/fixtures/kbn_archiver/dashboard_view_mode' + ); await kibanaServer.uiSettings.replace({ defaultIndex: 'logstash-*' }); await browser.setWindowSize(1600, 1000); - await PageObjects.common.navigateToApp('discover'); - await PageObjects.timePicker.setHistoricalDataRange(); - await PageObjects.discover.saveSearch(savedSearchName); - await PageObjects.common.navigateToApp('dashboard'); - await PageObjects.dashboard.clickNewDashboard(); - await dashboardAddPanel.addSavedSearch(savedSearchName); - await PageObjects.dashboard.addVisualizations( - PageObjects.dashboard.getTestVisualizationNames() + }); + + after(async () => { + await kibanaServer.importExport.unload( + 'x-pack/test/functional/fixtures/kbn_archiver/dashboard_view_mode' ); - await PageObjects.dashboard.saveDashboard(dashboardName); + const types = [ + 'search', + 'dashboard', + 'visualization', + 'search-session', + 'core-usage-stats', + 'event_loop_delays_daily', + 'search-telemetry', + 'core-usage-stats', + ]; + await kibanaServer.savedObjects.clean({ types }); }); describe('Dashboard viewer', () => { - before('Create logstash data role', async () => { - await PageObjects.settings.navigateTo(); - await testSubjects.click('roles'); - await PageObjects.security.clickCreateNewRole(); - - await testSubjects.setValue('roleFormNameInput', 'logstash-data'); - await PageObjects.security.addIndexToRole('logstash-*'); - await PageObjects.security.addPrivilegeToRole('read'); - await PageObjects.security.clickSaveEditRole(); - }); - - before('Create dashboard only mode user', async () => { - await PageObjects.settings.navigateTo(); - await PageObjects.security.createUser({ - username: 'dashuser', - password: '123456', - confirm_password: '123456', - email: 'example@example.com', - full_name: 'dashuser', - roles: ['kibana_dashboard_only_user', 'logstash-data'], - }); - }); - - before('Create user with mixes roles', async () => { - await PageObjects.security.createUser({ - username: 'mixeduser', - password: '123456', - confirm_password: '123456', - email: 'example@example.com', - full_name: 'mixeduser', - roles: ['kibana_dashboard_only_user', 'kibana_admin', 'logstash-data'], - }); - }); - - before('Create user with dashboard and superuser role', async () => { - await PageObjects.security.createUser({ - username: 'mysuperuser', - password: '123456', - confirm_password: '123456', - email: 'example@example.com', - full_name: 'mixeduser', - roles: ['kibana_dashboard_only_user', 'superuser'], - }); - }); - after(async () => { await security.testUser.restoreDefaults(); }); it('shows only the dashboard app link', async () => { - await security.testUser.setRoles( - ['test_logstash_reader', 'kibana_dashboard_only_user'], - false - ); - + await security.testUser.setRoles(['test_logstash_reader', 'kibana_dashboard_only_user']); await PageObjects.header.waitUntilLoadingHasFinished(); - await PageObjects.security.forceLogout(); - await PageObjects.security.login('test_user', 'changeme'); - const appLinks = await appsMenu.readLinks(); expect(appLinks).to.have.length(1); expect(appLinks[0]).to.have.property('text', 'Dashboard'); diff --git a/x-pack/test/functional/es_archives/dashboard_view_mode/data.json.gz b/x-pack/test/functional/es_archives/dashboard_view_mode/data.json.gz deleted file mode 100644 index 8d2e399dfce29f48c33860136faa0893bde0ad38..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1938 zcmV;D2W|KtiwFP!000026YX5xZre5#zVB0Lz8o4m$+iOZRg-2LHZ*AvXC1maFlgym z;zEfUNyTvkKgV{x`@O)hrx~z4#||mVmTVpg+xTyq(lMpIkrtGQy`G??qc3qa5S&+ zuc%^1J?)AQT7@p?KoPYRWnOQ*0wGI{?bWGNns2P=W>_P{2~2~=*hVOAG}El~*oKr7 zK~h=jAO~?uV*SS6E;h-8Pfv+Zl&~{C)$dFQlVDrWA~ci->VUCVa0P79t~EsBSU_7dc-nO5V+NIeD0byi?>F;@iHaq8( zp-pp#2-D=?5d%xmBI!0`KaM_1NxnACk#=6aG|=D>1uv-x83d)X+juFDKoV6596Gui zbP^!ym|XwBd8#M-vx-Es*O=T=r4_x~-LvE~6464lvj2sp9I`^IcdvRr;Ud*Sfli;6 z!%QmyAk%40R0Ekpl>V0}mCJswHzpFDJ?~~lFNEp8V}8}c85C35ljyND1ljv;@b%!F z=e&nz8Xyrw@B8CH`IpfGH`CURYwc6QR`;{+u6c!#S?RmOPDz+(_LU*f6!WZJu4kP# zjUXAO`@&$)LZJ$$<+xB)$H<8ca>1`Cf<-W%1)9ea!PJaFInb~(-zJ>Kz!P+=Q7mZm za4^NMyCLTyqG%4AjcE`)6%bOZP^*l*M%w>K=x6|ACr7=5$ofmrcsL|BdTL^xkzVRv zv~Bca(5OPd1caSh3+-08^mJjazDdgsXf~#~8L;7vC2ZB-(Q(JfU1bW!t_u!uK3ZdK zczjD~3~$#7O${&&C@*=Y6NN61`^HE5QyQtnE51rToH2AQWmk}?!>NK$j4m6yW@Ftl zwS>Z2Ji%EoVd&^ z5-wd1pOP@48FZ`t1~+kl(d<$>)B=qh3jYGbo$G8RPx2H}t~VEaNe1fJ=~z3yp_YH) zKjjg{#be|)`r1u3UzB6EcRX4eN~&O_+nq0se!?c@*8;7!_Hbx4v(MpJG3IDr`ZIH@ zK%l3uCwmJHl`|?g^qL&hiT7rqqI^gV_umfl16N$;k-7`VS}-Se()A{j<6LsIp;TaV zK2k?9|FG4My~%Z0ahpQ59Rbx(mqt0K_E=);`3h>rG0>P@CCin6Guj+Ddv^xl2UjxZ znRLy@ixi}EpEOh(U|f2;sqPyhJGR)hbZIKHRp}?LIF6K3gpQBQ+|SKL^6d?(xkh=t zx$XFP#XoOFK0G+!Mu&C2&E%bJ>c@hvPqTg6KWI`Hv#VvvkE_$ya#iTX)wBr}ZFkfBx$^1rK5yeatfO)XQc9oXNB^q3i-n&Ftua6S}oz{yFL{n+usU!MKkBlxyr*M_D=gl z0j&~m(Mfe_@J5S{6Fx1A3TxlWlyjA6QDq|#qT+JSOzP6CQf@6>jxZ}TeH?yH(;XdI|< Date: Thu, 19 Aug 2021 21:19:20 +0200 Subject: [PATCH 13/44] [Upgrade Assistant] Overview page should reference nextMajor (#109222) * Should use nextMajor instead of currentMajor * Fix small CR changes --- .../helpers/overview.helpers.ts | 2 + .../overview/overview.test.tsx | 39 +++++++++++++++++++ .../components/overview/overview.tsx | 12 +++--- .../review_logs_step/review_logs_step.tsx | 6 +-- .../overview/upgrade_step/upgrade_step.tsx | 12 +++--- 5 files changed, 56 insertions(+), 15 deletions(-) create mode 100644 x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/overview.test.tsx diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/overview.helpers.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/overview.helpers.ts index 93826497b8630..96e12d4806ee3 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/overview.helpers.ts +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/overview.helpers.ts @@ -76,4 +76,6 @@ export type OverviewTestSubjects = | 'upgradeSetupDocsLink' | 'upgradeSetupCloudLink' | 'deprecationWarningCallout' + | 'whatsNewLink' + | 'documentationLink' | 'upgradeStatusError'; diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/overview.test.tsx b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/overview.test.tsx new file mode 100644 index 0000000000000..0acf5ae65c6cc --- /dev/null +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/overview.test.tsx @@ -0,0 +1,39 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { mockKibanaSemverVersion } from '../../../common/constants'; +import { OverviewTestBed, setupOverviewPage, setupEnvironment } from '../helpers'; + +describe('Overview Page', () => { + let testBed: OverviewTestBed; + const { server } = setupEnvironment(); + + beforeEach(async () => { + testBed = await setupOverviewPage(); + testBed.component.update(); + }); + + afterAll(() => { + server.restore(); + }); + + describe('Documentation links', () => { + test('Has a whatsNew link and it references nextMajor version', () => { + const { exists, find } = testBed; + const nextMajor = mockKibanaSemverVersion.major + 1; + + expect(exists('whatsNewLink')).toBe(true); + expect(find('whatsNewLink').text()).toContain(`${nextMajor}.0`); + }); + + test('Has a link for upgrade assistant in page header', () => { + const { exists } = testBed; + + expect(exists('documentationLink')).toBe(true); + }); + }); +}); diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/overview/overview.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/overview/overview.tsx index bd076dd600216..b7cac67ca5a96 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/overview/overview.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/overview/overview.tsx @@ -27,7 +27,7 @@ import { getUpgradeStep } from './upgrade_step'; export const Overview: FunctionComponent = () => { const { kibanaVersionInfo, breadcrumbs, docLinks, api } = useAppContext(); - const { currentMajor } = kibanaVersionInfo; + const { nextMajor } = kibanaVersionInfo; useEffect(() => { async function sendTelemetryData() { @@ -68,12 +68,12 @@ export const Overview: FunctionComponent = () => { , ]} > - + @@ -83,9 +83,9 @@ export const Overview: FunctionComponent = () => { diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/overview/review_logs_step/review_logs_step.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/overview/review_logs_step/review_logs_step.tsx index 2da31a3801dd0..4ebde8b5f847a 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/overview/review_logs_step/review_logs_step.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/overview/review_logs_step/review_logs_step.tsx @@ -20,7 +20,7 @@ const i18nTexts = { }), }; -export const getReviewLogsStep = ({ currentMajor }: { currentMajor: number }): EuiStepProps => { +export const getReviewLogsStep = ({ nextMajor }: { nextMajor: number }): EuiStepProps => { return { title: i18nTexts.reviewStepTitle, status: 'incomplete', @@ -30,8 +30,8 @@ export const getReviewLogsStep = ({ currentMajor }: { currentMajor: number }): E

diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/overview/upgrade_step/upgrade_step.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/overview/upgrade_step/upgrade_step.tsx index 9b66a28e81cd8..d66a408cfce77 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/overview/upgrade_step/upgrade_step.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/overview/upgrade_step/upgrade_step.tsx @@ -21,10 +21,10 @@ import type { DocLinksStart } from 'src/core/public'; import { useKibana } from '../../../../shared_imports'; const i18nTexts = { - upgradeStepTitle: (currentMajor: number) => + upgradeStepTitle: (nextMajor: number) => i18n.translate('xpack.upgradeAssistant.overview.upgradeStepTitle', { - defaultMessage: 'Install {currentMajor}.0', - values: { currentMajor }, + defaultMessage: 'Install {nextMajor}.0', + values: { nextMajor }, }), upgradeStepDescription: i18n.translate('xpack.upgradeAssistant.overview.upgradeStepDescription', { defaultMessage: @@ -117,12 +117,12 @@ const UpgradeStep = ({ docLinks }: { docLinks: DocLinksStart }) => { interface Props { docLinks: DocLinksStart; - currentMajor: number; + nextMajor: number; } -export const getUpgradeStep = ({ docLinks, currentMajor }: Props): EuiStepProps => { +export const getUpgradeStep = ({ docLinks, nextMajor }: Props): EuiStepProps => { return { - title: i18nTexts.upgradeStepTitle(currentMajor), + title: i18nTexts.upgradeStepTitle(nextMajor), status: 'incomplete', children: , }; From 7369bdf36059166c1c52b55eb3039ccaac6d0219 Mon Sep 17 00:00:00 2001 From: Sandra G Date: Thu, 19 Aug 2021 15:38:49 -0400 Subject: [PATCH 14/44] [Monitoring] document monitoring.ui.ccs.enabled (#109318) * monitoring.ui.ccs.enabled doc * fix links --- docs/settings/monitoring-settings.asciidoc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/settings/monitoring-settings.asciidoc b/docs/settings/monitoring-settings.asciidoc index 6483442248cea..31148f0abf4e1 100644 --- a/docs/settings/monitoring-settings.asciidoc +++ b/docs/settings/monitoring-settings.asciidoc @@ -37,6 +37,10 @@ For more information, see monitoring back-end does not run and {kib} stats are not sent to the monitoring cluster. +| `monitoring.ui.ccs.enabled` + | Set to `true` (default) to enable {ref}/modules-cross-cluster-search.html[cross-cluster search] of your monitoring data. The {ref}/modules-remote-clusters.html#remote-cluster-settings[`remote_cluster_client`] role must exist on each node. + + | `monitoring.ui.elasticsearch.hosts` | Specifies the location of the {es} cluster where your monitoring data is stored. By default, this is the same as <>. This setting enables From 1fd7038b34084052895bb926b80c2301e4588de9 Mon Sep 17 00:00:00 2001 From: Jonathan Buttner <56361221+jonathan-buttner@users.noreply.github.com> Date: Thu, 19 Aug 2021 16:01:39 -0400 Subject: [PATCH 15/44] [Cases] Include rule registry client for updating alert statuses (#108588) * Trying to get import to work * Plumbed alerts client through and logging errors * No longer need the ES cluster client * Fixing types * Fixing imports * Fixing integration tests and refactoring * Throwing an error when rule registry is disabled * Reworking alert update and get to catch errors * Adding tests and fixing errors --- x-pack/plugins/cases/kibana.json | 1 + .../plugins/cases/server/client/alerts/get.ts | 14 +- .../cases/server/client/alerts/types.ts | 12 +- .../server/client/alerts/update_status.ts | 4 +- .../cases/server/client/attachments/add.ts | 34 +- .../plugins/cases/server/client/cases/push.ts | 65 +- .../cases/server/client/cases/update.ts | 27 +- x-pack/plugins/cases/server/client/factory.ts | 19 +- .../cases/server/client/sub_cases/update.ts | 21 +- x-pack/plugins/cases/server/client/types.ts | 3 +- .../server/common/models/commentable_case.ts | 34 +- .../connectors/servicenow/sir_format.test.ts | 159 +- .../connectors/servicenow/sir_format.ts | 36 +- x-pack/plugins/cases/server/plugin.ts | 7 +- .../server/services/alerts/index.test.ts | 81 +- .../cases/server/services/alerts/index.ts | 137 +- .../cases/server/services/alerts/types.ts | 13 + x-pack/plugins/cases/tsconfig.json | 1 + x-pack/plugins/rule_registry/server/index.ts | 1 + x-pack/plugins/rule_registry/server/mocks.ts | 2 + .../tests/common/cases/patch_cases.ts | 10 +- .../common/client/update_alert_status.ts | 6 +- .../tests/common/comments/post_comment.ts | 2 +- .../tests/common/sub_cases/patch_sub_cases.ts | 8 +- .../cases/signals/default/data.json.gz | Bin 5586 -> 3945 bytes .../cases/signals/default/mappings.json | 1926 ++++++++- .../cases/signals/duplicate_ids/data.json.gz | Bin 5513 -> 3876 bytes .../cases/signals/duplicate_ids/mappings.json | 3713 ++++++++++++++++- 28 files changed, 5794 insertions(+), 542 deletions(-) create mode 100644 x-pack/plugins/cases/server/services/alerts/types.ts diff --git a/x-pack/plugins/cases/kibana.json b/x-pack/plugins/cases/kibana.json index ebac6295166df..3889c559238b3 100644 --- a/x-pack/plugins/cases/kibana.json +++ b/x-pack/plugins/cases/kibana.json @@ -10,6 +10,7 @@ "id":"cases", "kibanaVersion":"kibana", "optionalPlugins":[ + "ruleRegistry", "security", "spaces" ], diff --git a/x-pack/plugins/cases/server/client/alerts/get.ts b/x-pack/plugins/cases/server/client/alerts/get.ts index 2048ccae4fa60..391279aab5a83 100644 --- a/x-pack/plugins/cases/server/client/alerts/get.ts +++ b/x-pack/plugins/cases/server/client/alerts/get.ts @@ -12,19 +12,11 @@ export const get = async ( { alertsInfo }: AlertGet, clientArgs: CasesClientArgs ): Promise => { - const { alertsService, scopedClusterClient, logger } = clientArgs; + const { alertsService, logger } = clientArgs; if (alertsInfo.length === 0) { return []; } - const alerts = await alertsService.getAlerts({ alertsInfo, scopedClusterClient, logger }); - if (!alerts) { - return []; - } - - return alerts.docs.map((alert) => ({ - id: alert._id, - index: alert._index, - ...alert._source, - })); + const alerts = await alertsService.getAlerts({ alertsInfo, logger }); + return alerts ?? []; }; diff --git a/x-pack/plugins/cases/server/client/alerts/types.ts b/x-pack/plugins/cases/server/client/alerts/types.ts index 95cd9ae33bff9..6b3a49f20d1e5 100644 --- a/x-pack/plugins/cases/server/client/alerts/types.ts +++ b/x-pack/plugins/cases/server/client/alerts/types.ts @@ -7,17 +7,7 @@ import { CaseStatuses } from '../../../common/api'; import { AlertInfo } from '../../common'; - -interface Alert { - id: string; - index: string; - destination?: { - ip: string; - }; - source?: { - ip: string; - }; -} +import { Alert } from '../../services/alerts/types'; export type CasesClientGetAlertsResponse = Alert[]; diff --git a/x-pack/plugins/cases/server/client/alerts/update_status.ts b/x-pack/plugins/cases/server/client/alerts/update_status.ts index a0684b59241b0..9c8cc33264413 100644 --- a/x-pack/plugins/cases/server/client/alerts/update_status.ts +++ b/x-pack/plugins/cases/server/client/alerts/update_status.ts @@ -16,6 +16,6 @@ export const updateStatus = async ( { alerts }: UpdateAlertsStatusArgs, clientArgs: CasesClientArgs ): Promise => { - const { alertsService, scopedClusterClient, logger } = clientArgs; - await alertsService.updateAlertsStatus({ alerts, scopedClusterClient, logger }); + const { alertsService, logger } = clientArgs; + await alertsService.updateAlertsStatus({ alerts, logger }); }; diff --git a/x-pack/plugins/cases/server/client/attachments/add.ts b/x-pack/plugins/cases/server/client/attachments/add.ts index 166ae2ae65012..5393a108d6af2 100644 --- a/x-pack/plugins/cases/server/client/attachments/add.ts +++ b/x-pack/plugins/cases/server/client/attachments/add.ts @@ -40,12 +40,7 @@ import { } from '../../services/user_actions/helpers'; import { AttachmentService, CasesService, CaseUserActionService } from '../../services'; -import { - createCaseError, - CommentableCase, - createAlertUpdateRequest, - isCommentRequestTypeGenAlert, -} from '../../common'; +import { createCaseError, CommentableCase, isCommentRequestTypeGenAlert } from '../../common'; import { CasesClientArgs, CasesClientInternal } from '..'; import { decodeCommentRequest } from '../utils'; @@ -195,22 +190,9 @@ const addGeneratedAlerts = async ( user: userDetails, commentReq: query, id: savedObjectID, + casesClientInternal, }); - if ( - (newComment.attributes.type === CommentType.alert || - newComment.attributes.type === CommentType.generatedAlert) && - caseInfo.attributes.settings.syncAlerts - ) { - const alertsToUpdate = createAlertUpdateRequest({ - comment: query, - status: subCase.attributes.status, - }); - await casesClientInternal.alerts.updateStatus({ - alerts: alertsToUpdate, - }); - } - await userActionService.bulkCreate({ unsecuredSavedObjectsClient, actions: [ @@ -386,19 +368,9 @@ export const addComment = async ( user: userInfo, commentReq: query, id: savedObjectID, + casesClientInternal, }); - if (newComment.attributes.type === CommentType.alert && updatedCase.settings.syncAlerts) { - const alertsToUpdate = createAlertUpdateRequest({ - comment: query, - status: updatedCase.status, - }); - - await casesClientInternal.alerts.updateStatus({ - alerts: alertsToUpdate, - }); - } - await userActionService.bulkCreate({ unsecuredSavedObjectsClient, actions: [ diff --git a/x-pack/plugins/cases/server/client/cases/push.ts b/x-pack/plugins/cases/server/client/cases/push.ts index 3048cf01bb3ba..80e69d53e9e8b 100644 --- a/x-pack/plugins/cases/server/client/cases/push.ts +++ b/x-pack/plugins/cases/server/client/cases/push.ts @@ -6,7 +6,7 @@ */ import Boom from '@hapi/boom'; -import { SavedObjectsFindResponse, SavedObject } from 'kibana/server'; +import { SavedObjectsFindResponse, SavedObject, Logger } from 'kibana/server'; import { ActionConnector, @@ -22,26 +22,16 @@ import { import { buildCaseUserActionItem } from '../../services/user_actions/helpers'; import { createIncident, getCommentContextFromAttributes } from './utils'; -import { createCaseError, flattenCaseSavedObject, getAlertInfoFromComments } from '../../common'; +import { + AlertInfo, + createCaseError, + flattenCaseSavedObject, + getAlertInfoFromComments, +} from '../../common'; import { CasesClient, CasesClientArgs, CasesClientInternal } from '..'; import { Operations } from '../../authorization'; import { casesConnectors } from '../../connectors'; - -/** - * Returns true if the case should be closed based on the configuration settings and whether the case - * is a collection. Collections are not closable because we aren't allowing their status to be changed. - * In the future we could allow push to close all the sub cases of a collection but that's not currently supported. - */ -function shouldCloseByPush( - configureSettings: SavedObjectsFindResponse, - caseInfo: SavedObject -): boolean { - return ( - configureSettings.total > 0 && - configureSettings.saved_objects[0].attributes.closure_type === 'close-by-pushing' && - caseInfo.attributes.type !== CaseType.collection - ); -} +import { CasesClientGetAlertsResponse } from '../alerts/types'; /** * Parameters for pushing a case to an external system @@ -106,9 +96,7 @@ export const push = async ( const alertsInfo = getAlertInfoFromComments(theCase?.comments); - const alerts = await casesClientInternal.alerts.get({ - alertsInfo, - }); + const alerts = await getAlertsCatchErrors({ casesClientInternal, alertsInfo, logger }); const getMappingsResponse = await casesClientInternal.configuration.getMappings({ connector: theCase.connector, @@ -278,3 +266,38 @@ export const push = async ( throw createCaseError({ message: `Failed to push case: ${error}`, error, logger }); } }; + +async function getAlertsCatchErrors({ + casesClientInternal, + alertsInfo, + logger, +}: { + casesClientInternal: CasesClientInternal; + alertsInfo: AlertInfo[]; + logger: Logger; +}): Promise { + try { + return await casesClientInternal.alerts.get({ + alertsInfo, + }); + } catch (error) { + logger.error(`Failed to retrieve alerts during push: ${error}`); + return []; + } +} + +/** + * Returns true if the case should be closed based on the configuration settings and whether the case + * is a collection. Collections are not closable because we aren't allowing their status to be changed. + * In the future we could allow push to close all the sub cases of a collection but that's not currently supported. + */ +function shouldCloseByPush( + configureSettings: SavedObjectsFindResponse, + caseInfo: SavedObject +): boolean { + return ( + configureSettings.total > 0 && + configureSettings.saved_objects[0].attributes.closure_type === 'close-by-pushing' && + caseInfo.attributes.type !== CaseType.collection + ); +} diff --git a/x-pack/plugins/cases/server/client/cases/update.ts b/x-pack/plugins/cases/server/client/cases/update.ts index ed19444414d57..611c9e09fa76e 100644 --- a/x-pack/plugins/cases/server/client/cases/update.ts +++ b/x-pack/plugins/cases/server/client/cases/update.ts @@ -12,6 +12,7 @@ import { fold } from 'fp-ts/lib/Either'; import { identity } from 'fp-ts/lib/function'; import { + Logger, SavedObject, SavedObjectsClientContract, SavedObjectsFindResponse, @@ -307,12 +308,14 @@ async function updateAlerts({ caseService, unsecuredSavedObjectsClient, casesClientInternal, + logger, }: { casesWithSyncSettingChangedToOn: UpdateRequestWithOriginalCase[]; casesWithStatusChangedAndSynced: UpdateRequestWithOriginalCase[]; caseService: CasesService; unsecuredSavedObjectsClient: SavedObjectsClientContract; casesClientInternal: CasesClientInternal; + logger: Logger; }) { /** * It's possible that a case ID can appear multiple times in each array. I'm intentionally placing the status changes @@ -361,7 +364,9 @@ async function updateAlerts({ [] ); - await casesClientInternal.alerts.updateStatus({ alerts: alertsToUpdate }); + await casesClientInternal.alerts.updateStatus({ + alerts: alertsToUpdate, + }); } function partitionPatchRequest( @@ -562,15 +567,6 @@ export const update = async ( ); }); - // Update the alert's status to match any case status or sync settings changes - await updateAlerts({ - casesWithStatusChangedAndSynced, - casesWithSyncSettingChangedToOn, - caseService, - unsecuredSavedObjectsClient, - casesClientInternal, - }); - const returnUpdatedCase = myCases.saved_objects .filter((myCase) => updatedCases.saved_objects.some((updatedCase) => updatedCase.id === myCase.id) @@ -598,6 +594,17 @@ export const update = async ( }), }); + // Update the alert's status to match any case status or sync settings changes + // Attempt to do this after creating/changing the other entities just in case it fails + await updateAlerts({ + casesWithStatusChangedAndSynced, + casesWithSyncSettingChangedToOn, + caseService, + unsecuredSavedObjectsClient, + casesClientInternal, + logger, + }); + return CasesResponseRt.encode(returnUpdatedCase); } catch (error) { const idVersions = cases.cases.map((caseInfo) => ({ diff --git a/x-pack/plugins/cases/server/client/factory.ts b/x-pack/plugins/cases/server/client/factory.ts index 2fae6996f4aa2..a1a3ccdd3bc52 100644 --- a/x-pack/plugins/cases/server/client/factory.ts +++ b/x-pack/plugins/cases/server/client/factory.ts @@ -5,12 +5,7 @@ * 2.0. */ -import { - KibanaRequest, - SavedObjectsServiceStart, - Logger, - ElasticsearchClient, -} from 'kibana/server'; +import { KibanaRequest, SavedObjectsServiceStart, Logger } from 'kibana/server'; import { SecurityPluginSetup, SecurityPluginStart } from '../../../security/server'; import { SAVED_OBJECT_TYPES } from '../../common'; import { Authorization } from '../authorization/authorization'; @@ -25,8 +20,8 @@ import { } from '../services'; import { PluginStartContract as FeaturesPluginStart } from '../../../features/server'; import { PluginStartContract as ActionsPluginStart } from '../../../actions/server'; +import { RuleRegistryPluginStartContract } from '../../../rule_registry/server'; import { LensServerPluginSetup } from '../../../lens/server'; - import { AuthorizationAuditLogger } from '../authorization'; import { CasesClient, createCasesClient } from '.'; @@ -36,6 +31,7 @@ interface CasesClientFactoryArgs { getSpace: GetSpaceFn; featuresPluginStart: FeaturesPluginStart; actionsPluginStart: ActionsPluginStart; + ruleRegistryPluginStart?: RuleRegistryPluginStartContract; lensEmbeddableFactory: LensServerPluginSetup['lensEmbeddableFactory']; } @@ -69,12 +65,10 @@ export class CasesClientFactory { */ public async create({ request, - scopedClusterClient, savedObjectsService, }: { request: KibanaRequest; savedObjectsService: SavedObjectsServiceStart; - scopedClusterClient: ElasticsearchClient; }): Promise { if (!this.isInitialized || !this.options) { throw new Error('CasesClientFactory must be initialized before calling create'); @@ -94,9 +88,12 @@ export class CasesClientFactory { const caseService = new CasesService(this.logger, this.options?.securityPluginStart?.authc); const userInfo = caseService.getUser({ request }); + const alertsClient = await this.options.ruleRegistryPluginStart?.getRacClientWithRequest( + request + ); + return createCasesClient({ - alertsService: new AlertService(), - scopedClusterClient, + alertsService: new AlertService(alertsClient), unsecuredSavedObjectsClient: savedObjectsService.getScopedClient(request, { includedHiddenTypes: SAVED_OBJECT_TYPES, // this tells the security plugin to not perform SO authorization and audit logging since we are handling diff --git a/x-pack/plugins/cases/server/client/sub_cases/update.ts b/x-pack/plugins/cases/server/client/sub_cases/update.ts index c8cb96cbb6b8c..56610ea6858e3 100644 --- a/x-pack/plugins/cases/server/client/sub_cases/update.ts +++ b/x-pack/plugins/cases/server/client/sub_cases/update.ts @@ -246,7 +246,9 @@ async function updateAlerts({ [] ); - await casesClientInternal.alerts.updateStatus({ alerts: alertsToUpdate }); + await casesClientInternal.alerts.updateStatus({ + alerts: alertsToUpdate, + }); } catch (error) { throw createCaseError({ message: `Failed to update alert status while updating sub cases: ${JSON.stringify( @@ -355,14 +357,6 @@ export async function update({ ); }); - await updateAlerts({ - caseService, - unsecuredSavedObjectsClient, - casesClientInternal, - subCasesToSync: subCasesToSyncAlertsFor, - logger: clientArgs.logger, - }); - const returnUpdatedSubCases = updatedCases.saved_objects.reduce( (acc, updatedSO) => { const originalSubCase = subCasesMap.get(updatedSO.id); @@ -394,6 +388,15 @@ export async function update({ }), }); + // attempt to update the status of the alerts after creating all the user actions just in case it fails + await updateAlerts({ + caseService, + unsecuredSavedObjectsClient, + casesClientInternal, + subCasesToSync: subCasesToSyncAlertsFor, + logger: clientArgs.logger, + }); + return SubCasesResponseRt.encode(returnUpdatedSubCases); } catch (error) { const idVersions = query.subCases.map((subCase) => ({ diff --git a/x-pack/plugins/cases/server/client/types.ts b/x-pack/plugins/cases/server/client/types.ts index 27829d2539c7d..3979c19949d9a 100644 --- a/x-pack/plugins/cases/server/client/types.ts +++ b/x-pack/plugins/cases/server/client/types.ts @@ -6,7 +6,7 @@ */ import type { PublicMethodsOf } from '@kbn/utility-types'; -import { ElasticsearchClient, SavedObjectsClientContract, Logger } from 'kibana/server'; +import { SavedObjectsClientContract, Logger } from 'kibana/server'; import { User } from '../../common'; import { Authorization } from '../authorization/authorization'; import { @@ -24,7 +24,6 @@ import { LensServerPluginSetup } from '../../../lens/server'; * Parameters for initializing a cases client */ export interface CasesClientArgs { - readonly scopedClusterClient: ElasticsearchClient; readonly caseConfigureService: CaseConfigureService; readonly caseService: CasesService; readonly connectorMappingsService: ConnectorMappingsService; diff --git a/x-pack/plugins/cases/server/common/models/commentable_case.ts b/x-pack/plugins/cases/server/common/models/commentable_case.ts index 856d6378d5900..e540332b1ff84 100644 --- a/x-pack/plugins/cases/server/common/models/commentable_case.ts +++ b/x-pack/plugins/cases/server/common/models/commentable_case.ts @@ -34,10 +34,16 @@ import { CommentRequestUserType, CaseAttributes, } from '../../../common'; -import { flattenCommentSavedObjects, flattenSubCaseSavedObject, transformNewComment } from '..'; +import { + createAlertUpdateRequest, + flattenCommentSavedObjects, + flattenSubCaseSavedObject, + transformNewComment, +} from '..'; import { AttachmentService, CasesService } from '../../services'; import { createCaseError } from '../error'; import { countAlertsForID } from '../index'; +import { CasesClientInternal } from '../../client'; import { getOrUpdateLensReferences } from '../utils'; interface UpdateCommentResp { @@ -273,11 +279,13 @@ export class CommentableCase { user, commentReq, id, + casesClientInternal, }: { createdDate: string; user: User; commentReq: CommentRequest; id: string; + casesClientInternal: CasesClientInternal; }): Promise { try { if (commentReq.type === CommentType.alert) { @@ -294,6 +302,10 @@ export class CommentableCase { throw Boom.badRequest('The owner field of the comment must match the case'); } + // Let's try to sync the alert's status before creating the attachment, that way if the alert doesn't exist + // we'll throw an error early before creating the attachment + await this.syncAlertStatus(commentReq, casesClientInternal); + let references = this.buildRefsToCase(); if (commentReq.type === CommentType.user && commentReq?.comment) { @@ -331,6 +343,26 @@ export class CommentableCase { } } + private async syncAlertStatus( + commentRequest: CommentRequest, + casesClientInternal: CasesClientInternal + ) { + if ( + (commentRequest.type === CommentType.alert || + commentRequest.type === CommentType.generatedAlert) && + this.settings.syncAlerts + ) { + const alertsToUpdate = createAlertUpdateRequest({ + comment: commentRequest, + status: this.status, + }); + + await casesClientInternal.alerts.updateStatus({ + alerts: alertsToUpdate, + }); + } + } + private formatCollectionForEncoding(totalComment: number) { return { id: this.collection.id, diff --git a/x-pack/plugins/cases/server/connectors/servicenow/sir_format.test.ts b/x-pack/plugins/cases/server/connectors/servicenow/sir_format.test.ts index fa103d4c1142d..7a1efe8b366d0 100644 --- a/x-pack/plugins/cases/server/connectors/servicenow/sir_format.test.ts +++ b/x-pack/plugins/cases/server/connectors/servicenow/sir_format.test.ts @@ -24,7 +24,7 @@ describe('ITSM formatter', () => { } as CaseResponse; it('it formats correctly without alerts', async () => { - const res = await format(theCase, []); + const res = format(theCase, []); expect(res).toEqual({ dest_ip: null, source_ip: null, @@ -38,7 +38,7 @@ describe('ITSM formatter', () => { it('it formats correctly when fields do not exist ', async () => { const invalidFields = { connector: { fields: null } } as CaseResponse; - const res = await format(invalidFields, []); + const res = format(invalidFields, []); expect(res).toEqual({ dest_ip: null, source_ip: null, @@ -55,25 +55,31 @@ describe('ITSM formatter', () => { { id: 'alert-1', index: 'index-1', - destination: { ip: '192.168.1.1' }, - source: { ip: '192.168.1.2' }, - file: { - hash: { sha256: '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08' }, + source: { + destination: { ip: '192.168.1.1' }, + source: { ip: '192.168.1.2' }, + file: { + hash: { sha256: '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08' }, + }, + url: { full: 'https://attack.com' }, }, - url: { full: 'https://attack.com' }, }, { id: 'alert-2', index: 'index-2', - destination: { ip: '192.168.1.4' }, - source: { ip: '192.168.1.3' }, - file: { - hash: { sha256: '60303ae22b998861bce3b28f33eec1be758a213c86c93c076dbe9f558c11c752' }, + source: { + source: { + ip: '192.168.1.3', + }, + destination: { ip: '192.168.1.4' }, + file: { + hash: { sha256: '60303ae22b998861bce3b28f33eec1be758a213c86c93c076dbe9f558c11c752' }, + }, + url: { full: 'https://attack.com/api' }, }, - url: { full: 'https://attack.com/api' }, }, ]; - const res = await format(theCase, alerts); + const res = format(theCase, alerts); expect(res).toEqual({ dest_ip: '192.168.1.1,192.168.1.4', source_ip: '192.168.1.2,192.168.1.3', @@ -86,30 +92,109 @@ describe('ITSM formatter', () => { }); }); + it('it ignores alerts with an error', async () => { + const alerts = [ + { + id: 'alert-1', + index: 'index-1', + error: new Error('an error'), + source: { + destination: { ip: '192.168.1.1' }, + source: { ip: '192.168.1.2' }, + file: { + hash: { sha256: '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08' }, + }, + url: { full: 'https://attack.com' }, + }, + }, + { + id: 'alert-2', + index: 'index-2', + source: { + source: { + ip: '192.168.1.3', + }, + destination: { ip: '192.168.1.4' }, + file: { + hash: { sha256: '60303ae22b998861bce3b28f33eec1be758a213c86c93c076dbe9f558c11c752' }, + }, + url: { full: 'https://attack.com/api' }, + }, + }, + ]; + const res = format(theCase, alerts); + expect(res).toEqual({ + dest_ip: '192.168.1.4', + source_ip: '192.168.1.3', + category: 'Denial of Service', + subcategory: 'Inbound DDos', + malware_hash: '60303ae22b998861bce3b28f33eec1be758a213c86c93c076dbe9f558c11c752', + malware_url: 'https://attack.com/api', + priority: '2 - High', + }); + }); + + it('it ignores alerts without a source field', async () => { + const alerts = [ + { + id: 'alert-1', + index: 'index-1', + }, + { + id: 'alert-2', + index: 'index-2', + source: { + source: { + ip: '192.168.1.3', + }, + destination: { ip: '192.168.1.4' }, + file: { + hash: { sha256: '60303ae22b998861bce3b28f33eec1be758a213c86c93c076dbe9f558c11c752' }, + }, + url: { full: 'https://attack.com/api' }, + }, + }, + ]; + const res = format(theCase, alerts); + expect(res).toEqual({ + dest_ip: '192.168.1.4', + source_ip: '192.168.1.3', + category: 'Denial of Service', + subcategory: 'Inbound DDos', + malware_hash: '60303ae22b998861bce3b28f33eec1be758a213c86c93c076dbe9f558c11c752', + malware_url: 'https://attack.com/api', + priority: '2 - High', + }); + }); + it('it handles duplicates correctly', async () => { const alerts = [ { id: 'alert-1', index: 'index-1', - destination: { ip: '192.168.1.1' }, - source: { ip: '192.168.1.2' }, - file: { - hash: { sha256: '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08' }, + source: { + destination: { ip: '192.168.1.1' }, + source: { ip: '192.168.1.2' }, + file: { + hash: { sha256: '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08' }, + }, + url: { full: 'https://attack.com' }, }, - url: { full: 'https://attack.com' }, }, { id: 'alert-2', index: 'index-2', - destination: { ip: '192.168.1.1' }, - source: { ip: '192.168.1.3' }, - file: { - hash: { sha256: '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08' }, + source: { + destination: { ip: '192.168.1.1' }, + source: { ip: '192.168.1.3' }, + file: { + hash: { sha256: '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08' }, + }, + url: { full: 'https://attack.com/api' }, }, - url: { full: 'https://attack.com/api' }, }, ]; - const res = await format(theCase, alerts); + const res = format(theCase, alerts); expect(res).toEqual({ dest_ip: '192.168.1.1', source_ip: '192.168.1.2,192.168.1.3', @@ -126,22 +211,26 @@ describe('ITSM formatter', () => { { id: 'alert-1', index: 'index-1', - destination: { ip: '192.168.1.1' }, - source: { ip: '192.168.1.2' }, - file: { - hash: { sha256: '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08' }, + source: { + destination: { ip: '192.168.1.1' }, + source: { ip: '192.168.1.2' }, + file: { + hash: { sha256: '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08' }, + }, + url: { full: 'https://attack.com' }, }, - url: { full: 'https://attack.com' }, }, { id: 'alert-2', index: 'index-2', - destination: { ip: '192.168.1.1' }, - source: { ip: '192.168.1.3' }, - file: { - hash: { sha256: '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08' }, + source: { + destination: { ip: '192.168.1.1' }, + source: { ip: '192.168.1.3' }, + file: { + hash: { sha256: '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08' }, + }, + url: { full: 'https://attack.com/api' }, }, - url: { full: 'https://attack.com/api' }, }, ]; @@ -150,7 +239,7 @@ describe('ITSM formatter', () => { connector: { fields: { ...theCase.connector.fields, destIp: false, malwareHash: false } }, } as CaseResponse; - const res = await format(newCase, alerts); + const res = format(newCase, alerts); expect(res).toEqual({ dest_ip: null, source_ip: '192.168.1.2,192.168.1.3', diff --git a/x-pack/plugins/cases/server/connectors/servicenow/sir_format.ts b/x-pack/plugins/cases/server/connectors/servicenow/sir_format.ts index b48a1b7f734c8..88b8f79d3ba5b 100644 --- a/x-pack/plugins/cases/server/connectors/servicenow/sir_format.ts +++ b/x-pack/plugins/cases/server/connectors/servicenow/sir_format.ts @@ -44,23 +44,25 @@ export const format: ServiceNowSIRFormat = (theCase, alerts) => { ); if (fieldsToAdd.length > 0) { - sirFields = alerts.reduce>((acc, alert) => { - fieldsToAdd.forEach((alertField) => { - const field = get(alertFieldMapping[alertField].alertPath, alert); - if (field && !manageDuplicate[alertFieldMapping[alertField].sirFieldKey].has(field)) { - manageDuplicate[alertFieldMapping[alertField].sirFieldKey].add(field); - acc = { - ...acc, - [alertFieldMapping[alertField].sirFieldKey]: `${ - acc[alertFieldMapping[alertField].sirFieldKey] != null - ? `${acc[alertFieldMapping[alertField].sirFieldKey]},${field}` - : field - }`, - }; - } - }); - return acc; - }, sirFields); + sirFields = alerts + .filter((alert) => !alert.error && alert.source != null) + .reduce>((acc, alert) => { + fieldsToAdd.forEach((alertField) => { + const field = get(alertFieldMapping[alertField].alertPath, alert.source); + if (field && !manageDuplicate[alertFieldMapping[alertField].sirFieldKey].has(field)) { + manageDuplicate[alertFieldMapping[alertField].sirFieldKey].add(field); + acc = { + ...acc, + [alertFieldMapping[alertField].sirFieldKey]: `${ + acc[alertFieldMapping[alertField].sirFieldKey] != null + ? `${acc[alertFieldMapping[alertField].sirFieldKey]},${field}` + : field + }`, + }; + } + }); + return acc; + }, sirFields); } return { diff --git a/x-pack/plugins/cases/server/plugin.ts b/x-pack/plugins/cases/server/plugin.ts index bb1be163585a8..49220fc716034 100644 --- a/x-pack/plugins/cases/server/plugin.ts +++ b/x-pack/plugins/cases/server/plugin.ts @@ -32,6 +32,7 @@ import type { CasesRequestHandlerContext } from './types'; import { CasesClientFactory } from './client/factory'; import { SpacesPluginStart } from '../../spaces/server'; import { PluginStartContract as FeaturesPluginStart } from '../../features/server'; +import { RuleRegistryPluginStartContract } from '../../rule_registry/server'; import { LensServerPluginSetup } from '../../lens/server'; function createConfig(context: PluginInitializerContext) { @@ -49,6 +50,7 @@ export interface PluginsStart { features: FeaturesPluginStart; spaces?: SpacesPluginStart; actions: ActionsPluginStart; + ruleRegistry?: RuleRegistryPluginStartContract; } /** @@ -137,15 +139,13 @@ export class CasePlugin { }, featuresPluginStart: plugins.features, actionsPluginStart: plugins.actions, + ruleRegistryPluginStart: plugins.ruleRegistry, lensEmbeddableFactory: this.lensEmbeddableFactory!, }); - const client = core.elasticsearch.client; - const getCasesClientWithRequest = async (request: KibanaRequest): Promise => { return this.clientFactory.create({ request, - scopedClusterClient: client.asScoped(request).asCurrentUser, savedObjectsService: core.savedObjects, }); }; @@ -171,7 +171,6 @@ export class CasePlugin { return this.clientFactory.create({ request, - scopedClusterClient: context.core.elasticsearch.client.asCurrentUser, savedObjectsService: savedObjects, }); }, diff --git a/x-pack/plugins/cases/server/services/alerts/index.test.ts b/x-pack/plugins/cases/server/services/alerts/index.test.ts index 28c3a6278d544..0e1ad03a32af2 100644 --- a/x-pack/plugins/cases/server/services/alerts/index.test.ts +++ b/x-pack/plugins/cases/server/services/alerts/index.test.ts @@ -5,56 +5,75 @@ * 2.0. */ -import { KibanaRequest } from 'kibana/server'; import { CaseStatuses } from '../../../common'; import { AlertService, AlertServiceContract } from '.'; -import { elasticsearchServiceMock, loggingSystemMock } from 'src/core/server/mocks'; +import { loggingSystemMock } from 'src/core/server/mocks'; +import { ruleRegistryMocks } from '../../../../rule_registry/server/mocks'; +import { AlertsClient } from '../../../../rule_registry/server'; +import { PublicMethodsOf } from '@kbn/utility-types'; describe('updateAlertsStatus', () => { - const esClient = elasticsearchServiceMock.createElasticsearchClient(); const logger = loggingSystemMock.create().get('case'); + let alertsClient: jest.Mocked>; + let alertService: AlertServiceContract; + + beforeEach(async () => { + alertsClient = ruleRegistryMocks.createAlertsClientMock.create(); + alertService = new AlertService(alertsClient); + jest.restoreAllMocks(); + }); describe('happy path', () => { - let alertService: AlertServiceContract; const args = { alerts: [{ id: 'alert-id-1', index: '.siem-signals', status: CaseStatuses.closed }], - request: {} as KibanaRequest, - scopedClusterClient: esClient, logger, }; - beforeEach(async () => { - alertService = new AlertService(); - jest.restoreAllMocks(); + it('updates the status of the alert correctly', async () => { + await alertService.updateAlertsStatus(args); + + expect(alertsClient.update).toHaveBeenCalledWith({ + id: 'alert-id-1', + index: '.siem-signals', + status: CaseStatuses.closed, + }); }); - test('it update the status of the alert correctly', async () => { - await alertService.updateAlertsStatus(args); + it('translates the in-progress status to acknowledged', async () => { + await alertService.updateAlertsStatus({ + alerts: [{ id: 'alert-id-1', index: '.siem-signals', status: CaseStatuses['in-progress'] }], + logger, + }); - expect(esClient.bulk).toHaveBeenCalledWith({ - body: [ - { update: { _id: 'alert-id-1', _index: '.siem-signals' } }, - { - doc: { - signal: { - status: CaseStatuses.closed, - }, - }, - }, - ], + expect(alertsClient.update).toHaveBeenCalledWith({ + id: 'alert-id-1', + index: '.siem-signals', + status: 'acknowledged', }); }); - describe('unhappy path', () => { - it('ignores empty indices', async () => { - expect( - await alertService.updateAlertsStatus({ - alerts: [{ id: 'alert-id-1', index: '', status: CaseStatuses.closed }], - scopedClusterClient: esClient, - logger, - }) - ).toBeUndefined(); + it('defaults an unknown status to open', async () => { + await alertService.updateAlertsStatus({ + alerts: [{ id: 'alert-id-1', index: '.siem-signals', status: 'bananas' as CaseStatuses }], + logger, + }); + + expect(alertsClient.update).toHaveBeenCalledWith({ + id: 'alert-id-1', + index: '.siem-signals', + status: 'open', }); }); }); + + describe('unhappy path', () => { + it('ignores empty indices', async () => { + expect( + await alertService.updateAlertsStatus({ + alerts: [{ id: 'alert-id-1', index: '', status: CaseStatuses.closed }], + logger, + }) + ).toBeUndefined(); + }); + }); }); diff --git a/x-pack/plugins/cases/server/services/alerts/index.ts b/x-pack/plugins/cases/server/services/alerts/index.ts index e33b0385bc123..ccb0fca4f995f 100644 --- a/x-pack/plugins/cases/server/services/alerts/index.ts +++ b/x-pack/plugins/cases/server/services/alerts/index.ts @@ -9,56 +9,67 @@ import { isEmpty } from 'lodash'; import type { PublicMethodsOf } from '@kbn/utility-types'; -import { ElasticsearchClient, Logger } from 'kibana/server'; -import { MAX_ALERTS_PER_SUB_CASE } from '../../../common'; +import { Logger } from 'kibana/server'; +import { CaseStatuses, MAX_ALERTS_PER_SUB_CASE } from '../../../common'; import { AlertInfo, createCaseError } from '../../common'; import { UpdateAlertRequest } from '../../client/alerts/types'; +import { AlertsClient } from '../../../../rule_registry/server'; +import { Alert } from './types'; +import { STATUS_VALUES } from '../../../../rule_registry/common/technical_rule_data_field_names'; export type AlertServiceContract = PublicMethodsOf; interface UpdateAlertsStatusArgs { alerts: UpdateAlertRequest[]; - scopedClusterClient: ElasticsearchClient; logger: Logger; } interface GetAlertsArgs { alertsInfo: AlertInfo[]; - scopedClusterClient: ElasticsearchClient; logger: Logger; } -interface Alert { - _id: string; - _index: string; - _source: Record; -} - -interface AlertsResponse { - docs: Alert[]; -} - function isEmptyAlert(alert: AlertInfo): boolean { return isEmpty(alert.id) || isEmpty(alert.index); } export class AlertService { - constructor() {} + constructor(private readonly alertsClient?: PublicMethodsOf) {} - public async updateAlertsStatus({ alerts, scopedClusterClient, logger }: UpdateAlertsStatusArgs) { + public async updateAlertsStatus({ alerts, logger }: UpdateAlertsStatusArgs) { try { - const body = alerts - .filter((alert) => !isEmptyAlert(alert)) - .flatMap((alert) => [ - { update: { _id: alert.id, _index: alert.index } }, - { doc: { signal: { status: alert.status } } }, - ]); - - if (body.length <= 0) { + if (!this.alertsClient) { + throw new Error( + 'Alert client is undefined, the rule registry plugin must be enabled to updated the status of alerts' + ); + } + + const alertsToUpdate = alerts.filter((alert) => !isEmptyAlert(alert)); + + if (alertsToUpdate.length <= 0) { return; } - return scopedClusterClient.bulk({ body }); + const updatedAlerts = await Promise.allSettled( + alertsToUpdate.map((alert) => + this.alertsClient?.update({ + id: alert.id, + index: alert.index, + status: translateStatus({ alert, logger }), + _version: undefined, + }) + ) + ); + + updatedAlerts.forEach((updatedAlert, index) => { + if (updatedAlert.status === 'rejected') { + logger.error( + `Failed to update status for alert: ${JSON.stringify(alertsToUpdate[index])}: ${ + updatedAlert.reason + }` + ); + } + }); } catch (error) { throw createCaseError({ message: `Failed to update alert status ids: ${JSON.stringify(alerts)}: ${error}`, @@ -68,25 +79,51 @@ export class AlertService { } } - public async getAlerts({ - scopedClusterClient, - alertsInfo, - logger, - }: GetAlertsArgs): Promise { + public async getAlerts({ alertsInfo, logger }: GetAlertsArgs): Promise { try { - const docs = alertsInfo - .filter((alert) => !isEmptyAlert(alert)) - .slice(0, MAX_ALERTS_PER_SUB_CASE) - .map((alert) => ({ _id: alert.id, _index: alert.index })); + if (!this.alertsClient) { + throw new Error( + 'Alert client is undefined, the rule registry plugin must be enabled to retrieve alerts' + ); + } - if (docs.length <= 0) { + const alertsToGet = alertsInfo + .filter((alert) => !isEmpty(alert)) + .slice(0, MAX_ALERTS_PER_SUB_CASE); + + if (alertsToGet.length <= 0) { return; } - const results = await scopedClusterClient.mget({ body: { docs } }); + const retrievedAlerts = await Promise.allSettled( + alertsToGet.map(({ id, index }) => this.alertsClient?.get({ id, index })) + ); + + retrievedAlerts.forEach((alert, index) => { + if (alert.status === 'rejected') { + logger.error( + `Failed to retrieve alert: ${JSON.stringify(alertsToGet[index])}: ${alert.reason}` + ); + } + }); - // @ts-expect-error @elastic/elasticsearch _source is optional - return results.body; + return retrievedAlerts.map((alert, index) => { + let source: unknown | undefined; + let error: Error | undefined; + + if (alert.status === 'fulfilled') { + source = alert.value; + } else { + error = alert.reason; + } + + return { + id: alertsToGet[index].id, + index: alertsToGet[index].index, + source, + error, + }; + }); } catch (error) { throw createCaseError({ message: `Failed to retrieve alerts ids: ${JSON.stringify(alertsInfo)}: ${error}`, @@ -96,3 +133,27 @@ export class AlertService { } } } + +function translateStatus({ + alert, + logger, +}: { + alert: UpdateAlertRequest; + logger: Logger; +}): STATUS_VALUES { + const translatedStatuses: Record = { + [CaseStatuses.open]: 'open', + [CaseStatuses['in-progress']]: 'acknowledged', + [CaseStatuses.closed]: 'closed', + }; + + const translatedStatus = translatedStatuses[alert.status]; + if (!translatedStatus) { + logger.error( + `Unable to translate case status ${alert.status} during alert update: ${JSON.stringify( + alert + )}` + ); + } + return translatedStatus ?? 'open'; +} diff --git a/x-pack/plugins/cases/server/services/alerts/types.ts b/x-pack/plugins/cases/server/services/alerts/types.ts new file mode 100644 index 0000000000000..5ddc57fa5861c --- /dev/null +++ b/x-pack/plugins/cases/server/services/alerts/types.ts @@ -0,0 +1,13 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export interface Alert { + id: string; + index: string; + error?: Error; + source?: unknown; +} diff --git a/x-pack/plugins/cases/tsconfig.json b/x-pack/plugins/cases/tsconfig.json index 1c9373e023366..d7c123ce3970b 100644 --- a/x-pack/plugins/cases/tsconfig.json +++ b/x-pack/plugins/cases/tsconfig.json @@ -22,6 +22,7 @@ // Required from './kibana.json' { "path": "../actions/tsconfig.json" }, + { "path": "../rule_registry/tsconfig.json" }, { "path": "../triggers_actions_ui/tsconfig.json"}, { "path": "../../../src/plugins/es_ui_shared/tsconfig.json" }, { "path": "../../../src/plugins/kibana_react/tsconfig.json" }, diff --git a/x-pack/plugins/rule_registry/server/index.ts b/x-pack/plugins/rule_registry/server/index.ts index 19257845fabe4..2a609aa3bef7e 100644 --- a/x-pack/plugins/rule_registry/server/index.ts +++ b/x-pack/plugins/rule_registry/server/index.ts @@ -29,6 +29,7 @@ export { } from './utils/create_lifecycle_executor'; export { createPersistenceRuleTypeFactory } from './utils/create_persistence_rule_type_factory'; export * from './utils/persistence_types'; +export type { AlertsClient } from './alert_data_client/alerts_client'; export const plugin = (initContext: PluginInitializerContext) => new RuleRegistryPlugin(initContext); diff --git a/x-pack/plugins/rule_registry/server/mocks.ts b/x-pack/plugins/rule_registry/server/mocks.ts index 395b53e229d64..269eff182633f 100644 --- a/x-pack/plugins/rule_registry/server/mocks.ts +++ b/x-pack/plugins/rule_registry/server/mocks.ts @@ -5,10 +5,12 @@ * 2.0. */ +import { alertsClientMock } from './alert_data_client/alerts_client.mock'; import { ruleDataPluginServiceMock } from './rule_data_plugin_service/rule_data_plugin_service.mock'; import { createLifecycleAlertServicesMock } from './utils/lifecycle_alert_services_mock'; export const ruleRegistryMocks = { createLifecycleAlertServices: createLifecycleAlertServicesMock, createRuleDataPluginService: ruleDataPluginServiceMock.create, + createAlertsClientMock: alertsClientMock, }; diff --git a/x-pack/test/case_api_integration/security_and_spaces/tests/common/cases/patch_cases.ts b/x-pack/test/case_api_integration/security_and_spaces/tests/common/cases/patch_cases.ts index e2a7512940250..63b2f2e9b90ed 100644 --- a/x-pack/test/case_api_integration/security_and_spaces/tests/common/cases/patch_cases.ts +++ b/x-pack/test/case_api_integration/security_and_spaces/tests/common/cases/patch_cases.ts @@ -535,8 +535,8 @@ export default ({ getService }: FtrProviderContext): void => { }); it('should update the status of multiple alerts attached to multiple cases', async () => { - const signalID = '5f2b9ec41f8febb1c06b5d1045aeabb9874733b7617e88a370510f2fb3a41a5d'; - const signalID2 = '4d0f4b1533e46b66b43bdd0330d23f39f2cf42a7253153270e38d30cce9ff0c6'; + const signalID = '4679431ee0ba3209b6fcd60a255a696886fe0a7d18f5375de510ff5b68fa6b78'; + const signalID2 = '1023bcfea939643c5e51fd8df53797e0ea693cee547db579ab56d96402365c1e'; // does NOT updates alert status when adding comments and syncAlerts=false const individualCase1 = await createCase(supertest, { @@ -653,7 +653,7 @@ export default ({ getService }: FtrProviderContext): void => { CaseStatuses.closed ); expect(signals.get(defaultSignalsIndex)?.get(signalID2)?._source?.signal.status).to.be( - CaseStatuses['in-progress'] + 'acknowledged' ); }); }); @@ -846,7 +846,7 @@ export default ({ getService }: FtrProviderContext): void => { .send(getQuerySignalIds([alert._id])) .expect(200); - expect(updatedAlert.hits.hits[0]._source?.signal.status).eql('in-progress'); + expect(updatedAlert.hits.hits[0]._source?.signal.status).eql('acknowledged'); }); it('does NOT updates alert status when the status is updated and syncAlerts=false', async () => { @@ -970,7 +970,7 @@ export default ({ getService }: FtrProviderContext): void => { .send(getQuerySignalIds([alert._id])) .expect(200); - expect(updatedAlert.hits.hits[0]._source?.signal.status).eql('in-progress'); + expect(updatedAlert.hits.hits[0]._source?.signal.status).eql('acknowledged'); }); it('it does NOT updates alert status when syncAlerts is turned off', async () => { diff --git a/x-pack/test/case_api_integration/security_and_spaces/tests/common/client/update_alert_status.ts b/x-pack/test/case_api_integration/security_and_spaces/tests/common/client/update_alert_status.ts index 15df0f0b40d0f..d2949c9728989 100644 --- a/x-pack/test/case_api_integration/security_and_spaces/tests/common/client/update_alert_status.ts +++ b/x-pack/test/case_api_integration/security_and_spaces/tests/common/client/update_alert_status.ts @@ -35,8 +35,8 @@ export default ({ getService }: FtrProviderContext): void => { }); it('should update the status of multiple alerts attached to multiple cases using the cases client', async () => { - const signalID = '5f2b9ec41f8febb1c06b5d1045aeabb9874733b7617e88a370510f2fb3a41a5d'; - const signalID2 = '4d0f4b1533e46b66b43bdd0330d23f39f2cf42a7253153270e38d30cce9ff0c6'; + const signalID = '4679431ee0ba3209b6fcd60a255a696886fe0a7d18f5375de510ff5b68fa6b78'; + const signalID2 = '1023bcfea939643c5e51fd8df53797e0ea693cee547db579ab56d96402365c1e'; // does NOT updates alert status when adding comments and syncAlerts=false const individualCase1 = await createCase(supertest, { @@ -160,7 +160,7 @@ export default ({ getService }: FtrProviderContext): void => { CaseStatuses.closed ); expect(signals.get(defaultSignalsIndex)?.get(signalID2)?._source?.signal.status).to.be( - CaseStatuses['in-progress'] + 'acknowledged' ); }); }); diff --git a/x-pack/test/case_api_integration/security_and_spaces/tests/common/comments/post_comment.ts b/x-pack/test/case_api_integration/security_and_spaces/tests/common/comments/post_comment.ts index ecd05a2717e08..f4c31c052cddd 100644 --- a/x-pack/test/case_api_integration/security_and_spaces/tests/common/comments/post_comment.ts +++ b/x-pack/test/case_api_integration/security_and_spaces/tests/common/comments/post_comment.ts @@ -394,7 +394,7 @@ export default ({ getService }: FtrProviderContext): void => { .send(getQuerySignalIds([alert._id])) .expect(200); - expect(updatedAlert.hits.hits[0]._source.signal.status).eql('in-progress'); + expect(updatedAlert.hits.hits[0]._source.signal.status).eql('acknowledged'); }); it('should NOT change the status of the alert if sync alert is off', async () => { diff --git a/x-pack/test/case_api_integration/security_and_spaces/tests/common/sub_cases/patch_sub_cases.ts b/x-pack/test/case_api_integration/security_and_spaces/tests/common/sub_cases/patch_sub_cases.ts index 45fada30ab567..340fdfbf77de1 100644 --- a/x-pack/test/case_api_integration/security_and_spaces/tests/common/sub_cases/patch_sub_cases.ts +++ b/x-pack/test/case_api_integration/security_and_spaces/tests/common/sub_cases/patch_sub_cases.ts @@ -129,7 +129,7 @@ export default function ({ getService }: FtrProviderContext) { signals = await getSignalsWithES({ es, indices: defaultSignalsIndex, ids: signalID }); expect(signals.get(defaultSignalsIndex)?.get(signalID)?._source?.signal.status).to.be( - CaseStatuses['in-progress'] + 'acknowledged' ); }); @@ -200,7 +200,7 @@ export default function ({ getService }: FtrProviderContext) { CaseStatuses['in-progress'] ); expect(signals.get(defaultSignalsIndex)?.get(signalID2)?._source?.signal.status).to.be( - CaseStatuses['in-progress'] + 'acknowledged' ); }); @@ -321,7 +321,7 @@ export default function ({ getService }: FtrProviderContext) { CaseStatuses.closed ); expect(signals.get(defaultSignalsIndex)?.get(signalID2)?._source?.signal.status).to.be( - CaseStatuses['in-progress'] + 'acknowledged' ); }); @@ -470,7 +470,7 @@ export default function ({ getService }: FtrProviderContext) { // alerts should be updated now that the expect(signals.get(defaultSignalsIndex)?.get(signalID)?._source?.signal.status).to.be( - CaseStatuses['in-progress'] + 'acknowledged' ); expect(signals.get(defaultSignalsIndex)?.get(signalID2)?._source?.signal.status).to.be( CaseStatuses.closed diff --git a/x-pack/test/functional/es_archives/cases/signals/default/data.json.gz b/x-pack/test/functional/es_archives/cases/signals/default/data.json.gz index 6caae322450e44b439e17bc8b6cf6445a4a9940c..51a1c96980e77311c8506a5f5311f88b6d0f1177 100644 GIT binary patch literal 3945 zcmV-v50>yBiwFq9d>UZ@17u-zVJ>QOZ*BnXomr3EwjIFV{V9ZfEW$BK@sgkFwkaAE zX@h!;An67Jp0l#0kyg^|RrtG?(pxJGQ~yHb=}+2*z3B(SsB|Dl<{IIlM)!~u~S6e5&n)uGlBT8oA$oGT-asR>R`7X5lUo3@yn6b zs_yYbuB!8SYAe|+GmXnKUM|}6(z3FPthn)&|Fe7QpKq7Ad-mIR{ez+~Bt$X?up=4} z!~8)}&OpdGw~RALjcyO+NA?0@&8U2YYcQw4#ap5uUqz+fQ4Uak^(Rqs(_ z^@>j>j;H%_FNd~dA!>iXNh>+jmayl9NT*~y>Zot@e1 zJjn`M%err`w^MO-GvC;e1;lA=)XKG|<7cT?l~hU7Uw;7|ZItDCf4Zrmjrv9sI)WWg5{H0z z^8{q*6mU}Gh&@ zh;<`_U6(tz-1w=srjDA6?HW+qJ{0jH_FFk0`ntz?yTkr&%;R+?_*k#^Fu&LGeCsuL zm2A}YjXS@g`#WSMcDq~$aN~2NGeU94Kj*R-Ig(L9yssEOyAU1{!Ow$rd;|LBdYP*fydUjbmu39|2x3t}&Yi*kj%6Squ;pgF1 zIG=#od7hPV6<^xpo8sc6vI9@it5al6w6e^uKm>cy%0`+wb;v~!I4dDQ$SM$V1AP=I zt&utkC8WJ}X}a^%&4fplx@VhYo`OGss*uZaed2!@$amqBsS@~#gCe;yai#oWfkBa1 ztA+R6!veoOcDzZWj)SK@mHT854B}%--)K{I*j+6Bd0aMuz)9HO>_jdXEAPST!cQyf z{ZY3#)^=GorQL#5Ue7m~c@utgE$v8<(K>aM_80OgR&wdHU!U*KWuDJhMKjy;s>n2q#!aW=ijl3VeC56NQP$9Ha?xy$uj_sNyY5+d ztLAJ`yTs#iUz@3UW2SsHj1H8|Q@_MIU^v>9U(zOSWz-OAu>z3u2oU8YPzE7DozLpH zq<(Is@4(l#a}5Hn#tZK?jY=+#FS$Cet=U~wvZ`wIcIgwMZdtam6XPEBVkok!+#I#I z(To%E>v)?Z7Iz;bqfrOG5B{>;E{B+8RobG*b+S~(jrp!FR;W?i6jPs_%oLh%8*#4Vbq0B&&}u%o*>->>4M&& zt{3=?LAs!Wy4r4e)U$QzU7lU}iJsde+3`CTtzHDbyP&98R9C7C$cFr`yM%iZJQ-5M z4fUxAWj@H#*a9JHiM9wb^Q`@n@t8I_^*c*nqmRjK!#oz99+B#c=2lB z-~-+5!yImKUpUzIx#M1U=y#t$2iY^w!8_&fwbH@Ypv{~5foa^h~=Dy#t=Iyef_nv%zJ!!%CgPqMn*QA2vux$XLD z)Ub4nii^@~&~a+mUcfz>q4SCqhCbFZ%F8%GUc^--EZ|T`LJ)Nk5yzR~p+WCK3=bUQ z011u(Lr$WBSiLY{`0-Wnj8_8;ALxM}=7WR#0>ic&9(Tk;SNsHE$e#fi-YJK#6&St_ z1$zQ8L=OXoA6;YxUzDqA0)`VXoPgm33|qw$Fr0wlu+3KjhH;fkMjSdX#(?48k3Ah2 zDq>vZe72w=VVp6;9CKl0Et6acV+3ji#$z;KkIH6<+y)pppU zKCcT5lTw!DjuxiHrx!sBbHWo{!Lh3Tu{7_SBtKG5?%%=ZTO1%++*JMMso zF8B$cP&@-Dyi*QeD=2&&3ibq0h#v+D&%^U`c3z|ePM~lCg%c>8Kw+zR0)-PO9JcvN zpzuZ;d=V+)+KRE0;JqJvhBphPw8EmuNMn(ch&ZFD)uB=@GR#PYkucIS7&(MP9)^k< z=%@%aq!DyG_V)!qVJjd#`F_jwIvc2EE>)a(pVU*kcD$jprHdDc-EEh=;E zja(VKSdS^jX4h*z;o`<_o%~!Q(K=8Z2v2>k8k|AV5W|eS}RhT#liQ~SpPCDT;NRt;%_w!nA9Q7{uWXh{ZU9NQFRKD82QT6hulJ zfJ6ud(JYj#W4)i}rYOzKI=3I4Sqo$lK4P1jM7-YX!Lc-3a2KZ^SeI_@IWV|=YonwI z>gKi>THL*@>3Z8{ng=88dm8_q>ECW$K6njzYxhy#61J`WjImyE&+LccVcT)Bl0G-D z;-$}uywTres!o2g!M-Ti79DEpXH&c15eib-G;aiYzPD0u>xXaaG3J{MYb?=dL?d-g z%bJ5g3`Yo4%pjrdUvjd+IY(+7dv&>9X+6K7e$dU+Hl}}HrFqh?voY_TTJ^Kh<)qv2 z;lNC{qB+={HpjhMuI1*#FCR|7|FKJJcYA!ShmGG32_62vgz36=x~~0ZuWOG7uV3B0 zRM{sx;!XCT;~%HN`+uMQ?Vtbp;q;f`)r1d28t#<%peJdJP$&i|bGO!RG3AY)?|>`j zMSST^-eQ2|#x^JzVD*1lFE82#GT5AT&cYgk@x5#pBvpxXiEd&z%J=g{_)n zX9}<8JD>;p--mhN;J)7hwVm*|8y-61$A1Sz&@-UBJLT}Teh2hA6zmJ3JarS?=GQ4H zE|#};0(%qKo50=#_FBag*qgxKu+3Nc4hY={A;>unJH%uw!FxY8iVOb-oKjw%B7^_{ D7lFVE literal 5586 zcmV;@6)ox?iwFqo`7>Yu17u-zVJ>QOZ*BnXomr3LNOFMR`&S5hTuj#Fee{!IV+_Bn z_rdloJnlsyPZe8diBw&S`R`7uN)jnjrK{AEs&g0UnNg6*JR&k8zRu&HUpk#`@jUU} zubr+N+wL#r4-a}UD}VWC{EzsbnJc9%V57XHD9GTAK^Ahu9DYsP(g?h90@O_ zCIT`90}h60iZpZcqRY}o&Oem}-sG7df;{Vu^dJY$2R$1U0G9tli-+^^Y-(3kiNE|y zkqv!b=;5R+14E1e!~miHM)E6RUn#o56#en`etcf{{HUlDuxt;8l4#@!K!H&}sR$r8 z0RnAet))jIAh9f_(o25iCgUuYS&=>XX`YQorI_Eu|99U+e=e)xbfItaV(RsGl@HVf1yi#v;LvLWqD-VtC zv%2uT@$@1xCssp(X+ zL%KRDaGXZgjqe|;qJOFCWUnl-`>p$LU%!1DX2YzniubG{W^KqzHQMG1qQpt+v+gClmr}vh= zyi5o8)#}7r+F7B^U|!yO18PR4^Skxx4jr3YArqW%A%N$C#|g(p6QU@pu+<(b4FkoY zy@rd1Z2IVAUU!9YV<_Kdp4v#>4t=55>$uVmMBB%2KG@@FzBbxxCgS|0xU0`<^WR^4 zSApMse`NpFd-$CFFM1psLc8lvE`74gLFqfd24A#v)8%Y@196;I>K=Pp6H=0(D)b5j-UTKrnFT1Ub zl*%sUh(InWf^nX&YOtQRbZe_J?W#&2u1K5I=+8zwegYer&IXNXS=%B`A?uB=tGk{R zcjM{1kC<6Da8bQ)&0uW%w{I02MNe6K%*OaN>i?}ST7z%GZy4ok`oDO`%ssLn=)A~m z{SoJLJIyA=o2z{5$IiUHwFmvE^atgTMJMFzq9^O;CFHk*Y#y9#Zf%GOhrgYS^Q_1o z{QI33vO(b+Gw|9o)A2k87>yqR;czVocvUg)1?DzDz^xLo%e(;!N(O}RnlsLEOrqA_ z8xEKLZ(ie8OIw>G^kfMB0*a{~<*%yomvyDnGnW-6jtOXpqC)qg+iMD9C;0YP=7!Mt zHD)M%zu_Y>nu;&I$u>{XquA>Yb2r*W!+OUI^r$zBd0i>%&wO+Nb#Z3>D4$E~f}wu8 zeM>jXX%W_^xE2px8Co`6Z%02fdK7cIn8e=d$>er6omcj*C?;Qj{WY4A9+c7kSH>aw zH9qib9^;v5jCwW)u8WxCw{kw{EF4^CvptN)MXQ~TXT@Yz+`gY`*NeKJcjRI+x>$inD#*nf8#?%KtE#24q#xc$E{%vl@^N-tDYn{5I>g`|SIsZO$g{ zT?Zm!E-L?Mf9D+sQi-HnLxffGGM@NRlXA>*KV8Ezl}URj22rsm?-i zKjYJ}87xcvviS4QFModdQkJ?$Puj=o@4&F$ucwjr#A?w|WzH}y5Lh2#E+izvlD*I0Hh;FAUu-9fohH0n0}68~k%TsM=)&0EZw+oC zE|6QCf$i<-1`l$Con6^p)fcvV!=^vn8}6ZF;oeqVx>mS%9Y&JiUV?ioX@Yy*1osl$ zOK>m2y_3Q{H!a+~nBB1&LRgq;zyI{2?p_%DemvZ>+6xJ}@SHJ;H8EHSi?pNMXkrak zkWx%>@X%puOd!EJFPI3<5#-RKPZHeg{=9I{a{{A|XyAoVfJ!fcGLXh0Kqig=G5ao` zlaN8QKinf}{ak{3pAGJ{a95c6KFx zI1#@@{5~1+YlUEQ$thUi zAlG@m1c5TEZFW5y2;_9abJ%BO{5}X=)_z9{h@qw|kT?N(1EaIh3`l7Rzy=ep0u9k& zyiWmJzqkVe+%T$5#@B`bDZ;X$X_tlouVOvZSvK_U~Vqm=NGe5#R{RXL$D=<7#rcG*x$}@=45Brto+KsF2l2 zS!s-=&SMreTr-J1=TW06w#)_sy=DYEOcB%85RMQf0vbu9#wP@r5TNDS2`mWUnsGoe zCBQiEfY2-`LL7CFSDUjvry-OaaAqD)i~bS<{A>uY6@R_H^F!fa8TL)ITjIgNeT~PR z4G#w5(DRHu=TGnB!Akvi1ccFHAxV)3ia-=y3HRk5;b*H&^y3VOa8GA?kUQ<{iU|3SSS3i0MTA>*=~@xtbr?xPgb5L@ zqzMsr6CzBAFd@Q(2v3R#sl+Oikf|CgSePnCA%A$8-P_`LLZ!9aWMfyGoo z=B=i(%CUCIX&5F4AVSpavxEp+hAkn&N+}nP2wM@@TyiP!u(8YdWq27Ed$1zT_<^F{ zmZJp^*kw!+SBOFexDo=;=pLgDa|8&X+`IB`*t|X2F5?X<(FBBT{16c-8ftoB{O~{j zb`5Cc4E%6UPkWHB?d;4C>v`2__#r!%A8ys9YvqU6VI+wkCVse*CVtpW{4nvu#19ic zJSjh9oG5wMpW;@2C=F*hLY#iU5e_nowbxfxvERXDp9Zy-gDnikcMQO%Spvuu&io8Qk!;w6I zAEsT#i64G8e%K1ZUK@PzWO032;zO@?YR37NCAyr+q499bjlugbOY{apOdJJ{a1E$8 z2uPw3(3U%{q=JOt_qpQX%Mv$eN|PJ5?pzk|^0DGooXd6wthlEGKF9@kcE*Z7V&^hH z8Y_O*!wav&ND@{|SaBsySh1V1V#10ED<-UXQmi=OgNISy+xyzF?F&u z`epIwzF1KPVq(}CoRgddVS=MHCO?p4X_;3}m06PDhFR~iM?5M#j}KBE<2oKNOjt2t zMGu|S0xH0@i@CIA3TVU~2ts3KC<$8CcHr-j(+G9Q&SjdgV#11_3@f%Gu({-#fn)Q+ z6jn`s&qo}4cX8ezJ{RBLCys|)m_iKJL@I!FoE)je7$`3YaOE^nK5~CC( zj%uZ$ncwQ7peD*|0gXY6W5g4U?EbtoGU^Go)COP$E3+DdfD+1rAcBheBIw#3L_6d( zOdUca(+bE$BR?CBY=vNR$sL!tT{~{^Y><-nSa!*HokSp)( zj3Ov2^Od%K}bO$4%i|eBtt|{;Uu+0#&E@wA9=NO z!jl(@CzW?fJ4}HS&HyT{1&Rp+0t;9Xp`1o_O1C|y;X)jMCt0)45}s@swuC1urCd0k zY{g%5NdlJ}w|i&P+TZJ)ja}ZGjPm?JkuCRLAF|y$x;AbJ12_;5s306D>=-aSx@_#7 zAWolbyY~jAY$D25f(iM>-+cZ1>>A+A83^W{zWyL@-`Sa9vYO;11T$9oSc17tm#&sz zUWJh)f|&^BN}32}HxbN4FcZN{1oNZ>^Z5zdyQyRMHQKf?RguT^EBm88zb{|wR*#(hkJq>mv94Tw=@k(3NV#f;}iEgapfou}apF+}4~%QHl2_mu@|7vt18DQisw2oiG?{k?Y42e#Jm1K{Qc zb$z3kn8|kT_$H>TVL=zhHtkjHi#-F|+%pO|C=TfC$~J4EKzlII3eUKl_a>C;O0u2;AS_$%>*|S+)Qxuq;T`4=Qw?MneWxRgo!JIYGDNw|;d?xEp=F(Q~_f)K}$mfCQec8@2x*;VE8U2int!fH@n ztps$O5`m%0BMSq!dOx_Skl+Vg%Z*q%%re2v&jvSJDcD?+u;+&!n%RG;>G9dH=aVL; z(D1om&CNdM&`i#u*UqZw7NpvETIIe=p;{eXyyh*UT{q!aO;=f#ELG$ ztc&HI->-t`oMTPregVQkAwp+o?#X_@shKfaJ(7EFRi#!d3vP)`yyYOy4c|N(dP?3NLoE*Klo!uD`&V(u;2D_bp25LE z;X!A2=J_Mmda`4g=T>F9R_1vfR+5-!VxB8$VxHZ^JQMRw%ri01lQPfZX(S2r`@-iJWBZM{O(K8q%9g1P74_0`?Jt9;_r6&YMsX@?b=Mh6xMIl6z z^R(78G0(1Iar*NF0!0l16e$g~gBnnyk$@Hj681ZaQ&Ef$VV)8-J1sHKmT^nWvr@{1 zGtWdek0G1>X;NR&nd{pAiL;?ioYN_x-VAG}Z8y*5n#YV!atJ7Q7#NM? zd`wMXgm|f_d!KD?`smRc+21>&lk&afP;d7&dy|0)-%4-kWGFp z+1#p3*Ge|8!%7m_Ok{H|JsR<*fb`IV4q=r+)_9vSdszf#u+5BW=vlW5OC5d@{=q~oB z@73t-jE8qlNbgP$?0u~|AF_*G#{`6y?hrZZqy6IO9Zj6GF^+R5f(9aQPqvGFgCf6i zO+w{+yVwO;0LzQTp3heSbk1?L`hM}jK@mb{SL|5}657LrW}vV)_7ulr&#lUIt=RKA ztR!L2ggsZ%ggv_ndnW9euxG-aC&ixk&Y;2L#1~l`_7wKf_UQOZ*BnXo!O4uxVeDu{S-o724BJywD&I*Bc%I`}l2BVWad-RcD!pI&R8yptRv- zQ~+50huX?{Qf6}ByM6LMMHuV6;Bi{@fgwf!`T(&rMBWqcJqeaR@_uXD+xmR1H$|s| z-4uP7BkdvsC@};OBR$|lE&w#x*T^%-qwcPo&cgLZrAcV}?37*UEDw`SRqQPhUgAYl z_GLE@#S6a5i%j#lKbxu`*G0GMrM|M0&X;MHNS){1kv80}KIL+I2HQQGnq`!%^YJ9K z%=?3PCXSY52`8FdjrOnJ(p9MJa(GczJuY}zT&!YU@OqhXnCIbU-JMq@3+p7iwUz&W z_tZXbm$-ZO``h6`QRouFnE}`k35a6$ps2@y%REmrk3p(rcPKlu6%ef^<-;Yvb?bh% z(pc5oN@2Go*O#T<)cXv_``cTC-G;2_tYEZ<7fC+c!c1O-g_cE`)yIX2MzOjs?!4|C zs&>_ZS2g}-|7{m9?#i`_F4bbRO`aAML6-tbeGG^cJ_wY+fNBqE0|U;f=(S3R>p*ac zJh=4Xl69xilu&nxp|`|@O&?aw<*-Ae00l|_t5sM5Kj?QVAh6Rj9-uBz82Ij>*azGI zM1ki6+mY{05Bq@qN%}%>pZsuB3?9{nEDL!p>x*BkSR~iE^HFD3Ll&KSUwU&iJPxBu zrWe=S7X2ldGK$9CIT#|=uh=f)m#JRTh!-Zw;)4~sN(}cpY$rRC#8%yU!Z_ZI1-FuK zjnzi&ic z=xHO*FNV{N6|L1b;Ls3kfZ*5##F{6-T_b?u5(iXp*VA-*hV4QQ4Vu<-w|ec3&a$yt zy`!vc@NklQ`JiL%Wr$v9EiY zw>#|braWG6f=~5&kMnyS&$nH3U&$t2-?Z}^yT3zLVz1VNK%j zK>CVUsd_$9r3&f2db=eF0(K#8n4csqTR-RJ-w+M zS0x_STk3w%jns7q`6>$Q@bmC0j7`AwDoygR2(R?^@JytdSIJ)8iPN9BIBEUd*Xi@ z$#-UxsT|mfqat3aun_jJz^KTo)!KUQae>_)J>8^M$I(-p%6--c2C*@vZPb(vP~{9J15kNU--)SJ96?H9!SX4Pcob@5A`%MuZ}pN1r-KA@c++x7aU{rk(CFK^ydeSRJ6hM$GqFr2a59|*ezSbLff0X#x9 zAOXj~C-%%ahukGvNEq~a(o17EglFzHb2n#jsM`g8XWY%{(W|bfope@xAeScBcA^(L zigrkj1?8(ia+efk>*8AUnb#P}^_TEKD92r@JVkAGL79!4B-X(9D~Z+!GGS=-=Qxx* zJnS@=xF0t<6GU%73hH7XvXKnEGTyg72_A7Wyzi0j_Hho^c_{De`rK)+JNCQJ0DkNR zfZx4xc&fnfG!*RVz|ZCjj{<(4SYO{{B9`S0{AS=c1HT#gb&6-;Hv_+Mn{NdC%+2L> z_zBCnn|bdfc<;xa5Bwz8p3N0J%_{o9U4cDMBCZG%+?4_ckPu9;(NJL`gmH~j+M}LP z%0&vbd-4@t%EM@;gMT18h=lMx*QP6&3t?@P!axMB21v-j^9czE@4aU8;&c#`nGVi$ z&>0-+c7fj?9h?Mdb;;AYVI0QcXI|Xxs3E=WU0{7PYM2{F{ma~H&~a+mUBCmGp|OhO zx;EBQ!pb;7R>Vc%Yv4hj6N0D-h<}_J9vbuk#PGl&j*#FKF!V?;6027R3_qO&&o~)i z_(%`@I3Mgh6c~2h@U$ZyyW(d6L+=HE;k|Nrs=)9x6zmzm5IqhUelmgfy>(s|GccTi z;S3CCVAv_1f#D1c$8Ek5Fbs>7Gh)z1HU$j#e(d?cP!MGTW3vSb3G*0J%rN5yS~Knm zUn!p%$*DEH(32$KzNZ3$l#j6t5O?|R4Z*Jf4Dk#M|3JV{A`~!g^Aqhu3<%^3a6&1t zzEE3zRFy#fSAn6+W?(o2LuYWP+Xa4qz;KeG)g>JY)pgjDKCcf9qnzjYjuyt*=T|`s zQ{qLkNUupZTbQ7QyV*Yw6-ok`vYr%3s1zU+W5BtgHvED%45J89eb4KKlOsNW6COCb z5eb~)gcuVt5~o)N3geUD7$*Y?AL)4?=X;%pg2Jx*op!)u7yJxR=)V9cyjKoS6%?L^ zf;|Hi;>Ur)3-{uJU1TwVGbo%v;S36AP}nJ+LE#Jv$8Ek5D7=*lUj~Ahu43#Yc<;xa z4+;a$wXad2xYEdQM2r$tOIHXJD5ki;$X8r57#M_I&vgY=&`{r%kOt7~*xy$Gg`I$O z@k7h?dK)Nt%0(DipEOXrZoDCrjS1If#v5PRbMj%HL~TLsGNxm*#G1j|QGk%9QCPdy zfthO~s@1mLYA-otVD`3WLOkUKR)+!et1sF-Us&}GBrpOhEQA}-zzhv$D;s~+6{m83 z;?cDYAf10~qT6BByw zc5CrVg+!}BaU?v|xi&5hj!G)?pI;=Ank?-cgAIhcbgZ`>yQ!yXW!RODPsZ} zNe!0R^*Kd8RKg>4lzrtF9Mw30`xFyvrnzC9*>e|)a~m!(pGu0fHrBce2}g==+uOlv z_2P;^89>euQZCcNH-Q$I7!HZ?Y-8>rR|(g5jiHo7mvd-bAL{@^hB!VPilw~HT5BHn zbC#?#9y|YQWi>xP?`-G?S>+bCT)<-4h&?%KgNWou6Sgd_SuND63n-QnLPda zr?n14#M=~wGEB;RRi!Z98WRR_d;_8}4j>XPkQ#Dpy*UMekP0B*g+7tY<*aADU*@JL zPSiHHpPX3-WD#$|HrI)Gwb!F#skh)hPCv3P{oHe8aEI1LaOG6ZbvCxRdt1}@w)Hd* zM%oWF{sYtBZe2Qh4Y{@ZXlMz$R)5LZpm<>RUH7oqdt_;6sRt!R!mr^|7#H(R;+ z`0K~BAAai7+T9)>>!I=6E}`S!moQ(~&eyfy?RD+(;Psokmm>MBC%nlXbo~9y`S7o^ zzy0H%Kc4+MzM8OMNX?xh8}vlA5pw-e%G|HDTTFgy=R4wxX%=2tleZpWxv33uMp*ry z+RBU64tJWfcIrW$?K+2>=5%rU2tYSA+WCIeAM$GRf6l^~XSZink3YAwT@2cN>HYls zV3GOOW_<+6S_tGHx}PbUA*$hqbs9L;TI_>5dZ^wruj$_%@B{bx#p5pVUT=8J5$-nKn+l&2wMvD*y?3)(zzrvb?6N|HGNs({izU zv$2QdWA|ocPtD05mz8z$vijf#_eaMPv%{&`k>u>LFB1^>0xuKXE730|&tK^!g4eC0 z&v_}M#23m?NRh_`@jOTs z_XB1G^@YUHgC6rG^swjoh7yF0O(wX|5*x!LXI@LQzV^lbNnZBOUjTIvs>&UxV1R00 z0|Frf0VW98=hn&)>0|ca{r~t8f4sr-7eJ%anvwE%fs`kKTV2wDQC-(M>7Dvt0Bw>& zr(Es60ZQZRp7Hor-vHfRMsE2@lCozS#@_&S=KnytsGyYAuK7R)*oH_*XdonofN*1# zl~Ka{1NVXLIu4Ba0BCsN1Y2l`j{UwMmwE0;s9qTaOi$u7g_HRX=#l>SaUR%t=yyO} zCp_(j$By{v-vJTy0_g5uIXu(LQOZ*BnXomq3^IDWw2`%|d&xHa(LKKdz@)THvV z*@q;vl}T^8aLR0*7Aap_^W6i=mPCq_by+RRjhQNUH~%DvdAnic{8M?)O`iGTn>+{3 z2R$1U0G9uu#m)J6HnpqLkD@8Y$qCeiAkN4}I z9~G4XmQ}=15{*0oC@=~r6#+;=A+`(&qLGe`pJ@9!1g~AzR>{G* zmp3cnZC-zQrQYa<-oTbe9vaJA^ z)Bqy`2G)DbAfZ(AP;E{&>cz44u4SmnSFCQZ5E!vPs*m)eewDYs>Qz;e`}>(6&ASdZ zyR6ofs9)2f(vU{C+>P_KUeQx~mlfU?v*~;UET$d}-DB}mtwZ@-IfmsO{}KNVs539K zo*Ue|Zlkx16y7id0bz^*im{Eog&Z)Ld4YU@O6%HFll68Wc!LSLK~UWwq$>Bm%8(Q{ zNa1KPtbNpm+O8Mr3NnK<0$$bl&xS%RjHjkk%?|16sKC*UtQ+4yRz?3()yZC2V)tA3-@bnPHq3@uUl%Vo z{>gvqcD{YnPrf=JcI^D^+-%--xc1^`62)v@S}~o?ZL-$Vd}h8!<-c9@*zPwBa_tomeTH0Bm&0t>MdIM@krSrS>>JA;7TOkvia3O%_ zf=7qrq6twHRoH5em4<=h&|bquLpHs1GOxSBxG|J(o~JgFw?kj(^*XM!1JU;Jn-BJQ zny-!anu$0+DemfCZGQc=cNO^E_eb_$y@$`)|DwmSA+)=G=Q1X{9F(yGY=}k6FkO1% z8;GM@sYmQ(k;`y746 zH=5Rn)E<+XQE8LaFT1VGl*%sUh(InWg3-@cHCRtuy0ulAc2%VhSENm9^k<_TKY@)* zXM=`Y*0zW)WWDiqb=R}vZajVW7BkBRE~@vf8H{cJ_N`*07%6MF*_gjZ{lC>kYw}I_ z4WoQb{}<1gc|`UDofny{-{O33r`e=<3zcvE*qOJtcB3Da@t_>C7=(OX^kn_Kg#31p z&6BgutqpO);cqA7JS(yX|9 zOuqj5YcwN0D6{>qj6?Kmyy4e8<}=fn^=wXD7dgjor9bE_0$gXaJ&eXhtDTN##bj38 zzCYEj7j-}H$b~byS-kw~w}m;zl(GKA)CWH;!`J)9G0pP+ZEnZ&loF#2vfE+oqUeC$ zFDiDxTh3^?hr!2?O|%PuDkXs?fdFZ-vWPKb{95pyKV0_k?Kmc0)6BK@T&^FYubRK3 zDT`e*AHewp`*A&%zY2G1NTGZ0cUo~*dd+ROjEiE>+KMvr53-Tp(2%7#CgGb4m_wF# zJF6JKdA;_Sec!ar*~GmYKt!C2%0Jqlc_)BWGU?V7VKsRfPyDD!IcB+^u3?$+P-pXK zBpz80;$h~h?s;jdvryd6_;hRr%Tm8Ae*XF8&o5ufGJgy-TTD(9H2Yl8O!zonLIq&0 zgMbF2fR>a3Oem2~5Gi=A&$rG}B*aSW56!Sl)GSf6&qU2SHTG1Ew5?I3j?*UN$5_uh zKNu{5+C7?H1W<$QCC+Q^d!zpQK&{?{9g!NOkaFZXke=aaUmOBM7zEabIK2@PVaeV{ zYMWo%jwH6j!cLRNtucbRlt@AwI&@*U?zaYt5EqCd&VcLo41)&+!p^R^t{My5qhT{1 z?#=7avAk}pE?q0HyAC5sye{#&l{E3XZsK)`*Ck$;c-={PotqZ!Ud--T4IwN{wcmew zQFkv4em|bqS?z^{TzJly#F`i^ghkp>ZZxq5D@ZA(IC$tVH71Z?ofk|5=Lm9W(I;s| zT=(aNd!7>*bwmR%gaTB036y~}4goT81c=#pMVy2TqW$3>NlW4q-1}^Bua$$%C5L0b z#wxmTUemawheD1y zb=)YfxMhkn98K3rD5H*BVG#2SIuCu2NSd?!2Gl7741^9S9Va`% z7zSx=rRffH8Ug76#1ALpmx$jdBYv$AY%Vzk3moJ+&zB%jX0`pRX9IzpPIwOcjEvt0 zfy>(ONC7d_lm!wUkT);}3(bI(h5&3Z;VRG&1IGIlu=R~QAixcy+GKof2#_Ky8=7`$ z2=FS_Go59R?q0$2pm5pQ83E#&!QEwFp`7-69QaG69Vie1eg$DLVyVY zo)iI&uzZGh-!ZOEPM4XB^OY$)9sw$3HBwd@W2y6)MGe-t?Rf64N~|&onX0jZ zg{fi`@`sn%y)BMMgb)YltcMm#>Ah4^2IZ-9%o0XbkTiHBkO)pO6SQJfazmi;C_du_ zTT;J-2!CEgXcW`|N0%r}>~6{k2HI;6ET#%FZ#9)wjug+Jjv`pI4oRAF^Zl z;Z|L`R(^OLMw0kp;)g3~;)mVD4--F3{4nvulk!8xiIR8yDQ@M5(r}g|#OVhtF@#Zd zop6N3yp%d2DG>rIgN-zlK`aE+2ueewB1Q-kLxwX%V@{E>6q`lHlK5fw=jDf3$LX|$ z<&j;n<0&gwMJQUbD9tzuR5@CkBJVJ#;Yc3957RE=#1B6kKWv3yuMNIu`epHRU#uttF){57&PmRKFu_q8CqIy5 zX_;3}m9r$l4YS^3k9bsg9&e;N=5;(^n6P5PiXJ+t1yq1*7w6KJDWDN|AP9|_p(JQk z+kwBsoJOcab}rL|6%$tcWLU8kfz2h?3>=#uOkvf@@A-&h?=Jcc;&bu+ed2h?2UCc_ znn(q(j?R%QYC^@oAhU920X~NfUGICgzx!V`7epIi8d`epk4dKnVx6na{#h z!%#|Ho@B_5XO0XzZ9Q{PIbpQ)!VqJf3|?r-q*didRG`9)Q)igu&<7%z#X)-xm9h&s z@*|idPR#K#nIrXzdm4vKieLdHm;e>k6IjAgunLhliQkVoa*7Z5V2Vmh8548-Y|OD0 zg1t8QQ_{%HKMi7THeDUdIA9k+BQyR;XZ`3VYrj8f(#UE9cBGLG`+&IefO%CefQ()= zMqmhJ^b*E9rKs4lv3k=>cc76Q6s(CGTUS65c=6wE`Jbx*Eob?5%U*H&pvc|Xl}4%` zu>w*aOCz`H(zVja>oAf;BNL5WNfV9iCK{P&WTKIYMxK;LPWU~?GnU&?D~&AJU0(=F z(eX5r1P!gxk{A+00;3|PY$BFzg@e*MPKi+p5=XVt(9FN;qM#VH(b?I91%itn#r0bDJ(*Ey27BBS{1^5zLh|5zKBPn2BH}f|&^B zNeSlj6SQ|z$L?#iZDFb+kJFPUZlaG`l=@}yb6p7AV`R_n&=HF^b9B-Jm7=`%ZRZ` z){)%SIgO$c?@urhPAe=E!u)Iqvz3C)B?)dW{aOUaiiDz)fAA z{fv14$PgFv)aaD8rU3+rIg0UKyBGsoYxn_hbA!6R(M!x^J9m5&Q`WGc3uBx1D)z;m zfo<-Y1ss$IbarK%wN#)z8EB>hd&5m~EZp3xOxFrGufs|b+)QwDB~5U%o8V@Gn+a|v zxOq~z`O4eFgg=ICI2uonhntEDV=WEX28prVaGQ3IC%D;Fx`G~mK&P<~no=;#uGp~@o*1GjoVxT%of2Yi+r zv2>Vaf}5WWZnjdexg=rF4?Q%q|5DTAvtiFCO-!NTbH6$_`tQ!{0mc_L$!4BQ*T6vN7Mgf%3HaApO^1)N~h>e?VIfk=R{~f8Pf^ptwqPIcV3P5#qyM_n^thUNq>7~S5 z4&vPK&ZD8H@yxS-6^9I-fqCwk92}G$barQ+KVq#XJC=EFRi?#)BpC=F~Y7n4EX`mg{ zfEtYiv?!3U-%*^3Vtfeml&INhiFvk+TVkG-QZAf%CbD@9+4N77`ijn6*Y;1G4Q=9_ zP6_p9SUYXIi8iYZ*pY2QAqCPr&iEvUfO3a{(Kz~JY62s~OGVxLY;)5~kKV}s-VvRg zUp(2I{_Pr=%{f+c?w0}_lmv8kCY!Q8<2w!6C7Yxd?85_p8nlv4S!g!Ndb8k;C!0bsp`rDRLE)6}SYpL#kT8hgtPTiL zMBXlT8d&BAbb9eloJziooWQ#5_NA7yHxqYW8-)^Hl(yb9`ET zzx?2!4570t_N*ld?P)?YQP>-Mies_oR%Np525!6ZTBlGhxq@ zV$XYL(BN_6i>wWM3j1h#cas?(f55lZS)2-$JJUHKo_Q@rRB{f9i|HuzI3P{5V$y4i z4fBX<$FL2=5`wh#L?-N+uqRap8%rdhERGv>h61I^9czwq=ahF?@41Ox3Ut7NPE2^h zo(X#w)zN{p diff --git a/x-pack/test/functional/es_archives/cases/signals/duplicate_ids/mappings.json b/x-pack/test/functional/es_archives/cases/signals/duplicate_ids/mappings.json index 97b2897150212..6ec0622bfce71 100644 --- a/x-pack/test/functional/es_archives/cases/signals/duplicate_ids/mappings.json +++ b/x-pack/test/functional/es_archives/cases/signals/duplicate_ids/mappings.json @@ -2,6 +2,9 @@ "type": "index", "value": { "aliases": { + ".alerts-security.alerts-default": { + "is_write_index": false + }, ".siem-signals-default": { "is_write_index": true } @@ -9,7 +12,8 @@ "index": ".siem-signals-default-000001", "mappings": { "_meta": { - "version": 14 + "aliases_version": 1, + "version": 55 }, "dynamic": "false", "properties": { @@ -18,6 +22,14 @@ }, "agent": { "properties": { + "build": { + "properties": { + "original": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, "ephemeral_id": { "ignore_above": 1024, "type": "keyword" @@ -101,6 +113,10 @@ "ignore_above": 1024, "type": "keyword" }, + "continent_code": { + "ignore_above": 1024, + "type": "keyword" + }, "continent_name": { "ignore_above": 1024, "type": "keyword" @@ -120,6 +136,10 @@ "ignore_above": 1024, "type": "keyword" }, + "postal_code": { + "ignore_above": 1024, + "type": "keyword" + }, "region_iso_code": { "ignore_above": 1024, "type": "keyword" @@ -127,6 +147,10 @@ "region_name": { "ignore_above": 1024, "type": "keyword" + }, + "timezone": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -157,6 +181,10 @@ "ignore_above": 1024, "type": "keyword" }, + "subdomain": { + "ignore_above": 1024, + "type": "keyword" + }, "top_level_domain": { "ignore_above": 1024, "type": "keyword" @@ -214,6 +242,10 @@ }, "ignore_above": 1024, "type": "keyword" + }, + "roles": { + "ignore_above": 1024, + "type": "keyword" } } } @@ -226,6 +258,10 @@ "id": { "ignore_above": 1024, "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -253,6 +289,18 @@ } } }, + "project": { + "properties": { + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, "provider": { "ignore_above": 1024, "type": "keyword" @@ -260,6 +308,14 @@ "region": { "ignore_above": 1024, "type": "keyword" + }, + "service": { + "properties": { + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } } } }, @@ -315,6 +371,19 @@ } } }, + "data_stream": { + "properties": { + "dataset": { + "type": "keyword" + }, + "namespace": { + "type": "keyword" + }, + "type": { + "type": "keyword" + } + } + }, "destination": { "properties": { "address": { @@ -355,6 +424,10 @@ "ignore_above": 1024, "type": "keyword" }, + "continent_code": { + "ignore_above": 1024, + "type": "keyword" + }, "continent_name": { "ignore_above": 1024, "type": "keyword" @@ -374,6 +447,10 @@ "ignore_above": 1024, "type": "keyword" }, + "postal_code": { + "ignore_above": 1024, + "type": "keyword" + }, "region_iso_code": { "ignore_above": 1024, "type": "keyword" @@ -381,6 +458,10 @@ "region_name": { "ignore_above": 1024, "type": "keyword" + }, + "timezone": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -411,6 +492,10 @@ "ignore_above": 1024, "type": "keyword" }, + "subdomain": { + "ignore_above": 1024, + "type": "keyword" + }, "top_level_domain": { "ignore_above": 1024, "type": "keyword" @@ -468,6 +553,10 @@ }, "ignore_above": 1024, "type": "keyword" + }, + "roles": { + "ignore_above": 1024, + "type": "keyword" } } } @@ -480,6 +569,10 @@ "exists": { "type": "boolean" }, + "signing_id": { + "ignore_above": 1024, + "type": "keyword" + }, "status": { "ignore_above": 1024, "type": "keyword" @@ -488,6 +581,10 @@ "ignore_above": 1024, "type": "keyword" }, + "team_id": { + "ignore_above": 1024, + "type": "keyword" + }, "trusted": { "type": "boolean" }, @@ -513,6 +610,10 @@ "sha512": { "ignore_above": 1024, "type": "keyword" + }, + "ssdeep": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -526,6 +627,10 @@ }, "pe": { "properties": { + "architecture": { + "ignore_above": 1024, + "type": "keyword" + }, "company": { "ignore_above": 1024, "type": "keyword" @@ -538,6 +643,10 @@ "ignore_above": 1024, "type": "keyword" }, + "imphash": { + "ignore_above": 1024, + "type": "keyword" + }, "original_file_name": { "ignore_above": 1024, "type": "keyword" @@ -728,6 +837,10 @@ "ignore_above": 1024, "type": "keyword" }, + "reason": { + "ignore_above": 1024, + "type": "keyword" + }, "reference": { "ignore_above": 1024, "type": "keyword" @@ -775,6 +888,10 @@ "exists": { "type": "boolean" }, + "signing_id": { + "ignore_above": 1024, + "type": "keyword" + }, "status": { "ignore_above": 1024, "type": "keyword" @@ -783,6 +900,10 @@ "ignore_above": 1024, "type": "keyword" }, + "team_id": { + "ignore_above": 1024, + "type": "keyword" + }, "trusted": { "type": "boolean" }, @@ -838,6 +959,10 @@ "sha512": { "ignore_above": 1024, "type": "keyword" + }, + "ssdeep": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -876,6 +1001,10 @@ }, "pe": { "properties": { + "architecture": { + "ignore_above": 1024, + "type": "keyword" + }, "company": { "ignore_above": 1024, "type": "keyword" @@ -888,6 +1017,10 @@ "ignore_above": 1024, "type": "keyword" }, + "imphash": { + "ignore_above": 1024, + "type": "keyword" + }, "original_file_name": { "ignore_above": 1024, "type": "keyword" @@ -918,6 +1051,112 @@ "uid": { "ignore_above": 1024, "type": "keyword" + }, + "x509": { + "properties": { + "alternative_names": { + "ignore_above": 1024, + "type": "keyword" + }, + "issuer": { + "properties": { + "common_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "country": { + "ignore_above": 1024, + "type": "keyword" + }, + "distinguished_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "locality": { + "ignore_above": 1024, + "type": "keyword" + }, + "organization": { + "ignore_above": 1024, + "type": "keyword" + }, + "organizational_unit": { + "ignore_above": 1024, + "type": "keyword" + }, + "state_or_province": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "not_after": { + "type": "date" + }, + "not_before": { + "type": "date" + }, + "public_key_algorithm": { + "ignore_above": 1024, + "type": "keyword" + }, + "public_key_curve": { + "ignore_above": 1024, + "type": "keyword" + }, + "public_key_exponent": { + "doc_values": false, + "index": false, + "type": "long" + }, + "public_key_size": { + "type": "long" + }, + "serial_number": { + "ignore_above": 1024, + "type": "keyword" + }, + "signature_algorithm": { + "ignore_above": 1024, + "type": "keyword" + }, + "subject": { + "properties": { + "common_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "country": { + "ignore_above": 1024, + "type": "keyword" + }, + "distinguished_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "locality": { + "ignore_above": 1024, + "type": "keyword" + }, + "organization": { + "ignore_above": 1024, + "type": "keyword" + }, + "organizational_unit": { + "ignore_above": 1024, + "type": "keyword" + }, + "state_or_province": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "version_number": { + "ignore_above": 1024, + "type": "keyword" + } + } } } }, @@ -998,6 +1237,32 @@ "ignore_above": 1024, "type": "keyword" }, + "cpu": { + "properties": { + "usage": { + "scaling_factor": 1000, + "type": "scaled_float" + } + } + }, + "disk": { + "properties": { + "read": { + "properties": { + "bytes": { + "type": "long" + } + } + }, + "write": { + "properties": { + "bytes": { + "type": "long" + } + } + } + } + }, "domain": { "ignore_above": 1024, "type": "keyword" @@ -1008,6 +1273,10 @@ "ignore_above": 1024, "type": "keyword" }, + "continent_code": { + "ignore_above": 1024, + "type": "keyword" + }, "continent_name": { "ignore_above": 1024, "type": "keyword" @@ -1027,6 +1296,10 @@ "ignore_above": 1024, "type": "keyword" }, + "postal_code": { + "ignore_above": 1024, + "type": "keyword" + }, "region_iso_code": { "ignore_above": 1024, "type": "keyword" @@ -1034,6 +1307,10 @@ "region_name": { "ignore_above": 1024, "type": "keyword" + }, + "timezone": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -1056,6 +1333,30 @@ "ignore_above": 1024, "type": "keyword" }, + "network": { + "properties": { + "egress": { + "properties": { + "bytes": { + "type": "long" + }, + "packets": { + "type": "long" + } + } + }, + "ingress": { + "properties": { + "bytes": { + "type": "long" + }, + "packets": { + "type": "long" + } + } + } + } + }, "os": { "properties": { "family": { @@ -1090,6 +1391,10 @@ "ignore_above": 1024, "type": "keyword" }, + "type": { + "ignore_above": 1024, + "type": "keyword" + }, "version": { "ignore_above": 1024, "type": "keyword" @@ -1156,6 +1461,10 @@ }, "ignore_above": 1024, "type": "keyword" + }, + "roles": { + "ignore_above": 1024, + "type": "keyword" } } } @@ -1185,10 +1494,18 @@ "bytes": { "type": "long" }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, "method": { "ignore_above": 1024, "type": "keyword" }, + "mime_type": { + "ignore_above": 1024, + "type": "keyword" + }, "referrer": { "ignore_above": 1024, "type": "keyword" @@ -1217,6 +1534,10 @@ "bytes": { "type": "long" }, + "mime_type": { + "ignore_above": 1024, + "type": "keyword" + }, "status_code": { "type": "long" } @@ -1244,11 +1565,475 @@ } } }, - "labels": { - "type": "object" + "kibana": { + "properties": { + "alert": { + "properties": { + "ancestors": { + "properties": { + "depth": { + "path": "signal.ancestors.depth", + "type": "alias" + }, + "id": { + "path": "signal.ancestors.id", + "type": "alias" + }, + "index": { + "path": "signal.ancestors.index", + "type": "alias" + }, + "type": { + "path": "signal.ancestors.type", + "type": "alias" + } + } + }, + "depth": { + "path": "signal.depth", + "type": "alias" + }, + "original_event": { + "properties": { + "action": { + "path": "signal.original_event.action", + "type": "alias" + }, + "category": { + "path": "signal.original_event.category", + "type": "alias" + }, + "code": { + "path": "signal.original_event.code", + "type": "alias" + }, + "created": { + "path": "signal.original_event.created", + "type": "alias" + }, + "dataset": { + "path": "signal.original_event.dataset", + "type": "alias" + }, + "duration": { + "path": "signal.original_event.duration", + "type": "alias" + }, + "end": { + "path": "signal.original_event.end", + "type": "alias" + }, + "hash": { + "path": "signal.original_event.hash", + "type": "alias" + }, + "id": { + "path": "signal.original_event.id", + "type": "alias" + }, + "kind": { + "path": "signal.original_event.kind", + "type": "alias" + }, + "module": { + "path": "signal.original_event.module", + "type": "alias" + }, + "outcome": { + "path": "signal.original_event.outcome", + "type": "alias" + }, + "provider": { + "path": "signal.original_event.provider", + "type": "alias" + }, + "reason": { + "path": "signal.original_event.reason", + "type": "alias" + }, + "risk_score": { + "path": "signal.original_event.risk_score", + "type": "alias" + }, + "risk_score_norm": { + "path": "signal.original_event.risk_score_norm", + "type": "alias" + }, + "sequence": { + "path": "signal.original_event.sequence", + "type": "alias" + }, + "severity": { + "path": "signal.original_event.severity", + "type": "alias" + }, + "start": { + "path": "signal.original_event.start", + "type": "alias" + }, + "timezone": { + "path": "signal.original_event.timezone", + "type": "alias" + }, + "type": { + "path": "signal.original_event.type", + "type": "alias" + } + } + }, + "original_time": { + "path": "signal.original_time", + "type": "alias" + }, + "reason": { + "path": "signal.reason", + "type": "alias" + }, + "risk_score": { + "path": "signal.rule.risk_score", + "type": "alias" + }, + "rule": { + "properties": { + "author": { + "path": "signal.rule.author", + "type": "alias" + }, + "building_block_type": { + "path": "signal.rule.building_block_type", + "type": "alias" + }, + "consumer": { + "type": "constant_keyword", + "value": "siem" + }, + "created_at": { + "path": "signal.rule.created_at", + "type": "alias" + }, + "created_by": { + "path": "signal.rule.created_by", + "type": "alias" + }, + "description": { + "path": "signal.rule.description", + "type": "alias" + }, + "enabled": { + "path": "signal.rule.enabled", + "type": "alias" + }, + "false_positives": { + "path": "signal.rule.false_positives", + "type": "alias" + }, + "from": { + "path": "signal.rule.from", + "type": "alias" + }, + "id": { + "path": "signal.rule.id", + "type": "alias" + }, + "immutable": { + "path": "signal.rule.immutable", + "type": "alias" + }, + "index": { + "path": "signal.rule.index", + "type": "alias" + }, + "interval": { + "path": "signal.rule.interval", + "type": "alias" + }, + "language": { + "path": "signal.rule.language", + "type": "alias" + }, + "license": { + "path": "signal.rule.license", + "type": "alias" + }, + "max_signals": { + "path": "signal.rule.max_signals", + "type": "alias" + }, + "name": { + "path": "signal.rule.name", + "type": "alias" + }, + "note": { + "path": "signal.rule.note", + "type": "alias" + }, + "producer": { + "type": "constant_keyword", + "value": "siem" + }, + "query": { + "path": "signal.rule.query", + "type": "alias" + }, + "references": { + "path": "signal.rule.references", + "type": "alias" + }, + "risk_score_mapping": { + "properties": { + "field": { + "path": "signal.rule.risk_score_mapping.field", + "type": "alias" + }, + "operator": { + "path": "signal.rule.risk_score_mapping.operator", + "type": "alias" + }, + "value": { + "path": "signal.rule.risk_score_mapping.value", + "type": "alias" + } + } + }, + "rule_id": { + "path": "signal.rule.rule_id", + "type": "alias" + }, + "rule_name_override": { + "path": "signal.rule.rule_name_override", + "type": "alias" + }, + "rule_type_id": { + "type": "constant_keyword", + "value": "siem.signals" + }, + "saved_id": { + "path": "signal.rule.saved_id", + "type": "alias" + }, + "severity_mapping": { + "properties": { + "field": { + "path": "signal.rule.severity_mapping.field", + "type": "alias" + }, + "operator": { + "path": "signal.rule.severity_mapping.operator", + "type": "alias" + }, + "severity": { + "path": "signal.rule.severity_mapping.severity", + "type": "alias" + }, + "value": { + "path": "signal.rule.severity_mapping.value", + "type": "alias" + } + } + }, + "tags": { + "path": "signal.rule.tags", + "type": "alias" + }, + "threat": { + "properties": { + "framework": { + "path": "signal.rule.threat.framework", + "type": "alias" + }, + "tactic": { + "properties": { + "id": { + "path": "signal.rule.threat.tactic.id", + "type": "alias" + }, + "name": { + "path": "signal.rule.threat.tactic.name", + "type": "alias" + }, + "reference": { + "path": "signal.rule.threat.tactic.reference", + "type": "alias" + } + } + }, + "technique": { + "properties": { + "id": { + "path": "signal.rule.threat.technique.id", + "type": "alias" + }, + "name": { + "path": "signal.rule.threat.technique.name", + "type": "alias" + }, + "reference": { + "path": "signal.rule.threat.technique.reference", + "type": "alias" + }, + "subtechnique": { + "properties": { + "id": { + "path": "signal.rule.threat.technique.subtechnique.id", + "type": "alias" + }, + "name": { + "path": "signal.rule.threat.technique.subtechnique.name", + "type": "alias" + }, + "reference": { + "path": "signal.rule.threat.technique.subtechnique.reference", + "type": "alias" + } + } + } + } + } + } + }, + "threat_index": { + "path": "signal.rule.threat_index", + "type": "alias" + }, + "threat_indicator_path": { + "path": "signal.rule.threat_indicator_path", + "type": "alias" + }, + "threat_language": { + "path": "signal.rule.threat_language", + "type": "alias" + }, + "threat_mapping": { + "properties": { + "entries": { + "properties": { + "field": { + "path": "signal.rule.threat_mapping.entries.field", + "type": "alias" + }, + "type": { + "path": "signal.rule.threat_mapping.entries.type", + "type": "alias" + }, + "value": { + "path": "signal.rule.threat_mapping.entries.value", + "type": "alias" + } + } + } + } + }, + "threat_query": { + "path": "signal.rule.threat_query", + "type": "alias" + }, + "threshold": { + "properties": { + "field": { + "path": "signal.rule.threshold.field", + "type": "alias" + }, + "value": { + "path": "signal.rule.threshold.value", + "type": "alias" + } + } + }, + "timeline_id": { + "path": "signal.rule.timeline_id", + "type": "alias" + }, + "timeline_title": { + "path": "signal.rule.timeline_title", + "type": "alias" + }, + "to": { + "path": "signal.rule.to", + "type": "alias" + }, + "type": { + "path": "signal.rule.type", + "type": "alias" + }, + "updated_at": { + "path": "signal.rule.updated_at", + "type": "alias" + }, + "updated_by": { + "path": "signal.rule.updated_by", + "type": "alias" + }, + "version": { + "path": "signal.rule.version", + "type": "alias" + } + } + }, + "severity": { + "path": "signal.rule.severity", + "type": "alias" + }, + "threshold_result": { + "properties": { + "cardinality": { + "properties": { + "field": { + "path": "signal.threshold_result.cardinality.field", + "type": "alias" + }, + "value": { + "path": "signal.threshold_result.cardinality.value", + "type": "alias" + } + } + }, + "count": { + "path": "signal.threshold_result.count", + "type": "alias" + }, + "from": { + "path": "signal.threshold_result.from", + "type": "alias" + }, + "terms": { + "properties": { + "field": { + "path": "signal.threshold_result.terms.field", + "type": "alias" + }, + "value": { + "path": "signal.threshold_result.terms.value", + "type": "alias" + } + } + } + } + }, + "workflow_status": { + "path": "signal.status", + "type": "alias" + } + } + }, + "space_ids": { + "type": "constant_keyword", + "value": "default" + } + } + }, + "labels": { + "type": "object" }, "log": { "properties": { + "file": { + "properties": { + "path": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, "level": { "ignore_above": 1024, "type": "keyword" @@ -1434,6 +2219,10 @@ "ignore_above": 1024, "type": "keyword" }, + "continent_code": { + "ignore_above": 1024, + "type": "keyword" + }, "continent_name": { "ignore_above": 1024, "type": "keyword" @@ -1453,6 +2242,10 @@ "ignore_above": 1024, "type": "keyword" }, + "postal_code": { + "ignore_above": 1024, + "type": "keyword" + }, "region_iso_code": { "ignore_above": 1024, "type": "keyword" @@ -1460,6 +2253,10 @@ "region_name": { "ignore_above": 1024, "type": "keyword" + }, + "timezone": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -1548,6 +2345,10 @@ "ignore_above": 1024, "type": "keyword" }, + "type": { + "ignore_above": 1024, + "type": "keyword" + }, "version": { "ignore_above": 1024, "type": "keyword" @@ -1576,6 +2377,54 @@ } } }, + "orchestrator": { + "properties": { + "api_version": { + "ignore_above": 1024, + "type": "keyword" + }, + "cluster": { + "properties": { + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "url": { + "ignore_above": 1024, + "type": "keyword" + }, + "version": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "namespace": { + "ignore_above": 1024, + "type": "keyword" + }, + "organization": { + "ignore_above": 1024, + "type": "keyword" + }, + "resource": { + "properties": { + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "type": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "type": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, "organization": { "properties": { "id": { @@ -1726,6 +2575,10 @@ "exists": { "type": "boolean" }, + "signing_id": { + "ignore_above": 1024, + "type": "keyword" + }, "status": { "ignore_above": 1024, "type": "keyword" @@ -1734,6 +2587,10 @@ "ignore_above": 1024, "type": "keyword" }, + "team_id": { + "ignore_above": 1024, + "type": "keyword" + }, "trusted": { "type": "boolean" }, @@ -1786,6 +2643,10 @@ "sha512": { "ignore_above": 1024, "type": "keyword" + }, + "ssdeep": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -1813,6 +2674,10 @@ "exists": { "type": "boolean" }, + "signing_id": { + "ignore_above": 1024, + "type": "keyword" + }, "status": { "ignore_above": 1024, "type": "keyword" @@ -1821,6 +2686,10 @@ "ignore_above": 1024, "type": "keyword" }, + "team_id": { + "ignore_above": 1024, + "type": "keyword" + }, "trusted": { "type": "boolean" }, @@ -1873,6 +2742,10 @@ "sha512": { "ignore_above": 1024, "type": "keyword" + }, + "ssdeep": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -1886,22 +2759,54 @@ "ignore_above": 1024, "type": "keyword" }, - "pgid": { - "type": "long" - }, - "pid": { - "type": "long" - }, - "ppid": { - "type": "long" - }, - "start": { - "type": "date" - }, - "thread": { + "pe": { "properties": { - "id": { - "type": "long" + "architecture": { + "ignore_above": 1024, + "type": "keyword" + }, + "company": { + "ignore_above": 1024, + "type": "keyword" + }, + "description": { + "ignore_above": 1024, + "type": "keyword" + }, + "file_version": { + "ignore_above": 1024, + "type": "keyword" + }, + "imphash": { + "ignore_above": 1024, + "type": "keyword" + }, + "original_file_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "product": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "pgid": { + "type": "long" + }, + "pid": { + "type": "long" + }, + "ppid": { + "type": "long" + }, + "start": { + "type": "date" + }, + "thread": { + "properties": { + "id": { + "type": "long" }, "name": { "ignore_above": 1024, @@ -1936,6 +2841,10 @@ }, "pe": { "properties": { + "architecture": { + "ignore_above": 1024, + "type": "keyword" + }, "company": { "ignore_above": 1024, "type": "keyword" @@ -1948,6 +2857,10 @@ "ignore_above": 1024, "type": "keyword" }, + "imphash": { + "ignore_above": 1024, + "type": "keyword" + }, "original_file_name": { "ignore_above": 1024, "type": "keyword" @@ -2048,6 +2961,10 @@ "ignore_above": 1024, "type": "keyword" }, + "hosts": { + "ignore_above": 1024, + "type": "keyword" + }, "ip": { "type": "ip" }, @@ -2141,6 +3058,10 @@ "ignore_above": 1024, "type": "keyword" }, + "continent_code": { + "ignore_above": 1024, + "type": "keyword" + }, "continent_name": { "ignore_above": 1024, "type": "keyword" @@ -2160,6 +3081,10 @@ "ignore_above": 1024, "type": "keyword" }, + "postal_code": { + "ignore_above": 1024, + "type": "keyword" + }, "region_iso_code": { "ignore_above": 1024, "type": "keyword" @@ -2167,6 +3092,10 @@ "region_name": { "ignore_above": 1024, "type": "keyword" + }, + "timezone": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -2197,6 +3126,10 @@ "ignore_above": 1024, "type": "keyword" }, + "subdomain": { + "ignore_above": 1024, + "type": "keyword" + }, "top_level_domain": { "ignore_above": 1024, "type": "keyword" @@ -2254,6 +3187,10 @@ }, "ignore_above": 1024, "type": "keyword" + }, + "roles": { + "ignore_above": 1024, + "type": "keyword" } } } @@ -2382,6 +3319,9 @@ "provider": { "type": "keyword" }, + "reason": { + "type": "keyword" + }, "risk_score": { "type": "float" }, @@ -2451,6 +3391,9 @@ } } }, + "reason": { + "type": "keyword" + }, "rule": { "properties": { "author": { @@ -2612,6 +3555,38 @@ } } }, + "threat_filters": { + "type": "object" + }, + "threat_index": { + "type": "keyword" + }, + "threat_indicator_path": { + "type": "keyword" + }, + "threat_language": { + "type": "keyword" + }, + "threat_mapping": { + "properties": { + "entries": { + "properties": { + "field": { + "type": "keyword" + }, + "type": { + "type": "keyword" + }, + "value": { + "type": "keyword" + } + } + } + } + }, + "threat_query": { + "type": "keyword" + }, "threshold": { "properties": { "field": { @@ -2656,11 +3631,31 @@ }, "threshold_result": { "properties": { + "cardinality": { + "properties": { + "field": { + "type": "keyword" + }, + "value": { + "type": "long" + } + } + }, "count": { "type": "long" }, - "value": { - "type": "keyword" + "from": { + "type": "date" + }, + "terms": { + "properties": { + "field": { + "type": "keyword" + }, + "value": { + "type": "keyword" + } + } } } } @@ -2706,6 +3701,10 @@ "ignore_above": 1024, "type": "keyword" }, + "continent_code": { + "ignore_above": 1024, + "type": "keyword" + }, "continent_name": { "ignore_above": 1024, "type": "keyword" @@ -2725,6 +3724,10 @@ "ignore_above": 1024, "type": "keyword" }, + "postal_code": { + "ignore_above": 1024, + "type": "keyword" + }, "region_iso_code": { "ignore_above": 1024, "type": "keyword" @@ -2732,6 +3735,10 @@ "region_name": { "ignore_above": 1024, "type": "keyword" + }, + "timezone": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -2762,6 +3769,10 @@ "ignore_above": 1024, "type": "keyword" }, + "subdomain": { + "ignore_above": 1024, + "type": "keyword" + }, "top_level_domain": { "ignore_above": 1024, "type": "keyword" @@ -2819,11 +3830,23 @@ }, "ignore_above": 1024, "type": "keyword" + }, + "roles": { + "ignore_above": 1024, + "type": "keyword" } } } } }, + "span": { + "properties": { + "id": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, "tags": { "ignore_above": 1024, "type": "keyword" @@ -2834,129 +3857,492 @@ "ignore_above": 1024, "type": "keyword" }, - "tactic": { + "indicator": { "properties": { - "id": { - "ignore_above": 1024, - "type": "keyword" + "as": { + "properties": { + "number": { + "type": "long" + }, + "organization": { + "properties": { + "name": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + } + } + } + } }, - "name": { + "confidence": { "ignore_above": 1024, "type": "keyword" }, - "reference": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "technique": { - "properties": { - "id": { + "dataset": { "ignore_above": 1024, "type": "keyword" }, - "name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" + "description": { + "type": "wildcard" }, - "reference": { - "ignore_above": 1024, - "type": "keyword" - } - } - } - } - }, - "tls": { - "properties": { - "cipher": { - "ignore_above": 1024, - "type": "keyword" - }, - "client": { - "properties": { - "certificate": { + "domain": { "ignore_above": 1024, "type": "keyword" }, - "certificate_chain": { - "ignore_above": 1024, - "type": "keyword" + "email": { + "properties": { + "address": { + "ignore_above": 1024, + "type": "keyword" + } + } }, - "hash": { + "event": { "properties": { - "md5": { + "action": { "ignore_above": 1024, "type": "keyword" }, - "sha1": { + "category": { "ignore_above": 1024, "type": "keyword" }, - "sha256": { + "code": { "ignore_above": 1024, "type": "keyword" - } - } - }, - "issuer": { - "ignore_above": 1024, - "type": "keyword" - }, - "ja3": { - "ignore_above": 1024, - "type": "keyword" - }, - "not_after": { - "type": "date" - }, - "not_before": { - "type": "date" - }, - "server_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "subject": { - "ignore_above": 1024, - "type": "keyword" - }, - "supported_ciphers": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "curve": { - "ignore_above": 1024, - "type": "keyword" - }, - "established": { - "type": "boolean" - }, - "next_protocol": { - "ignore_above": 1024, - "type": "keyword" - }, - "resumed": { - "type": "boolean" - }, - "server": { - "properties": { - "certificate": { - "ignore_above": 1024, - "type": "keyword" - }, - "certificate_chain": { - "ignore_above": 1024, - "type": "keyword" + }, + "created": { + "type": "date" + }, + "dataset": { + "ignore_above": 1024, + "type": "keyword" + }, + "duration": { + "type": "long" + }, + "end": { + "type": "date" + }, + "hash": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "ingested": { + "type": "date" + }, + "kind": { + "ignore_above": 1024, + "type": "keyword" + }, + "module": { + "ignore_above": 1024, + "type": "keyword" + }, + "original": { + "doc_values": false, + "ignore_above": 1024, + "index": false, + "type": "keyword" + }, + "outcome": { + "ignore_above": 1024, + "type": "keyword" + }, + "provider": { + "ignore_above": 1024, + "type": "keyword" + }, + "reason": { + "ignore_above": 1024, + "type": "keyword" + }, + "reference": { + "ignore_above": 1024, + "type": "keyword" + }, + "risk_score": { + "type": "float" + }, + "risk_score_norm": { + "type": "float" + }, + "sequence": { + "type": "long" + }, + "severity": { + "type": "long" + }, + "start": { + "type": "date" + }, + "timezone": { + "ignore_above": 1024, + "type": "keyword" + }, + "type": { + "ignore_above": 1024, + "type": "keyword" + }, + "url": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "first_seen": { + "type": "date" + }, + "geo": { + "properties": { + "city_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "continent_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "country_iso_code": { + "ignore_above": 1024, + "type": "keyword" + }, + "country_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "location": { + "type": "geo_point" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "region_iso_code": { + "ignore_above": 1024, + "type": "keyword" + }, + "region_name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "ip": { + "type": "ip" + }, + "last_seen": { + "type": "date" + }, + "marking": { + "properties": { + "tlp": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "matched": { + "properties": { + "atomic": { + "ignore_above": 1024, + "type": "keyword" + }, + "field": { + "ignore_above": 1024, + "type": "keyword" + }, + "type": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "module": { + "ignore_above": 1024, + "type": "keyword" + }, + "port": { + "type": "long" + }, + "provider": { + "ignore_above": 1024, + "type": "keyword" + }, + "scanner_stats": { + "type": "long" + }, + "sightings": { + "type": "long" + }, + "type": { + "ignore_above": 1024, + "type": "keyword" + } + }, + "type": "nested" + }, + "tactic": { + "properties": { + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "reference": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "technique": { + "properties": { + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + }, + "reference": { + "ignore_above": 1024, + "type": "keyword" + }, + "subtechnique": { + "properties": { + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + }, + "reference": { + "ignore_above": 1024, + "type": "keyword" + } + } + } + } + } + } + }, + "tls": { + "properties": { + "cipher": { + "ignore_above": 1024, + "type": "keyword" + }, + "client": { + "properties": { + "certificate": { + "ignore_above": 1024, + "type": "keyword" + }, + "certificate_chain": { + "ignore_above": 1024, + "type": "keyword" + }, + "hash": { + "properties": { + "md5": { + "ignore_above": 1024, + "type": "keyword" + }, + "sha1": { + "ignore_above": 1024, + "type": "keyword" + }, + "sha256": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "issuer": { + "ignore_above": 1024, + "type": "keyword" + }, + "ja3": { + "ignore_above": 1024, + "type": "keyword" + }, + "not_after": { + "type": "date" + }, + "not_before": { + "type": "date" + }, + "server_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "subject": { + "ignore_above": 1024, + "type": "keyword" + }, + "supported_ciphers": { + "ignore_above": 1024, + "type": "keyword" + }, + "x509": { + "properties": { + "alternative_names": { + "ignore_above": 1024, + "type": "keyword" + }, + "issuer": { + "properties": { + "common_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "country": { + "ignore_above": 1024, + "type": "keyword" + }, + "distinguished_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "locality": { + "ignore_above": 1024, + "type": "keyword" + }, + "organization": { + "ignore_above": 1024, + "type": "keyword" + }, + "organizational_unit": { + "ignore_above": 1024, + "type": "keyword" + }, + "state_or_province": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "not_after": { + "type": "date" + }, + "not_before": { + "type": "date" + }, + "public_key_algorithm": { + "ignore_above": 1024, + "type": "keyword" + }, + "public_key_curve": { + "ignore_above": 1024, + "type": "keyword" + }, + "public_key_exponent": { + "doc_values": false, + "index": false, + "type": "long" + }, + "public_key_size": { + "type": "long" + }, + "serial_number": { + "ignore_above": 1024, + "type": "keyword" + }, + "signature_algorithm": { + "ignore_above": 1024, + "type": "keyword" + }, + "subject": { + "properties": { + "common_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "country": { + "ignore_above": 1024, + "type": "keyword" + }, + "distinguished_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "locality": { + "ignore_above": 1024, + "type": "keyword" + }, + "organization": { + "ignore_above": 1024, + "type": "keyword" + }, + "organizational_unit": { + "ignore_above": 1024, + "type": "keyword" + }, + "state_or_province": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "version_number": { + "ignore_above": 1024, + "type": "keyword" + } + } + } + } + }, + "curve": { + "ignore_above": 1024, + "type": "keyword" + }, + "established": { + "type": "boolean" + }, + "next_protocol": { + "ignore_above": 1024, + "type": "keyword" + }, + "resumed": { + "type": "boolean" + }, + "server": { + "properties": { + "certificate": { + "ignore_above": 1024, + "type": "keyword" + }, + "certificate_chain": { + "ignore_above": 1024, + "type": "keyword" }, "hash": { "properties": { @@ -2991,6 +4377,112 @@ "subject": { "ignore_above": 1024, "type": "keyword" + }, + "x509": { + "properties": { + "alternative_names": { + "ignore_above": 1024, + "type": "keyword" + }, + "issuer": { + "properties": { + "common_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "country": { + "ignore_above": 1024, + "type": "keyword" + }, + "distinguished_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "locality": { + "ignore_above": 1024, + "type": "keyword" + }, + "organization": { + "ignore_above": 1024, + "type": "keyword" + }, + "organizational_unit": { + "ignore_above": 1024, + "type": "keyword" + }, + "state_or_province": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "not_after": { + "type": "date" + }, + "not_before": { + "type": "date" + }, + "public_key_algorithm": { + "ignore_above": 1024, + "type": "keyword" + }, + "public_key_curve": { + "ignore_above": 1024, + "type": "keyword" + }, + "public_key_exponent": { + "doc_values": false, + "index": false, + "type": "long" + }, + "public_key_size": { + "type": "long" + }, + "serial_number": { + "ignore_above": 1024, + "type": "keyword" + }, + "signature_algorithm": { + "ignore_above": 1024, + "type": "keyword" + }, + "subject": { + "properties": { + "common_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "country": { + "ignore_above": 1024, + "type": "keyword" + }, + "distinguished_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "locality": { + "ignore_above": 1024, + "type": "keyword" + }, + "organization": { + "ignore_above": 1024, + "type": "keyword" + }, + "organizational_unit": { + "ignore_above": 1024, + "type": "keyword" + }, + "state_or_province": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "version_number": { + "ignore_above": 1024, + "type": "keyword" + } + } } } }, @@ -3077,6 +4569,10 @@ "ignore_above": 1024, "type": "keyword" }, + "subdomain": { + "ignore_above": 1024, + "type": "keyword" + }, "top_level_domain": { "ignore_above": 1024, "type": "keyword" @@ -3089,10 +4585,130 @@ }, "user": { "properties": { + "changes": { + "properties": { + "domain": { + "ignore_above": 1024, + "type": "keyword" + }, + "email": { + "ignore_above": 1024, + "type": "keyword" + }, + "full_name": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + }, + "group": { + "properties": { + "domain": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "hash": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + }, + "roles": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, "domain": { "ignore_above": 1024, "type": "keyword" }, + "effective": { + "properties": { + "domain": { + "ignore_above": 1024, + "type": "keyword" + }, + "email": { + "ignore_above": 1024, + "type": "keyword" + }, + "full_name": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + }, + "group": { + "properties": { + "domain": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "hash": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + }, + "roles": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, "email": { "ignore_above": 1024, "type": "keyword" @@ -3140,6 +4756,70 @@ }, "ignore_above": 1024, "type": "keyword" + }, + "roles": { + "ignore_above": 1024, + "type": "keyword" + }, + "target": { + "properties": { + "domain": { + "ignore_above": 1024, + "type": "keyword" + }, + "email": { + "ignore_above": 1024, + "type": "keyword" + }, + "full_name": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + }, + "group": { + "properties": { + "domain": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "hash": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + }, + "roles": { + "ignore_above": 1024, + "type": "keyword" + } + } } } }, @@ -3201,6 +4881,10 @@ "ignore_above": 1024, "type": "keyword" }, + "type": { + "ignore_above": 1024, + "type": "keyword" + }, "version": { "ignore_above": 1024, "type": "keyword" @@ -3320,7 +5004,8 @@ "index": ".siem-signals-default-000002", "mappings": { "_meta": { - "version": 14 + "aliases_version": 1, + "version": 55 }, "dynamic": "false", "properties": { @@ -3329,6 +5014,14 @@ }, "agent": { "properties": { + "build": { + "properties": { + "original": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, "ephemeral_id": { "ignore_above": 1024, "type": "keyword" @@ -3412,6 +5105,10 @@ "ignore_above": 1024, "type": "keyword" }, + "continent_code": { + "ignore_above": 1024, + "type": "keyword" + }, "continent_name": { "ignore_above": 1024, "type": "keyword" @@ -3431,6 +5128,10 @@ "ignore_above": 1024, "type": "keyword" }, + "postal_code": { + "ignore_above": 1024, + "type": "keyword" + }, "region_iso_code": { "ignore_above": 1024, "type": "keyword" @@ -3438,6 +5139,10 @@ "region_name": { "ignore_above": 1024, "type": "keyword" + }, + "timezone": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -3468,6 +5173,10 @@ "ignore_above": 1024, "type": "keyword" }, + "subdomain": { + "ignore_above": 1024, + "type": "keyword" + }, "top_level_domain": { "ignore_above": 1024, "type": "keyword" @@ -3525,6 +5234,10 @@ }, "ignore_above": 1024, "type": "keyword" + }, + "roles": { + "ignore_above": 1024, + "type": "keyword" } } } @@ -3537,6 +5250,10 @@ "id": { "ignore_above": 1024, "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -3564,6 +5281,18 @@ } } }, + "project": { + "properties": { + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, "provider": { "ignore_above": 1024, "type": "keyword" @@ -3571,6 +5300,14 @@ "region": { "ignore_above": 1024, "type": "keyword" + }, + "service": { + "properties": { + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } } } }, @@ -3626,6 +5363,19 @@ } } }, + "data_stream": { + "properties": { + "dataset": { + "type": "keyword" + }, + "namespace": { + "type": "keyword" + }, + "type": { + "type": "keyword" + } + } + }, "destination": { "properties": { "address": { @@ -3666,6 +5416,10 @@ "ignore_above": 1024, "type": "keyword" }, + "continent_code": { + "ignore_above": 1024, + "type": "keyword" + }, "continent_name": { "ignore_above": 1024, "type": "keyword" @@ -3685,6 +5439,10 @@ "ignore_above": 1024, "type": "keyword" }, + "postal_code": { + "ignore_above": 1024, + "type": "keyword" + }, "region_iso_code": { "ignore_above": 1024, "type": "keyword" @@ -3692,6 +5450,10 @@ "region_name": { "ignore_above": 1024, "type": "keyword" + }, + "timezone": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -3722,6 +5484,10 @@ "ignore_above": 1024, "type": "keyword" }, + "subdomain": { + "ignore_above": 1024, + "type": "keyword" + }, "top_level_domain": { "ignore_above": 1024, "type": "keyword" @@ -3779,6 +5545,10 @@ }, "ignore_above": 1024, "type": "keyword" + }, + "roles": { + "ignore_above": 1024, + "type": "keyword" } } } @@ -3791,6 +5561,10 @@ "exists": { "type": "boolean" }, + "signing_id": { + "ignore_above": 1024, + "type": "keyword" + }, "status": { "ignore_above": 1024, "type": "keyword" @@ -3799,6 +5573,10 @@ "ignore_above": 1024, "type": "keyword" }, + "team_id": { + "ignore_above": 1024, + "type": "keyword" + }, "trusted": { "type": "boolean" }, @@ -3824,6 +5602,10 @@ "sha512": { "ignore_above": 1024, "type": "keyword" + }, + "ssdeep": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -3837,6 +5619,10 @@ }, "pe": { "properties": { + "architecture": { + "ignore_above": 1024, + "type": "keyword" + }, "company": { "ignore_above": 1024, "type": "keyword" @@ -3849,6 +5635,10 @@ "ignore_above": 1024, "type": "keyword" }, + "imphash": { + "ignore_above": 1024, + "type": "keyword" + }, "original_file_name": { "ignore_above": 1024, "type": "keyword" @@ -4039,6 +5829,10 @@ "ignore_above": 1024, "type": "keyword" }, + "reason": { + "ignore_above": 1024, + "type": "keyword" + }, "reference": { "ignore_above": 1024, "type": "keyword" @@ -4086,6 +5880,10 @@ "exists": { "type": "boolean" }, + "signing_id": { + "ignore_above": 1024, + "type": "keyword" + }, "status": { "ignore_above": 1024, "type": "keyword" @@ -4094,6 +5892,10 @@ "ignore_above": 1024, "type": "keyword" }, + "team_id": { + "ignore_above": 1024, + "type": "keyword" + }, "trusted": { "type": "boolean" }, @@ -4149,6 +5951,10 @@ "sha512": { "ignore_above": 1024, "type": "keyword" + }, + "ssdeep": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -4187,6 +5993,10 @@ }, "pe": { "properties": { + "architecture": { + "ignore_above": 1024, + "type": "keyword" + }, "company": { "ignore_above": 1024, "type": "keyword" @@ -4199,6 +6009,10 @@ "ignore_above": 1024, "type": "keyword" }, + "imphash": { + "ignore_above": 1024, + "type": "keyword" + }, "original_file_name": { "ignore_above": 1024, "type": "keyword" @@ -4229,6 +6043,112 @@ "uid": { "ignore_above": 1024, "type": "keyword" + }, + "x509": { + "properties": { + "alternative_names": { + "ignore_above": 1024, + "type": "keyword" + }, + "issuer": { + "properties": { + "common_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "country": { + "ignore_above": 1024, + "type": "keyword" + }, + "distinguished_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "locality": { + "ignore_above": 1024, + "type": "keyword" + }, + "organization": { + "ignore_above": 1024, + "type": "keyword" + }, + "organizational_unit": { + "ignore_above": 1024, + "type": "keyword" + }, + "state_or_province": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "not_after": { + "type": "date" + }, + "not_before": { + "type": "date" + }, + "public_key_algorithm": { + "ignore_above": 1024, + "type": "keyword" + }, + "public_key_curve": { + "ignore_above": 1024, + "type": "keyword" + }, + "public_key_exponent": { + "doc_values": false, + "index": false, + "type": "long" + }, + "public_key_size": { + "type": "long" + }, + "serial_number": { + "ignore_above": 1024, + "type": "keyword" + }, + "signature_algorithm": { + "ignore_above": 1024, + "type": "keyword" + }, + "subject": { + "properties": { + "common_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "country": { + "ignore_above": 1024, + "type": "keyword" + }, + "distinguished_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "locality": { + "ignore_above": 1024, + "type": "keyword" + }, + "organization": { + "ignore_above": 1024, + "type": "keyword" + }, + "organizational_unit": { + "ignore_above": 1024, + "type": "keyword" + }, + "state_or_province": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "version_number": { + "ignore_above": 1024, + "type": "keyword" + } + } } } }, @@ -4309,6 +6229,32 @@ "ignore_above": 1024, "type": "keyword" }, + "cpu": { + "properties": { + "usage": { + "scaling_factor": 1000, + "type": "scaled_float" + } + } + }, + "disk": { + "properties": { + "read": { + "properties": { + "bytes": { + "type": "long" + } + } + }, + "write": { + "properties": { + "bytes": { + "type": "long" + } + } + } + } + }, "domain": { "ignore_above": 1024, "type": "keyword" @@ -4319,6 +6265,10 @@ "ignore_above": 1024, "type": "keyword" }, + "continent_code": { + "ignore_above": 1024, + "type": "keyword" + }, "continent_name": { "ignore_above": 1024, "type": "keyword" @@ -4338,6 +6288,10 @@ "ignore_above": 1024, "type": "keyword" }, + "postal_code": { + "ignore_above": 1024, + "type": "keyword" + }, "region_iso_code": { "ignore_above": 1024, "type": "keyword" @@ -4345,6 +6299,10 @@ "region_name": { "ignore_above": 1024, "type": "keyword" + }, + "timezone": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -4367,6 +6325,30 @@ "ignore_above": 1024, "type": "keyword" }, + "network": { + "properties": { + "egress": { + "properties": { + "bytes": { + "type": "long" + }, + "packets": { + "type": "long" + } + } + }, + "ingress": { + "properties": { + "bytes": { + "type": "long" + }, + "packets": { + "type": "long" + } + } + } + } + }, "os": { "properties": { "family": { @@ -4401,6 +6383,10 @@ "ignore_above": 1024, "type": "keyword" }, + "type": { + "ignore_above": 1024, + "type": "keyword" + }, "version": { "ignore_above": 1024, "type": "keyword" @@ -4467,6 +6453,10 @@ }, "ignore_above": 1024, "type": "keyword" + }, + "roles": { + "ignore_above": 1024, + "type": "keyword" } } } @@ -4493,65 +6483,533 @@ } } }, - "bytes": { - "type": "long" - }, - "method": { - "ignore_above": 1024, - "type": "keyword" + "bytes": { + "type": "long" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "method": { + "ignore_above": 1024, + "type": "keyword" + }, + "mime_type": { + "ignore_above": 1024, + "type": "keyword" + }, + "referrer": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "response": { + "properties": { + "body": { + "properties": { + "bytes": { + "type": "long" + }, + "content": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "bytes": { + "type": "long" + }, + "mime_type": { + "ignore_above": 1024, + "type": "keyword" + }, + "status_code": { + "type": "long" + } + } + }, + "version": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "interface": { + "properties": { + "alias": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "kibana": { + "properties": { + "alert": { + "properties": { + "ancestors": { + "properties": { + "depth": { + "path": "signal.ancestors.depth", + "type": "alias" + }, + "id": { + "path": "signal.ancestors.id", + "type": "alias" + }, + "index": { + "path": "signal.ancestors.index", + "type": "alias" + }, + "type": { + "path": "signal.ancestors.type", + "type": "alias" + } + } + }, + "depth": { + "path": "signal.depth", + "type": "alias" + }, + "original_event": { + "properties": { + "action": { + "path": "signal.original_event.action", + "type": "alias" + }, + "category": { + "path": "signal.original_event.category", + "type": "alias" + }, + "code": { + "path": "signal.original_event.code", + "type": "alias" + }, + "created": { + "path": "signal.original_event.created", + "type": "alias" + }, + "dataset": { + "path": "signal.original_event.dataset", + "type": "alias" + }, + "duration": { + "path": "signal.original_event.duration", + "type": "alias" + }, + "end": { + "path": "signal.original_event.end", + "type": "alias" + }, + "hash": { + "path": "signal.original_event.hash", + "type": "alias" + }, + "id": { + "path": "signal.original_event.id", + "type": "alias" + }, + "kind": { + "path": "signal.original_event.kind", + "type": "alias" + }, + "module": { + "path": "signal.original_event.module", + "type": "alias" + }, + "outcome": { + "path": "signal.original_event.outcome", + "type": "alias" + }, + "provider": { + "path": "signal.original_event.provider", + "type": "alias" + }, + "reason": { + "path": "signal.original_event.reason", + "type": "alias" + }, + "risk_score": { + "path": "signal.original_event.risk_score", + "type": "alias" + }, + "risk_score_norm": { + "path": "signal.original_event.risk_score_norm", + "type": "alias" + }, + "sequence": { + "path": "signal.original_event.sequence", + "type": "alias" + }, + "severity": { + "path": "signal.original_event.severity", + "type": "alias" + }, + "start": { + "path": "signal.original_event.start", + "type": "alias" + }, + "timezone": { + "path": "signal.original_event.timezone", + "type": "alias" + }, + "type": { + "path": "signal.original_event.type", + "type": "alias" + } + } + }, + "original_time": { + "path": "signal.original_time", + "type": "alias" + }, + "reason": { + "path": "signal.reason", + "type": "alias" + }, + "risk_score": { + "path": "signal.rule.risk_score", + "type": "alias" + }, + "rule": { + "properties": { + "author": { + "path": "signal.rule.author", + "type": "alias" + }, + "building_block_type": { + "path": "signal.rule.building_block_type", + "type": "alias" + }, + "consumer": { + "type": "constant_keyword", + "value": "siem" + }, + "created_at": { + "path": "signal.rule.created_at", + "type": "alias" + }, + "created_by": { + "path": "signal.rule.created_by", + "type": "alias" + }, + "description": { + "path": "signal.rule.description", + "type": "alias" + }, + "enabled": { + "path": "signal.rule.enabled", + "type": "alias" + }, + "false_positives": { + "path": "signal.rule.false_positives", + "type": "alias" + }, + "from": { + "path": "signal.rule.from", + "type": "alias" + }, + "id": { + "path": "signal.rule.id", + "type": "alias" + }, + "immutable": { + "path": "signal.rule.immutable", + "type": "alias" + }, + "index": { + "path": "signal.rule.index", + "type": "alias" + }, + "interval": { + "path": "signal.rule.interval", + "type": "alias" + }, + "language": { + "path": "signal.rule.language", + "type": "alias" + }, + "license": { + "path": "signal.rule.license", + "type": "alias" + }, + "max_signals": { + "path": "signal.rule.max_signals", + "type": "alias" + }, + "name": { + "path": "signal.rule.name", + "type": "alias" + }, + "note": { + "path": "signal.rule.note", + "type": "alias" + }, + "producer": { + "type": "constant_keyword", + "value": "siem" + }, + "query": { + "path": "signal.rule.query", + "type": "alias" + }, + "references": { + "path": "signal.rule.references", + "type": "alias" + }, + "risk_score_mapping": { + "properties": { + "field": { + "path": "signal.rule.risk_score_mapping.field", + "type": "alias" + }, + "operator": { + "path": "signal.rule.risk_score_mapping.operator", + "type": "alias" + }, + "value": { + "path": "signal.rule.risk_score_mapping.value", + "type": "alias" + } + } + }, + "rule_id": { + "path": "signal.rule.rule_id", + "type": "alias" + }, + "rule_name_override": { + "path": "signal.rule.rule_name_override", + "type": "alias" + }, + "rule_type_id": { + "type": "constant_keyword", + "value": "siem.signals" + }, + "saved_id": { + "path": "signal.rule.saved_id", + "type": "alias" + }, + "severity_mapping": { + "properties": { + "field": { + "path": "signal.rule.severity_mapping.field", + "type": "alias" + }, + "operator": { + "path": "signal.rule.severity_mapping.operator", + "type": "alias" + }, + "severity": { + "path": "signal.rule.severity_mapping.severity", + "type": "alias" + }, + "value": { + "path": "signal.rule.severity_mapping.value", + "type": "alias" + } + } + }, + "tags": { + "path": "signal.rule.tags", + "type": "alias" + }, + "threat": { + "properties": { + "framework": { + "path": "signal.rule.threat.framework", + "type": "alias" + }, + "tactic": { + "properties": { + "id": { + "path": "signal.rule.threat.tactic.id", + "type": "alias" + }, + "name": { + "path": "signal.rule.threat.tactic.name", + "type": "alias" + }, + "reference": { + "path": "signal.rule.threat.tactic.reference", + "type": "alias" + } + } + }, + "technique": { + "properties": { + "id": { + "path": "signal.rule.threat.technique.id", + "type": "alias" + }, + "name": { + "path": "signal.rule.threat.technique.name", + "type": "alias" + }, + "reference": { + "path": "signal.rule.threat.technique.reference", + "type": "alias" + }, + "subtechnique": { + "properties": { + "id": { + "path": "signal.rule.threat.technique.subtechnique.id", + "type": "alias" + }, + "name": { + "path": "signal.rule.threat.technique.subtechnique.name", + "type": "alias" + }, + "reference": { + "path": "signal.rule.threat.technique.subtechnique.reference", + "type": "alias" + } + } + } + } + } + } + }, + "threat_index": { + "path": "signal.rule.threat_index", + "type": "alias" + }, + "threat_indicator_path": { + "path": "signal.rule.threat_indicator_path", + "type": "alias" + }, + "threat_language": { + "path": "signal.rule.threat_language", + "type": "alias" + }, + "threat_mapping": { + "properties": { + "entries": { + "properties": { + "field": { + "path": "signal.rule.threat_mapping.entries.field", + "type": "alias" + }, + "type": { + "path": "signal.rule.threat_mapping.entries.type", + "type": "alias" + }, + "value": { + "path": "signal.rule.threat_mapping.entries.value", + "type": "alias" + } + } + } + } + }, + "threat_query": { + "path": "signal.rule.threat_query", + "type": "alias" + }, + "threshold": { + "properties": { + "field": { + "path": "signal.rule.threshold.field", + "type": "alias" + }, + "value": { + "path": "signal.rule.threshold.value", + "type": "alias" + } + } + }, + "timeline_id": { + "path": "signal.rule.timeline_id", + "type": "alias" + }, + "timeline_title": { + "path": "signal.rule.timeline_title", + "type": "alias" + }, + "to": { + "path": "signal.rule.to", + "type": "alias" + }, + "type": { + "path": "signal.rule.type", + "type": "alias" + }, + "updated_at": { + "path": "signal.rule.updated_at", + "type": "alias" + }, + "updated_by": { + "path": "signal.rule.updated_by", + "type": "alias" + }, + "version": { + "path": "signal.rule.version", + "type": "alias" + } + } + }, + "severity": { + "path": "signal.rule.severity", + "type": "alias" }, - "referrer": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "response": { - "properties": { - "body": { + "threshold_result": { "properties": { - "bytes": { - "type": "long" + "cardinality": { + "properties": { + "field": { + "path": "signal.threshold_result.cardinality.field", + "type": "alias" + }, + "value": { + "path": "signal.threshold_result.cardinality.value", + "type": "alias" + } + } }, - "content": { - "fields": { - "text": { - "norms": false, - "type": "text" + "count": { + "path": "signal.threshold_result.count", + "type": "alias" + }, + "from": { + "path": "signal.threshold_result.from", + "type": "alias" + }, + "terms": { + "properties": { + "field": { + "path": "signal.threshold_result.terms.field", + "type": "alias" + }, + "value": { + "path": "signal.threshold_result.terms.value", + "type": "alias" } - }, - "ignore_above": 1024, - "type": "keyword" + } } } }, - "bytes": { - "type": "long" - }, - "status_code": { - "type": "long" + "workflow_status": { + "path": "signal.status", + "type": "alias" } } }, - "version": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "interface": { - "properties": { - "alias": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" + "space_ids": { + "type": "constant_keyword", + "value": "default" } } }, @@ -4560,6 +7018,14 @@ }, "log": { "properties": { + "file": { + "properties": { + "path": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, "level": { "ignore_above": 1024, "type": "keyword" @@ -4745,6 +7211,10 @@ "ignore_above": 1024, "type": "keyword" }, + "continent_code": { + "ignore_above": 1024, + "type": "keyword" + }, "continent_name": { "ignore_above": 1024, "type": "keyword" @@ -4764,6 +7234,10 @@ "ignore_above": 1024, "type": "keyword" }, + "postal_code": { + "ignore_above": 1024, + "type": "keyword" + }, "region_iso_code": { "ignore_above": 1024, "type": "keyword" @@ -4771,6 +7245,10 @@ "region_name": { "ignore_above": 1024, "type": "keyword" + }, + "timezone": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -4859,6 +7337,10 @@ "ignore_above": 1024, "type": "keyword" }, + "type": { + "ignore_above": 1024, + "type": "keyword" + }, "version": { "ignore_above": 1024, "type": "keyword" @@ -4887,6 +7369,54 @@ } } }, + "orchestrator": { + "properties": { + "api_version": { + "ignore_above": 1024, + "type": "keyword" + }, + "cluster": { + "properties": { + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "url": { + "ignore_above": 1024, + "type": "keyword" + }, + "version": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "namespace": { + "ignore_above": 1024, + "type": "keyword" + }, + "organization": { + "ignore_above": 1024, + "type": "keyword" + }, + "resource": { + "properties": { + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "type": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "type": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, "organization": { "properties": { "id": { @@ -5037,6 +7567,10 @@ "exists": { "type": "boolean" }, + "signing_id": { + "ignore_above": 1024, + "type": "keyword" + }, "status": { "ignore_above": 1024, "type": "keyword" @@ -5045,6 +7579,10 @@ "ignore_above": 1024, "type": "keyword" }, + "team_id": { + "ignore_above": 1024, + "type": "keyword" + }, "trusted": { "type": "boolean" }, @@ -5097,6 +7635,10 @@ "sha512": { "ignore_above": 1024, "type": "keyword" + }, + "ssdeep": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -5124,6 +7666,10 @@ "exists": { "type": "boolean" }, + "signing_id": { + "ignore_above": 1024, + "type": "keyword" + }, "status": { "ignore_above": 1024, "type": "keyword" @@ -5132,6 +7678,10 @@ "ignore_above": 1024, "type": "keyword" }, + "team_id": { + "ignore_above": 1024, + "type": "keyword" + }, "trusted": { "type": "boolean" }, @@ -5184,6 +7734,10 @@ "sha512": { "ignore_above": 1024, "type": "keyword" + }, + "ssdeep": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -5197,6 +7751,38 @@ "ignore_above": 1024, "type": "keyword" }, + "pe": { + "properties": { + "architecture": { + "ignore_above": 1024, + "type": "keyword" + }, + "company": { + "ignore_above": 1024, + "type": "keyword" + }, + "description": { + "ignore_above": 1024, + "type": "keyword" + }, + "file_version": { + "ignore_above": 1024, + "type": "keyword" + }, + "imphash": { + "ignore_above": 1024, + "type": "keyword" + }, + "original_file_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "product": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, "pgid": { "type": "long" }, @@ -5247,6 +7833,10 @@ }, "pe": { "properties": { + "architecture": { + "ignore_above": 1024, + "type": "keyword" + }, "company": { "ignore_above": 1024, "type": "keyword" @@ -5259,6 +7849,10 @@ "ignore_above": 1024, "type": "keyword" }, + "imphash": { + "ignore_above": 1024, + "type": "keyword" + }, "original_file_name": { "ignore_above": 1024, "type": "keyword" @@ -5359,6 +7953,10 @@ "ignore_above": 1024, "type": "keyword" }, + "hosts": { + "ignore_above": 1024, + "type": "keyword" + }, "ip": { "type": "ip" }, @@ -5452,6 +8050,10 @@ "ignore_above": 1024, "type": "keyword" }, + "continent_code": { + "ignore_above": 1024, + "type": "keyword" + }, "continent_name": { "ignore_above": 1024, "type": "keyword" @@ -5471,6 +8073,10 @@ "ignore_above": 1024, "type": "keyword" }, + "postal_code": { + "ignore_above": 1024, + "type": "keyword" + }, "region_iso_code": { "ignore_above": 1024, "type": "keyword" @@ -5478,6 +8084,10 @@ "region_name": { "ignore_above": 1024, "type": "keyword" + }, + "timezone": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -5508,6 +8118,10 @@ "ignore_above": 1024, "type": "keyword" }, + "subdomain": { + "ignore_above": 1024, + "type": "keyword" + }, "top_level_domain": { "ignore_above": 1024, "type": "keyword" @@ -5565,6 +8179,10 @@ }, "ignore_above": 1024, "type": "keyword" + }, + "roles": { + "ignore_above": 1024, + "type": "keyword" } } } @@ -5693,6 +8311,9 @@ "provider": { "type": "keyword" }, + "reason": { + "type": "keyword" + }, "risk_score": { "type": "float" }, @@ -5762,6 +8383,9 @@ } } }, + "reason": { + "type": "keyword" + }, "rule": { "properties": { "author": { @@ -5923,6 +8547,38 @@ } } }, + "threat_filters": { + "type": "object" + }, + "threat_index": { + "type": "keyword" + }, + "threat_indicator_path": { + "type": "keyword" + }, + "threat_language": { + "type": "keyword" + }, + "threat_mapping": { + "properties": { + "entries": { + "properties": { + "field": { + "type": "keyword" + }, + "type": { + "type": "keyword" + }, + "value": { + "type": "keyword" + } + } + } + } + }, + "threat_query": { + "type": "keyword" + }, "threshold": { "properties": { "field": { @@ -5967,11 +8623,31 @@ }, "threshold_result": { "properties": { + "cardinality": { + "properties": { + "field": { + "type": "keyword" + }, + "value": { + "type": "long" + } + } + }, "count": { "type": "long" }, - "value": { - "type": "keyword" + "from": { + "type": "date" + }, + "terms": { + "properties": { + "field": { + "type": "keyword" + }, + "value": { + "type": "keyword" + } + } } } } @@ -6017,6 +8693,10 @@ "ignore_above": 1024, "type": "keyword" }, + "continent_code": { + "ignore_above": 1024, + "type": "keyword" + }, "continent_name": { "ignore_above": 1024, "type": "keyword" @@ -6036,6 +8716,10 @@ "ignore_above": 1024, "type": "keyword" }, + "postal_code": { + "ignore_above": 1024, + "type": "keyword" + }, "region_iso_code": { "ignore_above": 1024, "type": "keyword" @@ -6043,6 +8727,10 @@ "region_name": { "ignore_above": 1024, "type": "keyword" + }, + "timezone": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -6069,7 +8757,11 @@ "port": { "type": "long" }, - "registered_domain": { + "registered_domain": { + "ignore_above": 1024, + "type": "keyword" + }, + "subdomain": { "ignore_above": 1024, "type": "keyword" }, @@ -6130,11 +8822,23 @@ }, "ignore_above": 1024, "type": "keyword" + }, + "roles": { + "ignore_above": 1024, + "type": "keyword" } } } } }, + "span": { + "properties": { + "id": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, "tags": { "ignore_above": 1024, "type": "keyword" @@ -6145,6 +8849,241 @@ "ignore_above": 1024, "type": "keyword" }, + "indicator": { + "properties": { + "as": { + "properties": { + "number": { + "type": "long" + }, + "organization": { + "properties": { + "name": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + } + } + } + } + }, + "confidence": { + "ignore_above": 1024, + "type": "keyword" + }, + "dataset": { + "ignore_above": 1024, + "type": "keyword" + }, + "description": { + "type": "wildcard" + }, + "domain": { + "ignore_above": 1024, + "type": "keyword" + }, + "email": { + "properties": { + "address": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "event": { + "properties": { + "action": { + "ignore_above": 1024, + "type": "keyword" + }, + "category": { + "ignore_above": 1024, + "type": "keyword" + }, + "code": { + "ignore_above": 1024, + "type": "keyword" + }, + "created": { + "type": "date" + }, + "dataset": { + "ignore_above": 1024, + "type": "keyword" + }, + "duration": { + "type": "long" + }, + "end": { + "type": "date" + }, + "hash": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "ingested": { + "type": "date" + }, + "kind": { + "ignore_above": 1024, + "type": "keyword" + }, + "module": { + "ignore_above": 1024, + "type": "keyword" + }, + "original": { + "doc_values": false, + "ignore_above": 1024, + "index": false, + "type": "keyword" + }, + "outcome": { + "ignore_above": 1024, + "type": "keyword" + }, + "provider": { + "ignore_above": 1024, + "type": "keyword" + }, + "reason": { + "ignore_above": 1024, + "type": "keyword" + }, + "reference": { + "ignore_above": 1024, + "type": "keyword" + }, + "risk_score": { + "type": "float" + }, + "risk_score_norm": { + "type": "float" + }, + "sequence": { + "type": "long" + }, + "severity": { + "type": "long" + }, + "start": { + "type": "date" + }, + "timezone": { + "ignore_above": 1024, + "type": "keyword" + }, + "type": { + "ignore_above": 1024, + "type": "keyword" + }, + "url": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "first_seen": { + "type": "date" + }, + "geo": { + "properties": { + "city_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "continent_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "country_iso_code": { + "ignore_above": 1024, + "type": "keyword" + }, + "country_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "location": { + "type": "geo_point" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "region_iso_code": { + "ignore_above": 1024, + "type": "keyword" + }, + "region_name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "ip": { + "type": "ip" + }, + "last_seen": { + "type": "date" + }, + "marking": { + "properties": { + "tlp": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "matched": { + "properties": { + "atomic": { + "ignore_above": 1024, + "type": "keyword" + }, + "field": { + "ignore_above": 1024, + "type": "keyword" + }, + "type": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "module": { + "ignore_above": 1024, + "type": "keyword" + }, + "port": { + "type": "long" + }, + "provider": { + "ignore_above": 1024, + "type": "keyword" + }, + "scanner_stats": { + "type": "long" + }, + "sightings": { + "type": "long" + }, + "type": { + "ignore_above": 1024, + "type": "keyword" + } + }, + "type": "nested" + }, "tactic": { "properties": { "id": { @@ -6180,6 +9119,28 @@ "reference": { "ignore_above": 1024, "type": "keyword" + }, + "subtechnique": { + "properties": { + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + }, + "reference": { + "ignore_above": 1024, + "type": "keyword" + } + } } } } @@ -6242,6 +9203,112 @@ "supported_ciphers": { "ignore_above": 1024, "type": "keyword" + }, + "x509": { + "properties": { + "alternative_names": { + "ignore_above": 1024, + "type": "keyword" + }, + "issuer": { + "properties": { + "common_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "country": { + "ignore_above": 1024, + "type": "keyword" + }, + "distinguished_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "locality": { + "ignore_above": 1024, + "type": "keyword" + }, + "organization": { + "ignore_above": 1024, + "type": "keyword" + }, + "organizational_unit": { + "ignore_above": 1024, + "type": "keyword" + }, + "state_or_province": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "not_after": { + "type": "date" + }, + "not_before": { + "type": "date" + }, + "public_key_algorithm": { + "ignore_above": 1024, + "type": "keyword" + }, + "public_key_curve": { + "ignore_above": 1024, + "type": "keyword" + }, + "public_key_exponent": { + "doc_values": false, + "index": false, + "type": "long" + }, + "public_key_size": { + "type": "long" + }, + "serial_number": { + "ignore_above": 1024, + "type": "keyword" + }, + "signature_algorithm": { + "ignore_above": 1024, + "type": "keyword" + }, + "subject": { + "properties": { + "common_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "country": { + "ignore_above": 1024, + "type": "keyword" + }, + "distinguished_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "locality": { + "ignore_above": 1024, + "type": "keyword" + }, + "organization": { + "ignore_above": 1024, + "type": "keyword" + }, + "organizational_unit": { + "ignore_above": 1024, + "type": "keyword" + }, + "state_or_province": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "version_number": { + "ignore_above": 1024, + "type": "keyword" + } + } } } }, @@ -6302,6 +9369,112 @@ "subject": { "ignore_above": 1024, "type": "keyword" + }, + "x509": { + "properties": { + "alternative_names": { + "ignore_above": 1024, + "type": "keyword" + }, + "issuer": { + "properties": { + "common_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "country": { + "ignore_above": 1024, + "type": "keyword" + }, + "distinguished_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "locality": { + "ignore_above": 1024, + "type": "keyword" + }, + "organization": { + "ignore_above": 1024, + "type": "keyword" + }, + "organizational_unit": { + "ignore_above": 1024, + "type": "keyword" + }, + "state_or_province": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "not_after": { + "type": "date" + }, + "not_before": { + "type": "date" + }, + "public_key_algorithm": { + "ignore_above": 1024, + "type": "keyword" + }, + "public_key_curve": { + "ignore_above": 1024, + "type": "keyword" + }, + "public_key_exponent": { + "doc_values": false, + "index": false, + "type": "long" + }, + "public_key_size": { + "type": "long" + }, + "serial_number": { + "ignore_above": 1024, + "type": "keyword" + }, + "signature_algorithm": { + "ignore_above": 1024, + "type": "keyword" + }, + "subject": { + "properties": { + "common_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "country": { + "ignore_above": 1024, + "type": "keyword" + }, + "distinguished_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "locality": { + "ignore_above": 1024, + "type": "keyword" + }, + "organization": { + "ignore_above": 1024, + "type": "keyword" + }, + "organizational_unit": { + "ignore_above": 1024, + "type": "keyword" + }, + "state_or_province": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "version_number": { + "ignore_above": 1024, + "type": "keyword" + } + } } } }, @@ -6388,6 +9561,10 @@ "ignore_above": 1024, "type": "keyword" }, + "subdomain": { + "ignore_above": 1024, + "type": "keyword" + }, "top_level_domain": { "ignore_above": 1024, "type": "keyword" @@ -6400,10 +9577,130 @@ }, "user": { "properties": { + "changes": { + "properties": { + "domain": { + "ignore_above": 1024, + "type": "keyword" + }, + "email": { + "ignore_above": 1024, + "type": "keyword" + }, + "full_name": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + }, + "group": { + "properties": { + "domain": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "hash": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + }, + "roles": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, "domain": { "ignore_above": 1024, "type": "keyword" }, + "effective": { + "properties": { + "domain": { + "ignore_above": 1024, + "type": "keyword" + }, + "email": { + "ignore_above": 1024, + "type": "keyword" + }, + "full_name": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + }, + "group": { + "properties": { + "domain": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "hash": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + }, + "roles": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, "email": { "ignore_above": 1024, "type": "keyword" @@ -6451,6 +9748,70 @@ }, "ignore_above": 1024, "type": "keyword" + }, + "roles": { + "ignore_above": 1024, + "type": "keyword" + }, + "target": { + "properties": { + "domain": { + "ignore_above": 1024, + "type": "keyword" + }, + "email": { + "ignore_above": 1024, + "type": "keyword" + }, + "full_name": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + }, + "group": { + "properties": { + "domain": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "hash": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + }, + "roles": { + "ignore_above": 1024, + "type": "keyword" + } + } } } }, @@ -6512,6 +9873,10 @@ "ignore_above": 1024, "type": "keyword" }, + "type": { + "ignore_above": 1024, + "type": "keyword" + }, "version": { "ignore_above": 1024, "type": "keyword" From 6317202fb6f2464e112fa92ad89283a2c11821e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Marcondes?= <55978943+cauemarcondes@users.noreply.github.com> Date: Thu, 19 Aug 2021 16:29:27 -0400 Subject: [PATCH 16/44] [APM] Hash-based links into APM app don't work (#108777) * fixing navigation issues * addressing PR comments --- .../components/routing/apm_route_config.tsx | 6 ++ .../public/components/routing/home/index.tsx | 4 +- .../public/components/routing/redirect_to.tsx | 63 ++++++++++++------- 3 files changed, 48 insertions(+), 25 deletions(-) diff --git a/x-pack/plugins/apm/public/components/routing/apm_route_config.tsx b/x-pack/plugins/apm/public/components/routing/apm_route_config.tsx index 922662e25ab20..b751ef3f71190 100644 --- a/x-pack/plugins/apm/public/components/routing/apm_route_config.tsx +++ b/x-pack/plugins/apm/public/components/routing/apm_route_config.tsx @@ -53,6 +53,12 @@ const apmRoutes = route([ }), }), ]), + defaults: { + query: { + rangeFrom: 'now-15m', + rangeTo: 'now', + }, + }, }, { path: '/', diff --git a/x-pack/plugins/apm/public/components/routing/home/index.tsx b/x-pack/plugins/apm/public/components/routing/home/index.tsx index ce74a48fd8c86..d1304e192ddce 100644 --- a/x-pack/plugins/apm/public/components/routing/home/index.tsx +++ b/x-pack/plugins/apm/public/components/routing/home/index.tsx @@ -8,7 +8,7 @@ import { i18n } from '@kbn/i18n'; import { Outlet } from '@kbn/typed-react-router-config'; import * as t from 'io-ts'; import React from 'react'; -import { Redirect } from 'react-router-dom'; +import { RedirectTo } from '../redirect_to'; import { ENVIRONMENT_ALL } from '../../../../common/environment_filter_values'; import { environmentRt } from '../../../../common/environment_rt'; import { BackendDetailOverview } from '../../app/backend_detail_overview'; @@ -121,7 +121,7 @@ export const home = { }, { path: '/', - element: , + element: , }, ], } as const; diff --git a/x-pack/plugins/apm/public/components/routing/redirect_to.tsx b/x-pack/plugins/apm/public/components/routing/redirect_to.tsx index 68ff2fce77f13..7e5e01cadbf3e 100644 --- a/x-pack/plugins/apm/public/components/routing/redirect_to.tsx +++ b/x-pack/plugins/apm/public/components/routing/redirect_to.tsx @@ -6,33 +6,50 @@ */ import React from 'react'; -import { Redirect, RouteComponentProps } from 'react-router-dom'; +import { Location } from 'history'; +import { Redirect, useLocation, RouteComponentProps } from 'react-router-dom'; /** - * Given a path, redirect to that location, preserving the search and maintaining - * backward-compatibilty with legacy (pre-7.9) hash-based URLs. + * Function that returns a react component to redirect to a given pathname removing hash-based URLs + * @param pathname */ -export function redirectTo(to: string) { +export function redirectTo(pathname: string) { return ({ location }: RouteComponentProps<{}>) => { - let resolvedUrl: URL | undefined; + return ; + }; +} - // Redirect root URLs with a hash to support backward compatibility with URLs - // from before we switched to the non-hash platform history. - if (location.pathname === '' && location.hash.length > 0) { - // We just want the search and pathname so the host doesn't matter - resolvedUrl = new URL(location.hash.slice(1), 'http://localhost'); - to = resolvedUrl.pathname; - } +/** + * React component to redirect to a given pathname removing hash-based URLs + * @param param0 + */ +export function RedirectTo({ pathname }: { pathname: string }) { + const location = useLocation(); + return ; +} - return ( - - ); - }; +interface Props { + location: Location; + pathname: string; +} + +/** + * Given a pathname, redirect to that location, preserving the search and maintaining + * backward-compatibilty with legacy (pre-7.9) hash-based URLs. + */ +function RenderRedirectTo(props: Props) { + const { location } = props; + let search = location.search; + let pathname = props.pathname; + + // Redirect root URLs with a hash to support backward compatibility with URLs + // from before we switched to the non-hash platform history. + if (location.pathname === '' && location.hash.length > 0) { + // We just want the search and pathname so the host doesn't matter + const resolvedUrl = new URL(location.hash.slice(1), 'http://localhost'); + search = resolvedUrl.search; + pathname = resolvedUrl.pathname; + } + + return ; } From e14f81451828733f1cc81152f5a483a08baf43cb Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Thu, 19 Aug 2021 22:02:15 +0100 Subject: [PATCH 17/44] skip flaky suite (#109329) --- x-pack/test/functional/apps/uptime/synthetics_integration.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/test/functional/apps/uptime/synthetics_integration.ts b/x-pack/test/functional/apps/uptime/synthetics_integration.ts index 6d468b32d7018..5a8ca33df791a 100644 --- a/x-pack/test/functional/apps/uptime/synthetics_integration.ts +++ b/x-pack/test/functional/apps/uptime/synthetics_integration.ts @@ -111,7 +111,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); }); - describe('create new policy', () => { + // FLAKY: https://github.com/elastic/kibana/issues/109329 + describe.skip('create new policy', () => { let version: string; before(async () => { await uptimeService.syntheticsPackage.deletePolicyByName('system-1'); From 96dfabd51b5ef4fa791fde0ff4d0bb51b80c0956 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Thu, 19 Aug 2021 23:00:44 +0100 Subject: [PATCH 18/44] skip failing es promotion suite (#109349) --- x-pack/test/functional/apps/security/users.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/test/functional/apps/security/users.js b/x-pack/test/functional/apps/security/users.js index 8730ee3aeeaf2..6f9af40badd05 100644 --- a/x-pack/test/functional/apps/security/users.js +++ b/x-pack/test/functional/apps/security/users.js @@ -12,7 +12,8 @@ export default function ({ getService, getPageObjects }) { const config = getService('config'); const log = getService('log'); - describe('users', function () { + // FAILING ES PROMOTION: https://github.com/elastic/kibana/issues/109349 + describe.skip('users', function () { before(async () => { log.debug('users'); await PageObjects.settings.navigateTo(); From d155a94fcec95cb6f99e879b099652623fc80451 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Thu, 19 Aug 2021 23:09:49 +0100 Subject: [PATCH 19/44] skip failing es promotion suite (#109351) --- .../test/functional/apps/dashboard_mode/dashboard_view_mode.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js b/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js index 74f4dca06c717..af7d16969c605 100644 --- a/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js +++ b/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js @@ -62,7 +62,8 @@ export default function ({ getService, getPageObjects }) { await kibanaServer.savedObjects.clean({ types }); }); - describe('Dashboard viewer', () => { + // FAILING ES PROMOTION: https://github.com/elastic/kibana/issues/109351 + describe.skip('Dashboard viewer', () => { after(async () => { await security.testUser.restoreDefaults(); }); From 442d9c3274bb923ee48098e4b34c9a71a689605b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Marcondes?= <55978943+cauemarcondes@users.noreply.github.com> Date: Thu, 19 Aug 2021 19:46:05 -0400 Subject: [PATCH 20/44] [APM] Rum service details doesn't show any data (#109117) * removing existing filter * fixing unit test * replacing terms agg for should filter * fixing test --- .../__snapshots__/queries.test.ts.snap | 12 ++++----- .../server/lib/services/get_service_agent.ts | 26 +++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/x-pack/plugins/apm/server/lib/services/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/lib/services/__snapshots__/queries.test.ts.snap index 1b5df64dd8d00..ce8a8bcb8930d 100644 --- a/x-pack/plugins/apm/server/lib/services/__snapshots__/queries.test.ts.snap +++ b/x-pack/plugins/apm/server/lib/services/__snapshots__/queries.test.ts.snap @@ -64,8 +64,8 @@ Object { }, "body": Object { "_source": Array [ - "service.runtime.name", "agent.name", + "service.runtime.name", ], "query": Object { "bool": Object { @@ -84,17 +84,17 @@ Object { }, }, }, - Object { - "exists": Object { - "field": "service.runtime.name", - }, - }, Object { "exists": Object { "field": "agent.name", }, }, ], + "should": Object { + "exists": Object { + "field": "service.runtime.name", + }, + }, }, }, "size": 1, diff --git a/x-pack/plugins/apm/server/lib/services/get_service_agent.ts b/x-pack/plugins/apm/server/lib/services/get_service_agent.ts index 2a6ec74bc0d1a..e99fd6b9ff278 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_agent.ts +++ b/x-pack/plugins/apm/server/lib/services/get_service_agent.ts @@ -16,14 +16,14 @@ import { Setup, SetupTimeRange } from '../helpers/setup_request'; import { getProcessorEventForAggregatedTransactions } from '../helpers/aggregated_transactions'; interface ServiceAgent { - service?: { - runtime: { - name: string; - }; - }; agent?: { name: string; }; + service?: { + runtime?: { + name?: string; + }; + }; } export async function getServiceAgent({ @@ -50,23 +50,23 @@ export async function getServiceAgent({ }, body: { size: 1, - _source: [SERVICE_RUNTIME_NAME, AGENT_NAME], + _source: [AGENT_NAME, SERVICE_RUNTIME_NAME], query: { bool: { filter: [ { term: { [SERVICE_NAME]: serviceName } }, ...rangeQuery(start, end), - { - exists: { - field: SERVICE_RUNTIME_NAME, - }, - }, { exists: { field: AGENT_NAME, }, }, ], + should: { + exists: { + field: SERVICE_RUNTIME_NAME, + }, + }, }, }, }, @@ -80,6 +80,6 @@ export async function getServiceAgent({ return {}; } - const { service, agent } = response.hits.hits[0]._source as ServiceAgent; - return { agentName: agent?.name, runtimeName: service?.runtime.name }; + const { agent, service } = response.hits.hits[0]._source as ServiceAgent; + return { agentName: agent?.name, runtimeName: service?.runtime?.name }; } From 5f9193d24c88ee1e64acbd05da4a0a24d7f88e03 Mon Sep 17 00:00:00 2001 From: Clint Andrew Hall Date: Thu, 19 Aug 2021 21:12:50 -0500 Subject: [PATCH 21/44] Fix height of editor when maximized (#109161) --- .../canvas/public/components/expression/expression.scss | 9 +++++++++ .../canvas/public/components/expression/expression.tsx | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/canvas/public/components/expression/expression.scss b/x-pack/plugins/canvas/public/components/expression/expression.scss index da95eca2b4f61..c649742077f2b 100644 --- a/x-pack/plugins/canvas/public/components/expression/expression.scss +++ b/x-pack/plugins/canvas/public/components/expression/expression.scss @@ -31,6 +31,15 @@ flex-direction: column; } + .canvasExpressionInput__editor { + height: auto; + position: absolute; + top: 0; + left: 0; + bottom: $euiSizeS * 7 + 1; + right: 0; + } + .canvasExpressionInput__inner { flex-grow: 1; display: flex; diff --git a/x-pack/plugins/canvas/public/components/expression/expression.tsx b/x-pack/plugins/canvas/public/components/expression/expression.tsx index ff3fed32c0ac0..a3ba18d541d76 100644 --- a/x-pack/plugins/canvas/public/components/expression/expression.tsx +++ b/x-pack/plugins/canvas/public/components/expression/expression.tsx @@ -171,7 +171,7 @@ export const Expression: FC = ({
- + {isCompact ? strings.getMaximizeButtonLabel() : strings.getMinimizeButtonLabel()} From 91630c63cf232e806ed28d9323e3ea6eb64438e3 Mon Sep 17 00:00:00 2001 From: Tim Sullivan Date: Thu, 19 Aug 2021 19:24:13 -0700 Subject: [PATCH 22/44] [Reporting/Telemetry] Include counts for each deprecated job type (#108614) * add isDeprecated to report meta for telemetry * test clean up * update snapshots * Update x-pack/plugins/reporting/server/usage/decorate_range_stats.ts Co-authored-by: Michael Dokolin Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Michael Dokolin --- x-pack/plugins/reporting/common/constants.ts | 2 + x-pack/plugins/reporting/common/types.ts | 7 +- .../reporting/server/lib/enqueue_job.test.ts | 1 + .../reporting/server/lib/enqueue_job.ts | 2 + .../reporting/server/lib/store/mapping.ts | 3 + .../reporting_usage_collector.test.ts.snap | 771 ++++++++++++++++ .../server/usage/decorate_range_stats.test.ts | 142 +++ .../server/usage/decorate_range_stats.ts | 9 +- .../server/usage/get_reporting_usage.ts | 33 +- .../usage/reporting_usage_collector.test.ts | 866 +++--------------- .../plugins/reporting/server/usage/schema.ts | 14 +- .../plugins/reporting/server/usage/types.ts | 58 +- .../schema/xpack_plugins.json | 142 +-- .../job_apis_csv_deprecated.ts | 16 +- 14 files changed, 1153 insertions(+), 913 deletions(-) create mode 100644 x-pack/plugins/reporting/server/usage/decorate_range_stats.test.ts diff --git a/x-pack/plugins/reporting/common/constants.ts b/x-pack/plugins/reporting/common/constants.ts index 4ba406a14bafc..842d7d1eb4b8d 100644 --- a/x-pack/plugins/reporting/common/constants.ts +++ b/x-pack/plugins/reporting/common/constants.ts @@ -79,6 +79,8 @@ export const CSV_JOB_TYPE_DEPRECATED = 'csv'; export const USES_HEADLESS_JOB_TYPES = [PDF_JOB_TYPE, PNG_JOB_TYPE]; +export const DEPRECATED_JOB_TYPES = [CSV_JOB_TYPE_DEPRECATED]; + // Licenses export const LICENSE_TYPE_TRIAL = 'trial'; export const LICENSE_TYPE_BASIC = 'basic'; diff --git a/x-pack/plugins/reporting/common/types.ts b/x-pack/plugins/reporting/common/types.ts index 745bc11a8c855..c324cf363faa1 100644 --- a/x-pack/plugins/reporting/common/types.ts +++ b/x-pack/plugins/reporting/common/types.ts @@ -73,7 +73,12 @@ export interface ReportSource { jobtype: string; // refers to `ExportTypeDefinition.jobType` created_by: string | false; // username or `false` if security is disabled. Used for ensuring users can only access the reports they've created. payload: BasePayload; - meta: { objectType: string; layout?: string }; // for telemetry + meta: { + // for telemetry + objectType: string; + layout?: string; + isDeprecated?: boolean; + }; migration_version: string; // for reminding the user to update their POST URL attempts: number; // initially populated as 0 created_at: string; // timestamp in UTC diff --git a/x-pack/plugins/reporting/server/lib/enqueue_job.test.ts b/x-pack/plugins/reporting/server/lib/enqueue_job.test.ts index 8cfea1b010dfe..50103c8806fe0 100644 --- a/x-pack/plugins/reporting/server/lib/enqueue_job.test.ts +++ b/x-pack/plugins/reporting/server/lib/enqueue_job.test.ts @@ -97,6 +97,7 @@ describe('Enqueue Job', () => { "kibana_name": undefined, "max_attempts": undefined, "meta": Object { + "isDeprecated": undefined, "layout": undefined, "objectType": "cool_object_type", }, diff --git a/x-pack/plugins/reporting/server/lib/enqueue_job.ts b/x-pack/plugins/reporting/server/lib/enqueue_job.ts index 998e4edf26a38..129c474fd134a 100644 --- a/x-pack/plugins/reporting/server/lib/enqueue_job.ts +++ b/x-pack/plugins/reporting/server/lib/enqueue_job.ts @@ -47,8 +47,10 @@ export async function enqueueJob( created_by: user ? user.username : false, payload: job, meta: { + // telemetry fields objectType: jobParams.objectType, layout: jobParams.layout?.id, + isDeprecated: job.isDeprecated, }, }) ); diff --git a/x-pack/plugins/reporting/server/lib/store/mapping.ts b/x-pack/plugins/reporting/server/lib/store/mapping.ts index 7a7a16c7bc7ea..a43b4494fe913 100644 --- a/x-pack/plugins/reporting/server/lib/store/mapping.ts +++ b/x-pack/plugins/reporting/server/lib/store/mapping.ts @@ -29,6 +29,9 @@ export const mapping = { }, }, }, + isDeprecated: { + type: 'boolean', + }, }, }, browser_type: { type: 'keyword' }, diff --git a/x-pack/plugins/reporting/server/usage/__snapshots__/reporting_usage_collector.test.ts.snap b/x-pack/plugins/reporting/server/usage/__snapshots__/reporting_usage_collector.test.ts.snap index 150154fa996c5..12e89f19e6248 100644 --- a/x-pack/plugins/reporting/server/usage/__snapshots__/reporting_usage_collector.test.ts.snap +++ b/x-pack/plugins/reporting/server/usage/__snapshots__/reporting_usage_collector.test.ts.snap @@ -1,9 +1,757 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`Ready for collection observable converts observable to promise 1`] = ` +Object { + "fetch": [Function], + "isReady": [Function], + "schema": Object { + "PNG": Object { + "available": Object { + "type": "boolean", + }, + "deprecated": Object { + "type": "long", + }, + "total": Object { + "type": "long", + }, + }, + "_all": Object { + "type": "long", + }, + "available": Object { + "type": "boolean", + }, + "browser_type": Object { + "type": "keyword", + }, + "csv": Object { + "available": Object { + "type": "boolean", + }, + "deprecated": Object { + "type": "long", + }, + "total": Object { + "type": "long", + }, + }, + "csv_searchsource": Object { + "available": Object { + "type": "boolean", + }, + "deprecated": Object { + "type": "long", + }, + "total": Object { + "type": "long", + }, + }, + "enabled": Object { + "type": "boolean", + }, + "last7Days": Object { + "PNG": Object { + "available": Object { + "type": "boolean", + }, + "deprecated": Object { + "type": "long", + }, + "total": Object { + "type": "long", + }, + }, + "_all": Object { + "type": "long", + }, + "csv": Object { + "available": Object { + "type": "boolean", + }, + "deprecated": Object { + "type": "long", + }, + "total": Object { + "type": "long", + }, + }, + "csv_searchsource": Object { + "available": Object { + "type": "boolean", + }, + "deprecated": Object { + "type": "long", + }, + "total": Object { + "type": "long", + }, + }, + "printable_pdf": Object { + "app": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "available": Object { + "type": "boolean", + }, + "deprecated": Object { + "type": "long", + }, + "layout": Object { + "preserve_layout": Object { + "type": "long", + }, + "print": Object { + "type": "long", + }, + }, + "total": Object { + "type": "long", + }, + }, + "status": Object { + "completed": Object { + "type": "long", + }, + "completed_with_warnings": Object { + "type": "long", + }, + "failed": Object { + "type": "long", + }, + "pending": Object { + "type": "long", + }, + "processing": Object { + "type": "long", + }, + }, + "statuses": Object { + "completed": Object { + "PNG": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "csv": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "csv_searchsource": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "printable_pdf": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + }, + "completed_with_warnings": Object { + "PNG": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "csv": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "csv_searchsource": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "printable_pdf": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + }, + "failed": Object { + "PNG": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "csv": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "csv_searchsource": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "printable_pdf": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + }, + "pending": Object { + "PNG": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "csv": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "csv_searchsource": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "printable_pdf": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + }, + "processing": Object { + "PNG": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "csv": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "csv_searchsource": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "printable_pdf": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + }, + }, + }, + "printable_pdf": Object { + "app": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "available": Object { + "type": "boolean", + }, + "deprecated": Object { + "type": "long", + }, + "layout": Object { + "preserve_layout": Object { + "type": "long", + }, + "print": Object { + "type": "long", + }, + }, + "total": Object { + "type": "long", + }, + }, + "status": Object { + "completed": Object { + "type": "long", + }, + "completed_with_warnings": Object { + "type": "long", + }, + "failed": Object { + "type": "long", + }, + "pending": Object { + "type": "long", + }, + "processing": Object { + "type": "long", + }, + }, + "statuses": Object { + "completed": Object { + "PNG": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "csv": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "csv_searchsource": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "printable_pdf": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + }, + "completed_with_warnings": Object { + "PNG": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "csv": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "csv_searchsource": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "printable_pdf": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + }, + "failed": Object { + "PNG": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "csv": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "csv_searchsource": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "printable_pdf": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + }, + "pending": Object { + "PNG": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "csv": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "csv_searchsource": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "printable_pdf": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + }, + "processing": Object { + "PNG": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "csv": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "csv_searchsource": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + "printable_pdf": Object { + "canvas workpad": Object { + "type": "long", + }, + "dashboard": Object { + "type": "long", + }, + "visualization": Object { + "type": "long", + }, + }, + }, + }, + }, + "type": "reporting", +} +`; + +exports[`data modeling usage data with meta.isDeprecated jobTypes 1`] = ` +Object { + "PNG": Object { + "available": true, + "deprecated": 0, + "total": 0, + }, + "_all": 9, + "available": true, + "browser_type": undefined, + "csv": Object { + "available": true, + "deprecated": 4, + "total": 4, + }, + "csv_searchsource": Object { + "available": true, + "deprecated": 0, + "total": 5, + }, + "enabled": true, + "last7Days": Object { + "PNG": Object { + "available": true, + "deprecated": 0, + "total": 0, + }, + "_all": 9, + "csv": Object { + "available": true, + "deprecated": 4, + "total": 4, + }, + "csv_searchsource": Object { + "available": true, + "deprecated": 0, + "total": 5, + }, + "printable_pdf": Object { + "app": Object { + "dashboard": 0, + "visualization": 0, + }, + "available": true, + "deprecated": 0, + "layout": Object { + "preserve_layout": 0, + "print": 0, + }, + "total": 0, + }, + "status": Object { + "completed": 9, + "failed": 0, + }, + "statuses": Object { + "completed": Object { + "csv": Object { + "search": 4, + }, + "csv_searchsource": Object { + "search": 5, + }, + }, + }, + }, + "printable_pdf": Object { + "app": Object { + "dashboard": 0, + "visualization": 0, + }, + "available": true, + "deprecated": 0, + "layout": Object { + "preserve_layout": 0, + "print": 0, + }, + "total": 0, + }, + "status": Object { + "completed": 9, + "failed": 0, + }, + "statuses": Object { + "completed": Object { + "csv": Object { + "search": 4, + }, + "csv_searchsource": Object { + "search": 5, + }, + }, + }, +} +`; + exports[`data modeling with empty data 1`] = ` Object { "PNG": Object { "available": true, + "deprecated": 0, "total": 0, }, "_all": 0, @@ -11,25 +759,30 @@ Object { "browser_type": undefined, "csv": Object { "available": true, + "deprecated": 0, "total": 0, }, "csv_searchsource": Object { "available": true, + "deprecated": 0, "total": 0, }, "enabled": true, "last7Days": Object { "PNG": Object { "available": true, + "deprecated": 0, "total": 0, }, "_all": 0, "csv": Object { "available": true, + "deprecated": 0, "total": 0, }, "csv_searchsource": Object { "available": true, + "deprecated": 0, "total": 0, }, "printable_pdf": Object { @@ -38,6 +791,7 @@ Object { "visualization": 0, }, "available": true, + "deprecated": 0, "layout": Object { "preserve_layout": 0, "print": 0, @@ -56,6 +810,7 @@ Object { "visualization": 0, }, "available": true, + "deprecated": 0, "layout": Object { "preserve_layout": 0, "print": 0, @@ -74,6 +829,7 @@ exports[`data modeling with normal looking usage data 1`] = ` Object { "PNG": Object { "available": true, + "deprecated": 0, "total": 3, }, "_all": 12, @@ -81,25 +837,30 @@ Object { "browser_type": undefined, "csv": Object { "available": true, + "deprecated": 0, "total": 0, }, "csv_searchsource": Object { "available": true, + "deprecated": 0, "total": 0, }, "enabled": true, "last7Days": Object { "PNG": Object { "available": true, + "deprecated": 0, "total": 1, }, "_all": 1, "csv": Object { "available": true, + "deprecated": 0, "total": 0, }, "csv_searchsource": Object { "available": true, + "deprecated": 0, "total": 0, }, "printable_pdf": Object { @@ -108,6 +869,7 @@ Object { "visualization": 0, }, "available": true, + "deprecated": 0, "layout": Object { "preserve_layout": 0, "print": 0, @@ -134,6 +896,7 @@ Object { "visualization": 3, }, "available": true, + "deprecated": 0, "layout": Object { "preserve_layout": 9, "print": 0, @@ -173,6 +936,7 @@ exports[`data modeling with sparse data 1`] = ` Object { "PNG": Object { "available": true, + "deprecated": 0, "total": 1, }, "_all": 4, @@ -180,25 +944,30 @@ Object { "browser_type": undefined, "csv": Object { "available": true, + "deprecated": 1, "total": 1, }, "csv_searchsource": Object { "available": true, + "deprecated": 0, "total": 0, }, "enabled": true, "last7Days": Object { "PNG": Object { "available": true, + "deprecated": 0, "total": 1, }, "_all": 4, "csv": Object { "available": true, + "deprecated": 1, "total": 1, }, "csv_searchsource": Object { "available": true, + "deprecated": 0, "total": 0, }, "printable_pdf": Object { @@ -208,6 +977,7 @@ Object { "visualization": 0, }, "available": true, + "deprecated": 0, "layout": Object { "preserve_layout": 2, "print": 0, @@ -238,6 +1008,7 @@ Object { "visualization": 0, }, "available": true, + "deprecated": 0, "layout": Object { "preserve_layout": 2, "print": 0, diff --git a/x-pack/plugins/reporting/server/usage/decorate_range_stats.test.ts b/x-pack/plugins/reporting/server/usage/decorate_range_stats.test.ts new file mode 100644 index 0000000000000..ca1677c2379fc --- /dev/null +++ b/x-pack/plugins/reporting/server/usage/decorate_range_stats.test.ts @@ -0,0 +1,142 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { decorateRangeStats } from './decorate_range_stats'; +import { FeatureAvailabilityMap } from './types'; + +let featureMap: FeatureAvailabilityMap; + +beforeEach(() => { + featureMap = { PNG: true, csv: true, csv_searchsource: true, printable_pdf: true }; +}); + +test('Model of job status and status-by-pdf-app', () => { + const result = decorateRangeStats( + { + status: { completed: 0, processing: 1, pending: 2, failed: 3 }, + statuses: { + processing: { printable_pdf: { 'canvas workpad': 1 } }, + pending: { printable_pdf: { dashboard: 1, 'canvas workpad': 1 } }, + failed: { printable_pdf: { visualization: 2, dashboard: 2, 'canvas workpad': 1 } }, + }, + }, + featureMap + ); + + expect(result.status).toMatchInlineSnapshot(` + Object { + "completed": 0, + "failed": 3, + "pending": 2, + "processing": 1, + } + `); + expect(result.statuses).toMatchInlineSnapshot(` + Object { + "failed": Object { + "printable_pdf": Object { + "canvas workpad": 1, + "dashboard": 2, + "visualization": 2, + }, + }, + "pending": Object { + "printable_pdf": Object { + "canvas workpad": 1, + "dashboard": 1, + }, + }, + "processing": Object { + "printable_pdf": Object { + "canvas workpad": 1, + }, + }, + } + `); +}); + +test('Model of jobTypes', () => { + const result = decorateRangeStats( + { + PNG: { available: true, total: 3 }, + printable_pdf: { + available: true, + total: 3, + app: { dashboard: 0, visualization: 0, 'canvas workpad': 3 }, + layout: { preserve_layout: 3, print: 0 }, + }, + csv_searchsource: { available: true, total: 3 }, + }, + featureMap + ); + + expect(result.PNG).toMatchInlineSnapshot(` + Object { + "available": true, + "deprecated": 0, + "total": 3, + } + `); + expect(result.csv).toMatchInlineSnapshot(` + Object { + "available": true, + "deprecated": 0, + "total": 0, + } + `); + expect(result.csv_searchsource).toMatchInlineSnapshot(` + Object { + "available": true, + "deprecated": 0, + "total": 3, + } + `); + expect(result.printable_pdf).toMatchInlineSnapshot(` + Object { + "app": Object { + "canvas workpad": 3, + "dashboard": 0, + "visualization": 0, + }, + "available": true, + "deprecated": 0, + "layout": Object { + "preserve_layout": 3, + "print": 0, + }, + "total": 3, + } + `); +}); + +test('PNG counts, provided count of deprecated jobs explicitly', () => { + const result = decorateRangeStats( + { PNG: { available: true, total: 15, deprecated: 5 } }, + featureMap + ); + expect(result.PNG).toMatchInlineSnapshot(` + Object { + "available": true, + "deprecated": 5, + "total": 15, + } + `); +}); + +test('CSV counts, provides all jobs implicitly deprecated due to jobtype', () => { + const result = decorateRangeStats( + { csv: { available: true, total: 15, deprecated: 0 } }, + featureMap + ); + expect(result.csv).toMatchInlineSnapshot(` + Object { + "available": true, + "deprecated": 15, + "total": 15, + } + `); +}); diff --git a/x-pack/plugins/reporting/server/usage/decorate_range_stats.ts b/x-pack/plugins/reporting/server/usage/decorate_range_stats.ts index 9fc0141ab742e..99d4b7d934579 100644 --- a/x-pack/plugins/reporting/server/usage/decorate_range_stats.ts +++ b/x-pack/plugins/reporting/server/usage/decorate_range_stats.ts @@ -9,11 +9,14 @@ import { uniq } from 'lodash'; import { CSV_JOB_TYPE, CSV_JOB_TYPE_DEPRECATED, + DEPRECATED_JOB_TYPES, PDF_JOB_TYPE, PNG_JOB_TYPE, } from '../../common/constants'; import { AvailableTotal, ExportType, FeatureAvailabilityMap, RangeStats } from './types'; +const jobTypeIsDeprecated = (jobType: string) => DEPRECATED_JOB_TYPES.includes(jobType); + function getForFeature( range: Partial, typeKey: ExportType, @@ -21,7 +24,7 @@ function getForFeature( additional?: any ): AvailableTotal & typeof additional { const isAvailable = (feature: ExportType) => !!featureAvailability[feature]; - const jobType = range[typeKey] || { total: 0, ...additional }; + const jobType = range[typeKey] || { total: 0, ...additional, deprecated: 0 }; // merge the additional stats for the jobType type AdditionalType = { [K in keyof typeof additional]: K }; @@ -32,9 +35,13 @@ function getForFeature( }); } + // if the type itself is deprecated, all jobs are deprecated, otherwise only some of them might be + const deprecated = jobTypeIsDeprecated(typeKey) ? jobType.total : jobType.deprecated || 0; + return { available: isAvailable(typeKey), total: jobType.total, + deprecated, ...filledAdditional, }; } diff --git a/x-pack/plugins/reporting/server/usage/get_reporting_usage.ts b/x-pack/plugins/reporting/server/usage/get_reporting_usage.ts index f07da188f3e62..e5801b30caff6 100644 --- a/x-pack/plugins/reporting/server/usage/get_reporting_usage.ts +++ b/x-pack/plugins/reporting/server/usage/get_reporting_usage.ts @@ -5,21 +5,21 @@ * 2.0. */ import type { estypes } from '@elastic/elasticsearch'; +import type { ElasticsearchClient } from 'kibana/server'; import { get } from 'lodash'; -import { ElasticsearchClient } from 'kibana/server'; -import { ReportingConfig } from '../'; -import { ExportTypesRegistry } from '../lib/export_types_registry'; -import { GetLicense } from './'; +import type { ReportingConfig } from '../'; +import type { ExportTypesRegistry } from '../lib/export_types_registry'; +import type { GetLicense } from './'; import { decorateRangeStats } from './decorate_range_stats'; import { getExportTypesHandler } from './get_export_type_handler'; -import { +import type { AggregationResultBuckets, + AvailableTotal, FeatureAvailabilityMap, JobTypes, KeyCountBucket, RangeStats, ReportingUsageType, - // ReportingUsageSearchResponse, StatusByAppBucket, } from './types'; @@ -28,6 +28,7 @@ const JOB_TYPES_FIELD = 'jobtype'; const LAYOUT_TYPES_KEY = 'layoutTypes'; const LAYOUT_TYPES_FIELD = 'meta.layout.keyword'; const OBJECT_TYPES_KEY = 'objectTypes'; +const OBJECT_TYPE_DEPRECATED_KEY = 'meta.isDeprecated'; const OBJECT_TYPES_FIELD = 'meta.objectType.keyword'; const STATUS_TYPES_KEY = 'statusTypes'; const STATUS_BY_APP_KEY = 'statusByApp'; @@ -64,12 +65,15 @@ const getAppStatuses = (buckets: StatusByAppBucket[]) => function getAggStats(aggs: AggregationResultBuckets): Partial { const { buckets: jobBuckets } = aggs[JOB_TYPES_KEY]; - const jobTypes = jobBuckets.reduce( - (accum: JobTypes, { key, doc_count: count }: { key: string; doc_count: number }) => { - return { ...accum, [key]: { total: count } }; - }, - {} as JobTypes - ); + const jobTypes = jobBuckets.reduce((accum: JobTypes, bucket) => { + const { key, doc_count: count, isDeprecated } = bucket; + const deprecatedCount = isDeprecated?.doc_count; + const total: Omit = { + total: count, + deprecated: deprecatedCount, + }; + return { ...accum, [key]: total }; + }, {} as JobTypes); // merge pdf stats into pdf jobtype key const pdfJobs = jobTypes[PRINTABLE_PDF_JOBTYPE]; @@ -141,7 +145,10 @@ export async function getReportingUsage( }, }, aggs: { - [JOB_TYPES_KEY]: { terms: { field: JOB_TYPES_FIELD, size: DEFAULT_TERMS_SIZE } }, + [JOB_TYPES_KEY]: { + terms: { field: JOB_TYPES_FIELD, size: DEFAULT_TERMS_SIZE }, + aggs: { isDeprecated: { filter: { term: { [OBJECT_TYPE_DEPRECATED_KEY]: true } } } }, + }, [STATUS_TYPES_KEY]: { terms: { field: STATUS_TYPES_FIELD, size: DEFAULT_TERMS_SIZE } }, [STATUS_BY_APP_KEY]: { terms: { field: 'status', size: DEFAULT_TERMS_SIZE }, diff --git a/x-pack/plugins/reporting/server/usage/reporting_usage_collector.test.ts b/x-pack/plugins/reporting/server/usage/reporting_usage_collector.test.ts index 226704b255ab3..72824f6aeeb38 100644 --- a/x-pack/plugins/reporting/server/usage/reporting_usage_collector.test.ts +++ b/x-pack/plugins/reporting/server/usage/reporting_usage_collector.test.ts @@ -238,6 +238,147 @@ describe('data modeling', () => { expect(usageStats).toMatchSnapshot(); }); + test('usage data with meta.isDeprecated jobTypes', async () => { + const plugins = getPluginsMock(); + const collector = getReportingUsageCollector( + mockCore, + plugins.usageCollection, + getLicenseMock(), + exportTypesRegistry, + function isReady() { + return Promise.resolve(true); + } + ); + collectorFetchContext = getMockFetchClients( + getResponseMock({ + aggregations: { + ranges: { + buckets: { + all: { + doc_count: 9, + layoutTypes: { + doc_count: 0, + pdf: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, + }, + statusByApp: { + doc_count_error_upper_bound: 0, + sum_other_doc_count: 0, + buckets: [ + { + key: 'completed', + doc_count: 9, + jobTypes: { + doc_count_error_upper_bound: 0, + sum_other_doc_count: 0, + buckets: [ + { + key: 'csv_searchsource', + doc_count: 5, + appNames: { + doc_count_error_upper_bound: 0, + sum_other_doc_count: 0, + buckets: [{ key: 'search', doc_count: 5 }], + }, + }, + { + key: 'csv', + doc_count: 4, + appNames: { + doc_count_error_upper_bound: 0, + sum_other_doc_count: 0, + buckets: [{ key: 'search', doc_count: 4 }], + }, + }, + ], + }, + }, + ], + }, + objectTypes: { + doc_count: 0, + pdf: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, + }, + statusTypes: { + doc_count_error_upper_bound: 0, + sum_other_doc_count: 0, + buckets: [{ key: 'completed', doc_count: 9 }], + }, + jobTypes: { + doc_count_error_upper_bound: 0, + sum_other_doc_count: 0, + buckets: [ + { key: 'csv_searchsource', doc_count: 5, isDeprecated: { doc_count: 0 } }, + { key: 'csv', doc_count: 4, isDeprecated: { doc_count: 4 } }, + ], + }, + }, + last7Days: { + doc_count: 9, + layoutTypes: { + doc_count: 0, + pdf: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, + }, + statusByApp: { + doc_count_error_upper_bound: 0, + sum_other_doc_count: 0, + buckets: [ + { + key: 'completed', + doc_count: 9, + jobTypes: { + doc_count_error_upper_bound: 0, + sum_other_doc_count: 0, + buckets: [ + { + key: 'csv_searchsource', + doc_count: 5, + appNames: { + doc_count_error_upper_bound: 0, + sum_other_doc_count: 0, + buckets: [{ key: 'search', doc_count: 5 }], + }, + }, + { + key: 'csv', + doc_count: 4, + appNames: { + doc_count_error_upper_bound: 0, + sum_other_doc_count: 0, + buckets: [{ key: 'search', doc_count: 4 }], + }, + }, + ], + }, + }, + ], + }, + objectTypes: { + doc_count: 0, + pdf: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, + }, + statusTypes: { + doc_count_error_upper_bound: 0, + sum_other_doc_count: 0, + buckets: [{ key: 'completed', doc_count: 9 }], + }, + jobTypes: { + doc_count_error_upper_bound: 0, + sum_other_doc_count: 0, + buckets: [ + { key: 'csv_searchsource', doc_count: 5, isDeprecated: { doc_count: 0 } }, + { key: 'csv', doc_count: 4, isDeprecated: { doc_count: 4 } }, + ], + }, + }, + }, + }, + }, + }) + ); + const usageStats = await collector.fetch(collectorFetchContext); + expect(usageStats).toMatchSnapshot(); + }); + test('with sparse data', async () => { const plugins = getPluginsMock(); const collector = getReportingUsageCollector( @@ -462,730 +603,7 @@ describe('Ready for collection observable', () => { registerReportingUsageCollector(mockReporting, plugins); const [args] = makeCollectorSpy.firstCall.args; - expect(args).toMatchInlineSnapshot(` - Object { - "fetch": [Function], - "isReady": [Function], - "schema": Object { - "PNG": Object { - "available": Object { - "type": "boolean", - }, - "total": Object { - "type": "long", - }, - }, - "_all": Object { - "type": "long", - }, - "available": Object { - "type": "boolean", - }, - "browser_type": Object { - "type": "keyword", - }, - "csv": Object { - "available": Object { - "type": "boolean", - }, - "total": Object { - "type": "long", - }, - }, - "csv_searchsource": Object { - "available": Object { - "type": "boolean", - }, - "total": Object { - "type": "long", - }, - }, - "enabled": Object { - "type": "boolean", - }, - "last7Days": Object { - "PNG": Object { - "available": Object { - "type": "boolean", - }, - "total": Object { - "type": "long", - }, - }, - "_all": Object { - "type": "long", - }, - "csv": Object { - "available": Object { - "type": "boolean", - }, - "total": Object { - "type": "long", - }, - }, - "csv_searchsource": Object { - "available": Object { - "type": "boolean", - }, - "total": Object { - "type": "long", - }, - }, - "printable_pdf": Object { - "app": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "available": Object { - "type": "boolean", - }, - "layout": Object { - "preserve_layout": Object { - "type": "long", - }, - "print": Object { - "type": "long", - }, - }, - "total": Object { - "type": "long", - }, - }, - "status": Object { - "cancelled": Object { - "type": "long", - }, - "completed": Object { - "type": "long", - }, - "completed_with_warnings": Object { - "type": "long", - }, - "failed": Object { - "type": "long", - }, - "pending": Object { - "type": "long", - }, - "processing": Object { - "type": "long", - }, - }, - "statuses": Object { - "cancelled": Object { - "PNG": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "csv": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "csv_searchsource": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "printable_pdf": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - }, - "completed": Object { - "PNG": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "csv": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "csv_searchsource": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "printable_pdf": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - }, - "completed_with_warnings": Object { - "PNG": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "csv": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "csv_searchsource": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "printable_pdf": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - }, - "failed": Object { - "PNG": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "csv": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "csv_searchsource": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "printable_pdf": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - }, - "pending": Object { - "PNG": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "csv": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "csv_searchsource": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "printable_pdf": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - }, - "processing": Object { - "PNG": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "csv": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "csv_searchsource": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "printable_pdf": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - }, - }, - }, - "printable_pdf": Object { - "app": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "available": Object { - "type": "boolean", - }, - "layout": Object { - "preserve_layout": Object { - "type": "long", - }, - "print": Object { - "type": "long", - }, - }, - "total": Object { - "type": "long", - }, - }, - "status": Object { - "cancelled": Object { - "type": "long", - }, - "completed": Object { - "type": "long", - }, - "completed_with_warnings": Object { - "type": "long", - }, - "failed": Object { - "type": "long", - }, - "pending": Object { - "type": "long", - }, - "processing": Object { - "type": "long", - }, - }, - "statuses": Object { - "cancelled": Object { - "PNG": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "csv": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "csv_searchsource": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "printable_pdf": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - }, - "completed": Object { - "PNG": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "csv": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "csv_searchsource": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "printable_pdf": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - }, - "completed_with_warnings": Object { - "PNG": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "csv": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "csv_searchsource": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "printable_pdf": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - }, - "failed": Object { - "PNG": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "csv": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "csv_searchsource": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "printable_pdf": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - }, - "pending": Object { - "PNG": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "csv": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "csv_searchsource": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "printable_pdf": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - }, - "processing": Object { - "PNG": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "csv": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "csv_searchsource": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - "printable_pdf": Object { - "canvas workpad": Object { - "type": "long", - }, - "dashboard": Object { - "type": "long", - }, - "visualization": Object { - "type": "long", - }, - }, - }, - }, - }, - "type": "reporting", - } - `); + expect(args).toMatchSnapshot(); await expect(args.isReady()).resolves.toBe(true); }); diff --git a/x-pack/plugins/reporting/server/usage/schema.ts b/x-pack/plugins/reporting/server/usage/schema.ts index 8528543b09e07..2060fdcb1f01e 100644 --- a/x-pack/plugins/reporting/server/usage/schema.ts +++ b/x-pack/plugins/reporting/server/usage/schema.ts @@ -6,7 +6,14 @@ */ import { MakeSchemaFrom } from 'src/plugins/usage_collection/server'; -import { AppCounts, AvailableTotal, JobTypes, RangeStats, ReportingUsageType } from './types'; +import { + AppCounts, + AvailableTotal, + ByAppCounts, + JobTypes, + RangeStats, + ReportingUsageType, +} from './types'; const appCountsSchema: MakeSchemaFrom = { 'canvas workpad': { type: 'long' }, @@ -14,7 +21,7 @@ const appCountsSchema: MakeSchemaFrom = { visualization: { type: 'long' }, }; -const byAppCountsSchema: MakeSchemaFrom = { +const byAppCountsSchema: MakeSchemaFrom = { csv: appCountsSchema, csv_searchsource: appCountsSchema, PNG: appCountsSchema, @@ -24,6 +31,7 @@ const byAppCountsSchema: MakeSchemaFrom = { const availableTotalSchema: MakeSchemaFrom = { available: { type: 'boolean' }, total: { type: 'long' }, + deprecated: { type: 'long' }, }; const jobTypesSchema: MakeSchemaFrom = { @@ -44,7 +52,6 @@ const rangeStatsSchema: MakeSchemaFrom = { ...jobTypesSchema, _all: { type: 'long' }, status: { - cancelled: { type: 'long' }, completed: { type: 'long' }, completed_with_warnings: { type: 'long' }, failed: { type: 'long' }, @@ -52,7 +59,6 @@ const rangeStatsSchema: MakeSchemaFrom = { processing: { type: 'long' }, }, statuses: { - cancelled: byAppCountsSchema, completed: byAppCountsSchema, completed_with_warnings: byAppCountsSchema, failed: byAppCountsSchema, diff --git a/x-pack/plugins/reporting/server/usage/types.ts b/x-pack/plugins/reporting/server/usage/types.ts index 58def60a24ccb..aae8c0ff42710 100644 --- a/x-pack/plugins/reporting/server/usage/types.ts +++ b/x-pack/plugins/reporting/server/usage/types.ts @@ -8,6 +8,9 @@ export interface KeyCountBucket { key: string; doc_count: number; + isDeprecated?: { + doc_count: number; + }; } export interface AggregationBuckets { @@ -57,9 +60,11 @@ export interface SearchResponse { export interface AvailableTotal { available: boolean; total: number; + deprecated?: number; } type BaseJobTypes = 'csv' | 'csv_searchsource' | 'PNG' | 'printable_pdf'; + export interface LayoutCounts { print: number; preserve_layout: number; @@ -77,20 +82,15 @@ export type JobTypes = { [K in BaseJobTypes]: AvailableTotal } & { }; }; -type Statuses = - | 'cancelled' - | 'completed' - | 'completed_with_warnings' - | 'failed' - | 'pending' - | 'processing'; +export type ByAppCounts = { [J in BaseJobTypes]?: AppCounts }; + +type Statuses = 'completed' | 'completed_with_warnings' | 'failed' | 'pending' | 'processing'; + type StatusCounts = { [S in Statuses]?: number; }; type StatusByAppCounts = { - [S in Statuses]?: { - [J in BaseJobTypes]?: AppCounts; - }; + [S in Statuses]?: ByAppCounts; }; export type RangeStats = JobTypes & { @@ -109,44 +109,6 @@ export type ReportingUsageType = RangeStats & { export type ExportType = 'csv' | 'csv_searchsource' | 'printable_pdf' | 'PNG'; export type FeatureAvailabilityMap = { [F in ExportType]: boolean }; -export interface KeyCountBucket { - key: string; - doc_count: number; -} - -export interface AggregationBuckets { - buckets: KeyCountBucket[]; -} - -export interface StatusByAppBucket { - key: string; - doc_count: number; - jobTypes: { - buckets: Array<{ - doc_count: number; - key: string; - appNames: AggregationBuckets; - }>; - }; -} - -export interface AggregationResultBuckets { - jobTypes: AggregationBuckets; - layoutTypes: { - doc_count: number; - pdf: AggregationBuckets; - }; - objectTypes: { - doc_count: number; - pdf: AggregationBuckets; - }; - statusTypes: AggregationBuckets; - statusByApp: { - buckets: StatusByAppBucket[]; - }; - doc_count: number; -} - export interface ReportingUsageSearchResponse { aggregations: { ranges: { diff --git a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json index bbe0ad8014ae7..ddb077efda9a0 100644 --- a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json +++ b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @@ -4044,6 +4044,9 @@ }, "total": { "type": "long" + }, + "deprecated": { + "type": "long" } } }, @@ -4054,6 +4057,9 @@ }, "total": { "type": "long" + }, + "deprecated": { + "type": "long" } } }, @@ -4064,6 +4070,9 @@ }, "total": { "type": "long" + }, + "deprecated": { + "type": "long" } } }, @@ -4075,6 +4084,9 @@ "total": { "type": "long" }, + "deprecated": { + "type": "long" + }, "app": { "properties": { "canvas workpad": { @@ -4105,9 +4117,6 @@ }, "status": { "properties": { - "cancelled": { - "type": "long" - }, "completed": { "type": "long" }, @@ -4127,62 +4136,6 @@ }, "statuses": { "properties": { - "cancelled": { - "properties": { - "csv": { - "properties": { - "canvas workpad": { - "type": "long" - }, - "dashboard": { - "type": "long" - }, - "visualization": { - "type": "long" - } - } - }, - "csv_searchsource": { - "properties": { - "canvas workpad": { - "type": "long" - }, - "dashboard": { - "type": "long" - }, - "visualization": { - "type": "long" - } - } - }, - "PNG": { - "properties": { - "canvas workpad": { - "type": "long" - }, - "dashboard": { - "type": "long" - }, - "visualization": { - "type": "long" - } - } - }, - "printable_pdf": { - "properties": { - "canvas workpad": { - "type": "long" - }, - "dashboard": { - "type": "long" - }, - "visualization": { - "type": "long" - } - } - } - } - }, "completed": { "properties": { "csv": { @@ -4483,6 +4436,9 @@ }, "total": { "type": "long" + }, + "deprecated": { + "type": "long" } } }, @@ -4493,6 +4449,9 @@ }, "total": { "type": "long" + }, + "deprecated": { + "type": "long" } } }, @@ -4503,6 +4462,9 @@ }, "total": { "type": "long" + }, + "deprecated": { + "type": "long" } } }, @@ -4514,6 +4476,9 @@ "total": { "type": "long" }, + "deprecated": { + "type": "long" + }, "app": { "properties": { "canvas workpad": { @@ -4544,9 +4509,6 @@ }, "status": { "properties": { - "cancelled": { - "type": "long" - }, "completed": { "type": "long" }, @@ -4566,62 +4528,6 @@ }, "statuses": { "properties": { - "cancelled": { - "properties": { - "csv": { - "properties": { - "canvas workpad": { - "type": "long" - }, - "dashboard": { - "type": "long" - }, - "visualization": { - "type": "long" - } - } - }, - "csv_searchsource": { - "properties": { - "canvas workpad": { - "type": "long" - }, - "dashboard": { - "type": "long" - }, - "visualization": { - "type": "long" - } - } - }, - "PNG": { - "properties": { - "canvas workpad": { - "type": "long" - }, - "dashboard": { - "type": "long" - }, - "visualization": { - "type": "long" - } - } - }, - "printable_pdf": { - "properties": { - "canvas workpad": { - "type": "long" - }, - "dashboard": { - "type": "long" - }, - "visualization": { - "type": "long" - } - } - } - } - }, "completed": { "properties": { "csv": { diff --git a/x-pack/test/reporting_api_integration/reporting_without_security/job_apis_csv_deprecated.ts b/x-pack/test/reporting_api_integration/reporting_without_security/job_apis_csv_deprecated.ts index 2d62725e23989..6ff8946d48c5b 100644 --- a/x-pack/test/reporting_api_integration/reporting_without_security/job_apis_csv_deprecated.ts +++ b/x-pack/test/reporting_api_integration/reporting_without_security/job_apis_csv_deprecated.ts @@ -59,7 +59,9 @@ export default function ({ getService }: FtrProviderContext) { "attempts": 0, "created_by": false, "jobtype": "csv", - "meta": Object {}, + "meta": Object { + "isDeprecated": true, + }, "payload": Object { "isDeprecated": true, "title": "A Saved Search With a DATE FILTER", @@ -101,7 +103,9 @@ export default function ({ getService }: FtrProviderContext) { "attempts": 0, "created_by": false, "jobtype": "csv", - "meta": Object {}, + "meta": Object { + "isDeprecated": true, + }, "payload": Object { "isDeprecated": true, "title": "A Saved Search With a DATE FILTER", @@ -136,7 +140,9 @@ export default function ({ getService }: FtrProviderContext) { "attempts": 0, "created_by": false, "jobtype": "csv", - "meta": Object {}, + "meta": Object { + "isDeprecated": true, + }, "payload": Object { "isDeprecated": true, "title": "A Saved Search With a DATE FILTER", @@ -168,7 +174,9 @@ export default function ({ getService }: FtrProviderContext) { "attempts": 0, "created_by": false, "jobtype": "csv", - "meta": Object {}, + "meta": Object { + "isDeprecated": true, + }, "payload": Object { "isDeprecated": true, "title": "A Saved Search With a DATE FILTER", From e18370a7c0527d2ec094835228499d90f61b4741 Mon Sep 17 00:00:00 2001 From: Marta Bondyra Date: Fri, 20 Aug 2021 09:45:19 +0200 Subject: [PATCH 23/44] fix dnd tests (#109271) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../functional/apps/lens/drag_and_drop.ts | 7 ++----- .../test/functional/page_objects/lens_page.ts | 19 +++++++++++++++---- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/x-pack/test/functional/apps/lens/drag_and_drop.ts b/x-pack/test/functional/apps/lens/drag_and_drop.ts index c8a0e171d5a79..e7b7ba18d62fb 100644 --- a/x-pack/test/functional/apps/lens/drag_and_drop.ts +++ b/x-pack/test/functional/apps/lens/drag_and_drop.ts @@ -8,9 +8,8 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; -export default function ({ getService, getPageObjects }: FtrProviderContext) { +export default function ({ getPageObjects }: FtrProviderContext) { const PageObjects = getPageObjects(['visualize', 'lens', 'common', 'header']); - const retry = getService('retry'); describe('lens drag and drop tests', () => { describe('basic drag and drop', () => { @@ -19,9 +18,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visualize.clickVisType('lens'); await PageObjects.lens.goToTimeRange(); await PageObjects.header.waitUntilLoadingHasFinished(); - await retry.try(async () => { - await PageObjects.lens.dragFieldToWorkspace('@timestamp'); - }); + await PageObjects.lens.dragFieldToWorkspace('@timestamp'); expect(await PageObjects.lens.getDimensionTriggerText('lnsXY_xDimensionPanel')).to.eql( '@timestamp' diff --git a/x-pack/test/functional/page_objects/lens_page.ts b/x-pack/test/functional/page_objects/lens_page.ts index 1acddd4641ff4..2e1151602f311 100644 --- a/x-pack/test/functional/page_objects/lens_page.ts +++ b/x-pack/test/functional/page_objects/lens_page.ts @@ -185,8 +185,10 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont * @param field - the desired field for the dimension * */ async dragFieldToWorkspace(field: string) { + const from = `lnsFieldListPanelField-${field}`; + await find.existsByCssSelector(from); await browser.html5DragAndDrop( - testSubjects.getCssSelector(`lnsFieldListPanelField-${field}`), + testSubjects.getCssSelector(from), testSubjects.getCssSelector('lnsWorkspace') ); await this.waitForLensDragDropToFinish(); @@ -199,8 +201,10 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont * @param field - the desired geo_point or geo_shape field * */ async dragFieldToGeoFieldWorkspace(field: string) { + const from = `lnsFieldListPanelField-${field}`; + await find.existsByCssSelector(from); await browser.html5DragAndDrop( - testSubjects.getCssSelector(`lnsFieldListPanelField-${field}`), + testSubjects.getCssSelector(from), testSubjects.getCssSelector('lnsGeoFieldWorkspace') ); await this.waitForLensDragDropToFinish(); @@ -262,7 +266,10 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont `[data-test-subj="lnsDragDrop_draggable-${fieldName}"] [data-test-subj="lnsDragDrop-keyboardHandler"]` ); await field.focus(); - await browser.pressKeys(browser.keys.ENTER); + await retry.try(async () => { + await browser.pressKeys(browser.keys.ENTER); + await testSubjects.exists('.lnsDragDrop-isDropTarget'); // checks if we're in dnd mode and there's any drop target active + }); for (let i = 0; i < steps; i++) { await browser.pressKeys(reverse ? browser.keys.LEFT : browser.keys.RIGHT); } @@ -335,8 +342,10 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont * @param dimension - the selector of the dimension being changed * */ async dragFieldToDimensionTrigger(field: string, dimension: string) { + const from = `lnsFieldListPanelField-${field}`; + await find.existsByCssSelector(from); await browser.html5DragAndDrop( - testSubjects.getCssSelector(`lnsFieldListPanelField-${field}`), + testSubjects.getCssSelector(from), testSubjects.getCssSelector(dimension) ); await this.waitForLensDragDropToFinish(); @@ -350,6 +359,7 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont * @param to - the selector of the dimension being dropped to * */ async dragDimensionToDimension(from: string, to: string) { + await find.existsByCssSelector(from); await browser.html5DragAndDrop( testSubjects.getCssSelector(from), testSubjects.getCssSelector(to) @@ -367,6 +377,7 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont async reorderDimensions(dimension: string, startIndex: number, endIndex: number) { const dragging = `[data-test-subj='${dimension}']:nth-of-type(${startIndex}) .lnsDragDrop`; const dropping = `[data-test-subj='${dimension}']:nth-of-type(${endIndex}) [data-test-subj='lnsDragDrop-reorderableDropLayer'`; + await find.existsByCssSelector(dragging); await browser.html5DragAndDrop(dragging, dropping); await this.waitForLensDragDropToFinish(); await PageObjects.header.waitUntilLoadingHasFinished(); From 4274a2bf68250e294f24467651345e2c5ce1c054 Mon Sep 17 00:00:00 2001 From: Pablo Machado Date: Fri, 20 Aug 2021 09:45:47 +0200 Subject: [PATCH 24/44] Preserve timeline data when navigating between tabs (#106716) --- .../timelines/store/timeline/helpers.ts | 1 + .../public/timelines/store/timeline/model.ts | 1 + .../public/store/t_grid/helpers.test.tsx | 30 +++++++++++++---- .../timelines/public/store/t_grid/helpers.ts | 32 +++++++++++-------- .../timelines/public/store/t_grid/model.ts | 1 + 5 files changed, 44 insertions(+), 21 deletions(-) diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/helpers.ts b/x-pack/plugins/security_solution/public/timelines/store/timeline/helpers.ts index 610c394614c32..7c07410a2789a 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/helpers.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/timeline/helpers.ts @@ -157,6 +157,7 @@ export const addTimelineToStore = ({ [id]: { ...timeline, isLoading: timelineById[id].isLoading, + initialized: timelineById[id].initialized, dateRange: timeline.status === TimelineStatus.immutable && timeline.timelineType === TimelineType.template diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/model.ts b/x-pack/plugins/security_solution/public/timelines/store/timeline/model.ts index 7a16b62cd45e6..a2d7e2300d171 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/model.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/timeline/model.ts @@ -72,6 +72,7 @@ export type TimelineModel = TGridModelForTimeline & { /** timeline is saving */ isSaving: boolean; version: string | null; + initialized?: boolean; }; export type SubsetTimelineModel = Readonly< diff --git a/x-pack/plugins/timelines/public/store/t_grid/helpers.test.tsx b/x-pack/plugins/timelines/public/store/t_grid/helpers.test.tsx index 0c492ad8f8a59..121e5bda78ed8 100644 --- a/x-pack/plugins/timelines/public/store/t_grid/helpers.test.tsx +++ b/x-pack/plugins/timelines/public/store/t_grid/helpers.test.tsx @@ -13,7 +13,7 @@ import { mockGlobalState } from '../../mock/global_state'; import { TGridModelSettings } from '.'; const id = 'foo'; -const timelineById = { +const defaultTimelineById = { ...mockGlobalState.timelineById, }; @@ -28,16 +28,32 @@ describe('setInitializeTgridSettings', () => { sort, // <-- override }; - expect(setInitializeTgridSettings({ id, timelineById, tGridSettingsProps })[id].sort).toEqual( - sort - ); + expect( + setInitializeTgridSettings({ id, timelineById: defaultTimelineById, tGridSettingsProps })[id] + .sort + ).toEqual(sort); }); test('it returns the default sort when tGridSettingsProps does NOT contain an override', () => { const tGridSettingsProps = { footerText: 'test' }; // <-- no `sort` override - expect(setInitializeTgridSettings({ id, timelineById, tGridSettingsProps })[id].sort).toEqual( - tGridDefaults.sort - ); + expect( + setInitializeTgridSettings({ id, timelineById: defaultTimelineById, tGridSettingsProps })[id] + .sort + ).toEqual(tGridDefaults.sort); + }); + + test('it doesn`t overwrite the timeline if it is initialized', () => { + const tGridSettingsProps = { title: 'testTitle' }; + + const timelineById = { + [id]: { + ...defaultTimelineById.test, + initialized: true, + }, + }; + + const result = setInitializeTgridSettings({ id, timelineById, tGridSettingsProps }); + expect(result).toBe(timelineById); }); }); diff --git a/x-pack/plugins/timelines/public/store/t_grid/helpers.ts b/x-pack/plugins/timelines/public/store/t_grid/helpers.ts index c7c015a283b75..730d127d16d98 100644 --- a/x-pack/plugins/timelines/public/store/t_grid/helpers.ts +++ b/x-pack/plugins/timelines/public/store/t_grid/helpers.ts @@ -160,20 +160,24 @@ export const setInitializeTgridSettings = ({ }: InitializeTgridParams): TimelineById => { const timeline = timelineById[id]; - return { - ...timelineById, - [id]: { - ...tGridDefaults, - ...timeline, - ...getTGridManageDefaults(id), - ...tGridSettingsProps, - ...(!timeline || (isEmpty(timeline.columns) && !isEmpty(tGridSettingsProps.defaultColumns)) - ? { columns: tGridSettingsProps.defaultColumns } - : {}), - sort: tGridSettingsProps.sort ?? tGridDefaults.sort, - loadingEventIds: tGridDefaults.loadingEventIds, - }, - }; + return !timeline?.initialized + ? { + ...timelineById, + [id]: { + ...tGridDefaults, + ...getTGridManageDefaults(id), + ...timeline, + ...tGridSettingsProps, + ...(!timeline || + (isEmpty(timeline.columns) && !isEmpty(tGridSettingsProps.defaultColumns)) + ? { columns: tGridSettingsProps.defaultColumns } + : {}), + sort: tGridSettingsProps.sort ?? tGridDefaults.sort, + loadingEventIds: tGridDefaults.loadingEventIds, + initialized: true, + }, + } + : timelineById; }; interface ApplyDeltaToTimelineColumnWidth { diff --git a/x-pack/plugins/timelines/public/store/t_grid/model.ts b/x-pack/plugins/timelines/public/store/t_grid/model.ts index 2c39e3739b691..0972189b38b30 100644 --- a/x-pack/plugins/timelines/public/store/t_grid/model.ts +++ b/x-pack/plugins/timelines/public/store/t_grid/model.ts @@ -82,6 +82,7 @@ export interface TGridModel extends TGridModelSettings { selectedEventIds: Record; savedObjectId: string | null; version: string | null; + initialized?: boolean; } export type TGridModelForTimeline = Pick< From cb868928a72b9fef31f1081b7abb146d2d1f7aed Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Fri, 20 Aug 2021 11:43:21 +0300 Subject: [PATCH 25/44] Move to vis types part 1 (#107535) * Move to vis types part 1 * Fix types * fix more types * Fix paths * Update readme file Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .github/CODEOWNERS | 6 ++--- .i18nrc.json | 6 ++--- docs/developer/plugin-list.asciidoc | 6 ++--- jest.config.js | 1 + src/dev/typescript/projects.ts | 1 + src/plugins/vis_type_pie/tsconfig.json | 24 ----------------- src/plugins/vis_type_vislib/tsconfig.json | 26 ------------------- src/plugins/vis_type_xy/tsconfig.json | 24 ----------------- src/plugins/vis_types/README.md | 19 ++++++++++++++ .../pie}/common/index.ts | 0 .../pie}/jest.config.js | 4 +-- .../pie}/kibana.json | 0 .../public/__snapshots__/pie_fn.test.ts.snap | 0 .../public/__snapshots__/to_ast.test.ts.snap | 0 .../pie}/public/chart.scss | 0 .../pie}/public/components/chart_split.tsx | 2 +- .../pie}/public/editor/collections.ts | 0 .../pie}/public/editor/components/index.tsx | 2 +- .../public/editor/components/pie.test.tsx | 2 +- .../pie}/public/editor/components/pie.tsx | 6 ++--- .../components/truncate_labels.test.tsx | 0 .../editor/components/truncate_labels.tsx | 0 .../pie}/public/editor/positions.ts | 0 .../public/expression_functions/pie_labels.ts | 2 +- .../pie}/public/index.ts | 0 .../pie}/public/mocks.ts | 2 +- .../pie}/public/pie_component.test.tsx | 4 +-- .../pie}/public/pie_component.tsx | 14 ++++++---- .../pie}/public/pie_fn.test.ts | 4 +-- .../pie}/public/pie_fn.ts | 4 +-- .../pie}/public/pie_renderer.tsx | 6 ++--- .../pie}/public/plugin.ts | 10 +++---- .../pie}/public/sample_vis.test.mocks.ts | 0 .../pie}/public/to_ast.test.ts | 2 +- .../pie}/public/to_ast.ts | 4 +-- .../pie}/public/to_ast_esaggs.ts | 6 ++--- .../pie}/public/types/index.ts | 0 .../pie}/public/types/types.ts | 6 ++--- .../pie}/public/utils/filter_helpers.test.ts | 2 +- .../pie}/public/utils/filter_helpers.ts | 10 +++---- .../public/utils/get_color_picker.test.tsx | 4 +-- .../pie}/public/utils/get_color_picker.tsx | 6 ++--- .../pie}/public/utils/get_columns.test.ts | 0 .../pie}/public/utils/get_columns.ts | 2 +- .../pie}/public/utils/get_config.ts | 0 .../public/utils/get_distinct_series.test.ts | 0 .../pie}/public/utils/get_distinct_series.ts | 2 +- .../pie}/public/utils/get_layers.test.ts | 6 ++--- .../pie}/public/utils/get_layers.ts | 6 ++--- .../pie}/public/utils/get_legend_actions.tsx | 4 +-- .../utils/get_split_dimension_accessor.ts | 4 +-- .../pie}/public/utils/index.ts | 0 .../pie}/public/vis_type/index.ts | 0 .../pie}/public/vis_type/pie.ts | 4 +-- .../pie}/server/index.ts | 0 .../pie}/server/plugin.ts | 0 src/plugins/vis_types/pie/tsconfig.json | 24 +++++++++++++++++ .../vislib}/common/index.ts | 0 .../vislib}/jest.config.js | 4 +-- .../vislib}/kibana.json | 0 .../public/__snapshots__/pie_fn.test.ts.snap | 0 .../public/__snapshots__/to_ast.test.ts.snap | 0 .../__snapshots__/to_ast_pie.test.ts.snap | 0 .../vislib}/public/area.ts | 4 +-- .../vislib}/public/editor/collections.ts | 4 +-- .../public/editor/components/gauge/index.tsx | 0 .../editor/components/gauge/labels_panel.tsx | 2 +- .../editor/components/gauge/ranges_panel.tsx | 4 +-- .../editor/components/gauge/style_panel.tsx | 4 +-- .../editor/components/heatmap/index.tsx | 4 +-- .../components/heatmap/labels_panel.tsx | 4 +-- .../public/editor/components/index.tsx | 0 .../vislib}/public/editor/index.ts | 0 .../dispatch_bar_chart_config_normal.json | 0 .../dispatch_bar_chart_config_percentage.json | 0 .../fixtures/dispatch_bar_chart_d3.json | 0 .../dispatch_bar_chart_data_point.json | 0 .../fixtures/dispatch_heatmap_config.json | 0 .../public/fixtures/dispatch_heatmap_d3.json | 0 .../fixtures/dispatch_heatmap_data_point.json | 0 .../mock_data/date_histogram/_columns.js | 0 .../mock_data/date_histogram/_rows.js | 0 .../date_histogram/_rows_series_with_holes.js | 0 .../mock_data/date_histogram/_series.js | 0 .../_series_monthly_interval.js | 0 .../mock_data/date_histogram/_series_neg.js | 0 .../date_histogram/_series_pos_neg.js | 0 .../date_histogram/_stacked_series.js | 0 .../fixtures/mock_data/filters/_columns.js | 0 .../fixtures/mock_data/filters/_rows.js | 0 .../fixtures/mock_data/filters/_series.js | 0 .../fixtures/mock_data/geohash/_columns.js | 0 .../fixtures/mock_data/geohash/_geo_json.js | 0 .../fixtures/mock_data/geohash/_rows.js | 0 .../fixtures/mock_data/histogram/_columns.js | 0 .../fixtures/mock_data/histogram/_rows.js | 0 .../fixtures/mock_data/histogram/_series.js | 0 .../fixtures/mock_data/histogram/_slices.js | 0 .../mock_data/not_enough_data/_one_point.js | 0 .../fixtures/mock_data/range/_columns.js | 0 .../public/fixtures/mock_data/range/_rows.js | 0 .../fixtures/mock_data/range/_series.js | 0 .../mock_data/significant_terms/_columns.js | 0 .../mock_data/significant_terms/_rows.js | 0 .../mock_data/significant_terms/_series.js | 0 .../fixtures/mock_data/stacked/_stacked.js | 0 .../fixtures/mock_data/terms/_columns.js | 0 .../public/fixtures/mock_data/terms/_rows.js | 0 .../fixtures/mock_data/terms/_series.js | 0 .../mock_data/terms/_series_multiple.js | 0 .../vislib}/public/fixtures/mocks.js | 0 .../vislib}/public/gauge.ts | 8 +++--- .../vislib}/public/goal.ts | 6 ++--- .../vislib}/public/heatmap.ts | 10 +++---- .../vislib}/public/histogram.ts | 4 +-- .../vislib}/public/horizontal_bar.ts | 4 +-- .../vislib}/public/index.scss | 0 .../vislib}/public/index.ts | 2 +- .../vislib}/public/line.ts | 4 +-- .../vislib}/public/pie.ts | 4 +-- .../vislib}/public/pie_fn.test.ts | 2 +- .../vislib}/public/pie_fn.ts | 2 +- .../vislib}/public/plugin.ts | 14 +++++----- .../vislib}/public/services.ts | 4 +-- .../vislib}/public/to_ast.test.ts | 10 +++---- .../vislib}/public/to_ast.ts | 10 +++---- .../vislib}/public/to_ast_esaggs.ts | 6 ++--- .../vislib}/public/to_ast_pie.test.ts | 10 +++---- .../vislib}/public/to_ast_pie.ts | 4 +-- .../vislib}/public/types.ts | 4 +-- .../vislib}/public/vis_controller.tsx | 8 +++--- .../vislib}/public/vis_renderer.tsx | 6 ++--- .../vislib}/public/vis_type_vislib_vis_fn.ts | 2 +- .../public/vis_type_vislib_vis_types.ts | 0 .../vislib}/public/vis_wrapper.tsx | 6 ++--- .../vislib}/public/vislib/VISLIB.md | 0 .../vislib}/public/vislib/_index.scss | 0 .../vislib}/public/vislib/_variables.scss | 0 .../public/vislib/_vislib_vis_type.scss | 0 .../vislib/components/labels/data_array.js | 0 .../components/labels/flatten_series.js | 0 .../public/vislib/components/labels/index.js | 0 .../public/vislib/components/labels/labels.js | 0 .../vislib/components/labels/labels.test.js | 0 .../components/labels/truncate_labels.js | 0 .../vislib/components/labels/uniq_labels.js | 0 .../legend/__snapshots__/legend.test.tsx.snap | 0 .../vislib/components/legend/_index.scss | 0 .../vislib/components/legend/_legend.scss | 0 .../public/vislib/components/legend/index.ts | 0 .../vislib/components/legend/legend.test.tsx | 0 .../vislib/components/legend/legend.tsx | 4 +-- .../vislib/components/legend/legend_item.tsx | 2 +- .../public/vislib/components/legend/models.ts | 0 .../vislib/components/legend/pie_utils.ts | 2 +- .../components/tooltip/_collect_branch.js | 0 .../tooltip/_collect_branch.test.js | 0 .../_hierarchical_tooltip_formatter.js | 0 .../vislib/components/tooltip/_index.scss | 0 .../tooltip/_pointseries_tooltip_formatter.js | 2 +- .../_pointseries_tooltip_formatter.test.js | 0 .../vislib/components/tooltip/_tooltip.scss | 0 .../public/vislib/components/tooltip/index.js | 0 .../components/tooltip/position_tooltip.js | 0 .../tooltip/position_tooltip.test.js | 0 .../vislib/components/tooltip/tooltip.js | 0 .../components/zero_injection/flatten_data.js | 0 .../components/zero_injection/inject_zeros.js | 0 .../zero_injection/ordered_x_keys.js | 0 .../components/zero_injection/uniq_keys.js | 0 .../zero_injection/zero_fill_data_array.js | 0 .../zero_injection/zero_filled_array.js | 0 .../zero_injection/zero_injection.test.js | 0 .../vislib}/public/vislib/errors.ts | 2 +- .../build_hierarchical_data.test.ts | 2 +- .../hierarchical/build_hierarchical_data.ts | 2 +- .../vislib}/public/vislib/helpers/index.ts | 0 .../helpers/point_series/_add_to_siri.test.ts | 2 +- .../helpers/point_series/_add_to_siri.ts | 4 +-- .../point_series/_fake_x_aspect.test.ts | 0 .../helpers/point_series/_fake_x_aspect.ts | 0 .../helpers/point_series/_get_aspects.test.ts | 2 +- .../helpers/point_series/_get_aspects.ts | 2 +- .../helpers/point_series/_get_point.test.ts | 2 +- .../vislib/helpers/point_series/_get_point.ts | 0 .../helpers/point_series/_get_series.test.ts | 0 .../helpers/point_series/_get_series.ts | 0 .../helpers/point_series/_init_x_axis.test.ts | 2 +- .../helpers/point_series/_init_x_axis.ts | 0 .../helpers/point_series/_init_y_axis.test.ts | 0 .../helpers/point_series/_init_y_axis.ts | 0 .../point_series/_ordered_date_axis.test.ts | 2 +- .../point_series/_ordered_date_axis.ts | 0 .../vislib/helpers/point_series/index.ts | 0 .../helpers/point_series/point_series.test.ts | 2 +- .../helpers/point_series/point_series.ts | 4 +-- .../dispatch_heatmap.test.js.snap | 0 .../vislib}/public/vislib/lib/_alerts.scss | 0 .../vislib}/public/vislib/lib/_data_label.js | 0 .../public/vislib/lib/_error_handler.js | 0 .../public/vislib/lib/_error_handler.test.js | 0 .../vislib}/public/vislib/lib/_index.scss | 0 .../vislib}/public/vislib/lib/alerts.js | 0 .../vislib}/public/vislib/lib/axis/axis.js | 0 .../public/vislib/lib/axis/axis.test.js | 0 .../public/vislib/lib/axis/axis_config.js | 0 .../public/vislib/lib/axis/axis_labels.js | 0 .../public/vislib/lib/axis/axis_scale.js | 0 .../public/vislib/lib/axis/axis_title.js | 0 .../public/vislib/lib/axis/axis_title.test.js | 0 .../vislib}/public/vislib/lib/axis/index.js | 0 .../public/vislib/lib/axis/scale_modes.js | 0 .../public/vislib/lib/axis/time_ticks.js | 0 .../public/vislib/lib/axis/time_ticks.test.js | 0 .../public/vislib/lib/axis/x_axis.test.js | 0 .../public/vislib/lib/axis/y_axis.test.js | 0 .../vislib}/public/vislib/lib/binder.ts | 0 .../vislib}/public/vislib/lib/chart_grid.js | 0 .../vislib}/public/vislib/lib/chart_title.js | 0 .../public/vislib/lib/chart_title.test.js | 0 .../vislib}/public/vislib/lib/data.js | 0 .../vislib}/public/vislib/lib/data.test.js | 0 .../vislib}/public/vislib/lib/dispatch.js | 0 .../public/vislib/lib/dispatch.test.js | 0 .../vislib/lib/dispatch_heatmap.test.js | 0 .../lib/dispatch_vertical_bar_chart.test.js | 0 .../vislib}/public/vislib/lib/handler.js | 2 +- .../vislib}/public/vislib/lib/handler.test.js | 0 .../public/vislib/lib/layout/_index.scss | 0 .../public/vislib/lib/layout/_layout.scss | 0 .../vislib}/public/vislib/lib/layout/index.js | 0 .../public/vislib/lib/layout/layout.js | 0 .../public/vislib/lib/layout/layout.test.js | 0 .../public/vislib/lib/layout/layout_types.js | 0 .../vislib/lib/layout/layout_types.test.js | 0 .../layout/splits/column_chart/chart_split.js | 0 .../splits/column_chart/chart_title_split.js | 0 .../layout/splits/column_chart/splits.test.js | 0 .../splits/column_chart/x_axis_split.js | 0 .../splits/column_chart/y_axis_split.js | 0 .../layout/splits/gauge_chart/chart_split.js | 0 .../splits/gauge_chart/chart_title_split.js | 0 .../layout/splits/gauge_chart/splits.test.js | 0 .../layout/splits/pie_chart/chart_split.js | 0 .../splits/pie_chart/chart_title_split.js | 0 .../vislib/lib/layout/types/column_layout.js | 0 .../lib/layout/types/column_layout.test.js | 0 .../vislib/lib/layout/types/gauge_layout.js | 0 .../vislib/lib/layout/types/pie_layout.js | 0 .../vislib}/public/vislib/lib/types/gauge.js | 0 .../vislib}/public/vislib/lib/types/index.js | 0 .../vislib}/public/vislib/lib/types/pie.js | 0 .../public/vislib/lib/types/point_series.js | 0 .../vislib/lib/types/point_series.test.js | 0 .../types/testdata_linechart_percentile.json | 0 ...data_linechart_percentile_float_value.json | 0 ...nechart_percentile_float_value_result.json | 0 .../testdata_linechart_percentile_result.json | 0 .../vislib}/public/vislib/lib/vis_config.js | 0 .../public/vislib/lib/vis_config.test.js | 0 .../vislib/partials/touchdown_template.tsx | 0 .../vislib/percentage_mode_transform.ts | 0 .../vislib}/public/vislib/response_handler.js | 0 .../public/vislib/response_handler.test.ts | 0 .../vislib}/public/vislib/types.ts | 0 .../vislib}/public/vislib/vis.js | 0 .../vislib}/public/vislib/vis.test.js | 0 .../public/vislib/visualizations/_chart.js | 0 .../vislib/visualizations/_vis_fixture.js | 4 +-- .../vislib/visualizations/chart.test.js | 0 .../vislib/visualizations/gauge_chart.js | 0 .../vislib/visualizations/gauge_chart.test.js | 0 .../vislib/visualizations/gauges/_index.scss | 0 .../vislib/visualizations/gauges/_meter.scss | 0 .../visualizations/gauges/gauge_types.js | 0 .../vislib/visualizations/gauges/meter.js | 4 +-- .../public/vislib/visualizations/pie_chart.js | 0 .../vislib/visualizations/pie_chart.test.js | 0 .../visualizations/pie_chart_mock_data.js | 0 .../vislib/visualizations/point_series.js | 0 .../visualizations/point_series/_index.scss | 0 .../visualizations/point_series/_labels.scss | 0 .../point_series/_point_series.js | 0 .../point_series/_point_series.test.js | 0 .../visualizations/point_series/area_chart.js | 0 .../point_series/area_chart.test.js | 0 .../point_series/column_chart.js | 0 .../point_series/column_chart.test.js | 0 .../point_series/heatmap_chart.js | 4 +-- .../point_series/heatmap_chart.test.js | 0 .../visualizations/point_series/line_chart.js | 0 .../point_series/line_chart.test.js | 0 .../point_series/series_types.js | 0 .../vislib/visualizations/time_marker.d.ts | 0 .../vislib/visualizations/time_marker.js | 0 .../vislib/visualizations/time_marker.test.js | 0 .../public/vislib/visualizations/vis_types.js | 0 .../vislib/visualizations/vis_types.test.js | 0 .../vislib}/server/index.ts | 0 .../vislib}/server/plugin.ts | 0 .../vislib}/server/ui_settings.ts | 0 src/plugins/vis_types/vislib/tsconfig.json | 26 +++++++++++++++++++ .../xy}/common/index.ts | 0 .../xy}/jest.config.js | 4 +-- .../{vis_type_xy => vis_types/xy}/kibana.json | 0 .../public/__snapshots__/to_ast.test.ts.snap | 0 .../xy}/public/_chart.scss | 0 .../xy}/public/chart_splitter.tsx | 0 .../public/components/_detailed_tooltip.scss | 0 .../components/detailed_tooltip.mock.ts | 0 .../components/detailed_tooltip.test.tsx | 0 .../public/components/detailed_tooltip.tsx | 0 .../xy}/public/components/index.ts | 0 .../xy}/public/components/xy_axis.tsx | 0 .../xy}/public/components/xy_current_time.tsx | 2 +- .../xy}/public/components/xy_endzones.tsx | 2 +- .../xy}/public/components/xy_settings.tsx | 2 +- .../public/components/xy_threshold_line.tsx | 0 .../xy}/public/config/get_agg_id.ts | 0 .../xy}/public/config/get_aspects.ts | 2 +- .../xy}/public/config/get_axis.ts | 4 +-- .../xy}/public/config/get_config.ts | 6 ++--- .../xy}/public/config/get_legend.ts | 0 .../xy}/public/config/get_rotation.ts | 0 .../xy}/public/config/get_threshold_line.ts | 0 .../xy}/public/config/get_tooltip.ts | 0 .../xy}/public/config/index.ts | 0 .../xy}/public/editor/collections.ts | 2 +- .../xy}/public/editor/common_config.tsx | 2 +- .../public/editor/components/common/index.ts | 0 .../common/truncate_labels.test.tsx | 0 .../components/common/truncate_labels.tsx | 0 .../components/common/validation_wrapper.tsx | 2 +- .../xy}/public/editor/components/index.ts | 0 .../editor/components/options/index.tsx | 0 .../category_axis_panel.test.tsx.snap | 0 .../__snapshots__/chart_options.test.tsx.snap | 0 .../custom_extents_options.test.tsx.snap | 0 .../__snapshots__/index.test.tsx.snap | 0 .../__snapshots__/label_options.test.tsx.snap | 0 .../__snapshots__/line_options.test.tsx.snap | 0 .../__snapshots__/point_options.test.tsx.snap | 0 .../value_axes_panel.test.tsx.snap | 0 .../value_axis_options.test.tsx.snap | 0 .../__snapshots__/y_extents.test.tsx.snap | 0 .../metrics_axes/category_axis_panel.test.tsx | 0 .../metrics_axes/category_axis_panel.tsx | 2 +- .../metrics_axes/chart_options.test.tsx | 0 .../options/metrics_axes/chart_options.tsx | 2 +- .../custom_extents_options.test.tsx | 0 .../metrics_axes/custom_extents_options.tsx | 2 +- .../options/metrics_axes/index.test.tsx | 0 .../components/options/metrics_axes/index.tsx | 2 +- .../metrics_axes/label_options.test.tsx | 0 .../options/metrics_axes/label_options.tsx | 4 +-- .../metrics_axes/line_options.test.tsx | 2 +- .../options/metrics_axes/line_options.tsx | 2 +- .../components/options/metrics_axes/mocks.ts | 4 +-- .../metrics_axes/point_options.test.tsx | 0 .../options/metrics_axes/point_options.tsx | 2 +- .../options/metrics_axes/series_panel.tsx | 2 +- .../components/options/metrics_axes/utils.ts | 0 .../metrics_axes/value_axes_panel.test.tsx | 0 .../options/metrics_axes/value_axes_panel.tsx | 0 .../metrics_axes/value_axis_options.test.tsx | 2 +- .../metrics_axes/value_axis_options.tsx | 2 +- .../options/metrics_axes/y_extents.test.tsx | 2 +- .../options/metrics_axes/y_extents.tsx | 2 +- .../point_series/elastic_charts_options.tsx | 4 +-- .../options/point_series/grid_panel.tsx | 2 +- .../components/options/point_series/index.ts | 0 .../point_series/point_series.mocks.ts | 0 .../point_series/point_series.test.tsx | 0 .../options/point_series/point_series.tsx | 4 +-- .../options/point_series/threshold_panel.tsx | 2 +- .../xy}/public/editor/index.ts | 0 .../xy}/public/editor/positions.ts | 0 .../xy}/public/editor/scale_types.ts | 0 .../expression_functions/category_axis.ts | 2 +- .../xy}/public/expression_functions/index.ts | 0 .../xy}/public/expression_functions/label.ts | 4 +-- .../expression_functions/series_param.ts | 2 +- .../expression_functions/threshold_line.ts | 2 +- .../expression_functions/time_marker.ts | 2 +- .../public/expression_functions/value_axis.ts | 2 +- .../public/expression_functions/vis_scale.ts | 2 +- .../public/expression_functions/xy_vis_fn.ts | 8 ++++-- .../xy}/public/index.ts | 0 .../xy}/public/plugin.ts | 12 ++++----- .../xy}/public/sample_vis.test.mocks.ts | 0 .../xy}/public/services.ts | 8 +++--- .../xy}/public/to_ast.test.ts | 8 +++--- .../xy}/public/to_ast.ts | 10 +++---- .../xy}/public/to_ast_esaggs.ts | 6 ++--- .../xy}/public/types/config.ts | 0 .../xy}/public/types/constants.ts | 0 .../xy}/public/types/index.ts | 0 .../xy}/public/types/param.ts | 4 +-- .../xy}/public/types/vis_type.ts | 2 +- .../xy}/public/utils/accessors.test.ts | 2 +- .../xy}/public/utils/accessors.tsx | 4 +-- .../xy}/public/utils/domain.ts | 6 ++--- .../xy}/public/utils/get_all_series.test.ts | 0 .../xy}/public/utils/get_all_series.ts | 2 +- .../public/utils/get_color_picker.test.tsx | 4 +-- .../xy}/public/utils/get_color_picker.tsx | 4 +-- .../xy}/public/utils/get_legend_actions.tsx | 2 +- .../public/utils/get_series_name_fn.test.ts | 0 .../xy}/public/utils/get_series_name_fn.ts | 0 .../xy}/public/utils/get_time_zone.tsx | 0 .../xy}/public/utils/index.tsx | 0 .../utils/render_all_series.test.mocks.ts | 0 .../public/utils/render_all_series.test.tsx | 2 +- .../xy}/public/utils/render_all_series.tsx | 4 +-- .../xy}/public/vis_component.tsx | 8 +++--- .../xy}/public/vis_renderer.tsx | 6 ++--- .../xy}/public/vis_types/area.ts | 6 ++--- .../xy}/public/vis_types/histogram.ts | 6 ++--- .../xy}/public/vis_types/horizontal_bar.ts | 6 ++--- .../xy}/public/vis_types/index.ts | 0 .../xy}/public/vis_types/line.ts | 6 ++--- .../xy}/server/index.ts | 0 .../xy}/server/plugin.ts | 0 src/plugins/vis_types/xy/tsconfig.json | 24 +++++++++++++++++ .../ml/public/application/util/chart_utils.js | 2 +- 425 files changed, 387 insertions(+), 358 deletions(-) delete mode 100644 src/plugins/vis_type_pie/tsconfig.json delete mode 100644 src/plugins/vis_type_vislib/tsconfig.json delete mode 100644 src/plugins/vis_type_xy/tsconfig.json create mode 100644 src/plugins/vis_types/README.md rename src/plugins/{vis_type_pie => vis_types/pie}/common/index.ts (100%) rename src/plugins/{vis_type_xy => vis_types/pie}/jest.config.js (84%) rename src/plugins/{vis_type_pie => vis_types/pie}/kibana.json (100%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/__snapshots__/pie_fn.test.ts.snap (100%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/__snapshots__/to_ast.test.ts.snap (100%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/chart.scss (100%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/components/chart_split.tsx (96%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/editor/collections.ts (100%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/editor/components/index.tsx (91%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/editor/components/pie.test.tsx (98%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/editor/components/pie.tsx (98%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/editor/components/truncate_labels.test.tsx (100%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/editor/components/truncate_labels.tsx (100%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/editor/positions.ts (100%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/expression_functions/pie_labels.ts (98%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/index.ts (100%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/mocks.ts (99%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/pie_component.test.tsx (97%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/pie_component.tsx (96%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/pie_fn.test.ts (90%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/pie_fn.ts (98%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/pie_renderer.tsx (90%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/plugin.ts (87%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/sample_vis.test.mocks.ts (100%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/to_ast.test.ts (94%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/to_ast.ts (97%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/to_ast_esaggs.ts (90%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/types/index.ts (100%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/types/types.ts (92%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/utils/filter_helpers.test.ts (97%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/utils/filter_helpers.ts (88%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/utils/get_color_picker.test.tsx (96%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/utils/get_color_picker.tsx (94%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/utils/get_columns.test.ts (100%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/utils/get_columns.ts (94%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/utils/get_config.ts (100%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/utils/get_distinct_series.test.ts (100%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/utils/get_distinct_series.ts (94%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/utils/get_layers.test.ts (95%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/utils/get_layers.ts (97%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/utils/get_legend_actions.tsx (96%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/utils/get_split_dimension_accessor.ts (87%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/utils/index.ts (100%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/vis_type/index.ts (100%) rename src/plugins/{vis_type_pie => vis_types/pie}/public/vis_type/pie.ts (97%) rename src/plugins/{vis_type_pie => vis_types/pie}/server/index.ts (100%) rename src/plugins/{vis_type_pie => vis_types/pie}/server/plugin.ts (100%) create mode 100644 src/plugins/vis_types/pie/tsconfig.json rename src/plugins/{vis_type_vislib => vis_types/vislib}/common/index.ts (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/jest.config.js (83%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/kibana.json (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/__snapshots__/pie_fn.test.ts.snap (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/__snapshots__/to_ast.test.ts.snap (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/__snapshots__/to_ast_pie.test.ts.snap (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/area.ts (82%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/editor/collections.ts (92%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/editor/components/gauge/index.tsx (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/editor/components/gauge/labels_panel.tsx (96%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/editor/components/gauge/ranges_panel.tsx (97%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/editor/components/gauge/style_panel.tsx (93%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/editor/components/heatmap/index.tsx (98%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/editor/components/heatmap/labels_panel.tsx (96%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/editor/components/index.tsx (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/editor/index.ts (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/dispatch_bar_chart_config_normal.json (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/dispatch_bar_chart_config_percentage.json (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/dispatch_bar_chart_d3.json (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/dispatch_bar_chart_data_point.json (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/dispatch_heatmap_config.json (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/dispatch_heatmap_d3.json (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/dispatch_heatmap_data_point.json (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/date_histogram/_columns.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/date_histogram/_rows.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/date_histogram/_rows_series_with_holes.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/date_histogram/_series.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/date_histogram/_series_monthly_interval.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/date_histogram/_series_neg.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/date_histogram/_series_pos_neg.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/date_histogram/_stacked_series.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/filters/_columns.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/filters/_rows.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/filters/_series.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/geohash/_columns.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/geohash/_geo_json.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/geohash/_rows.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/histogram/_columns.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/histogram/_rows.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/histogram/_series.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/histogram/_slices.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/not_enough_data/_one_point.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/range/_columns.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/range/_rows.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/range/_series.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/significant_terms/_columns.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/significant_terms/_rows.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/significant_terms/_series.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/stacked/_stacked.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/terms/_columns.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/terms/_rows.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/terms/_series.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mock_data/terms/_series_multiple.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/fixtures/mocks.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/gauge.ts (93%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/goal.ts (93%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/heatmap.ts (91%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/histogram.ts (82%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/horizontal_bar.ts (83%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/index.scss (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/index.ts (89%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/line.ts (82%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/pie.ts (86%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/pie_fn.test.ts (95%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/pie_fn.ts (98%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/plugin.ts (83%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/services.ts (82%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/to_ast.test.ts (78%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/to_ast.ts (94%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/to_ast_esaggs.ts (91%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/to_ast_pie.test.ts (78%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/to_ast_pie.ts (91%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/types.ts (95%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vis_controller.tsx (94%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vis_renderer.tsx (89%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vis_type_vislib_vis_fn.ts (98%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vis_type_vislib_vis_types.ts (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vis_wrapper.tsx (92%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/VISLIB.md (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/_index.scss (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/_variables.scss (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/_vislib_vis_type.scss (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/labels/data_array.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/labels/flatten_series.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/labels/index.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/labels/labels.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/labels/labels.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/labels/truncate_labels.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/labels/uniq_labels.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/legend/__snapshots__/legend.test.tsx.snap (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/legend/_index.scss (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/legend/_legend.scss (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/legend/index.ts (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/legend/legend.test.tsx (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/legend/legend.tsx (98%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/legend/legend_item.tsx (98%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/legend/models.ts (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/legend/pie_utils.ts (97%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/tooltip/_collect_branch.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/tooltip/_collect_branch.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/tooltip/_hierarchical_tooltip_formatter.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/tooltip/_index.scss (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/tooltip/_pointseries_tooltip_formatter.js (97%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/tooltip/_pointseries_tooltip_formatter.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/tooltip/_tooltip.scss (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/tooltip/index.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/tooltip/position_tooltip.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/tooltip/position_tooltip.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/tooltip/tooltip.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/zero_injection/flatten_data.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/zero_injection/inject_zeros.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/zero_injection/ordered_x_keys.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/zero_injection/uniq_keys.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/zero_injection/zero_fill_data_array.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/zero_injection/zero_filled_array.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/components/zero_injection/zero_injection.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/errors.ts (95%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/helpers/hierarchical/build_hierarchical_data.test.ts (99%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/helpers/hierarchical/build_hierarchical_data.ts (97%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/helpers/index.ts (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/helpers/point_series/_add_to_siri.test.ts (97%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/helpers/point_series/_add_to_siri.ts (89%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/helpers/point_series/_fake_x_aspect.test.ts (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/helpers/point_series/_fake_x_aspect.ts (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/helpers/point_series/_get_aspects.test.ts (96%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/helpers/point_series/_get_aspects.ts (95%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/helpers/point_series/_get_point.test.ts (97%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/helpers/point_series/_get_point.ts (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/helpers/point_series/_get_series.test.ts (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/helpers/point_series/_get_series.ts (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/helpers/point_series/_init_x_axis.test.ts (99%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/helpers/point_series/_init_x_axis.ts (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/helpers/point_series/_init_y_axis.test.ts (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/helpers/point_series/_init_y_axis.ts (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/helpers/point_series/_ordered_date_axis.test.ts (95%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/helpers/point_series/_ordered_date_axis.ts (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/helpers/point_series/index.ts (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/helpers/point_series/point_series.test.ts (98%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/helpers/point_series/point_series.ts (95%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/__snapshots__/dispatch_heatmap.test.js.snap (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/_alerts.scss (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/_data_label.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/_error_handler.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/_error_handler.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/_index.scss (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/alerts.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/axis/axis.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/axis/axis.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/axis/axis_config.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/axis/axis_labels.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/axis/axis_scale.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/axis/axis_title.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/axis/axis_title.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/axis/index.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/axis/scale_modes.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/axis/time_ticks.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/axis/time_ticks.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/axis/x_axis.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/axis/y_axis.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/binder.ts (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/chart_grid.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/chart_title.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/chart_title.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/data.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/data.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/dispatch.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/dispatch.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/dispatch_heatmap.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/dispatch_vertical_bar_chart.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/handler.js (98%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/handler.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/layout/_index.scss (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/layout/_layout.scss (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/layout/index.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/layout/layout.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/layout/layout.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/layout/layout_types.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/layout/layout_types.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/layout/splits/column_chart/chart_split.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/layout/splits/column_chart/chart_title_split.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/layout/splits/column_chart/splits.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/layout/splits/column_chart/x_axis_split.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/layout/splits/column_chart/y_axis_split.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/layout/splits/gauge_chart/chart_split.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/layout/splits/gauge_chart/chart_title_split.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/layout/splits/gauge_chart/splits.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/layout/splits/pie_chart/chart_split.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/layout/splits/pie_chart/chart_title_split.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/layout/types/column_layout.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/layout/types/column_layout.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/layout/types/gauge_layout.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/layout/types/pie_layout.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/types/gauge.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/types/index.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/types/pie.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/types/point_series.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/types/point_series.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/types/testdata_linechart_percentile.json (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/types/testdata_linechart_percentile_float_value.json (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/types/testdata_linechart_percentile_float_value_result.json (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/types/testdata_linechart_percentile_result.json (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/vis_config.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/lib/vis_config.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/partials/touchdown_template.tsx (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/percentage_mode_transform.ts (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/response_handler.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/response_handler.test.ts (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/types.ts (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/vis.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/vis.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/_chart.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/_vis_fixture.js (91%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/chart.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/gauge_chart.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/gauge_chart.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/gauges/_index.scss (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/gauges/_meter.scss (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/gauges/gauge_types.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/gauges/meter.js (98%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/pie_chart.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/pie_chart.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/pie_chart_mock_data.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/point_series.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/point_series/_index.scss (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/point_series/_labels.scss (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/point_series/_point_series.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/point_series/_point_series.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/point_series/area_chart.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/point_series/area_chart.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/point_series/column_chart.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/point_series/column_chart.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/point_series/heatmap_chart.js (98%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/point_series/heatmap_chart.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/point_series/line_chart.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/point_series/line_chart.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/point_series/series_types.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/time_marker.d.ts (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/time_marker.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/time_marker.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/vis_types.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/public/vislib/visualizations/vis_types.test.js (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/server/index.ts (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/server/plugin.ts (100%) rename src/plugins/{vis_type_vislib => vis_types/vislib}/server/ui_settings.ts (100%) create mode 100644 src/plugins/vis_types/vislib/tsconfig.json rename src/plugins/{vis_type_xy => vis_types/xy}/common/index.ts (100%) rename src/plugins/{vis_type_pie => vis_types/xy}/jest.config.js (84%) rename src/plugins/{vis_type_xy => vis_types/xy}/kibana.json (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/__snapshots__/to_ast.test.ts.snap (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/_chart.scss (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/chart_splitter.tsx (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/components/_detailed_tooltip.scss (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/components/detailed_tooltip.mock.ts (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/components/detailed_tooltip.test.tsx (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/components/detailed_tooltip.tsx (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/components/index.ts (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/components/xy_axis.tsx (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/components/xy_current_time.tsx (93%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/components/xy_endzones.tsx (96%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/components/xy_settings.tsx (98%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/components/xy_threshold_line.tsx (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/config/get_agg_id.ts (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/config/get_aspects.ts (97%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/config/get_axis.ts (97%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/config/get_config.ts (94%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/config/get_legend.ts (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/config/get_rotation.ts (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/config/get_threshold_line.ts (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/config/get_tooltip.ts (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/config/index.ts (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/collections.ts (98%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/common_config.tsx (94%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/common/index.ts (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/common/truncate_labels.test.tsx (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/common/truncate_labels.tsx (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/common/validation_wrapper.tsx (94%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/index.ts (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/index.tsx (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/__snapshots__/category_axis_panel.test.tsx.snap (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/__snapshots__/chart_options.test.tsx.snap (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/__snapshots__/custom_extents_options.test.tsx.snap (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/__snapshots__/index.test.tsx.snap (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/__snapshots__/label_options.test.tsx.snap (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/__snapshots__/line_options.test.tsx.snap (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/__snapshots__/point_options.test.tsx.snap (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/__snapshots__/value_axes_panel.test.tsx.snap (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/__snapshots__/value_axis_options.test.tsx.snap (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/__snapshots__/y_extents.test.tsx.snap (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/category_axis_panel.test.tsx (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/category_axis_panel.tsx (96%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/chart_options.test.tsx (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/chart_options.tsx (98%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/custom_extents_options.test.tsx (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/custom_extents_options.tsx (99%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/index.test.tsx (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/index.tsx (99%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/label_options.test.tsx (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/label_options.tsx (94%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/line_options.test.tsx (95%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/line_options.tsx (97%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/mocks.ts (93%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/point_options.test.tsx (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/point_options.tsx (95%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/series_panel.tsx (96%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/utils.ts (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/value_axes_panel.test.tsx (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/value_axes_panel.tsx (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/value_axis_options.test.tsx (97%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/value_axis_options.tsx (99%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/y_extents.test.tsx (97%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/metrics_axes/y_extents.tsx (97%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/point_series/elastic_charts_options.tsx (97%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/point_series/grid_panel.tsx (97%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/point_series/index.ts (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/point_series/point_series.mocks.ts (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/point_series/point_series.test.tsx (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/point_series/point_series.tsx (97%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/components/options/point_series/threshold_panel.tsx (98%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/index.ts (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/positions.ts (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/editor/scale_types.ts (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/expression_functions/category_axis.ts (98%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/expression_functions/index.ts (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/expression_functions/label.ts (96%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/expression_functions/series_param.ts (98%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/expression_functions/threshold_line.ts (98%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/expression_functions/time_marker.ts (98%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/expression_functions/value_axis.ts (98%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/expression_functions/vis_scale.ts (98%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/expression_functions/xy_vis_fn.ts (98%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/index.ts (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/plugin.ts (89%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/sample_vis.test.mocks.ts (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/services.ts (83%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/to_ast.test.ts (83%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/to_ast.ts (97%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/to_ast_esaggs.ts (91%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/types/config.ts (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/types/constants.ts (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/types/index.ts (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/types/param.ts (97%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/types/vis_type.ts (88%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/utils/accessors.test.ts (98%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/utils/accessors.tsx (94%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/utils/domain.ts (90%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/utils/get_all_series.test.ts (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/utils/get_all_series.ts (95%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/utils/get_color_picker.test.tsx (96%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/utils/get_color_picker.tsx (95%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/utils/get_legend_actions.tsx (98%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/utils/get_series_name_fn.test.ts (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/utils/get_series_name_fn.ts (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/utils/get_time_zone.tsx (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/utils/index.tsx (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/utils/render_all_series.test.mocks.ts (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/utils/render_all_series.test.tsx (98%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/utils/render_all_series.tsx (98%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/vis_component.tsx (98%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/vis_renderer.tsx (89%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/vis_types/area.ts (95%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/vis_types/histogram.ts (96%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/vis_types/horizontal_bar.ts (96%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/vis_types/index.ts (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/public/vis_types/line.ts (95%) rename src/plugins/{vis_type_xy => vis_types/xy}/server/index.ts (100%) rename src/plugins/{vis_type_xy => vis_types/xy}/server/plugin.ts (100%) create mode 100644 src/plugins/vis_types/xy/tsconfig.json diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b47c3b09cce30..d08676c5070b4 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -29,9 +29,9 @@ /src/plugins/vis_type_timelion/ @elastic/kibana-app /src/plugins/vis_type_timeseries/ @elastic/kibana-app /src/plugins/vis_type_vega/ @elastic/kibana-app -/src/plugins/vis_type_vislib/ @elastic/kibana-app -/src/plugins/vis_type_xy/ @elastic/kibana-app -/src/plugins/vis_type_pie/ @elastic/kibana-app +/src/plugins/vis_types/vislib/ @elastic/kibana-app +/src/plugins/vis_types/xy/ @elastic/kibana-app +/src/plugins/vis_types/pie/ @elastic/kibana-app /src/plugins/visualize/ @elastic/kibana-app /src/plugins/visualizations/ @elastic/kibana-app /src/plugins/url_forwarding/ @elastic/kibana-app diff --git a/.i18nrc.json b/.i18nrc.json index d19226e6b6f8c..2670e0554a0d9 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -63,9 +63,9 @@ "visTypeTagCloud": "src/plugins/vis_type_tagcloud", "visTypeTimeseries": "src/plugins/vis_type_timeseries", "visTypeVega": "src/plugins/vis_type_vega", - "visTypeVislib": "src/plugins/vis_type_vislib", - "visTypeXy": "src/plugins/vis_type_xy", - "visTypePie": "src/plugins/vis_type_pie", + "visTypeVislib": "src/plugins/vis_types/vislib", + "visTypeXy": "src/plugins/vis_types/xy", + "visTypePie": "src/plugins/vis_types/pie", "visualizations": "src/plugins/visualizations", "visualize": "src/plugins/visualize", "apmOss": "src/plugins/apm_oss", diff --git a/docs/developer/plugin-list.asciidoc b/docs/developer/plugin-list.asciidoc index 6431d85ac1a51..3879a54a99470 100644 --- a/docs/developer/plugin-list.asciidoc +++ b/docs/developer/plugin-list.asciidoc @@ -290,7 +290,7 @@ The plugin exposes the static DefaultEditorController class to consume. |WARNING: Missing README. -|{kib-repo}blob/{branch}/src/plugins/vis_type_pie[visTypePie] +|{kib-repo}blob/{branch}/src/plugins/vis_types/pie[visTypePie] |WARNING: Missing README. @@ -314,11 +314,11 @@ The plugin exposes the static DefaultEditorController class to consume. |WARNING: Missing README. -|{kib-repo}blob/{branch}/src/plugins/vis_type_vislib[visTypeVislib] +|{kib-repo}blob/{branch}/src/plugins/vis_types/vislib[visTypeVislib] |WARNING: Missing README. -|{kib-repo}blob/{branch}/src/plugins/vis_type_xy[visTypeXy] +|{kib-repo}blob/{branch}/src/plugins/vis_types/xy[visTypeXy] |WARNING: Missing README. diff --git a/jest.config.js b/jest.config.js index bd1e865a7e64a..6cb23b279925e 100644 --- a/jest.config.js +++ b/jest.config.js @@ -13,6 +13,7 @@ module.exports = { '/packages/*/jest.config.js', '/src/*/jest.config.js', '/src/plugins/*/jest.config.js', + '/src/plugins/vis_types/*/jest.config.js', '/test/*/jest.config.js', '/x-pack/plugins/*/jest.config.js', ], diff --git a/src/dev/typescript/projects.ts b/src/dev/typescript/projects.ts index 0244cb2cd9115..58234be1317a7 100644 --- a/src/dev/typescript/projects.ts +++ b/src/dev/typescript/projects.ts @@ -70,6 +70,7 @@ export const PROJECTS = [ ...findProjects('packages/*/tsconfig.json'), ...findProjects('src/plugins/*/tsconfig.json'), + ...findProjects('src/plugins/vis_types/*/tsconfig.json'), ...findProjects('x-pack/plugins/*/tsconfig.json'), ...findProjects('examples/*/tsconfig.json'), ...findProjects('x-pack/examples/*/tsconfig.json'), diff --git a/src/plugins/vis_type_pie/tsconfig.json b/src/plugins/vis_type_pie/tsconfig.json deleted file mode 100644 index 9640447b35d98..0000000000000 --- a/src/plugins/vis_type_pie/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "extends": "../../../tsconfig.base.json", - "compilerOptions": { - "outDir": "./target/types", - "emitDeclarationOnly": true, - "declaration": true, - "declarationMap": true - }, - "include": [ - "common/**/*", - "public/**/*", - "server/**/*" - ], - "references": [ - { "path": "../../core/tsconfig.json" }, - { "path": "../charts/tsconfig.json" }, - { "path": "../data/tsconfig.json" }, - { "path": "../expressions/tsconfig.json" }, - { "path": "../visualizations/tsconfig.json" }, - { "path": "../usage_collection/tsconfig.json" }, - { "path": "../vis_default_editor/tsconfig.json" }, - { "path": "../field_formats/tsconfig.json" } - ] -} diff --git a/src/plugins/vis_type_vislib/tsconfig.json b/src/plugins/vis_type_vislib/tsconfig.json deleted file mode 100644 index 0d2a4094f04be..0000000000000 --- a/src/plugins/vis_type_vislib/tsconfig.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "extends": "../../../tsconfig.base.json", - "compilerOptions": { - "outDir": "./target/types", - "emitDeclarationOnly": true, - "declaration": true, - "declarationMap": true - }, - "include": [ - "common/**/*", - "public/**/*", - "server/**/*" - ], - "references": [ - { "path": "../../core/tsconfig.json" }, - { "path": "../charts/tsconfig.json" }, - { "path": "../data/tsconfig.json" }, - { "path": "../expressions/tsconfig.json" }, - { "path": "../visualizations/tsconfig.json" }, - { "path": "../kibana_legacy/tsconfig.json" }, - { "path": "../kibana_utils/tsconfig.json" }, - { "path": "../vis_default_editor/tsconfig.json" }, - { "path": "../vis_type_xy/tsconfig.json" }, - { "path": "../vis_type_pie/tsconfig.json" }, - ] -} diff --git a/src/plugins/vis_type_xy/tsconfig.json b/src/plugins/vis_type_xy/tsconfig.json deleted file mode 100644 index 0e4e41c286bd2..0000000000000 --- a/src/plugins/vis_type_xy/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "extends": "../../../tsconfig.base.json", - "compilerOptions": { - "outDir": "./target/types", - "emitDeclarationOnly": true, - "declaration": true, - "declarationMap": true - }, - "include": [ - "common/**/*", - "public/**/*", - "server/**/*" - ], - "references": [ - { "path": "../../core/tsconfig.json" }, - { "path": "../charts/tsconfig.json" }, - { "path": "../data/tsconfig.json" }, - { "path": "../expressions/tsconfig.json" }, - { "path": "../visualizations/tsconfig.json" }, - { "path": "../usage_collection/tsconfig.json" }, - { "path": "../kibana_utils/tsconfig.json" }, - { "path": "../vis_default_editor/tsconfig.json" }, - ] -} diff --git a/src/plugins/vis_types/README.md b/src/plugins/vis_types/README.md new file mode 100644 index 0000000000000..db3d426d4bb48 --- /dev/null +++ b/src/plugins/vis_types/README.md @@ -0,0 +1,19 @@ +# Vis types + +This folder contains all the legacy visualizations plugins. The legacy visualizations are: +- TSVB +- Vega +- All the aggregation-based visualizations + +The structure is: +``` + └ vis_types (just a folder) + + └ pie (previous vis_type_pie) + + └ tagcloud (previous vis_type_tagcloud) + + └ ... +``` + + If their renderer/expression is not shared with any other plugin, it can be contained within the vis_types/* plugin in this folder. If it's sharing a renderer/expression with Lens or Canvas, the renderer must be extracted into the chart_expression folder. diff --git a/src/plugins/vis_type_pie/common/index.ts b/src/plugins/vis_types/pie/common/index.ts similarity index 100% rename from src/plugins/vis_type_pie/common/index.ts rename to src/plugins/vis_types/pie/common/index.ts diff --git a/src/plugins/vis_type_xy/jest.config.js b/src/plugins/vis_types/pie/jest.config.js similarity index 84% rename from src/plugins/vis_type_xy/jest.config.js rename to src/plugins/vis_types/pie/jest.config.js index a14203b7b757f..505ea97f489f7 100644 --- a/src/plugins/vis_type_xy/jest.config.js +++ b/src/plugins/vis_types/pie/jest.config.js @@ -8,6 +8,6 @@ module.exports = { preset: '@kbn/test', - rootDir: '../../..', - roots: ['/src/plugins/vis_type_xy'], + rootDir: '../../../..', + roots: ['/src/plugins/vis_types/pie'], }; diff --git a/src/plugins/vis_type_pie/kibana.json b/src/plugins/vis_types/pie/kibana.json similarity index 100% rename from src/plugins/vis_type_pie/kibana.json rename to src/plugins/vis_types/pie/kibana.json diff --git a/src/plugins/vis_type_pie/public/__snapshots__/pie_fn.test.ts.snap b/src/plugins/vis_types/pie/public/__snapshots__/pie_fn.test.ts.snap similarity index 100% rename from src/plugins/vis_type_pie/public/__snapshots__/pie_fn.test.ts.snap rename to src/plugins/vis_types/pie/public/__snapshots__/pie_fn.test.ts.snap diff --git a/src/plugins/vis_type_pie/public/__snapshots__/to_ast.test.ts.snap b/src/plugins/vis_types/pie/public/__snapshots__/to_ast.test.ts.snap similarity index 100% rename from src/plugins/vis_type_pie/public/__snapshots__/to_ast.test.ts.snap rename to src/plugins/vis_types/pie/public/__snapshots__/to_ast.test.ts.snap diff --git a/src/plugins/vis_type_pie/public/chart.scss b/src/plugins/vis_types/pie/public/chart.scss similarity index 100% rename from src/plugins/vis_type_pie/public/chart.scss rename to src/plugins/vis_types/pie/public/chart.scss diff --git a/src/plugins/vis_type_pie/public/components/chart_split.tsx b/src/plugins/vis_types/pie/public/components/chart_split.tsx similarity index 96% rename from src/plugins/vis_type_pie/public/components/chart_split.tsx rename to src/plugins/vis_types/pie/public/components/chart_split.tsx index 46f841113c03d..563d9e9234b66 100644 --- a/src/plugins/vis_type_pie/public/components/chart_split.tsx +++ b/src/plugins/vis_types/pie/public/components/chart_split.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { Accessor, AccessorFn, GroupBy, GroupBySort, SmallMultiples } from '@elastic/charts'; -import { DatatableColumn } from '../../../expressions/public'; +import { DatatableColumn } from '../../../../expressions/public'; import { SplitDimensionParams } from '../types'; interface ChartSplitProps { diff --git a/src/plugins/vis_type_pie/public/editor/collections.ts b/src/plugins/vis_types/pie/public/editor/collections.ts similarity index 100% rename from src/plugins/vis_type_pie/public/editor/collections.ts rename to src/plugins/vis_types/pie/public/editor/collections.ts diff --git a/src/plugins/vis_type_pie/public/editor/components/index.tsx b/src/plugins/vis_types/pie/public/editor/components/index.tsx similarity index 91% rename from src/plugins/vis_type_pie/public/editor/components/index.tsx rename to src/plugins/vis_types/pie/public/editor/components/index.tsx index 6bc31208fbdb0..5f7c744db0716 100644 --- a/src/plugins/vis_type_pie/public/editor/components/index.tsx +++ b/src/plugins/vis_types/pie/public/editor/components/index.tsx @@ -7,7 +7,7 @@ */ import React, { lazy } from 'react'; -import { VisEditorOptionsProps } from '../../../../visualizations/public'; +import { VisEditorOptionsProps } from '../../../../../visualizations/public'; import { PieVisParams, PieTypeProps } from '../../types'; const PieOptionsLazy = lazy(() => import('./pie')); diff --git a/src/plugins/vis_type_pie/public/editor/components/pie.test.tsx b/src/plugins/vis_types/pie/public/editor/components/pie.test.tsx similarity index 98% rename from src/plugins/vis_type_pie/public/editor/components/pie.test.tsx rename to src/plugins/vis_types/pie/public/editor/components/pie.test.tsx index d37f4c10ea9ea..ee8d0bf19ecac 100644 --- a/src/plugins/vis_type_pie/public/editor/components/pie.test.tsx +++ b/src/plugins/vis_types/pie/public/editor/components/pie.test.tsx @@ -10,7 +10,7 @@ import React from 'react'; import { mountWithIntl } from '@kbn/test/jest'; import { ReactWrapper } from 'enzyme'; import PieOptions, { PieOptionsProps } from './pie'; -import { chartPluginMock } from '../../../../charts/public/mocks'; +import { chartPluginMock } from '../../../../../charts/public/mocks'; import { findTestSubject } from '@elastic/eui/lib/test'; import { act } from 'react-dom/test-utils'; diff --git a/src/plugins/vis_type_pie/public/editor/components/pie.tsx b/src/plugins/vis_types/pie/public/editor/components/pie.tsx similarity index 98% rename from src/plugins/vis_type_pie/public/editor/components/pie.tsx rename to src/plugins/vis_types/pie/public/editor/components/pie.tsx index 3bf28ba58d4eb..78ae9527da3f9 100644 --- a/src/plugins/vis_type_pie/public/editor/components/pie.tsx +++ b/src/plugins/vis_types/pie/public/editor/components/pie.tsx @@ -27,10 +27,10 @@ import { SelectOption, PalettePicker, LongLegendOptions, -} from '../../../../vis_default_editor/public'; -import { VisEditorOptionsProps } from '../../../../visualizations/public'; +} from '../../../../../vis_default_editor/public'; +import { VisEditorOptionsProps } from '../../../../../visualizations/public'; import { TruncateLabelsOption } from './truncate_labels'; -import { PaletteRegistry } from '../../../../charts/public'; +import { PaletteRegistry } from '../../../../../charts/public'; import { DEFAULT_PERCENT_DECIMALS } from '../../../common'; import { PieVisParams, LabelPositions, ValueFormats, PieTypeProps } from '../../types'; import { getLabelPositions, getValuesFormats } from '../collections'; diff --git a/src/plugins/vis_type_pie/public/editor/components/truncate_labels.test.tsx b/src/plugins/vis_types/pie/public/editor/components/truncate_labels.test.tsx similarity index 100% rename from src/plugins/vis_type_pie/public/editor/components/truncate_labels.test.tsx rename to src/plugins/vis_types/pie/public/editor/components/truncate_labels.test.tsx diff --git a/src/plugins/vis_type_pie/public/editor/components/truncate_labels.tsx b/src/plugins/vis_types/pie/public/editor/components/truncate_labels.tsx similarity index 100% rename from src/plugins/vis_type_pie/public/editor/components/truncate_labels.tsx rename to src/plugins/vis_types/pie/public/editor/components/truncate_labels.tsx diff --git a/src/plugins/vis_type_pie/public/editor/positions.ts b/src/plugins/vis_types/pie/public/editor/positions.ts similarity index 100% rename from src/plugins/vis_type_pie/public/editor/positions.ts rename to src/plugins/vis_types/pie/public/editor/positions.ts diff --git a/src/plugins/vis_type_pie/public/expression_functions/pie_labels.ts b/src/plugins/vis_types/pie/public/expression_functions/pie_labels.ts similarity index 98% rename from src/plugins/vis_type_pie/public/expression_functions/pie_labels.ts rename to src/plugins/vis_types/pie/public/expression_functions/pie_labels.ts index 269d5d5f779d6..eeda49bce4c4c 100644 --- a/src/plugins/vis_type_pie/public/expression_functions/pie_labels.ts +++ b/src/plugins/vis_types/pie/public/expression_functions/pie_labels.ts @@ -11,7 +11,7 @@ import { ExpressionFunctionDefinition, Datatable, ExpressionValueBoxed, -} from '../../../expressions/public'; +} from '../../../../expressions/public'; interface Arguments { show: boolean; diff --git a/src/plugins/vis_type_pie/public/index.ts b/src/plugins/vis_types/pie/public/index.ts similarity index 100% rename from src/plugins/vis_type_pie/public/index.ts rename to src/plugins/vis_types/pie/public/index.ts diff --git a/src/plugins/vis_type_pie/public/mocks.ts b/src/plugins/vis_types/pie/public/mocks.ts similarity index 99% rename from src/plugins/vis_type_pie/public/mocks.ts rename to src/plugins/vis_types/pie/public/mocks.ts index 6cf291b8bf370..f7ba4056c77e4 100644 --- a/src/plugins/vis_type_pie/public/mocks.ts +++ b/src/plugins/vis_types/pie/public/mocks.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { Datatable } from '../../expressions/public'; +import { Datatable } from '../../../expressions/public'; import { BucketColumns, PieVisParams, LabelPositions, ValueFormats } from './types'; export const createMockBucketColumns = (): BucketColumns[] => { diff --git a/src/plugins/vis_type_pie/public/pie_component.test.tsx b/src/plugins/vis_types/pie/public/pie_component.test.tsx similarity index 97% rename from src/plugins/vis_type_pie/public/pie_component.test.tsx rename to src/plugins/vis_types/pie/public/pie_component.test.tsx index 177396f25adb6..c70cad285f2ae 100644 --- a/src/plugins/vis_type_pie/public/pie_component.test.tsx +++ b/src/plugins/vis_types/pie/public/pie_component.test.tsx @@ -8,8 +8,8 @@ import React from 'react'; import { Settings, TooltipType, SeriesIdentifier } from '@elastic/charts'; -import { chartPluginMock } from '../../charts/public/mocks'; -import { dataPluginMock } from '../../data/public/mocks'; +import { chartPluginMock } from '../../../charts/public/mocks'; +import { dataPluginMock } from '../../../data/public/mocks'; import { shallow, mount } from 'enzyme'; import { findTestSubject } from '@elastic/eui/lib/test'; import { act } from 'react-dom/test-utils'; diff --git a/src/plugins/vis_type_pie/public/pie_component.tsx b/src/plugins/vis_types/pie/public/pie_component.tsx similarity index 96% rename from src/plugins/vis_type_pie/public/pie_component.tsx rename to src/plugins/vis_types/pie/public/pie_component.tsx index 9119f2f2ecd6c..a5475a76e27cd 100644 --- a/src/plugins/vis_type_pie/public/pie_component.tsx +++ b/src/plugins/vis_types/pie/public/pie_component.tsx @@ -25,11 +25,15 @@ import { ClickTriggerEvent, ChartsPluginSetup, PaletteRegistry, -} from '../../charts/public'; -import { DataPublicPluginStart } from '../../data/public'; -import type { FieldFormat } from '../../field_formats/common'; -import type { PersistedState } from '../../visualizations/public'; -import { Datatable, DatatableColumn, IInterpreterRenderHandlers } from '../../expressions/public'; +} from '../../../charts/public'; +import { DataPublicPluginStart } from '../../../data/public'; +import type { PersistedState } from '../../../visualizations/public'; +import { + Datatable, + DatatableColumn, + IInterpreterRenderHandlers, +} from '../../../expressions/public'; +import type { FieldFormat } from '../../../field_formats/common'; import { DEFAULT_PERCENT_DECIMALS } from '../common'; import { PieVisParams, BucketColumns, ValueFormats, PieContainerDimensions } from './types'; import { diff --git a/src/plugins/vis_type_pie/public/pie_fn.test.ts b/src/plugins/vis_types/pie/public/pie_fn.test.ts similarity index 90% rename from src/plugins/vis_type_pie/public/pie_fn.test.ts rename to src/plugins/vis_types/pie/public/pie_fn.test.ts index 33b5f38cbe630..d0e0af9807f34 100644 --- a/src/plugins/vis_type_pie/public/pie_fn.test.ts +++ b/src/plugins/vis_types/pie/public/pie_fn.test.ts @@ -6,9 +6,9 @@ * Side Public License, v 1. */ -import { functionWrapper } from '../../expressions/common/expression_functions/specs/tests/utils'; +import { functionWrapper } from '../../../expressions/common/expression_functions/specs/tests/utils'; import { createPieVisFn } from './pie_fn'; -import { Datatable } from '../../expressions/common/expression_types/specs'; +import { Datatable } from '../../../expressions/common/expression_types/specs'; describe('interpreter/functions#pie', () => { const fn = functionWrapper(createPieVisFn()); diff --git a/src/plugins/vis_type_pie/public/pie_fn.ts b/src/plugins/vis_types/pie/public/pie_fn.ts similarity index 98% rename from src/plugins/vis_type_pie/public/pie_fn.ts rename to src/plugins/vis_types/pie/public/pie_fn.ts index c5987001d4494..74e8127712399 100644 --- a/src/plugins/vis_type_pie/public/pie_fn.ts +++ b/src/plugins/vis_types/pie/public/pie_fn.ts @@ -7,9 +7,9 @@ */ import { i18n } from '@kbn/i18n'; -import { ExpressionFunctionDefinition, Datatable, Render } from '../../expressions/common'; +import { ExpressionFunctionDefinition, Datatable, Render } from '../../../expressions/common'; import { PieVisParams, PieVisConfig } from './types'; -import { prepareLogTable } from '../../visualizations/public'; +import { prepareLogTable } from '../../../visualizations/public'; export const vislibPieName = 'pie_vis'; diff --git a/src/plugins/vis_type_pie/public/pie_renderer.tsx b/src/plugins/vis_types/pie/public/pie_renderer.tsx similarity index 90% rename from src/plugins/vis_type_pie/public/pie_renderer.tsx rename to src/plugins/vis_types/pie/public/pie_renderer.tsx index bcd4cad4efa66..e8fb6311904a6 100644 --- a/src/plugins/vis_type_pie/public/pie_renderer.tsx +++ b/src/plugins/vis_types/pie/public/pie_renderer.tsx @@ -9,9 +9,9 @@ import React, { lazy } from 'react'; import { render, unmountComponentAtNode } from 'react-dom'; import { I18nProvider } from '@kbn/i18n/react'; -import { ExpressionRenderDefinition } from '../../expressions/public'; -import { VisualizationContainer } from '../../visualizations/public'; -import type { PersistedState } from '../../visualizations/public'; +import { ExpressionRenderDefinition } from '../../../expressions/public'; +import { VisualizationContainer } from '../../../visualizations/public'; +import type { PersistedState } from '../../../visualizations/public'; import { VisTypePieDependencies } from './plugin'; import { RenderValue, vislibPieName } from './pie_fn'; diff --git a/src/plugins/vis_type_pie/public/plugin.ts b/src/plugins/vis_types/pie/public/plugin.ts similarity index 87% rename from src/plugins/vis_type_pie/public/plugin.ts rename to src/plugins/vis_types/pie/public/plugin.ts index 787f49c19aca3..12be6dd5de10f 100644 --- a/src/plugins/vis_type_pie/public/plugin.ts +++ b/src/plugins/vis_types/pie/public/plugin.ts @@ -7,11 +7,11 @@ */ import { CoreSetup, DocLinksStart } from 'src/core/public'; -import { VisualizationsSetup } from '../../visualizations/public'; -import { Plugin as ExpressionsPublicPlugin } from '../../expressions/public'; -import { ChartsPluginSetup } from '../../charts/public'; -import { UsageCollectionSetup } from '../../usage_collection/public'; -import { DataPublicPluginStart } from '../../data/public'; +import { VisualizationsSetup } from '../../../visualizations/public'; +import { Plugin as ExpressionsPublicPlugin } from '../../../expressions/public'; +import { ChartsPluginSetup } from '../../../charts/public'; +import { UsageCollectionSetup } from '../../../usage_collection/public'; +import { DataPublicPluginStart } from '../../../data/public'; import { LEGACY_PIE_CHARTS_LIBRARY } from '../common'; import { pieLabels as pieLabelsExpressionFunction } from './expression_functions/pie_labels'; import { createPieVisFn } from './pie_fn'; diff --git a/src/plugins/vis_type_pie/public/sample_vis.test.mocks.ts b/src/plugins/vis_types/pie/public/sample_vis.test.mocks.ts similarity index 100% rename from src/plugins/vis_type_pie/public/sample_vis.test.mocks.ts rename to src/plugins/vis_types/pie/public/sample_vis.test.mocks.ts diff --git a/src/plugins/vis_type_pie/public/to_ast.test.ts b/src/plugins/vis_types/pie/public/to_ast.test.ts similarity index 94% rename from src/plugins/vis_type_pie/public/to_ast.test.ts rename to src/plugins/vis_types/pie/public/to_ast.test.ts index 019c6e2176710..9d1dba32f2623 100644 --- a/src/plugins/vis_type_pie/public/to_ast.test.ts +++ b/src/plugins/vis_types/pie/public/to_ast.test.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { Vis } from '../../visualizations/public'; +import { Vis } from '../../../visualizations/public'; import { PieVisParams } from './types'; import { samplePieVis } from './sample_vis.test.mocks'; diff --git a/src/plugins/vis_type_pie/public/to_ast.ts b/src/plugins/vis_types/pie/public/to_ast.ts similarity index 97% rename from src/plugins/vis_type_pie/public/to_ast.ts rename to src/plugins/vis_types/pie/public/to_ast.ts index b360e375bf40d..fbfffbb77d5fb 100644 --- a/src/plugins/vis_type_pie/public/to_ast.ts +++ b/src/plugins/vis_types/pie/public/to_ast.ts @@ -6,8 +6,8 @@ * Side Public License, v 1. */ -import { getVisSchemas, VisToExpressionAst, SchemaConfig } from '../../visualizations/public'; -import { buildExpression, buildExpressionFunction } from '../../expressions/public'; +import { getVisSchemas, VisToExpressionAst, SchemaConfig } from '../../../visualizations/public'; +import { buildExpression, buildExpressionFunction } from '../../../expressions/public'; import { PieVisParams, LabelsParams } from './types'; import { vislibPieName, VisTypePieExpressionFunctionDefinition } from './pie_fn'; import { getEsaggsFn } from './to_ast_esaggs'; diff --git a/src/plugins/vis_type_pie/public/to_ast_esaggs.ts b/src/plugins/vis_types/pie/public/to_ast_esaggs.ts similarity index 90% rename from src/plugins/vis_type_pie/public/to_ast_esaggs.ts rename to src/plugins/vis_types/pie/public/to_ast_esaggs.ts index 9b760bd4bebcc..48a7dc50de171 100644 --- a/src/plugins/vis_type_pie/public/to_ast_esaggs.ts +++ b/src/plugins/vis_types/pie/public/to_ast_esaggs.ts @@ -6,12 +6,12 @@ * Side Public License, v 1. */ -import { Vis } from '../../visualizations/public'; -import { buildExpression, buildExpressionFunction } from '../../expressions/public'; +import { Vis } from '../../../visualizations/public'; +import { buildExpression, buildExpressionFunction } from '../../../expressions/public'; import { EsaggsExpressionFunctionDefinition, IndexPatternLoadExpressionFunctionDefinition, -} from '../../data/public'; +} from '../../../data/public'; import { PieVisParams } from './types'; diff --git a/src/plugins/vis_type_pie/public/types/index.ts b/src/plugins/vis_types/pie/public/types/index.ts similarity index 100% rename from src/plugins/vis_type_pie/public/types/index.ts rename to src/plugins/vis_types/pie/public/types/index.ts diff --git a/src/plugins/vis_type_pie/public/types/types.ts b/src/plugins/vis_types/pie/public/types/types.ts similarity index 92% rename from src/plugins/vis_type_pie/public/types/types.ts rename to src/plugins/vis_types/pie/public/types/types.ts index 94eaeb55f7242..a1f41e80fae28 100644 --- a/src/plugins/vis_type_pie/public/types/types.ts +++ b/src/plugins/vis_types/pie/public/types/types.ts @@ -8,10 +8,10 @@ import { Position } from '@elastic/charts'; import { UiCounterMetricType } from '@kbn/analytics'; -import { DatatableColumn, SerializedFieldFormat } from '../../../expressions/public'; -import { ExpressionValueVisDimension } from '../../../visualizations/public'; +import { DatatableColumn, SerializedFieldFormat } from '../../../../expressions/public'; +import { ExpressionValueVisDimension } from '../../../../visualizations/public'; import { ExpressionValuePieLabels } from '../expression_functions/pie_labels'; -import { PaletteOutput, ChartsPluginSetup } from '../../../charts/public'; +import { PaletteOutput, ChartsPluginSetup } from '../../../../charts/public'; export interface Dimension { accessor: number; diff --git a/src/plugins/vis_type_pie/public/utils/filter_helpers.test.ts b/src/plugins/vis_types/pie/public/utils/filter_helpers.test.ts similarity index 97% rename from src/plugins/vis_type_pie/public/utils/filter_helpers.test.ts rename to src/plugins/vis_types/pie/public/utils/filter_helpers.test.ts index 3f532cf4c384f..f6e20104779fa 100644 --- a/src/plugins/vis_type_pie/public/utils/filter_helpers.test.ts +++ b/src/plugins/vis_types/pie/public/utils/filter_helpers.test.ts @@ -5,7 +5,7 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ -import { DatatableColumn } from '../../../expressions/public'; +import { DatatableColumn } from '../../../../expressions/public'; import { getFilterClickData, getFilterEventData } from './filter_helpers'; import { createMockBucketColumns, createMockVisData } from '../mocks'; diff --git a/src/plugins/vis_type_pie/public/utils/filter_helpers.ts b/src/plugins/vis_types/pie/public/utils/filter_helpers.ts similarity index 88% rename from src/plugins/vis_type_pie/public/utils/filter_helpers.ts rename to src/plugins/vis_types/pie/public/utils/filter_helpers.ts index f1a4791821c12..31fff7612faf3 100644 --- a/src/plugins/vis_type_pie/public/utils/filter_helpers.ts +++ b/src/plugins/vis_types/pie/public/utils/filter_helpers.ts @@ -7,11 +7,11 @@ */ import { LayerValue, SeriesIdentifier } from '@elastic/charts'; -import { Datatable, DatatableColumn } from '../../../expressions/public'; -import { DataPublicPluginStart } from '../../../data/public'; -import type { FieldFormat } from '../../../field_formats/common'; -import { ClickTriggerEvent } from '../../../charts/public'; -import { ValueClickContext } from '../../../embeddable/public'; +import { Datatable, DatatableColumn } from '../../../../expressions/public'; +import { DataPublicPluginStart } from '../../../../data/public'; +import { ClickTriggerEvent } from '../../../../charts/public'; +import { ValueClickContext } from '../../../../embeddable/public'; +import type { FieldFormat } from '../../../../field_formats/common'; import { BucketColumns } from '../types'; export const canFilter = async ( diff --git a/src/plugins/vis_type_pie/public/utils/get_color_picker.test.tsx b/src/plugins/vis_types/pie/public/utils/get_color_picker.test.tsx similarity index 96% rename from src/plugins/vis_type_pie/public/utils/get_color_picker.test.tsx rename to src/plugins/vis_types/pie/public/utils/get_color_picker.test.tsx index 5e9087947b95e..bb4cbd8c08ae2 100644 --- a/src/plugins/vis_type_pie/public/utils/get_color_picker.test.tsx +++ b/src/plugins/vis_types/pie/public/utils/get_color_picker.test.tsx @@ -12,8 +12,8 @@ import { EuiPopover } from '@elastic/eui'; import { mountWithIntl } from '@kbn/test/jest'; import { ComponentType, ReactWrapper } from 'enzyme'; import { getColorPicker } from './get_color_picker'; -import { ColorPicker } from '../../../charts/public'; -import type { PersistedState } from '../../../visualizations/public'; +import { ColorPicker } from '../../../../charts/public'; +import type { PersistedState } from '../../../../visualizations/public'; import { createMockBucketColumns, createMockVisData } from '../mocks'; const bucketColumns = createMockBucketColumns(); diff --git a/src/plugins/vis_type_pie/public/utils/get_color_picker.tsx b/src/plugins/vis_types/pie/public/utils/get_color_picker.tsx similarity index 94% rename from src/plugins/vis_type_pie/public/utils/get_color_picker.tsx rename to src/plugins/vis_types/pie/public/utils/get_color_picker.tsx index 628c2d74dc438..68daa7bb82df7 100644 --- a/src/plugins/vis_type_pie/public/utils/get_color_picker.tsx +++ b/src/plugins/vis_types/pie/public/utils/get_color_picker.tsx @@ -10,9 +10,9 @@ import React, { useCallback } from 'react'; import Color from 'color'; import { LegendColorPicker, Position } from '@elastic/charts'; import { PopoverAnchorPosition, EuiPopover, EuiOutsideClickDetector } from '@elastic/eui'; -import type { DatatableRow } from '../../../expressions/public'; -import type { PersistedState } from '../../../visualizations/public'; -import { ColorPicker } from '../../../charts/public'; +import type { DatatableRow } from '../../../../expressions/public'; +import type { PersistedState } from '../../../../visualizations/public'; +import { ColorPicker } from '../../../../charts/public'; import { BucketColumns } from '../types'; const KEY_CODE_ENTER = 13; diff --git a/src/plugins/vis_type_pie/public/utils/get_columns.test.ts b/src/plugins/vis_types/pie/public/utils/get_columns.test.ts similarity index 100% rename from src/plugins/vis_type_pie/public/utils/get_columns.test.ts rename to src/plugins/vis_types/pie/public/utils/get_columns.test.ts diff --git a/src/plugins/vis_type_pie/public/utils/get_columns.ts b/src/plugins/vis_types/pie/public/utils/get_columns.ts similarity index 94% rename from src/plugins/vis_type_pie/public/utils/get_columns.ts rename to src/plugins/vis_types/pie/public/utils/get_columns.ts index 4a32466d808da..c8b8399f0f786 100644 --- a/src/plugins/vis_type_pie/public/utils/get_columns.ts +++ b/src/plugins/vis_types/pie/public/utils/get_columns.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { DatatableColumn, Datatable } from '../../../expressions/public'; +import { DatatableColumn, Datatable } from '../../../../expressions/public'; import { BucketColumns, PieVisParams } from '../types'; export const getColumns = ( diff --git a/src/plugins/vis_type_pie/public/utils/get_config.ts b/src/plugins/vis_types/pie/public/utils/get_config.ts similarity index 100% rename from src/plugins/vis_type_pie/public/utils/get_config.ts rename to src/plugins/vis_types/pie/public/utils/get_config.ts diff --git a/src/plugins/vis_type_pie/public/utils/get_distinct_series.test.ts b/src/plugins/vis_types/pie/public/utils/get_distinct_series.test.ts similarity index 100% rename from src/plugins/vis_type_pie/public/utils/get_distinct_series.test.ts rename to src/plugins/vis_types/pie/public/utils/get_distinct_series.test.ts diff --git a/src/plugins/vis_type_pie/public/utils/get_distinct_series.ts b/src/plugins/vis_types/pie/public/utils/get_distinct_series.ts similarity index 94% rename from src/plugins/vis_type_pie/public/utils/get_distinct_series.ts rename to src/plugins/vis_types/pie/public/utils/get_distinct_series.ts index ba5042dfc210c..8e0111391ec0f 100644 --- a/src/plugins/vis_type_pie/public/utils/get_distinct_series.ts +++ b/src/plugins/vis_types/pie/public/utils/get_distinct_series.ts @@ -5,7 +5,7 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ -import { DatatableRow } from '../../../expressions/public'; +import { DatatableRow } from '../../../../expressions/public'; import { BucketColumns } from '../types'; export const getDistinctSeries = (rows: DatatableRow[], buckets: Array>) => { diff --git a/src/plugins/vis_type_pie/public/utils/get_layers.test.ts b/src/plugins/vis_types/pie/public/utils/get_layers.test.ts similarity index 95% rename from src/plugins/vis_type_pie/public/utils/get_layers.test.ts rename to src/plugins/vis_types/pie/public/utils/get_layers.test.ts index d6f80b3eb231d..859d0daf07a02 100644 --- a/src/plugins/vis_type_pie/public/utils/get_layers.test.ts +++ b/src/plugins/vis_types/pie/public/utils/get_layers.test.ts @@ -6,9 +6,9 @@ * Side Public License, v 1. */ import { ShapeTreeNode } from '@elastic/charts'; -import { PaletteDefinition, SeriesLayer } from '../../../charts/public'; -import { dataPluginMock } from '../../../data/public/mocks'; -import type { DataPublicPluginStart } from '../../../data/public'; +import { PaletteDefinition, SeriesLayer } from '../../../../charts/public'; +import { dataPluginMock } from '../../../../data/public/mocks'; +import type { DataPublicPluginStart } from '../../../../data/public'; import { computeColor } from './get_layers'; import { createMockVisData, createMockBucketColumns, createMockPieParams } from '../mocks'; diff --git a/src/plugins/vis_type_pie/public/utils/get_layers.ts b/src/plugins/vis_types/pie/public/utils/get_layers.ts similarity index 97% rename from src/plugins/vis_type_pie/public/utils/get_layers.ts rename to src/plugins/vis_types/pie/public/utils/get_layers.ts index 42c4650419c6b..6ecef858619b5 100644 --- a/src/plugins/vis_type_pie/public/utils/get_layers.ts +++ b/src/plugins/vis_types/pie/public/utils/get_layers.ts @@ -14,9 +14,9 @@ import { ArrayEntry, } from '@elastic/charts'; import { isEqual } from 'lodash'; -import { SeriesLayer, PaletteRegistry, lightenColor } from '../../../charts/public'; -import type { DataPublicPluginStart } from '../../../data/public'; -import type { DatatableRow } from '../../../expressions/public'; +import { SeriesLayer, PaletteRegistry, lightenColor } from '../../../../charts/public'; +import type { DataPublicPluginStart } from '../../../../data/public'; +import type { DatatableRow } from '../../../../expressions/public'; import type { BucketColumns, PieVisParams, SplitDimensionParams } from '../types'; import { getDistinctSeries } from './get_distinct_series'; diff --git a/src/plugins/vis_type_pie/public/utils/get_legend_actions.tsx b/src/plugins/vis_types/pie/public/utils/get_legend_actions.tsx similarity index 96% rename from src/plugins/vis_type_pie/public/utils/get_legend_actions.tsx rename to src/plugins/vis_types/pie/public/utils/get_legend_actions.tsx index 4ffc458bfd401..cd1d1d71aaa76 100644 --- a/src/plugins/vis_type_pie/public/utils/get_legend_actions.tsx +++ b/src/plugins/vis_types/pie/public/utils/get_legend_actions.tsx @@ -11,9 +11,9 @@ import React, { useState, useEffect, useMemo } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiContextMenuPanelDescriptor, EuiIcon, EuiPopover, EuiContextMenu } from '@elastic/eui'; import { LegendAction, SeriesIdentifier } from '@elastic/charts'; -import { DataPublicPluginStart } from '../../../data/public'; +import { DataPublicPluginStart } from '../../../../data/public'; import { PieVisParams } from '../types'; -import { ClickTriggerEvent } from '../../../charts/public'; +import { ClickTriggerEvent } from '../../../../charts/public'; export const getLegendActions = ( canFilter: ( diff --git a/src/plugins/vis_type_pie/public/utils/get_split_dimension_accessor.ts b/src/plugins/vis_types/pie/public/utils/get_split_dimension_accessor.ts similarity index 87% rename from src/plugins/vis_type_pie/public/utils/get_split_dimension_accessor.ts rename to src/plugins/vis_types/pie/public/utils/get_split_dimension_accessor.ts index 5addae51dd011..4f30d4f8b3cc4 100644 --- a/src/plugins/vis_type_pie/public/utils/get_split_dimension_accessor.ts +++ b/src/plugins/vis_types/pie/public/utils/get_split_dimension_accessor.ts @@ -6,8 +6,8 @@ * Side Public License, v 1. */ import { AccessorFn } from '@elastic/charts'; -import type { FieldFormatsStart } from '../../../field_formats/public'; -import { DatatableColumn } from '../../../expressions/public'; +import { DatatableColumn } from '../../../../expressions/public'; +import type { FieldFormatsStart } from '../../../../field_formats/public'; import { Dimension } from '../types'; export const getSplitDimensionAccessor = ( diff --git a/src/plugins/vis_type_pie/public/utils/index.ts b/src/plugins/vis_types/pie/public/utils/index.ts similarity index 100% rename from src/plugins/vis_type_pie/public/utils/index.ts rename to src/plugins/vis_types/pie/public/utils/index.ts diff --git a/src/plugins/vis_type_pie/public/vis_type/index.ts b/src/plugins/vis_types/pie/public/vis_type/index.ts similarity index 100% rename from src/plugins/vis_type_pie/public/vis_type/index.ts rename to src/plugins/vis_types/pie/public/vis_type/index.ts diff --git a/src/plugins/vis_type_pie/public/vis_type/pie.ts b/src/plugins/vis_types/pie/public/vis_type/pie.ts similarity index 97% rename from src/plugins/vis_type_pie/public/vis_type/pie.ts rename to src/plugins/vis_types/pie/public/vis_type/pie.ts index 95a9d0d41481b..cfe38442a1548 100644 --- a/src/plugins/vis_type_pie/public/vis_type/pie.ts +++ b/src/plugins/vis_types/pie/public/vis_type/pie.ts @@ -8,8 +8,8 @@ import { i18n } from '@kbn/i18n'; import { Position } from '@elastic/charts'; -import { AggGroupNames } from '../../../data/public'; -import { VIS_EVENT_TO_TRIGGER, VisTypeDefinition } from '../../../visualizations/public'; +import { AggGroupNames } from '../../../../data/public'; +import { VIS_EVENT_TO_TRIGGER, VisTypeDefinition } from '../../../../visualizations/public'; import { DEFAULT_PERCENT_DECIMALS } from '../../common'; import { PieVisParams, LabelPositions, ValueFormats, PieTypeProps } from '../types'; import { toExpressionAst } from '../to_ast'; diff --git a/src/plugins/vis_type_pie/server/index.ts b/src/plugins/vis_types/pie/server/index.ts similarity index 100% rename from src/plugins/vis_type_pie/server/index.ts rename to src/plugins/vis_types/pie/server/index.ts diff --git a/src/plugins/vis_type_pie/server/plugin.ts b/src/plugins/vis_types/pie/server/plugin.ts similarity index 100% rename from src/plugins/vis_type_pie/server/plugin.ts rename to src/plugins/vis_types/pie/server/plugin.ts diff --git a/src/plugins/vis_types/pie/tsconfig.json b/src/plugins/vis_types/pie/tsconfig.json new file mode 100644 index 0000000000000..9a0a3418d72db --- /dev/null +++ b/src/plugins/vis_types/pie/tsconfig.json @@ -0,0 +1,24 @@ +{ + "extends": "../../../../tsconfig.base.json", + "compilerOptions": { + "outDir": "./target/types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true + }, + "include": [ + "common/**/*", + "public/**/*", + "server/**/*" + ], + "references": [ + { "path": "../../../core/tsconfig.json" }, + { "path": "../../charts/tsconfig.json" }, + { "path": "../../data/tsconfig.json" }, + { "path": "../../expressions/tsconfig.json" }, + { "path": "../../visualizations/tsconfig.json" }, + { "path": "../../usage_collection/tsconfig.json" }, + { "path": "../../vis_default_editor/tsconfig.json" }, + { "path": "../../field_formats/tsconfig.json" } + ] + } \ No newline at end of file diff --git a/src/plugins/vis_type_vislib/common/index.ts b/src/plugins/vis_types/vislib/common/index.ts similarity index 100% rename from src/plugins/vis_type_vislib/common/index.ts rename to src/plugins/vis_types/vislib/common/index.ts diff --git a/src/plugins/vis_type_vislib/jest.config.js b/src/plugins/vis_types/vislib/jest.config.js similarity index 83% rename from src/plugins/vis_type_vislib/jest.config.js rename to src/plugins/vis_types/vislib/jest.config.js index 5e144dabd25e2..6b6d7c3361ecf 100644 --- a/src/plugins/vis_type_vislib/jest.config.js +++ b/src/plugins/vis_types/vislib/jest.config.js @@ -8,6 +8,6 @@ module.exports = { preset: '@kbn/test', - rootDir: '../../..', - roots: ['/src/plugins/vis_type_vislib'], + rootDir: '../../../..', + roots: ['/src/plugins/vis_types/vislib'], }; diff --git a/src/plugins/vis_type_vislib/kibana.json b/src/plugins/vis_types/vislib/kibana.json similarity index 100% rename from src/plugins/vis_type_vislib/kibana.json rename to src/plugins/vis_types/vislib/kibana.json diff --git a/src/plugins/vis_type_vislib/public/__snapshots__/pie_fn.test.ts.snap b/src/plugins/vis_types/vislib/public/__snapshots__/pie_fn.test.ts.snap similarity index 100% rename from src/plugins/vis_type_vislib/public/__snapshots__/pie_fn.test.ts.snap rename to src/plugins/vis_types/vislib/public/__snapshots__/pie_fn.test.ts.snap diff --git a/src/plugins/vis_type_vislib/public/__snapshots__/to_ast.test.ts.snap b/src/plugins/vis_types/vislib/public/__snapshots__/to_ast.test.ts.snap similarity index 100% rename from src/plugins/vis_type_vislib/public/__snapshots__/to_ast.test.ts.snap rename to src/plugins/vis_types/vislib/public/__snapshots__/to_ast.test.ts.snap diff --git a/src/plugins/vis_type_vislib/public/__snapshots__/to_ast_pie.test.ts.snap b/src/plugins/vis_types/vislib/public/__snapshots__/to_ast_pie.test.ts.snap similarity index 100% rename from src/plugins/vis_type_vislib/public/__snapshots__/to_ast_pie.test.ts.snap rename to src/plugins/vis_types/vislib/public/__snapshots__/to_ast_pie.test.ts.snap diff --git a/src/plugins/vis_type_vislib/public/area.ts b/src/plugins/vis_types/vislib/public/area.ts similarity index 82% rename from src/plugins/vis_type_vislib/public/area.ts rename to src/plugins/vis_types/vislib/public/area.ts index 3b132ae9be12c..f4ac79e12bbe2 100644 --- a/src/plugins/vis_type_vislib/public/area.ts +++ b/src/plugins/vis_types/vislib/public/area.ts @@ -6,8 +6,8 @@ * Side Public License, v 1. */ -import { xyVisTypes } from '../../vis_type_xy/public'; -import { VisTypeDefinition } from '../../visualizations/public'; +import { xyVisTypes } from '../../xy/public'; +import { VisTypeDefinition } from '../../../visualizations/public'; import { toExpressionAst } from './to_ast'; import { BasicVislibParams } from './types'; diff --git a/src/plugins/vis_type_vislib/public/editor/collections.ts b/src/plugins/vis_types/vislib/public/editor/collections.ts similarity index 92% rename from src/plugins/vis_type_vislib/public/editor/collections.ts rename to src/plugins/vis_types/vislib/public/editor/collections.ts index cee6901b611ae..e7905ccaf1c29 100644 --- a/src/plugins/vis_type_vislib/public/editor/collections.ts +++ b/src/plugins/vis_types/vislib/public/editor/collections.ts @@ -8,8 +8,8 @@ import { i18n } from '@kbn/i18n'; -import { colorSchemas } from '../../../charts/public'; -import { getPositions, getScaleTypes } from '../../../vis_type_xy/public'; +import { colorSchemas } from '../../../../charts/public'; +import { getPositions, getScaleTypes } from '../../../xy/public'; import { Alignment, GaugeType } from '../types'; diff --git a/src/plugins/vis_type_vislib/public/editor/components/gauge/index.tsx b/src/plugins/vis_types/vislib/public/editor/components/gauge/index.tsx similarity index 100% rename from src/plugins/vis_type_vislib/public/editor/components/gauge/index.tsx rename to src/plugins/vis_types/vislib/public/editor/components/gauge/index.tsx diff --git a/src/plugins/vis_type_vislib/public/editor/components/gauge/labels_panel.tsx b/src/plugins/vis_types/vislib/public/editor/components/gauge/labels_panel.tsx similarity index 96% rename from src/plugins/vis_type_vislib/public/editor/components/gauge/labels_panel.tsx rename to src/plugins/vis_types/vislib/public/editor/components/gauge/labels_panel.tsx index a5fb435da4550..ae200892cec57 100644 --- a/src/plugins/vis_type_vislib/public/editor/components/gauge/labels_panel.tsx +++ b/src/plugins/vis_types/vislib/public/editor/components/gauge/labels_panel.tsx @@ -10,7 +10,7 @@ import React from 'react'; import { EuiPanel, EuiSpacer, EuiTitle } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { SwitchOption, TextInputOption } from '../../../../../vis_default_editor/public'; +import { SwitchOption, TextInputOption } from '../../../../../../vis_default_editor/public'; import { GaugeOptionsInternalProps } from '../gauge'; function LabelsPanel({ stateParams, setValue, setGaugeValue }: GaugeOptionsInternalProps) { diff --git a/src/plugins/vis_type_vislib/public/editor/components/gauge/ranges_panel.tsx b/src/plugins/vis_types/vislib/public/editor/components/gauge/ranges_panel.tsx similarity index 97% rename from src/plugins/vis_type_vislib/public/editor/components/gauge/ranges_panel.tsx rename to src/plugins/vis_types/vislib/public/editor/components/gauge/ranges_panel.tsx index 5091c29c28752..0cb6d7d5940fd 100644 --- a/src/plugins/vis_type_vislib/public/editor/components/gauge/ranges_panel.tsx +++ b/src/plugins/vis_types/vislib/public/editor/components/gauge/ranges_panel.tsx @@ -16,8 +16,8 @@ import { SwitchOption, ColorSchemaOptions, PercentageModeOption, -} from '../../../../../vis_default_editor/public'; -import { ColorSchemaParams, ColorSchemas, colorSchemas } from '../../../../../charts/public'; +} from '../../../../../../vis_default_editor/public'; +import { ColorSchemaParams, ColorSchemas, colorSchemas } from '../../../../../../charts/public'; import { GaugeOptionsInternalProps } from '../gauge'; import { Gauge } from '../../../gauge'; diff --git a/src/plugins/vis_type_vislib/public/editor/components/gauge/style_panel.tsx b/src/plugins/vis_types/vislib/public/editor/components/gauge/style_panel.tsx similarity index 93% rename from src/plugins/vis_type_vislib/public/editor/components/gauge/style_panel.tsx rename to src/plugins/vis_types/vislib/public/editor/components/gauge/style_panel.tsx index 79e4ed96cadec..30bdab93cdfa8 100644 --- a/src/plugins/vis_type_vislib/public/editor/components/gauge/style_panel.tsx +++ b/src/plugins/vis_types/vislib/public/editor/components/gauge/style_panel.tsx @@ -11,9 +11,9 @@ import { EuiPanel, EuiSpacer, EuiTitle } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { SelectOption } from '../../../../../vis_default_editor/public'; +import { SelectOption } from '../../../../../../vis_default_editor/public'; import { GaugeOptionsInternalProps } from '../gauge'; -import { AggGroupNames } from '../../../../../data/public'; +import { AggGroupNames } from '../../../../../../data/public'; import { getGaugeCollections } from './../../collections'; const gaugeCollections = getGaugeCollections(); diff --git a/src/plugins/vis_type_vislib/public/editor/components/heatmap/index.tsx b/src/plugins/vis_types/vislib/public/editor/components/heatmap/index.tsx similarity index 98% rename from src/plugins/vis_type_vislib/public/editor/components/heatmap/index.tsx rename to src/plugins/vis_types/vislib/public/editor/components/heatmap/index.tsx index bdabded67a74a..c0d89f2f66958 100644 --- a/src/plugins/vis_type_vislib/public/editor/components/heatmap/index.tsx +++ b/src/plugins/vis_types/vislib/public/editor/components/heatmap/index.tsx @@ -13,7 +13,7 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import { VisEditorOptionsProps } from 'src/plugins/visualizations/public'; -import { ValueAxis } from '../../../../../vis_type_xy/public'; +import { ValueAxis } from '../../../../../xy/public'; import { BasicOptions, SelectOption, @@ -24,7 +24,7 @@ import { ColorSchemaOptions, NumberInputOption, PercentageModeOption, -} from '../../../../../vis_default_editor/public'; +} from '../../../../../../vis_default_editor/public'; import { HeatmapVisParams } from '../../../heatmap'; import { LabelsPanel } from './labels_panel'; diff --git a/src/plugins/vis_type_vislib/public/editor/components/heatmap/labels_panel.tsx b/src/plugins/vis_types/vislib/public/editor/components/heatmap/labels_panel.tsx similarity index 96% rename from src/plugins/vis_type_vislib/public/editor/components/heatmap/labels_panel.tsx rename to src/plugins/vis_types/vislib/public/editor/components/heatmap/labels_panel.tsx index 206900959a35b..05b8949901e79 100644 --- a/src/plugins/vis_type_vislib/public/editor/components/heatmap/labels_panel.tsx +++ b/src/plugins/vis_types/vislib/public/editor/components/heatmap/labels_panel.tsx @@ -13,8 +13,8 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import { VisEditorOptionsProps } from 'src/plugins/visualizations/public'; -import { SwitchOption } from '../../../../../vis_default_editor/public'; -import { ValueAxis } from '../../../../../vis_type_xy/public'; +import { SwitchOption } from '../../../../../../vis_default_editor/public'; +import { ValueAxis } from '../../../../../xy/public'; import { HeatmapVisParams } from '../../../heatmap'; diff --git a/src/plugins/vis_type_vislib/public/editor/components/index.tsx b/src/plugins/vis_types/vislib/public/editor/components/index.tsx similarity index 100% rename from src/plugins/vis_type_vislib/public/editor/components/index.tsx rename to src/plugins/vis_types/vislib/public/editor/components/index.tsx diff --git a/src/plugins/vis_type_vislib/public/editor/index.ts b/src/plugins/vis_types/vislib/public/editor/index.ts similarity index 100% rename from src/plugins/vis_type_vislib/public/editor/index.ts rename to src/plugins/vis_types/vislib/public/editor/index.ts diff --git a/src/plugins/vis_type_vislib/public/fixtures/dispatch_bar_chart_config_normal.json b/src/plugins/vis_types/vislib/public/fixtures/dispatch_bar_chart_config_normal.json similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/dispatch_bar_chart_config_normal.json rename to src/plugins/vis_types/vislib/public/fixtures/dispatch_bar_chart_config_normal.json diff --git a/src/plugins/vis_type_vislib/public/fixtures/dispatch_bar_chart_config_percentage.json b/src/plugins/vis_types/vislib/public/fixtures/dispatch_bar_chart_config_percentage.json similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/dispatch_bar_chart_config_percentage.json rename to src/plugins/vis_types/vislib/public/fixtures/dispatch_bar_chart_config_percentage.json diff --git a/src/plugins/vis_type_vislib/public/fixtures/dispatch_bar_chart_d3.json b/src/plugins/vis_types/vislib/public/fixtures/dispatch_bar_chart_d3.json similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/dispatch_bar_chart_d3.json rename to src/plugins/vis_types/vislib/public/fixtures/dispatch_bar_chart_d3.json diff --git a/src/plugins/vis_type_vislib/public/fixtures/dispatch_bar_chart_data_point.json b/src/plugins/vis_types/vislib/public/fixtures/dispatch_bar_chart_data_point.json similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/dispatch_bar_chart_data_point.json rename to src/plugins/vis_types/vislib/public/fixtures/dispatch_bar_chart_data_point.json diff --git a/src/plugins/vis_type_vislib/public/fixtures/dispatch_heatmap_config.json b/src/plugins/vis_types/vislib/public/fixtures/dispatch_heatmap_config.json similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/dispatch_heatmap_config.json rename to src/plugins/vis_types/vislib/public/fixtures/dispatch_heatmap_config.json diff --git a/src/plugins/vis_type_vislib/public/fixtures/dispatch_heatmap_d3.json b/src/plugins/vis_types/vislib/public/fixtures/dispatch_heatmap_d3.json similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/dispatch_heatmap_d3.json rename to src/plugins/vis_types/vislib/public/fixtures/dispatch_heatmap_d3.json diff --git a/src/plugins/vis_type_vislib/public/fixtures/dispatch_heatmap_data_point.json b/src/plugins/vis_types/vislib/public/fixtures/dispatch_heatmap_data_point.json similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/dispatch_heatmap_data_point.json rename to src/plugins/vis_types/vislib/public/fixtures/dispatch_heatmap_data_point.json diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_columns.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/date_histogram/_columns.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_columns.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/date_histogram/_columns.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/date_histogram/_rows.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/date_histogram/_rows.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows_series_with_holes.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/date_histogram/_rows_series_with_holes.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows_series_with_holes.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/date_histogram/_rows_series_with_holes.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/date_histogram/_series.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/date_histogram/_series.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_monthly_interval.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/date_histogram/_series_monthly_interval.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_monthly_interval.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/date_histogram/_series_monthly_interval.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_neg.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/date_histogram/_series_neg.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_neg.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/date_histogram/_series_neg.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_pos_neg.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/date_histogram/_series_pos_neg.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_pos_neg.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/date_histogram/_series_pos_neg.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/date_histogram/_stacked_series.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/date_histogram/_stacked_series.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/filters/_columns.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/filters/_columns.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/filters/_columns.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/filters/_columns.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/filters/_rows.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/filters/_rows.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/filters/_rows.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/filters/_rows.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/filters/_series.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/filters/_series.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/filters/_series.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/filters/_series.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/geohash/_columns.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/geohash/_columns.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/geohash/_columns.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/geohash/_columns.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/geohash/_geo_json.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/geohash/_geo_json.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/geohash/_geo_json.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/geohash/_geo_json.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/geohash/_rows.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/geohash/_rows.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/geohash/_rows.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/geohash/_rows.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_columns.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/histogram/_columns.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_columns.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/histogram/_columns.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_rows.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/histogram/_rows.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_rows.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/histogram/_rows.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_series.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/histogram/_series.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_series.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/histogram/_series.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_slices.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/histogram/_slices.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_slices.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/histogram/_slices.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/not_enough_data/_one_point.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/not_enough_data/_one_point.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/not_enough_data/_one_point.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/not_enough_data/_one_point.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/range/_columns.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/range/_columns.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/range/_columns.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/range/_columns.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/range/_rows.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/range/_rows.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/range/_rows.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/range/_rows.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/range/_series.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/range/_series.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/range/_series.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/range/_series.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/significant_terms/_columns.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/significant_terms/_columns.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/significant_terms/_columns.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/significant_terms/_columns.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/significant_terms/_rows.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/significant_terms/_rows.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/significant_terms/_rows.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/significant_terms/_rows.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/significant_terms/_series.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/significant_terms/_series.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/significant_terms/_series.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/significant_terms/_series.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/stacked/_stacked.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/stacked/_stacked.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/stacked/_stacked.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/stacked/_stacked.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_columns.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/terms/_columns.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_columns.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/terms/_columns.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_rows.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/terms/_rows.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_rows.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/terms/_rows.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_series.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/terms/_series.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_series.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/terms/_series.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_series_multiple.js b/src/plugins/vis_types/vislib/public/fixtures/mock_data/terms/_series_multiple.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_series_multiple.js rename to src/plugins/vis_types/vislib/public/fixtures/mock_data/terms/_series_multiple.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/mocks.js b/src/plugins/vis_types/vislib/public/fixtures/mocks.js similarity index 100% rename from src/plugins/vis_type_vislib/public/fixtures/mocks.js rename to src/plugins/vis_types/vislib/public/fixtures/mocks.js diff --git a/src/plugins/vis_type_vislib/public/gauge.ts b/src/plugins/vis_types/vislib/public/gauge.ts similarity index 93% rename from src/plugins/vis_type_vislib/public/gauge.ts rename to src/plugins/vis_types/vislib/public/gauge.ts index fa463bea6f27f..e03abf5d90cbe 100644 --- a/src/plugins/vis_type_vislib/public/gauge.ts +++ b/src/plugins/vis_types/vislib/public/gauge.ts @@ -8,10 +8,10 @@ import { i18n } from '@kbn/i18n'; -import { ColorMode, ColorSchemas, ColorSchemaParams, Labels, Style } from '../../charts/public'; -import { RangeValues } from '../../vis_default_editor/public'; -import { AggGroupNames } from '../../data/public'; -import { VisTypeDefinition, VIS_EVENT_TO_TRIGGER } from '../../visualizations/public'; +import { ColorMode, ColorSchemas, ColorSchemaParams, Labels, Style } from '../../../charts/public'; +import { RangeValues } from '../../../vis_default_editor/public'; +import { AggGroupNames } from '../../../data/public'; +import { VisTypeDefinition, VIS_EVENT_TO_TRIGGER } from '../../../visualizations/public'; import { Alignment, GaugeType, VislibChartType } from './types'; import { toExpressionAst } from './to_ast'; diff --git a/src/plugins/vis_type_vislib/public/goal.ts b/src/plugins/vis_types/vislib/public/goal.ts similarity index 93% rename from src/plugins/vis_type_vislib/public/goal.ts rename to src/plugins/vis_types/vislib/public/goal.ts index e594122871fe7..5e6074b12ce47 100644 --- a/src/plugins/vis_type_vislib/public/goal.ts +++ b/src/plugins/vis_types/vislib/public/goal.ts @@ -8,9 +8,9 @@ import { i18n } from '@kbn/i18n'; -import { AggGroupNames } from '../../data/public'; -import { ColorMode, ColorSchemas } from '../../charts/public'; -import { VisTypeDefinition } from '../../visualizations/public'; +import { AggGroupNames } from '../../../data/public'; +import { ColorMode, ColorSchemas } from '../../../charts/public'; +import { VisTypeDefinition } from '../../../visualizations/public'; import { GaugeOptions } from './editor'; import { toExpressionAst } from './to_ast'; diff --git a/src/plugins/vis_type_vislib/public/heatmap.ts b/src/plugins/vis_types/vislib/public/heatmap.ts similarity index 91% rename from src/plugins/vis_type_vislib/public/heatmap.ts rename to src/plugins/vis_types/vislib/public/heatmap.ts index f3f320b3658a0..3ea3a4b1e4a06 100644 --- a/src/plugins/vis_type_vislib/public/heatmap.ts +++ b/src/plugins/vis_types/vislib/public/heatmap.ts @@ -9,11 +9,11 @@ import { i18n } from '@kbn/i18n'; import { Position } from '@elastic/charts'; -import { RangeValues } from '../../vis_default_editor/public'; -import { AggGroupNames } from '../../data/public'; -import { ColorSchemas, ColorSchemaParams } from '../../charts/public'; -import { VIS_EVENT_TO_TRIGGER, VisTypeDefinition } from '../../visualizations/public'; -import { ValueAxis, ScaleType, AxisType } from '../../vis_type_xy/public'; +import { RangeValues } from '../../../vis_default_editor/public'; +import { AggGroupNames } from '../../../data/public'; +import { ColorSchemas, ColorSchemaParams } from '../../../charts/public'; +import { VIS_EVENT_TO_TRIGGER, VisTypeDefinition } from '../../../visualizations/public'; +import { ValueAxis, ScaleType, AxisType } from '../../xy/public'; import { HeatmapOptions } from './editor'; import { TimeMarker } from './vislib/visualizations/time_marker'; diff --git a/src/plugins/vis_type_vislib/public/histogram.ts b/src/plugins/vis_types/vislib/public/histogram.ts similarity index 82% rename from src/plugins/vis_type_vislib/public/histogram.ts rename to src/plugins/vis_types/vislib/public/histogram.ts index e7200a9ff30aa..bb4f570c6a2d8 100644 --- a/src/plugins/vis_type_vislib/public/histogram.ts +++ b/src/plugins/vis_types/vislib/public/histogram.ts @@ -6,8 +6,8 @@ * Side Public License, v 1. */ -import { xyVisTypes } from '../../vis_type_xy/public'; -import { VisTypeDefinition } from '../../visualizations/public'; +import { xyVisTypes } from '../../xy/public'; +import { VisTypeDefinition } from '../../../visualizations/public'; import { toExpressionAst } from './to_ast'; import { BasicVislibParams } from './types'; diff --git a/src/plugins/vis_type_vislib/public/horizontal_bar.ts b/src/plugins/vis_types/vislib/public/horizontal_bar.ts similarity index 83% rename from src/plugins/vis_type_vislib/public/horizontal_bar.ts rename to src/plugins/vis_types/vislib/public/horizontal_bar.ts index 70f0372025e3e..37aa79a0b1aee 100644 --- a/src/plugins/vis_type_vislib/public/horizontal_bar.ts +++ b/src/plugins/vis_types/vislib/public/horizontal_bar.ts @@ -6,8 +6,8 @@ * Side Public License, v 1. */ -import { xyVisTypes } from '../../vis_type_xy/public'; -import { VisTypeDefinition } from '../../visualizations/public'; +import { xyVisTypes } from '../../xy/public'; +import { VisTypeDefinition } from '../../../visualizations/public'; import { toExpressionAst } from './to_ast'; import { BasicVislibParams } from './types'; diff --git a/src/plugins/vis_type_vislib/public/index.scss b/src/plugins/vis_types/vislib/public/index.scss similarity index 100% rename from src/plugins/vis_type_vislib/public/index.scss rename to src/plugins/vis_types/vislib/public/index.scss diff --git a/src/plugins/vis_type_vislib/public/index.ts b/src/plugins/vis_types/vislib/public/index.ts similarity index 89% rename from src/plugins/vis_type_vislib/public/index.ts rename to src/plugins/vis_types/vislib/public/index.ts index 2a063e4d8a7f4..232e0494a9ebf 100644 --- a/src/plugins/vis_type_vislib/public/index.ts +++ b/src/plugins/vis_types/vislib/public/index.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { PluginInitializerContext } from '../../../core/public'; +import { PluginInitializerContext } from '../../../../core/public'; import { VisTypeVislibPlugin as Plugin } from './plugin'; export function plugin(initializerContext: PluginInitializerContext) { diff --git a/src/plugins/vis_type_vislib/public/line.ts b/src/plugins/vis_types/vislib/public/line.ts similarity index 82% rename from src/plugins/vis_type_vislib/public/line.ts rename to src/plugins/vis_types/vislib/public/line.ts index d91bb5d0384b6..0f33c393e0643 100644 --- a/src/plugins/vis_type_vislib/public/line.ts +++ b/src/plugins/vis_types/vislib/public/line.ts @@ -6,8 +6,8 @@ * Side Public License, v 1. */ -import { xyVisTypes } from '../../vis_type_xy/public'; -import { VisTypeDefinition } from '../../visualizations/public'; +import { xyVisTypes } from '../../xy/public'; +import { VisTypeDefinition } from '../../../visualizations/public'; import { toExpressionAst } from './to_ast'; import { BasicVislibParams } from './types'; diff --git a/src/plugins/vis_type_vislib/public/pie.ts b/src/plugins/vis_types/vislib/public/pie.ts similarity index 86% rename from src/plugins/vis_type_vislib/public/pie.ts rename to src/plugins/vis_types/vislib/public/pie.ts index 4f6eb7e536509..45794776bc998 100644 --- a/src/plugins/vis_type_vislib/public/pie.ts +++ b/src/plugins/vis_types/vislib/public/pie.ts @@ -6,8 +6,8 @@ * Side Public License, v 1. */ -import { pieVisType } from '../../vis_type_pie/public'; -import { VisTypeDefinition } from '../../visualizations/public'; +import { pieVisType } from '../../pie/public'; +import { VisTypeDefinition } from '../../../visualizations/public'; import { CommonVislibParams } from './types'; import { toExpressionAst } from './to_ast_pie'; diff --git a/src/plugins/vis_type_vislib/public/pie_fn.test.ts b/src/plugins/vis_types/vislib/public/pie_fn.test.ts similarity index 95% rename from src/plugins/vis_type_vislib/public/pie_fn.test.ts rename to src/plugins/vis_types/vislib/public/pie_fn.test.ts index 4291b5c05fc39..0df7bf1365bea 100644 --- a/src/plugins/vis_type_vislib/public/pie_fn.test.ts +++ b/src/plugins/vis_types/vislib/public/pie_fn.test.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { functionWrapper } from '../../expressions/common/expression_functions/specs/tests/utils'; +import { functionWrapper } from '../../../expressions/common/expression_functions/specs/tests/utils'; import { createPieVisFn } from './pie_fn'; // @ts-ignore import { vislibSlicesResponseHandler } from './vislib/response_handler'; diff --git a/src/plugins/vis_type_vislib/public/pie_fn.ts b/src/plugins/vis_types/vislib/public/pie_fn.ts similarity index 98% rename from src/plugins/vis_type_vislib/public/pie_fn.ts rename to src/plugins/vis_types/vislib/public/pie_fn.ts index 8776a6bc2d18a..dd5d2689af74d 100644 --- a/src/plugins/vis_type_vislib/public/pie_fn.ts +++ b/src/plugins/vis_types/vislib/public/pie_fn.ts @@ -8,7 +8,7 @@ import { i18n } from '@kbn/i18n'; -import { ExpressionFunctionDefinition, Datatable, Render } from '../../expressions/public'; +import { ExpressionFunctionDefinition, Datatable, Render } from '../../../expressions/public'; // @ts-ignore import { vislibSlicesResponseHandler } from './vislib/response_handler'; diff --git a/src/plugins/vis_type_vislib/public/plugin.ts b/src/plugins/vis_types/vislib/public/plugin.ts similarity index 83% rename from src/plugins/vis_type_vislib/public/plugin.ts rename to src/plugins/vis_types/vislib/public/plugin.ts index cdc02aacafa3b..24ba7741cab91 100644 --- a/src/plugins/vis_type_vislib/public/plugin.ts +++ b/src/plugins/vis_types/vislib/public/plugin.ts @@ -8,13 +8,13 @@ import { CoreSetup, CoreStart, Plugin, PluginInitializerContext } from 'kibana/public'; -import { Plugin as ExpressionsPublicPlugin } from '../../expressions/public'; -import { VisualizationsSetup } from '../../visualizations/public'; -import { ChartsPluginSetup } from '../../charts/public'; -import { DataPublicPluginStart } from '../../data/public'; -import { KibanaLegacyStart } from '../../kibana_legacy/public'; -import { LEGACY_CHARTS_LIBRARY } from '../../vis_type_xy/common/index'; -import { LEGACY_PIE_CHARTS_LIBRARY } from '../../vis_type_pie/common/index'; +import { Plugin as ExpressionsPublicPlugin } from '../../../expressions/public'; +import { VisualizationsSetup } from '../../../visualizations/public'; +import { ChartsPluginSetup } from '../../../charts/public'; +import { DataPublicPluginStart } from '../../../data/public'; +import { KibanaLegacyStart } from '../../../kibana_legacy/public'; +import { LEGACY_CHARTS_LIBRARY } from '../../xy/common/index'; +import { LEGACY_PIE_CHARTS_LIBRARY } from '../../pie/common/index'; import { createVisTypeVislibVisFn } from './vis_type_vislib_vis_fn'; import { createPieVisFn } from './pie_fn'; diff --git a/src/plugins/vis_type_vislib/public/services.ts b/src/plugins/vis_types/vislib/public/services.ts similarity index 82% rename from src/plugins/vis_type_vislib/public/services.ts rename to src/plugins/vis_types/vislib/public/services.ts index 00e3ed0791e5d..d111007598b8b 100644 --- a/src/plugins/vis_type_vislib/public/services.ts +++ b/src/plugins/vis_types/vislib/public/services.ts @@ -6,8 +6,8 @@ * Side Public License, v 1. */ -import { createGetterSetter } from '../../kibana_utils/public'; -import { DataPublicPluginStart } from '../../data/public'; +import { createGetterSetter } from '../../../kibana_utils/public'; +import { DataPublicPluginStart } from '../../../data/public'; export const [getDataActions, setDataActions] = createGetterSetter< DataPublicPluginStart['actions'] diff --git a/src/plugins/vis_type_vislib/public/to_ast.test.ts b/src/plugins/vis_types/vislib/public/to_ast.test.ts similarity index 78% rename from src/plugins/vis_type_vislib/public/to_ast.test.ts rename to src/plugins/vis_types/vislib/public/to_ast.test.ts index d4e4d4fcdd1dd..70a1f938a8266 100644 --- a/src/plugins/vis_type_vislib/public/to_ast.test.ts +++ b/src/plugins/vis_types/vislib/public/to_ast.test.ts @@ -6,15 +6,15 @@ * Side Public License, v 1. */ -import { Vis } from '../../visualizations/public'; -import { buildExpression } from '../../expressions/public'; +import { Vis } from '../../../visualizations/public'; +import { buildExpression } from '../../../expressions/public'; import { BasicVislibParams } from './types'; import { toExpressionAst } from './to_ast'; -import { sampleAreaVis } from '../../vis_type_xy/public/sample_vis.test.mocks'; +import { sampleAreaVis } from '../../xy/public/sample_vis.test.mocks'; -jest.mock('../../expressions/public', () => ({ - ...(jest.requireActual('../../expressions/public') as any), +jest.mock('../../../expressions/public', () => ({ + ...(jest.requireActual('../../../expressions/public') as any), buildExpression: jest.fn().mockImplementation(() => ({ toAst: () => ({ type: 'expression', diff --git a/src/plugins/vis_type_vislib/public/to_ast.ts b/src/plugins/vis_types/vislib/public/to_ast.ts similarity index 94% rename from src/plugins/vis_type_vislib/public/to_ast.ts rename to src/plugins/vis_types/vislib/public/to_ast.ts index 1e33c589ff1fc..c1de94ba0f5f9 100644 --- a/src/plugins/vis_type_vislib/public/to_ast.ts +++ b/src/plugins/vis_types/vislib/public/to_ast.ts @@ -13,12 +13,12 @@ import { VisToExpressionAstParams, getVisSchemas, VisParams, -} from '../../visualizations/public'; -import { buildExpression, buildExpressionFunction } from '../../expressions/public'; -import type { Dimensions } from '../../vis_type_xy/public'; -import type { DateHistogramParams, HistogramParams } from '../../visualizations/public'; +} from '../../../visualizations/public'; +import { buildExpression, buildExpressionFunction } from '../../../expressions/public'; +import type { Dimensions } from '../../xy/public'; +import type { DateHistogramParams, HistogramParams } from '../../../visualizations/public'; -import { BUCKET_TYPES } from '../../data/public'; +import { BUCKET_TYPES } from '../../../data/public'; import { vislibVisName, VisTypeVislibExpressionFunctionDefinition } from './vis_type_vislib_vis_fn'; import { BasicVislibParams, VislibChartType } from './types'; diff --git a/src/plugins/vis_type_vislib/public/to_ast_esaggs.ts b/src/plugins/vis_types/vislib/public/to_ast_esaggs.ts similarity index 91% rename from src/plugins/vis_type_vislib/public/to_ast_esaggs.ts rename to src/plugins/vis_types/vislib/public/to_ast_esaggs.ts index c7e351ccc0429..d34989917e707 100644 --- a/src/plugins/vis_type_vislib/public/to_ast_esaggs.ts +++ b/src/plugins/vis_types/vislib/public/to_ast_esaggs.ts @@ -6,12 +6,12 @@ * Side Public License, v 1. */ -import { Vis } from '../../visualizations/public'; -import { buildExpression, buildExpressionFunction } from '../../expressions/public'; +import { Vis } from '../../../visualizations/public'; +import { buildExpression, buildExpressionFunction } from '../../../expressions/public'; import { EsaggsExpressionFunctionDefinition, IndexPatternLoadExpressionFunctionDefinition, -} from '../../data/public'; +} from '../../../data/public'; /** * Get esaggs expressions function diff --git a/src/plugins/vis_type_vislib/public/to_ast_pie.test.ts b/src/plugins/vis_types/vislib/public/to_ast_pie.test.ts similarity index 78% rename from src/plugins/vis_type_vislib/public/to_ast_pie.test.ts rename to src/plugins/vis_types/vislib/public/to_ast_pie.test.ts index 3178c23ee8fa0..6202df3f65094 100644 --- a/src/plugins/vis_type_vislib/public/to_ast_pie.test.ts +++ b/src/plugins/vis_types/vislib/public/to_ast_pie.test.ts @@ -6,15 +6,15 @@ * Side Public License, v 1. */ -import { Vis } from '../../visualizations/public'; -import { buildExpression } from '../../expressions/public'; +import { Vis } from '../../../visualizations/public'; +import { buildExpression } from '../../../expressions/public'; import { PieVisParams } from './pie'; -import { samplePieVis } from '../../vis_type_pie/public/sample_vis.test.mocks'; +import { samplePieVis } from '../../pie/public/sample_vis.test.mocks'; import { toExpressionAst } from './to_ast_pie'; -jest.mock('../../expressions/public', () => ({ - ...(jest.requireActual('../../expressions/public') as any), +jest.mock('../../../expressions/public', () => ({ + ...(jest.requireActual('../../../expressions/public') as any), buildExpression: jest.fn().mockImplementation(() => ({ toAst: () => ({ type: 'expression', diff --git a/src/plugins/vis_type_vislib/public/to_ast_pie.ts b/src/plugins/vis_types/vislib/public/to_ast_pie.ts similarity index 91% rename from src/plugins/vis_type_vislib/public/to_ast_pie.ts rename to src/plugins/vis_types/vislib/public/to_ast_pie.ts index 05a887b5513a3..90c181f8ac74e 100644 --- a/src/plugins/vis_type_vislib/public/to_ast_pie.ts +++ b/src/plugins/vis_types/vislib/public/to_ast_pie.ts @@ -6,8 +6,8 @@ * Side Public License, v 1. */ -import { getVisSchemas, VisToExpressionAst } from '../../visualizations/public'; -import { buildExpression, buildExpressionFunction } from '../../expressions/public'; +import { getVisSchemas, VisToExpressionAst } from '../../../visualizations/public'; +import { buildExpression, buildExpressionFunction } from '../../../expressions/public'; import { PieVisParams } from './pie'; import { vislibPieName, VisTypeVislibPieExpressionFunctionDefinition } from './pie_fn'; diff --git a/src/plugins/vis_type_vislib/public/types.ts b/src/plugins/vis_types/vislib/public/types.ts similarity index 95% rename from src/plugins/vis_type_vislib/public/types.ts rename to src/plugins/vis_types/vislib/public/types.ts index d5432a12624fb..5196f0e33f404 100644 --- a/src/plugins/vis_type_vislib/public/types.ts +++ b/src/plugins/vis_types/vislib/public/types.ts @@ -9,7 +9,7 @@ import { $Values } from '@kbn/utility-types'; import { Position } from '@elastic/charts'; -import { Labels } from '../../charts/public'; +import { Labels } from '../../../charts/public'; import { CategoryAxis, Dimensions, @@ -17,7 +17,7 @@ import { SeriesParam, ThresholdLine, ValueAxis, -} from '../../vis_type_xy/public'; +} from '../../../vis_types/xy/public'; import { TimeMarker } from './vislib/visualizations/time_marker'; /** diff --git a/src/plugins/vis_type_vislib/public/vis_controller.tsx b/src/plugins/vis_types/vislib/public/vis_controller.tsx similarity index 94% rename from src/plugins/vis_type_vislib/public/vis_controller.tsx rename to src/plugins/vis_types/vislib/public/vis_controller.tsx index 73d110e4d8d75..7bae32d031b46 100644 --- a/src/plugins/vis_type_vislib/public/vis_controller.tsx +++ b/src/plugins/vis_types/vislib/public/vis_controller.tsx @@ -9,10 +9,10 @@ import $ from 'jquery'; import React, { RefObject } from 'react'; -import { mountReactNode } from '../../../core/public/utils'; -import { ChartsPluginSetup } from '../../charts/public'; -import type { PersistedState } from '../../visualizations/public'; -import { IInterpreterRenderHandlers } from '../../expressions/public'; +import { mountReactNode } from '../../../../core/public/utils'; +import { ChartsPluginSetup } from '../../../charts/public'; +import type { PersistedState } from '../../../visualizations/public'; +import { IInterpreterRenderHandlers } from '../../../expressions/public'; import { VisTypeVislibCoreSetup } from './plugin'; import { VisLegend, CUSTOM_LEGEND_VIS_TYPES } from './vislib/components/legend'; diff --git a/src/plugins/vis_type_vislib/public/vis_renderer.tsx b/src/plugins/vis_types/vislib/public/vis_renderer.tsx similarity index 89% rename from src/plugins/vis_type_vislib/public/vis_renderer.tsx rename to src/plugins/vis_types/vislib/public/vis_renderer.tsx index 2e954b9a5b710..04c4c3cedc9d2 100644 --- a/src/plugins/vis_type_vislib/public/vis_renderer.tsx +++ b/src/plugins/vis_types/vislib/public/vis_renderer.tsx @@ -9,9 +9,9 @@ import React, { lazy } from 'react'; import { render, unmountComponentAtNode } from 'react-dom'; -import { ExpressionRenderDefinition } from '../../expressions/public'; -import { VisualizationContainer } from '../../visualizations/public'; -import { ChartsPluginSetup } from '../../charts/public'; +import { ExpressionRenderDefinition } from '../../../expressions/public'; +import { VisualizationContainer } from '../../../visualizations/public'; +import { ChartsPluginSetup } from '../../../charts/public'; import { VisTypeVislibCoreSetup } from './plugin'; import { VislibRenderValue, vislibVisName } from './vis_type_vislib_vis_fn'; diff --git a/src/plugins/vis_type_vislib/public/vis_type_vislib_vis_fn.ts b/src/plugins/vis_types/vislib/public/vis_type_vislib_vis_fn.ts similarity index 98% rename from src/plugins/vis_type_vislib/public/vis_type_vislib_vis_fn.ts rename to src/plugins/vis_types/vislib/public/vis_type_vislib_vis_fn.ts index 2a987b3691f5e..0658ed1b7c4b1 100644 --- a/src/plugins/vis_type_vislib/public/vis_type_vislib_vis_fn.ts +++ b/src/plugins/vis_types/vislib/public/vis_type_vislib_vis_fn.ts @@ -8,7 +8,7 @@ import { i18n } from '@kbn/i18n'; -import { ExpressionFunctionDefinition, Datatable, Render } from '../../expressions/public'; +import { ExpressionFunctionDefinition, Datatable, Render } from '../../../expressions/public'; // @ts-ignore import { vislibSeriesResponseHandler } from './vislib/response_handler'; diff --git a/src/plugins/vis_type_vislib/public/vis_type_vislib_vis_types.ts b/src/plugins/vis_types/vislib/public/vis_type_vislib_vis_types.ts similarity index 100% rename from src/plugins/vis_type_vislib/public/vis_type_vislib_vis_types.ts rename to src/plugins/vis_types/vislib/public/vis_type_vislib_vis_types.ts diff --git a/src/plugins/vis_type_vislib/public/vis_wrapper.tsx b/src/plugins/vis_types/vislib/public/vis_wrapper.tsx similarity index 92% rename from src/plugins/vis_type_vislib/public/vis_wrapper.tsx rename to src/plugins/vis_types/vislib/public/vis_wrapper.tsx index c9b978b3a2cee..e3948807005e6 100644 --- a/src/plugins/vis_type_vislib/public/vis_wrapper.tsx +++ b/src/plugins/vis_types/vislib/public/vis_wrapper.tsx @@ -10,9 +10,9 @@ import React, { useEffect, useMemo, useRef } from 'react'; import { EuiResizeObserver } from '@elastic/eui'; import { debounce } from 'lodash'; -import { IInterpreterRenderHandlers } from '../../expressions/public'; -import type { PersistedState } from '../../visualizations/public'; -import { ChartsPluginSetup } from '../../charts/public'; +import { IInterpreterRenderHandlers } from '../../../expressions/public'; +import type { PersistedState } from '../../../visualizations/public'; +import { ChartsPluginSetup } from '../../../charts/public'; import { VislibRenderValue } from './vis_type_vislib_vis_fn'; import { createVislibVisController, VislibVisController } from './vis_controller'; diff --git a/src/plugins/vis_type_vislib/public/vislib/VISLIB.md b/src/plugins/vis_types/vislib/public/vislib/VISLIB.md similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/VISLIB.md rename to src/plugins/vis_types/vislib/public/vislib/VISLIB.md diff --git a/src/plugins/vis_type_vislib/public/vislib/_index.scss b/src/plugins/vis_types/vislib/public/vislib/_index.scss similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/_index.scss rename to src/plugins/vis_types/vislib/public/vislib/_index.scss diff --git a/src/plugins/vis_type_vislib/public/vislib/_variables.scss b/src/plugins/vis_types/vislib/public/vislib/_variables.scss similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/_variables.scss rename to src/plugins/vis_types/vislib/public/vislib/_variables.scss diff --git a/src/plugins/vis_type_vislib/public/vislib/_vislib_vis_type.scss b/src/plugins/vis_types/vislib/public/vislib/_vislib_vis_type.scss similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/_vislib_vis_type.scss rename to src/plugins/vis_types/vislib/public/vislib/_vislib_vis_type.scss diff --git a/src/plugins/vis_type_vislib/public/vislib/components/labels/data_array.js b/src/plugins/vis_types/vislib/public/vislib/components/labels/data_array.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/labels/data_array.js rename to src/plugins/vis_types/vislib/public/vislib/components/labels/data_array.js diff --git a/src/plugins/vis_type_vislib/public/vislib/components/labels/flatten_series.js b/src/plugins/vis_types/vislib/public/vislib/components/labels/flatten_series.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/labels/flatten_series.js rename to src/plugins/vis_types/vislib/public/vislib/components/labels/flatten_series.js diff --git a/src/plugins/vis_type_vislib/public/vislib/components/labels/index.js b/src/plugins/vis_types/vislib/public/vislib/components/labels/index.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/labels/index.js rename to src/plugins/vis_types/vislib/public/vislib/components/labels/index.js diff --git a/src/plugins/vis_type_vislib/public/vislib/components/labels/labels.js b/src/plugins/vis_types/vislib/public/vislib/components/labels/labels.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/labels/labels.js rename to src/plugins/vis_types/vislib/public/vislib/components/labels/labels.js diff --git a/src/plugins/vis_type_vislib/public/vislib/components/labels/labels.test.js b/src/plugins/vis_types/vislib/public/vislib/components/labels/labels.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/labels/labels.test.js rename to src/plugins/vis_types/vislib/public/vislib/components/labels/labels.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/components/labels/truncate_labels.js b/src/plugins/vis_types/vislib/public/vislib/components/labels/truncate_labels.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/labels/truncate_labels.js rename to src/plugins/vis_types/vislib/public/vislib/components/labels/truncate_labels.js diff --git a/src/plugins/vis_type_vislib/public/vislib/components/labels/uniq_labels.js b/src/plugins/vis_types/vislib/public/vislib/components/labels/uniq_labels.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/labels/uniq_labels.js rename to src/plugins/vis_types/vislib/public/vislib/components/labels/uniq_labels.js diff --git a/src/plugins/vis_type_vislib/public/vislib/components/legend/__snapshots__/legend.test.tsx.snap b/src/plugins/vis_types/vislib/public/vislib/components/legend/__snapshots__/legend.test.tsx.snap similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/legend/__snapshots__/legend.test.tsx.snap rename to src/plugins/vis_types/vislib/public/vislib/components/legend/__snapshots__/legend.test.tsx.snap diff --git a/src/plugins/vis_type_vislib/public/vislib/components/legend/_index.scss b/src/plugins/vis_types/vislib/public/vislib/components/legend/_index.scss similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/legend/_index.scss rename to src/plugins/vis_types/vislib/public/vislib/components/legend/_index.scss diff --git a/src/plugins/vis_type_vislib/public/vislib/components/legend/_legend.scss b/src/plugins/vis_types/vislib/public/vislib/components/legend/_legend.scss similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/legend/_legend.scss rename to src/plugins/vis_types/vislib/public/vislib/components/legend/_legend.scss diff --git a/src/plugins/vis_type_vislib/public/vislib/components/legend/index.ts b/src/plugins/vis_types/vislib/public/vislib/components/legend/index.ts similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/legend/index.ts rename to src/plugins/vis_types/vislib/public/vislib/components/legend/index.ts diff --git a/src/plugins/vis_type_vislib/public/vislib/components/legend/legend.test.tsx b/src/plugins/vis_types/vislib/public/vislib/components/legend/legend.test.tsx similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/legend/legend.test.tsx rename to src/plugins/vis_types/vislib/public/vislib/components/legend/legend.test.tsx diff --git a/src/plugins/vis_type_vislib/public/vislib/components/legend/legend.tsx b/src/plugins/vis_types/vislib/public/vislib/components/legend/legend.tsx similarity index 98% rename from src/plugins/vis_type_vislib/public/vislib/components/legend/legend.tsx rename to src/plugins/vis_types/vislib/public/vislib/components/legend/legend.tsx index 9ce5a5339c04f..56f9025a6bd0b 100644 --- a/src/plugins/vis_type_vislib/public/vislib/components/legend/legend.tsx +++ b/src/plugins/vis_types/vislib/public/vislib/components/legend/legend.tsx @@ -13,8 +13,8 @@ import { compact, uniqBy, map, every, isUndefined } from 'lodash'; import { i18n } from '@kbn/i18n'; import { EuiPopoverProps, EuiIcon, keys, htmlIdGenerator } from '@elastic/eui'; -import { PersistedState } from '../../../../../visualizations/public'; -import { IInterpreterRenderHandlers } from '../../../../../expressions/public'; +import { PersistedState } from '../../../../../../visualizations/public'; +import { IInterpreterRenderHandlers } from '../../../../../../expressions/public'; import { getDataActions } from '../../../services'; import { CUSTOM_LEGEND_VIS_TYPES, LegendItem } from './models'; diff --git a/src/plugins/vis_type_vislib/public/vislib/components/legend/legend_item.tsx b/src/plugins/vis_types/vislib/public/vislib/components/legend/legend_item.tsx similarity index 98% rename from src/plugins/vis_type_vislib/public/vislib/components/legend/legend_item.tsx rename to src/plugins/vis_types/vislib/public/vislib/components/legend/legend_item.tsx index f4ca3eb5c40ae..5752a0ac09e8f 100644 --- a/src/plugins/vis_type_vislib/public/vislib/components/legend/legend_item.tsx +++ b/src/plugins/vis_types/vislib/public/vislib/components/legend/legend_item.tsx @@ -21,7 +21,7 @@ import { } from '@elastic/eui'; import { LegendItem } from './models'; -import { ColorPicker } from '../../../../../charts/public'; +import { ColorPicker } from '../../../../../../charts/public'; interface Props { item: LegendItem; diff --git a/src/plugins/vis_type_vislib/public/vislib/components/legend/models.ts b/src/plugins/vis_types/vislib/public/vislib/components/legend/models.ts similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/legend/models.ts rename to src/plugins/vis_types/vislib/public/vislib/components/legend/models.ts diff --git a/src/plugins/vis_type_vislib/public/vislib/components/legend/pie_utils.ts b/src/plugins/vis_types/vislib/public/vislib/components/legend/pie_utils.ts similarity index 97% rename from src/plugins/vis_type_vislib/public/vislib/components/legend/pie_utils.ts rename to src/plugins/vis_types/vislib/public/vislib/components/legend/pie_utils.ts index 61051eadf6b93..0912adaf9f548 100644 --- a/src/plugins/vis_type_vislib/public/vislib/components/legend/pie_utils.ts +++ b/src/plugins/vis_types/vislib/public/vislib/components/legend/pie_utils.ts @@ -14,7 +14,7 @@ import _ from 'lodash'; * * > Duplicated utilty method from vislib Data class to decouple `vislib_vis_legend` from `vislib` * - * @see src/plugins/vis_type_vislib/public/vislib/lib/data.js + * @see src/plugins/vis_types/vislib/public/vislib/lib/data.js * * @returns {Array} Array of unique names (strings) */ diff --git a/src/plugins/vis_type_vislib/public/vislib/components/tooltip/_collect_branch.js b/src/plugins/vis_types/vislib/public/vislib/components/tooltip/_collect_branch.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/tooltip/_collect_branch.js rename to src/plugins/vis_types/vislib/public/vislib/components/tooltip/_collect_branch.js diff --git a/src/plugins/vis_type_vislib/public/vislib/components/tooltip/_collect_branch.test.js b/src/plugins/vis_types/vislib/public/vislib/components/tooltip/_collect_branch.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/tooltip/_collect_branch.test.js rename to src/plugins/vis_types/vislib/public/vislib/components/tooltip/_collect_branch.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/components/tooltip/_hierarchical_tooltip_formatter.js b/src/plugins/vis_types/vislib/public/vislib/components/tooltip/_hierarchical_tooltip_formatter.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/tooltip/_hierarchical_tooltip_formatter.js rename to src/plugins/vis_types/vislib/public/vislib/components/tooltip/_hierarchical_tooltip_formatter.js diff --git a/src/plugins/vis_type_vislib/public/vislib/components/tooltip/_index.scss b/src/plugins/vis_types/vislib/public/vislib/components/tooltip/_index.scss similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/tooltip/_index.scss rename to src/plugins/vis_types/vislib/public/vislib/components/tooltip/_index.scss diff --git a/src/plugins/vis_type_vislib/public/vislib/components/tooltip/_pointseries_tooltip_formatter.js b/src/plugins/vis_types/vislib/public/vislib/components/tooltip/_pointseries_tooltip_formatter.js similarity index 97% rename from src/plugins/vis_type_vislib/public/vislib/components/tooltip/_pointseries_tooltip_formatter.js rename to src/plugins/vis_types/vislib/public/vislib/components/tooltip/_pointseries_tooltip_formatter.js index 04ab8db1cda8f..ecd741bc4d5d0 100644 --- a/src/plugins/vis_type_vislib/public/vislib/components/tooltip/_pointseries_tooltip_formatter.js +++ b/src/plugins/vis_types/vislib/public/vislib/components/tooltip/_pointseries_tooltip_formatter.js @@ -9,7 +9,7 @@ import { last } from 'lodash'; import React from 'react'; import { renderToStaticMarkup } from 'react-dom/server'; -import { FORMATS_UI_SETTINGS } from '../../../../../../plugins/field_formats/common'; +import { FORMATS_UI_SETTINGS } from '../../../../../../../plugins/field_formats/common'; import { getValueForPercentageMode } from '../../percentage_mode_transform'; function getMax(handler, config, isGauge) { diff --git a/src/plugins/vis_type_vislib/public/vislib/components/tooltip/_pointseries_tooltip_formatter.test.js b/src/plugins/vis_types/vislib/public/vislib/components/tooltip/_pointseries_tooltip_formatter.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/tooltip/_pointseries_tooltip_formatter.test.js rename to src/plugins/vis_types/vislib/public/vislib/components/tooltip/_pointseries_tooltip_formatter.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/components/tooltip/_tooltip.scss b/src/plugins/vis_types/vislib/public/vislib/components/tooltip/_tooltip.scss similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/tooltip/_tooltip.scss rename to src/plugins/vis_types/vislib/public/vislib/components/tooltip/_tooltip.scss diff --git a/src/plugins/vis_type_vislib/public/vislib/components/tooltip/index.js b/src/plugins/vis_types/vislib/public/vislib/components/tooltip/index.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/tooltip/index.js rename to src/plugins/vis_types/vislib/public/vislib/components/tooltip/index.js diff --git a/src/plugins/vis_type_vislib/public/vislib/components/tooltip/position_tooltip.js b/src/plugins/vis_types/vislib/public/vislib/components/tooltip/position_tooltip.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/tooltip/position_tooltip.js rename to src/plugins/vis_types/vislib/public/vislib/components/tooltip/position_tooltip.js diff --git a/src/plugins/vis_type_vislib/public/vislib/components/tooltip/position_tooltip.test.js b/src/plugins/vis_types/vislib/public/vislib/components/tooltip/position_tooltip.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/tooltip/position_tooltip.test.js rename to src/plugins/vis_types/vislib/public/vislib/components/tooltip/position_tooltip.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/components/tooltip/tooltip.js b/src/plugins/vis_types/vislib/public/vislib/components/tooltip/tooltip.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/tooltip/tooltip.js rename to src/plugins/vis_types/vislib/public/vislib/components/tooltip/tooltip.js diff --git a/src/plugins/vis_type_vislib/public/vislib/components/zero_injection/flatten_data.js b/src/plugins/vis_types/vislib/public/vislib/components/zero_injection/flatten_data.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/zero_injection/flatten_data.js rename to src/plugins/vis_types/vislib/public/vislib/components/zero_injection/flatten_data.js diff --git a/src/plugins/vis_type_vislib/public/vislib/components/zero_injection/inject_zeros.js b/src/plugins/vis_types/vislib/public/vislib/components/zero_injection/inject_zeros.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/zero_injection/inject_zeros.js rename to src/plugins/vis_types/vislib/public/vislib/components/zero_injection/inject_zeros.js diff --git a/src/plugins/vis_type_vislib/public/vislib/components/zero_injection/ordered_x_keys.js b/src/plugins/vis_types/vislib/public/vislib/components/zero_injection/ordered_x_keys.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/zero_injection/ordered_x_keys.js rename to src/plugins/vis_types/vislib/public/vislib/components/zero_injection/ordered_x_keys.js diff --git a/src/plugins/vis_type_vislib/public/vislib/components/zero_injection/uniq_keys.js b/src/plugins/vis_types/vislib/public/vislib/components/zero_injection/uniq_keys.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/zero_injection/uniq_keys.js rename to src/plugins/vis_types/vislib/public/vislib/components/zero_injection/uniq_keys.js diff --git a/src/plugins/vis_type_vislib/public/vislib/components/zero_injection/zero_fill_data_array.js b/src/plugins/vis_types/vislib/public/vislib/components/zero_injection/zero_fill_data_array.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/zero_injection/zero_fill_data_array.js rename to src/plugins/vis_types/vislib/public/vislib/components/zero_injection/zero_fill_data_array.js diff --git a/src/plugins/vis_type_vislib/public/vislib/components/zero_injection/zero_filled_array.js b/src/plugins/vis_types/vislib/public/vislib/components/zero_injection/zero_filled_array.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/zero_injection/zero_filled_array.js rename to src/plugins/vis_types/vislib/public/vislib/components/zero_injection/zero_filled_array.js diff --git a/src/plugins/vis_type_vislib/public/vislib/components/zero_injection/zero_injection.test.js b/src/plugins/vis_types/vislib/public/vislib/components/zero_injection/zero_injection.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/components/zero_injection/zero_injection.test.js rename to src/plugins/vis_types/vislib/public/vislib/components/zero_injection/zero_injection.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/errors.ts b/src/plugins/vis_types/vislib/public/vislib/errors.ts similarity index 95% rename from src/plugins/vis_type_vislib/public/vislib/errors.ts rename to src/plugins/vis_types/vislib/public/vislib/errors.ts index cde0f4b43d1cb..67a9d79363e73 100644 --- a/src/plugins/vis_type_vislib/public/vislib/errors.ts +++ b/src/plugins/vis_types/vislib/public/vislib/errors.ts @@ -9,7 +9,7 @@ /* eslint-disable max-classes-per-file */ import { i18n } from '@kbn/i18n'; -import { KbnError } from '../../../kibana_utils/public'; +import { KbnError } from '../../../../kibana_utils/public'; export class VislibError extends KbnError { constructor(message: string) { diff --git a/src/plugins/vis_type_vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.test.ts b/src/plugins/vis_types/vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.test.ts similarity index 99% rename from src/plugins/vis_type_vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.test.ts rename to src/plugins/vis_types/vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.test.ts index de91053b6dc4d..43fdb3c198474 100644 --- a/src/plugins/vis_type_vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.test.ts +++ b/src/plugins/vis_types/vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.test.ts @@ -5,7 +5,7 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ -import type { Dimensions, Dimension } from '../../../../../vis_type_pie/public'; +import type { Dimensions, Dimension } from '../../../../../pie/public'; import { buildHierarchicalData } from './build_hierarchical_data'; import { Table, TableParent } from '../../types'; diff --git a/src/plugins/vis_type_vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.ts b/src/plugins/vis_types/vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.ts similarity index 97% rename from src/plugins/vis_type_vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.ts rename to src/plugins/vis_types/vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.ts index da10edf9591fb..e5b11fcc0339c 100644 --- a/src/plugins/vis_type_vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.ts +++ b/src/plugins/vis_types/vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.ts @@ -9,7 +9,7 @@ import { toArray } from 'lodash'; import { getFormatService } from '../../../services'; import { Table } from '../../types'; -import type { Dimensions } from '../../../../../vis_type_pie/public'; +import type { Dimensions } from '../../../../../pie/public'; interface Slice { name: string; diff --git a/src/plugins/vis_type_vislib/public/vislib/helpers/index.ts b/src/plugins/vis_types/vislib/public/vislib/helpers/index.ts similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/helpers/index.ts rename to src/plugins/vis_types/vislib/public/vislib/helpers/index.ts diff --git a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_add_to_siri.test.ts b/src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_add_to_siri.test.ts similarity index 97% rename from src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_add_to_siri.test.ts rename to src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_add_to_siri.test.ts index a5897519901a1..9256276b1e9c7 100644 --- a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_add_to_siri.test.ts +++ b/src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_add_to_siri.test.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import type { Dimension } from '../../../../../vis_type_xy/public'; +import type { Dimension } from '../../../../../xy/public'; import { addToSiri, Serie } from './_add_to_siri'; import { Point } from './_get_point'; diff --git a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_add_to_siri.ts b/src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_add_to_siri.ts similarity index 89% rename from src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_add_to_siri.ts rename to src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_add_to_siri.ts index 187b569f28867..c334a83f3dd6a 100644 --- a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_add_to_siri.ts +++ b/src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_add_to_siri.ts @@ -6,8 +6,8 @@ * Side Public License, v 1. */ -import { getAggId } from '../../../../../vis_type_xy/public'; -import type { Dimension } from '../../../../../vis_type_xy/public'; +import { getAggId } from '../../../../../xy/public'; +import type { Dimension } from '../../../../../xy/public'; import { Point } from './_get_point'; diff --git a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_fake_x_aspect.test.ts b/src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_fake_x_aspect.test.ts similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_fake_x_aspect.test.ts rename to src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_fake_x_aspect.test.ts diff --git a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_fake_x_aspect.ts b/src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_fake_x_aspect.ts similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_fake_x_aspect.ts rename to src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_fake_x_aspect.ts diff --git a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_aspects.test.ts b/src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_get_aspects.test.ts similarity index 96% rename from src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_aspects.test.ts rename to src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_get_aspects.test.ts index 710857e08ccde..e4ebb1fa47929 100644 --- a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_aspects.test.ts +++ b/src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_get_aspects.test.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import type { Dimension, Dimensions } from '../../../../../vis_type_xy/public'; +import type { Dimension, Dimensions } from '../../../../../xy/public'; import { getAspects } from './_get_aspects'; import { Aspect } from './point_series'; diff --git a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_aspects.ts b/src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_get_aspects.ts similarity index 95% rename from src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_aspects.ts rename to src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_get_aspects.ts index 1f27d2af1942d..1fecf09f77380 100644 --- a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_aspects.ts +++ b/src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_get_aspects.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import type { Dimensions } from '../../../../../vis_type_xy/public'; +import type { Dimensions } from '../../../../../xy/public'; import { makeFakeXAspect } from './_fake_x_aspect'; import { Aspects } from './point_series'; diff --git a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_point.test.ts b/src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_get_point.test.ts similarity index 97% rename from src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_point.test.ts rename to src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_get_point.test.ts index 815d0e10aafb2..bf7ff40904130 100644 --- a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_point.test.ts +++ b/src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_get_point.test.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { IFieldFormatsRegistry } from '../../../../../field_formats/common'; +import { IFieldFormatsRegistry } from '../../../../../../field_formats/common'; import { getPoint } from './_get_point'; import { setFormatService } from '../../../services'; diff --git a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_point.ts b/src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_get_point.ts similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_point.ts rename to src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_get_point.ts diff --git a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_series.test.ts b/src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_get_series.test.ts similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_series.test.ts rename to src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_get_series.test.ts diff --git a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_series.ts b/src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_get_series.ts similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_series.ts rename to src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_get_series.ts diff --git a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_init_x_axis.test.ts b/src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_init_x_axis.test.ts similarity index 99% rename from src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_init_x_axis.test.ts rename to src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_init_x_axis.test.ts index cb0ebe563f54b..251888aa19498 100644 --- a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_init_x_axis.test.ts +++ b/src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_init_x_axis.test.ts @@ -8,7 +8,7 @@ import moment from 'moment'; -import type { DateHistogramParams, HistogramParams } from '../../../../../visualizations/public'; +import type { DateHistogramParams, HistogramParams } from '../../../../../../visualizations/public'; import { initXAxis } from './_init_x_axis'; import { makeFakeXAspect } from './_fake_x_aspect'; diff --git a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_init_x_axis.ts b/src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_init_x_axis.ts similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_init_x_axis.ts rename to src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_init_x_axis.ts diff --git a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_init_y_axis.test.ts b/src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_init_y_axis.test.ts similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_init_y_axis.test.ts rename to src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_init_y_axis.test.ts diff --git a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_init_y_axis.ts b/src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_init_y_axis.ts similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_init_y_axis.ts rename to src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_init_y_axis.ts diff --git a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_ordered_date_axis.test.ts b/src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_ordered_date_axis.test.ts similarity index 95% rename from src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_ordered_date_axis.test.ts rename to src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_ordered_date_axis.test.ts index 4dfa5035275fb..4d39147587169 100644 --- a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_ordered_date_axis.test.ts +++ b/src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_ordered_date_axis.test.ts @@ -9,7 +9,7 @@ import moment from 'moment'; import _ from 'lodash'; -import type { DateHistogramParams } from '../../../../../visualizations/public'; +import type { DateHistogramParams } from '../../../../../../visualizations/public'; import { orderedDateAxis } from './_ordered_date_axis'; import { OrderedChart } from './point_series'; diff --git a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_ordered_date_axis.ts b/src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_ordered_date_axis.ts similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_ordered_date_axis.ts rename to src/plugins/vis_types/vislib/public/vislib/helpers/point_series/_ordered_date_axis.ts diff --git a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/index.ts b/src/plugins/vis_types/vislib/public/vislib/helpers/point_series/index.ts similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/helpers/point_series/index.ts rename to src/plugins/vis_types/vislib/public/vislib/helpers/point_series/index.ts diff --git a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/point_series.test.ts b/src/plugins/vis_types/vislib/public/vislib/helpers/point_series/point_series.test.ts similarity index 98% rename from src/plugins/vis_type_vislib/public/vislib/helpers/point_series/point_series.test.ts rename to src/plugins/vis_types/vislib/public/vislib/helpers/point_series/point_series.test.ts index 2ff4040e3a8aa..d6e6531866d4b 100644 --- a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/point_series.test.ts +++ b/src/plugins/vis_types/vislib/public/vislib/helpers/point_series/point_series.test.ts @@ -8,7 +8,7 @@ import _ from 'lodash'; -import type { Dimensions } from '../../../../../vis_type_xy/public'; +import type { Dimensions } from '../../../../../xy/public'; import { buildPointSeriesData } from './point_series'; import { Table, Column } from '../../types'; diff --git a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/point_series.ts b/src/plugins/vis_types/vislib/public/vislib/helpers/point_series/point_series.ts similarity index 95% rename from src/plugins/vis_type_vislib/public/vislib/helpers/point_series/point_series.ts rename to src/plugins/vis_types/vislib/public/vislib/helpers/point_series/point_series.ts index 62be39ffb8a73..ec9f0169a48fc 100644 --- a/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/point_series.ts +++ b/src/plugins/vis_types/vislib/public/vislib/helpers/point_series/point_series.ts @@ -8,8 +8,8 @@ import { Duration } from 'moment'; -import type { Dimension, Dimensions } from '../../../../../vis_type_xy/public'; -import type { DateHistogramParams, HistogramParams } from '../../../../../visualizations/public'; +import type { Dimension, Dimensions } from '../../../../../xy/public'; +import type { DateHistogramParams, HistogramParams } from '../../../../../../visualizations/public'; import { getSeries } from './_get_series'; import { getAspects } from './_get_aspects'; diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/__snapshots__/dispatch_heatmap.test.js.snap b/src/plugins/vis_types/vislib/public/vislib/lib/__snapshots__/dispatch_heatmap.test.js.snap similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/__snapshots__/dispatch_heatmap.test.js.snap rename to src/plugins/vis_types/vislib/public/vislib/lib/__snapshots__/dispatch_heatmap.test.js.snap diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/_alerts.scss b/src/plugins/vis_types/vislib/public/vislib/lib/_alerts.scss similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/_alerts.scss rename to src/plugins/vis_types/vislib/public/vislib/lib/_alerts.scss diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/_data_label.js b/src/plugins/vis_types/vislib/public/vislib/lib/_data_label.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/_data_label.js rename to src/plugins/vis_types/vislib/public/vislib/lib/_data_label.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/_error_handler.js b/src/plugins/vis_types/vislib/public/vislib/lib/_error_handler.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/_error_handler.js rename to src/plugins/vis_types/vislib/public/vislib/lib/_error_handler.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/_error_handler.test.js b/src/plugins/vis_types/vislib/public/vislib/lib/_error_handler.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/_error_handler.test.js rename to src/plugins/vis_types/vislib/public/vislib/lib/_error_handler.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/_index.scss b/src/plugins/vis_types/vislib/public/vislib/lib/_index.scss similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/_index.scss rename to src/plugins/vis_types/vislib/public/vislib/lib/_index.scss diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/alerts.js b/src/plugins/vis_types/vislib/public/vislib/lib/alerts.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/alerts.js rename to src/plugins/vis_types/vislib/public/vislib/lib/alerts.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis.js b/src/plugins/vis_types/vislib/public/vislib/lib/axis/axis.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/axis/axis.js rename to src/plugins/vis_types/vislib/public/vislib/lib/axis/axis.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis.test.js b/src/plugins/vis_types/vislib/public/vislib/lib/axis/axis.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/axis/axis.test.js rename to src/plugins/vis_types/vislib/public/vislib/lib/axis/axis.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_config.js b/src/plugins/vis_types/vislib/public/vislib/lib/axis/axis_config.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_config.js rename to src/plugins/vis_types/vislib/public/vislib/lib/axis/axis_config.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_labels.js b/src/plugins/vis_types/vislib/public/vislib/lib/axis/axis_labels.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_labels.js rename to src/plugins/vis_types/vislib/public/vislib/lib/axis/axis_labels.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_scale.js b/src/plugins/vis_types/vislib/public/vislib/lib/axis/axis_scale.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_scale.js rename to src/plugins/vis_types/vislib/public/vislib/lib/axis/axis_scale.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_title.js b/src/plugins/vis_types/vislib/public/vislib/lib/axis/axis_title.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_title.js rename to src/plugins/vis_types/vislib/public/vislib/lib/axis/axis_title.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_title.test.js b/src/plugins/vis_types/vislib/public/vislib/lib/axis/axis_title.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_title.test.js rename to src/plugins/vis_types/vislib/public/vislib/lib/axis/axis_title.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/axis/index.js b/src/plugins/vis_types/vislib/public/vislib/lib/axis/index.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/axis/index.js rename to src/plugins/vis_types/vislib/public/vislib/lib/axis/index.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/axis/scale_modes.js b/src/plugins/vis_types/vislib/public/vislib/lib/axis/scale_modes.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/axis/scale_modes.js rename to src/plugins/vis_types/vislib/public/vislib/lib/axis/scale_modes.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/axis/time_ticks.js b/src/plugins/vis_types/vislib/public/vislib/lib/axis/time_ticks.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/axis/time_ticks.js rename to src/plugins/vis_types/vislib/public/vislib/lib/axis/time_ticks.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/axis/time_ticks.test.js b/src/plugins/vis_types/vislib/public/vislib/lib/axis/time_ticks.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/axis/time_ticks.test.js rename to src/plugins/vis_types/vislib/public/vislib/lib/axis/time_ticks.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/axis/x_axis.test.js b/src/plugins/vis_types/vislib/public/vislib/lib/axis/x_axis.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/axis/x_axis.test.js rename to src/plugins/vis_types/vislib/public/vislib/lib/axis/x_axis.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/axis/y_axis.test.js b/src/plugins/vis_types/vislib/public/vislib/lib/axis/y_axis.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/axis/y_axis.test.js rename to src/plugins/vis_types/vislib/public/vislib/lib/axis/y_axis.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/binder.ts b/src/plugins/vis_types/vislib/public/vislib/lib/binder.ts similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/binder.ts rename to src/plugins/vis_types/vislib/public/vislib/lib/binder.ts diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/chart_grid.js b/src/plugins/vis_types/vislib/public/vislib/lib/chart_grid.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/chart_grid.js rename to src/plugins/vis_types/vislib/public/vislib/lib/chart_grid.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/chart_title.js b/src/plugins/vis_types/vislib/public/vislib/lib/chart_title.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/chart_title.js rename to src/plugins/vis_types/vislib/public/vislib/lib/chart_title.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/chart_title.test.js b/src/plugins/vis_types/vislib/public/vislib/lib/chart_title.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/chart_title.test.js rename to src/plugins/vis_types/vislib/public/vislib/lib/chart_title.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/data.js b/src/plugins/vis_types/vislib/public/vislib/lib/data.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/data.js rename to src/plugins/vis_types/vislib/public/vislib/lib/data.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/data.test.js b/src/plugins/vis_types/vislib/public/vislib/lib/data.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/data.test.js rename to src/plugins/vis_types/vislib/public/vislib/lib/data.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/dispatch.js b/src/plugins/vis_types/vislib/public/vislib/lib/dispatch.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/dispatch.js rename to src/plugins/vis_types/vislib/public/vislib/lib/dispatch.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/dispatch.test.js b/src/plugins/vis_types/vislib/public/vislib/lib/dispatch.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/dispatch.test.js rename to src/plugins/vis_types/vislib/public/vislib/lib/dispatch.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/dispatch_heatmap.test.js b/src/plugins/vis_types/vislib/public/vislib/lib/dispatch_heatmap.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/dispatch_heatmap.test.js rename to src/plugins/vis_types/vislib/public/vislib/lib/dispatch_heatmap.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/dispatch_vertical_bar_chart.test.js b/src/plugins/vis_types/vislib/public/vislib/lib/dispatch_vertical_bar_chart.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/dispatch_vertical_bar_chart.test.js rename to src/plugins/vis_types/vislib/public/vislib/lib/dispatch_vertical_bar_chart.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/handler.js b/src/plugins/vis_types/vislib/public/vislib/lib/handler.js similarity index 98% rename from src/plugins/vis_type_vislib/public/vislib/lib/handler.js rename to src/plugins/vis_types/vislib/public/vislib/lib/handler.js index 1be6271382b10..a2b747f4d5d9c 100644 --- a/src/plugins/vis_type_vislib/public/vislib/lib/handler.js +++ b/src/plugins/vis_types/vislib/public/vislib/lib/handler.js @@ -11,7 +11,7 @@ import _ from 'lodash'; import MarkdownIt from 'markdown-it'; import moment from 'moment'; -import { dispatchRenderComplete } from '../../../../kibana_utils/public'; +import { dispatchRenderComplete } from '../../../../../kibana_utils/public'; import { visTypes as chartTypes } from '../visualizations/vis_types'; import { NoResults } from '../errors'; diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/handler.test.js b/src/plugins/vis_types/vislib/public/vislib/lib/handler.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/handler.test.js rename to src/plugins/vis_types/vislib/public/vislib/lib/handler.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/layout/_index.scss b/src/plugins/vis_types/vislib/public/vislib/lib/layout/_index.scss similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/layout/_index.scss rename to src/plugins/vis_types/vislib/public/vislib/lib/layout/_index.scss diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/layout/_layout.scss b/src/plugins/vis_types/vislib/public/vislib/lib/layout/_layout.scss similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/layout/_layout.scss rename to src/plugins/vis_types/vislib/public/vislib/lib/layout/_layout.scss diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/layout/index.js b/src/plugins/vis_types/vislib/public/vislib/lib/layout/index.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/layout/index.js rename to src/plugins/vis_types/vislib/public/vislib/lib/layout/index.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/layout/layout.js b/src/plugins/vis_types/vislib/public/vislib/lib/layout/layout.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/layout/layout.js rename to src/plugins/vis_types/vislib/public/vislib/lib/layout/layout.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/layout/layout.test.js b/src/plugins/vis_types/vislib/public/vislib/lib/layout/layout.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/layout/layout.test.js rename to src/plugins/vis_types/vislib/public/vislib/lib/layout/layout.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/layout/layout_types.js b/src/plugins/vis_types/vislib/public/vislib/lib/layout/layout_types.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/layout/layout_types.js rename to src/plugins/vis_types/vislib/public/vislib/lib/layout/layout_types.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/layout/layout_types.test.js b/src/plugins/vis_types/vislib/public/vislib/lib/layout/layout_types.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/layout/layout_types.test.js rename to src/plugins/vis_types/vislib/public/vislib/lib/layout/layout_types.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/chart_split.js b/src/plugins/vis_types/vislib/public/vislib/lib/layout/splits/column_chart/chart_split.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/chart_split.js rename to src/plugins/vis_types/vislib/public/vislib/lib/layout/splits/column_chart/chart_split.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/chart_title_split.js b/src/plugins/vis_types/vislib/public/vislib/lib/layout/splits/column_chart/chart_title_split.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/chart_title_split.js rename to src/plugins/vis_types/vislib/public/vislib/lib/layout/splits/column_chart/chart_title_split.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/splits.test.js b/src/plugins/vis_types/vislib/public/vislib/lib/layout/splits/column_chart/splits.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/splits.test.js rename to src/plugins/vis_types/vislib/public/vislib/lib/layout/splits/column_chart/splits.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/x_axis_split.js b/src/plugins/vis_types/vislib/public/vislib/lib/layout/splits/column_chart/x_axis_split.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/x_axis_split.js rename to src/plugins/vis_types/vislib/public/vislib/lib/layout/splits/column_chart/x_axis_split.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/y_axis_split.js b/src/plugins/vis_types/vislib/public/vislib/lib/layout/splits/column_chart/y_axis_split.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/y_axis_split.js rename to src/plugins/vis_types/vislib/public/vislib/lib/layout/splits/column_chart/y_axis_split.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/gauge_chart/chart_split.js b/src/plugins/vis_types/vislib/public/vislib/lib/layout/splits/gauge_chart/chart_split.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/gauge_chart/chart_split.js rename to src/plugins/vis_types/vislib/public/vislib/lib/layout/splits/gauge_chart/chart_split.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/gauge_chart/chart_title_split.js b/src/plugins/vis_types/vislib/public/vislib/lib/layout/splits/gauge_chart/chart_title_split.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/gauge_chart/chart_title_split.js rename to src/plugins/vis_types/vislib/public/vislib/lib/layout/splits/gauge_chart/chart_title_split.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/gauge_chart/splits.test.js b/src/plugins/vis_types/vislib/public/vislib/lib/layout/splits/gauge_chart/splits.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/gauge_chart/splits.test.js rename to src/plugins/vis_types/vislib/public/vislib/lib/layout/splits/gauge_chart/splits.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/pie_chart/chart_split.js b/src/plugins/vis_types/vislib/public/vislib/lib/layout/splits/pie_chart/chart_split.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/pie_chart/chart_split.js rename to src/plugins/vis_types/vislib/public/vislib/lib/layout/splits/pie_chart/chart_split.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/pie_chart/chart_title_split.js b/src/plugins/vis_types/vislib/public/vislib/lib/layout/splits/pie_chart/chart_title_split.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/pie_chart/chart_title_split.js rename to src/plugins/vis_types/vislib/public/vislib/lib/layout/splits/pie_chart/chart_title_split.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/layout/types/column_layout.js b/src/plugins/vis_types/vislib/public/vislib/lib/layout/types/column_layout.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/layout/types/column_layout.js rename to src/plugins/vis_types/vislib/public/vislib/lib/layout/types/column_layout.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/layout/types/column_layout.test.js b/src/plugins/vis_types/vislib/public/vislib/lib/layout/types/column_layout.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/layout/types/column_layout.test.js rename to src/plugins/vis_types/vislib/public/vislib/lib/layout/types/column_layout.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/layout/types/gauge_layout.js b/src/plugins/vis_types/vislib/public/vislib/lib/layout/types/gauge_layout.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/layout/types/gauge_layout.js rename to src/plugins/vis_types/vislib/public/vislib/lib/layout/types/gauge_layout.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/layout/types/pie_layout.js b/src/plugins/vis_types/vislib/public/vislib/lib/layout/types/pie_layout.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/layout/types/pie_layout.js rename to src/plugins/vis_types/vislib/public/vislib/lib/layout/types/pie_layout.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/types/gauge.js b/src/plugins/vis_types/vislib/public/vislib/lib/types/gauge.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/types/gauge.js rename to src/plugins/vis_types/vislib/public/vislib/lib/types/gauge.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/types/index.js b/src/plugins/vis_types/vislib/public/vislib/lib/types/index.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/types/index.js rename to src/plugins/vis_types/vislib/public/vislib/lib/types/index.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/types/pie.js b/src/plugins/vis_types/vislib/public/vislib/lib/types/pie.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/types/pie.js rename to src/plugins/vis_types/vislib/public/vislib/lib/types/pie.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/types/point_series.js b/src/plugins/vis_types/vislib/public/vislib/lib/types/point_series.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/types/point_series.js rename to src/plugins/vis_types/vislib/public/vislib/lib/types/point_series.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/types/point_series.test.js b/src/plugins/vis_types/vislib/public/vislib/lib/types/point_series.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/types/point_series.test.js rename to src/plugins/vis_types/vislib/public/vislib/lib/types/point_series.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/types/testdata_linechart_percentile.json b/src/plugins/vis_types/vislib/public/vislib/lib/types/testdata_linechart_percentile.json similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/types/testdata_linechart_percentile.json rename to src/plugins/vis_types/vislib/public/vislib/lib/types/testdata_linechart_percentile.json diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/types/testdata_linechart_percentile_float_value.json b/src/plugins/vis_types/vislib/public/vislib/lib/types/testdata_linechart_percentile_float_value.json similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/types/testdata_linechart_percentile_float_value.json rename to src/plugins/vis_types/vislib/public/vislib/lib/types/testdata_linechart_percentile_float_value.json diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/types/testdata_linechart_percentile_float_value_result.json b/src/plugins/vis_types/vislib/public/vislib/lib/types/testdata_linechart_percentile_float_value_result.json similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/types/testdata_linechart_percentile_float_value_result.json rename to src/plugins/vis_types/vislib/public/vislib/lib/types/testdata_linechart_percentile_float_value_result.json diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/types/testdata_linechart_percentile_result.json b/src/plugins/vis_types/vislib/public/vislib/lib/types/testdata_linechart_percentile_result.json similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/types/testdata_linechart_percentile_result.json rename to src/plugins/vis_types/vislib/public/vislib/lib/types/testdata_linechart_percentile_result.json diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/vis_config.js b/src/plugins/vis_types/vislib/public/vislib/lib/vis_config.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/vis_config.js rename to src/plugins/vis_types/vislib/public/vislib/lib/vis_config.js diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/vis_config.test.js b/src/plugins/vis_types/vislib/public/vislib/lib/vis_config.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/lib/vis_config.test.js rename to src/plugins/vis_types/vislib/public/vislib/lib/vis_config.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/partials/touchdown_template.tsx b/src/plugins/vis_types/vislib/public/vislib/partials/touchdown_template.tsx similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/partials/touchdown_template.tsx rename to src/plugins/vis_types/vislib/public/vislib/partials/touchdown_template.tsx diff --git a/src/plugins/vis_type_vislib/public/vislib/percentage_mode_transform.ts b/src/plugins/vis_types/vislib/public/vislib/percentage_mode_transform.ts similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/percentage_mode_transform.ts rename to src/plugins/vis_types/vislib/public/vislib/percentage_mode_transform.ts diff --git a/src/plugins/vis_type_vislib/public/vislib/response_handler.js b/src/plugins/vis_types/vislib/public/vislib/response_handler.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/response_handler.js rename to src/plugins/vis_types/vislib/public/vislib/response_handler.js diff --git a/src/plugins/vis_type_vislib/public/vislib/response_handler.test.ts b/src/plugins/vis_types/vislib/public/vislib/response_handler.test.ts similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/response_handler.test.ts rename to src/plugins/vis_types/vislib/public/vislib/response_handler.test.ts diff --git a/src/plugins/vis_type_vislib/public/vislib/types.ts b/src/plugins/vis_types/vislib/public/vislib/types.ts similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/types.ts rename to src/plugins/vis_types/vislib/public/vislib/types.ts diff --git a/src/plugins/vis_type_vislib/public/vislib/vis.js b/src/plugins/vis_types/vislib/public/vislib/vis.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/vis.js rename to src/plugins/vis_types/vislib/public/vislib/vis.js diff --git a/src/plugins/vis_type_vislib/public/vislib/vis.test.js b/src/plugins/vis_types/vislib/public/vislib/vis.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/vis.test.js rename to src/plugins/vis_types/vislib/public/vislib/vis.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/_chart.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/_chart.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/_chart.js rename to src/plugins/vis_types/vislib/public/vislib/visualizations/_chart.js diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/_vis_fixture.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/_vis_fixture.js similarity index 91% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/_vis_fixture.js rename to src/plugins/vis_types/vislib/public/vislib/visualizations/_vis_fixture.js index aa05eb57f354a..f4e2e4b977b8f 100644 --- a/src/plugins/vis_type_vislib/public/vislib/visualizations/_vis_fixture.js +++ b/src/plugins/vis_types/vislib/public/vislib/visualizations/_vis_fixture.js @@ -8,8 +8,8 @@ import _ from 'lodash'; import $ from 'jquery'; -import { coreMock } from '../../../../../core/public/mocks'; -import { chartPluginMock } from '../../../../charts/public/mocks'; +import { coreMock } from '../../../../../../core/public/mocks'; +import { chartPluginMock } from '../../../../../charts/public/mocks'; import { Vis } from '../vis'; diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/chart.test.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/chart.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/chart.test.js rename to src/plugins/vis_types/vislib/public/vislib/visualizations/chart.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/gauge_chart.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/gauge_chart.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/gauge_chart.js rename to src/plugins/vis_types/vislib/public/vislib/visualizations/gauge_chart.js diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/gauge_chart.test.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/gauge_chart.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/gauge_chart.test.js rename to src/plugins/vis_types/vislib/public/vislib/visualizations/gauge_chart.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/gauges/_index.scss b/src/plugins/vis_types/vislib/public/vislib/visualizations/gauges/_index.scss similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/gauges/_index.scss rename to src/plugins/vis_types/vislib/public/vislib/visualizations/gauges/_index.scss diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/gauges/_meter.scss b/src/plugins/vis_types/vislib/public/vislib/visualizations/gauges/_meter.scss similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/gauges/_meter.scss rename to src/plugins/vis_types/vislib/public/vislib/visualizations/gauges/_meter.scss diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/gauges/gauge_types.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/gauges/gauge_types.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/gauges/gauge_types.js rename to src/plugins/vis_types/vislib/public/vislib/visualizations/gauges/gauge_types.js diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/gauges/meter.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/gauges/meter.js similarity index 98% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/gauges/meter.js rename to src/plugins/vis_types/vislib/public/vislib/visualizations/gauges/meter.js index 65f7df6459bfe..ad278847b0780 100644 --- a/src/plugins/vis_type_vislib/public/vislib/visualizations/gauges/meter.js +++ b/src/plugins/vis_types/vislib/public/vislib/visualizations/gauges/meter.js @@ -9,8 +9,8 @@ import d3 from 'd3'; import _ from 'lodash'; -import { getHeatmapColors } from '../../../../../charts/public'; -import { FORMATS_UI_SETTINGS } from '../../../../../field_formats/common'; +import { getHeatmapColors } from '../../../../../../charts/public'; +import { FORMATS_UI_SETTINGS } from '../../../../../../field_formats/common'; import { getValueForPercentageMode } from '../../percentage_mode_transform'; const arcAngles = { diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/pie_chart.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/pie_chart.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/pie_chart.js rename to src/plugins/vis_types/vislib/public/vislib/visualizations/pie_chart.js diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/pie_chart.test.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/pie_chart.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/pie_chart.test.js rename to src/plugins/vis_types/vislib/public/vislib/visualizations/pie_chart.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/pie_chart_mock_data.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/pie_chart_mock_data.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/pie_chart_mock_data.js rename to src/plugins/vis_types/vislib/public/vislib/visualizations/pie_chart_mock_data.js diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/point_series.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/point_series.js rename to src/plugins/vis_types/vislib/public/vislib/visualizations/point_series.js diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/_index.scss b/src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/_index.scss similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/_index.scss rename to src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/_index.scss diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/_labels.scss b/src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/_labels.scss similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/_labels.scss rename to src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/_labels.scss diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/_point_series.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/_point_series.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/_point_series.js rename to src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/_point_series.js diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/_point_series.test.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/_point_series.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/_point_series.test.js rename to src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/_point_series.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/area_chart.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/area_chart.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/area_chart.js rename to src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/area_chart.js diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/area_chart.test.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/area_chart.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/area_chart.test.js rename to src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/area_chart.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/column_chart.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/column_chart.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/column_chart.js rename to src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/column_chart.js diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/column_chart.test.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/column_chart.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/column_chart.test.js rename to src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/column_chart.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/heatmap_chart.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/heatmap_chart.js similarity index 98% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/heatmap_chart.js rename to src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/heatmap_chart.js index a25d408769273..bef6c939f864a 100644 --- a/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/heatmap_chart.js +++ b/src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/heatmap_chart.js @@ -12,8 +12,8 @@ import moment from 'moment'; import { isColorDark } from '@elastic/eui'; import { PointSeries } from './_point_series'; -import { getHeatmapColors } from '../../../../../../plugins/charts/public'; -import { FORMATS_UI_SETTINGS } from '../../../../../../plugins/field_formats/common'; +import { getHeatmapColors } from '../../../../../../../plugins/charts/public'; +import { FORMATS_UI_SETTINGS } from '../../../../../../../plugins/field_formats/common'; import { getValueForPercentageMode } from '../../percentage_mode_transform'; const defaults = { diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/heatmap_chart.test.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/heatmap_chart.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/heatmap_chart.test.js rename to src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/heatmap_chart.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/line_chart.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/line_chart.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/line_chart.js rename to src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/line_chart.js diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/line_chart.test.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/line_chart.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/line_chart.test.js rename to src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/line_chart.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/series_types.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/series_types.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/series_types.js rename to src/plugins/vis_types/vislib/public/vislib/visualizations/point_series/series_types.js diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/time_marker.d.ts b/src/plugins/vis_types/vislib/public/vislib/visualizations/time_marker.d.ts similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/time_marker.d.ts rename to src/plugins/vis_types/vislib/public/vislib/visualizations/time_marker.d.ts diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/time_marker.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/time_marker.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/time_marker.js rename to src/plugins/vis_types/vislib/public/vislib/visualizations/time_marker.js diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/time_marker.test.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/time_marker.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/time_marker.test.js rename to src/plugins/vis_types/vislib/public/vislib/visualizations/time_marker.test.js diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/vis_types.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/vis_types.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/vis_types.js rename to src/plugins/vis_types/vislib/public/vislib/visualizations/vis_types.js diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/vis_types.test.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/vis_types.test.js similarity index 100% rename from src/plugins/vis_type_vislib/public/vislib/visualizations/vis_types.test.js rename to src/plugins/vis_types/vislib/public/vislib/visualizations/vis_types.test.js diff --git a/src/plugins/vis_type_vislib/server/index.ts b/src/plugins/vis_types/vislib/server/index.ts similarity index 100% rename from src/plugins/vis_type_vislib/server/index.ts rename to src/plugins/vis_types/vislib/server/index.ts diff --git a/src/plugins/vis_type_vislib/server/plugin.ts b/src/plugins/vis_types/vislib/server/plugin.ts similarity index 100% rename from src/plugins/vis_type_vislib/server/plugin.ts rename to src/plugins/vis_types/vislib/server/plugin.ts diff --git a/src/plugins/vis_type_vislib/server/ui_settings.ts b/src/plugins/vis_types/vislib/server/ui_settings.ts similarity index 100% rename from src/plugins/vis_type_vislib/server/ui_settings.ts rename to src/plugins/vis_types/vislib/server/ui_settings.ts diff --git a/src/plugins/vis_types/vislib/tsconfig.json b/src/plugins/vis_types/vislib/tsconfig.json new file mode 100644 index 0000000000000..8246b3f30646b --- /dev/null +++ b/src/plugins/vis_types/vislib/tsconfig.json @@ -0,0 +1,26 @@ +{ + "extends": "../../../../tsconfig.base.json", + "compilerOptions": { + "outDir": "./target/types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true + }, + "include": [ + "common/**/*", + "public/**/*", + "server/**/*" + ], + "references": [ + { "path": "../../../core/tsconfig.json" }, + { "path": "../../charts/tsconfig.json" }, + { "path": "../../data/tsconfig.json" }, + { "path": "../../expressions/tsconfig.json" }, + { "path": "../../visualizations/tsconfig.json" }, + { "path": "../../kibana_legacy/tsconfig.json" }, + { "path": "../../kibana_utils/tsconfig.json" }, + { "path": "../../vis_default_editor/tsconfig.json" }, + { "path": "../../vis_types/xy/tsconfig.json" }, + { "path": "../../vis_types/pie/tsconfig.json" }, + ] +} diff --git a/src/plugins/vis_type_xy/common/index.ts b/src/plugins/vis_types/xy/common/index.ts similarity index 100% rename from src/plugins/vis_type_xy/common/index.ts rename to src/plugins/vis_types/xy/common/index.ts diff --git a/src/plugins/vis_type_pie/jest.config.js b/src/plugins/vis_types/xy/jest.config.js similarity index 84% rename from src/plugins/vis_type_pie/jest.config.js rename to src/plugins/vis_types/xy/jest.config.js index e4900ef4a35c8..57b041b575e3f 100644 --- a/src/plugins/vis_type_pie/jest.config.js +++ b/src/plugins/vis_types/xy/jest.config.js @@ -8,6 +8,6 @@ module.exports = { preset: '@kbn/test', - rootDir: '../../..', - roots: ['/src/plugins/vis_type_pie'], + rootDir: '../../../..', + roots: ['/src/plugins/vis_types/xy'], }; diff --git a/src/plugins/vis_type_xy/kibana.json b/src/plugins/vis_types/xy/kibana.json similarity index 100% rename from src/plugins/vis_type_xy/kibana.json rename to src/plugins/vis_types/xy/kibana.json diff --git a/src/plugins/vis_type_xy/public/__snapshots__/to_ast.test.ts.snap b/src/plugins/vis_types/xy/public/__snapshots__/to_ast.test.ts.snap similarity index 100% rename from src/plugins/vis_type_xy/public/__snapshots__/to_ast.test.ts.snap rename to src/plugins/vis_types/xy/public/__snapshots__/to_ast.test.ts.snap diff --git a/src/plugins/vis_type_xy/public/_chart.scss b/src/plugins/vis_types/xy/public/_chart.scss similarity index 100% rename from src/plugins/vis_type_xy/public/_chart.scss rename to src/plugins/vis_types/xy/public/_chart.scss diff --git a/src/plugins/vis_type_xy/public/chart_splitter.tsx b/src/plugins/vis_types/xy/public/chart_splitter.tsx similarity index 100% rename from src/plugins/vis_type_xy/public/chart_splitter.tsx rename to src/plugins/vis_types/xy/public/chart_splitter.tsx diff --git a/src/plugins/vis_type_xy/public/components/_detailed_tooltip.scss b/src/plugins/vis_types/xy/public/components/_detailed_tooltip.scss similarity index 100% rename from src/plugins/vis_type_xy/public/components/_detailed_tooltip.scss rename to src/plugins/vis_types/xy/public/components/_detailed_tooltip.scss diff --git a/src/plugins/vis_type_xy/public/components/detailed_tooltip.mock.ts b/src/plugins/vis_types/xy/public/components/detailed_tooltip.mock.ts similarity index 100% rename from src/plugins/vis_type_xy/public/components/detailed_tooltip.mock.ts rename to src/plugins/vis_types/xy/public/components/detailed_tooltip.mock.ts diff --git a/src/plugins/vis_type_xy/public/components/detailed_tooltip.test.tsx b/src/plugins/vis_types/xy/public/components/detailed_tooltip.test.tsx similarity index 100% rename from src/plugins/vis_type_xy/public/components/detailed_tooltip.test.tsx rename to src/plugins/vis_types/xy/public/components/detailed_tooltip.test.tsx diff --git a/src/plugins/vis_type_xy/public/components/detailed_tooltip.tsx b/src/plugins/vis_types/xy/public/components/detailed_tooltip.tsx similarity index 100% rename from src/plugins/vis_type_xy/public/components/detailed_tooltip.tsx rename to src/plugins/vis_types/xy/public/components/detailed_tooltip.tsx diff --git a/src/plugins/vis_type_xy/public/components/index.ts b/src/plugins/vis_types/xy/public/components/index.ts similarity index 100% rename from src/plugins/vis_type_xy/public/components/index.ts rename to src/plugins/vis_types/xy/public/components/index.ts diff --git a/src/plugins/vis_type_xy/public/components/xy_axis.tsx b/src/plugins/vis_types/xy/public/components/xy_axis.tsx similarity index 100% rename from src/plugins/vis_type_xy/public/components/xy_axis.tsx rename to src/plugins/vis_types/xy/public/components/xy_axis.tsx diff --git a/src/plugins/vis_type_xy/public/components/xy_current_time.tsx b/src/plugins/vis_types/xy/public/components/xy_current_time.tsx similarity index 93% rename from src/plugins/vis_type_xy/public/components/xy_current_time.tsx rename to src/plugins/vis_types/xy/public/components/xy_current_time.tsx index 1294302d0becd..1ecf661355868 100644 --- a/src/plugins/vis_type_xy/public/components/xy_current_time.tsx +++ b/src/plugins/vis_types/xy/public/components/xy_current_time.tsx @@ -8,7 +8,7 @@ import React, { FC } from 'react'; import { DomainRange } from '@elastic/charts'; -import { CurrentTime } from '../../../charts/public'; +import { CurrentTime } from '../../../../charts/public'; interface XYCurrentTime { enabled: boolean; diff --git a/src/plugins/vis_type_xy/public/components/xy_endzones.tsx b/src/plugins/vis_types/xy/public/components/xy_endzones.tsx similarity index 96% rename from src/plugins/vis_type_xy/public/components/xy_endzones.tsx rename to src/plugins/vis_types/xy/public/components/xy_endzones.tsx index 1510ec1bcb89a..fbf398b886ffa 100644 --- a/src/plugins/vis_type_xy/public/components/xy_endzones.tsx +++ b/src/plugins/vis_types/xy/public/components/xy_endzones.tsx @@ -10,7 +10,7 @@ import React, { FC } from 'react'; import { DomainRange } from '@elastic/charts'; -import { Endzones } from '../../../charts/public'; +import { Endzones } from '../../../../charts/public'; interface XYEndzones { enabled: boolean; diff --git a/src/plugins/vis_type_xy/public/components/xy_settings.tsx b/src/plugins/vis_types/xy/public/components/xy_settings.tsx similarity index 98% rename from src/plugins/vis_type_xy/public/components/xy_settings.tsx rename to src/plugins/vis_types/xy/public/components/xy_settings.tsx index 2dd7d7e0a91f9..92b47edccfd92 100644 --- a/src/plugins/vis_type_xy/public/components/xy_settings.tsx +++ b/src/plugins/vis_types/xy/public/components/xy_settings.tsx @@ -26,7 +26,7 @@ import { HorizontalAlignment, } from '@elastic/charts'; -import { renderEndzoneTooltip } from '../../../charts/public'; +import { renderEndzoneTooltip } from '../../../../charts/public'; import { getThemeService, getUISettings } from '../services'; import { VisConfig } from '../types'; diff --git a/src/plugins/vis_type_xy/public/components/xy_threshold_line.tsx b/src/plugins/vis_types/xy/public/components/xy_threshold_line.tsx similarity index 100% rename from src/plugins/vis_type_xy/public/components/xy_threshold_line.tsx rename to src/plugins/vis_types/xy/public/components/xy_threshold_line.tsx diff --git a/src/plugins/vis_type_xy/public/config/get_agg_id.ts b/src/plugins/vis_types/xy/public/config/get_agg_id.ts similarity index 100% rename from src/plugins/vis_type_xy/public/config/get_agg_id.ts rename to src/plugins/vis_types/xy/public/config/get_agg_id.ts diff --git a/src/plugins/vis_type_xy/public/config/get_aspects.ts b/src/plugins/vis_types/xy/public/config/get_aspects.ts similarity index 97% rename from src/plugins/vis_type_xy/public/config/get_aspects.ts rename to src/plugins/vis_types/xy/public/config/get_aspects.ts index 1485131da83bc..666a913e48402 100644 --- a/src/plugins/vis_type_xy/public/config/get_aspects.ts +++ b/src/plugins/vis_types/xy/public/config/get_aspects.ts @@ -10,7 +10,7 @@ import { compact } from 'lodash'; import { i18n } from '@kbn/i18n'; -import { DatatableColumn } from '../../../expressions/public'; +import { DatatableColumn } from '../../../../expressions/public'; import { Aspect, Dimension, Aspects, Dimensions } from '../types'; import { getFormatService } from '../services'; diff --git a/src/plugins/vis_type_xy/public/config/get_axis.ts b/src/plugins/vis_types/xy/public/config/get_axis.ts similarity index 97% rename from src/plugins/vis_type_xy/public/config/get_axis.ts rename to src/plugins/vis_types/xy/public/config/get_axis.ts index 71d33cc20d057..4750724ca3d42 100644 --- a/src/plugins/vis_type_xy/public/config/get_axis.ts +++ b/src/plugins/vis_types/xy/public/config/get_axis.ts @@ -10,8 +10,8 @@ import { identity, isNil } from 'lodash'; import { AxisSpec, TickFormatter, YDomainRange, ScaleType as ECScaleType } from '@elastic/charts'; -import { LabelRotation } from '../../../charts/public'; -import { BUCKET_TYPES } from '../../../data/public'; +import { LabelRotation } from '../../../../charts/public'; +import { BUCKET_TYPES } from '../../../../data/public'; import { Aspect, diff --git a/src/plugins/vis_type_xy/public/config/get_config.ts b/src/plugins/vis_types/xy/public/config/get_config.ts similarity index 94% rename from src/plugins/vis_type_xy/public/config/get_config.ts rename to src/plugins/vis_types/xy/public/config/get_config.ts index 0c687aa918056..13c9a6c275f8e 100644 --- a/src/plugins/vis_type_xy/public/config/get_config.ts +++ b/src/plugins/vis_types/xy/public/config/get_config.ts @@ -8,9 +8,9 @@ import { ScaleContinuousType } from '@elastic/charts'; -import { Datatable } from '../../../expressions/public'; -import { BUCKET_TYPES } from '../../../data/public'; -import { DateHistogramParams } from '../../../visualizations/public'; +import { Datatable } from '../../../../expressions/public'; +import { BUCKET_TYPES } from '../../../../data/public'; +import { DateHistogramParams } from '../../../../visualizations/public'; import { Aspect, diff --git a/src/plugins/vis_type_xy/public/config/get_legend.ts b/src/plugins/vis_types/xy/public/config/get_legend.ts similarity index 100% rename from src/plugins/vis_type_xy/public/config/get_legend.ts rename to src/plugins/vis_types/xy/public/config/get_legend.ts diff --git a/src/plugins/vis_type_xy/public/config/get_rotation.ts b/src/plugins/vis_types/xy/public/config/get_rotation.ts similarity index 100% rename from src/plugins/vis_type_xy/public/config/get_rotation.ts rename to src/plugins/vis_types/xy/public/config/get_rotation.ts diff --git a/src/plugins/vis_type_xy/public/config/get_threshold_line.ts b/src/plugins/vis_types/xy/public/config/get_threshold_line.ts similarity index 100% rename from src/plugins/vis_type_xy/public/config/get_threshold_line.ts rename to src/plugins/vis_types/xy/public/config/get_threshold_line.ts diff --git a/src/plugins/vis_type_xy/public/config/get_tooltip.ts b/src/plugins/vis_types/xy/public/config/get_tooltip.ts similarity index 100% rename from src/plugins/vis_type_xy/public/config/get_tooltip.ts rename to src/plugins/vis_types/xy/public/config/get_tooltip.ts diff --git a/src/plugins/vis_type_xy/public/config/index.ts b/src/plugins/vis_types/xy/public/config/index.ts similarity index 100% rename from src/plugins/vis_type_xy/public/config/index.ts rename to src/plugins/vis_types/xy/public/config/index.ts diff --git a/src/plugins/vis_type_xy/public/editor/collections.ts b/src/plugins/vis_types/xy/public/editor/collections.ts similarity index 98% rename from src/plugins/vis_type_xy/public/editor/collections.ts rename to src/plugins/vis_types/xy/public/editor/collections.ts index 7053f7de0d328..71f7a639379e0 100644 --- a/src/plugins/vis_type_xy/public/editor/collections.ts +++ b/src/plugins/vis_types/xy/public/editor/collections.ts @@ -11,7 +11,7 @@ import { Fit } from '@elastic/charts'; import { AxisMode, ChartMode, InterpolationMode, ThresholdLineStyle } from '../types'; import { ChartType } from '../../common'; -import { LabelRotation } from '../../../charts/public'; +import { LabelRotation } from '../../../../charts/public'; import { getScaleTypes } from './scale_types'; import { getPositions } from './positions'; diff --git a/src/plugins/vis_type_xy/public/editor/common_config.tsx b/src/plugins/vis_types/xy/public/editor/common_config.tsx similarity index 94% rename from src/plugins/vis_type_xy/public/editor/common_config.tsx rename to src/plugins/vis_types/xy/public/editor/common_config.tsx index 5cafbdd0a569c..bd9882a15c124 100644 --- a/src/plugins/vis_type_xy/public/editor/common_config.tsx +++ b/src/plugins/vis_types/xy/public/editor/common_config.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; -import type { VisEditorOptionsProps } from '../../../visualizations/public'; +import type { VisEditorOptionsProps } from '../../../../visualizations/public'; import type { VisParams } from '../types'; import { MetricsAxisOptions, PointSeriesOptions } from './components/options'; diff --git a/src/plugins/vis_type_xy/public/editor/components/common/index.ts b/src/plugins/vis_types/xy/public/editor/components/common/index.ts similarity index 100% rename from src/plugins/vis_type_xy/public/editor/components/common/index.ts rename to src/plugins/vis_types/xy/public/editor/components/common/index.ts diff --git a/src/plugins/vis_type_xy/public/editor/components/common/truncate_labels.test.tsx b/src/plugins/vis_types/xy/public/editor/components/common/truncate_labels.test.tsx similarity index 100% rename from src/plugins/vis_type_xy/public/editor/components/common/truncate_labels.test.tsx rename to src/plugins/vis_types/xy/public/editor/components/common/truncate_labels.test.tsx diff --git a/src/plugins/vis_type_xy/public/editor/components/common/truncate_labels.tsx b/src/plugins/vis_types/xy/public/editor/components/common/truncate_labels.tsx similarity index 100% rename from src/plugins/vis_type_xy/public/editor/components/common/truncate_labels.tsx rename to src/plugins/vis_types/xy/public/editor/components/common/truncate_labels.tsx diff --git a/src/plugins/vis_type_xy/public/editor/components/common/validation_wrapper.tsx b/src/plugins/vis_types/xy/public/editor/components/common/validation_wrapper.tsx similarity index 94% rename from src/plugins/vis_type_xy/public/editor/components/common/validation_wrapper.tsx rename to src/plugins/vis_types/xy/public/editor/components/common/validation_wrapper.tsx index 63df3f7eead43..2088878f963ae 100644 --- a/src/plugins/vis_type_xy/public/editor/components/common/validation_wrapper.tsx +++ b/src/plugins/vis_types/xy/public/editor/components/common/validation_wrapper.tsx @@ -8,7 +8,7 @@ import React, { useEffect, useState, useCallback } from 'react'; -import { VisEditorOptionsProps } from '../../../../../visualizations/public'; +import { VisEditorOptionsProps } from '../../../../../../visualizations/public'; export interface ValidationVisOptionsProps extends VisEditorOptionsProps { setMultipleValidity(paramName: string, isValid: boolean): void; diff --git a/src/plugins/vis_type_xy/public/editor/components/index.ts b/src/plugins/vis_types/xy/public/editor/components/index.ts similarity index 100% rename from src/plugins/vis_type_xy/public/editor/components/index.ts rename to src/plugins/vis_types/xy/public/editor/components/index.ts diff --git a/src/plugins/vis_type_xy/public/editor/components/options/index.tsx b/src/plugins/vis_types/xy/public/editor/components/options/index.tsx similarity index 100% rename from src/plugins/vis_type_xy/public/editor/components/options/index.tsx rename to src/plugins/vis_types/xy/public/editor/components/options/index.tsx diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/__snapshots__/category_axis_panel.test.tsx.snap b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/__snapshots__/category_axis_panel.test.tsx.snap similarity index 100% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/__snapshots__/category_axis_panel.test.tsx.snap rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/__snapshots__/category_axis_panel.test.tsx.snap diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/__snapshots__/chart_options.test.tsx.snap b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/__snapshots__/chart_options.test.tsx.snap similarity index 100% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/__snapshots__/chart_options.test.tsx.snap rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/__snapshots__/chart_options.test.tsx.snap diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/__snapshots__/custom_extents_options.test.tsx.snap b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/__snapshots__/custom_extents_options.test.tsx.snap similarity index 100% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/__snapshots__/custom_extents_options.test.tsx.snap rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/__snapshots__/custom_extents_options.test.tsx.snap diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/__snapshots__/index.test.tsx.snap b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/__snapshots__/index.test.tsx.snap similarity index 100% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/__snapshots__/index.test.tsx.snap rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/__snapshots__/index.test.tsx.snap diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/__snapshots__/label_options.test.tsx.snap b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/__snapshots__/label_options.test.tsx.snap similarity index 100% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/__snapshots__/label_options.test.tsx.snap rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/__snapshots__/label_options.test.tsx.snap diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/__snapshots__/line_options.test.tsx.snap b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/__snapshots__/line_options.test.tsx.snap similarity index 100% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/__snapshots__/line_options.test.tsx.snap rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/__snapshots__/line_options.test.tsx.snap diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/__snapshots__/point_options.test.tsx.snap b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/__snapshots__/point_options.test.tsx.snap similarity index 100% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/__snapshots__/point_options.test.tsx.snap rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/__snapshots__/point_options.test.tsx.snap diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/__snapshots__/value_axes_panel.test.tsx.snap b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/__snapshots__/value_axes_panel.test.tsx.snap similarity index 100% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/__snapshots__/value_axes_panel.test.tsx.snap rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/__snapshots__/value_axes_panel.test.tsx.snap diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/__snapshots__/value_axis_options.test.tsx.snap b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/__snapshots__/value_axis_options.test.tsx.snap similarity index 100% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/__snapshots__/value_axis_options.test.tsx.snap rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/__snapshots__/value_axis_options.test.tsx.snap diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/__snapshots__/y_extents.test.tsx.snap b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/__snapshots__/y_extents.test.tsx.snap similarity index 100% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/__snapshots__/y_extents.test.tsx.snap rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/__snapshots__/y_extents.test.tsx.snap diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/category_axis_panel.test.tsx b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/category_axis_panel.test.tsx similarity index 100% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/category_axis_panel.test.tsx rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/category_axis_panel.test.tsx diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/category_axis_panel.tsx b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/category_axis_panel.tsx similarity index 96% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/category_axis_panel.tsx rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/category_axis_panel.tsx index 5ba35717e46f3..ee5cc950ff66b 100644 --- a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/category_axis_panel.tsx +++ b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/category_axis_panel.tsx @@ -13,7 +13,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { EuiPanel, EuiTitle, EuiSpacer } from '@elastic/eui'; import { Position } from '@elastic/charts'; -import { SelectOption, SwitchOption } from '../../../../../../vis_default_editor/public'; +import { SelectOption, SwitchOption } from '../../../../../../../vis_default_editor/public'; import { LabelOptions, SetAxisLabel } from './label_options'; import { CategoryAxis } from '../../../../types'; diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/chart_options.test.tsx b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/chart_options.test.tsx similarity index 100% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/chart_options.test.tsx rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/chart_options.test.tsx diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/chart_options.tsx b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/chart_options.tsx similarity index 98% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/chart_options.tsx rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/chart_options.tsx index 34ee33781f269..04013969fb4fa 100644 --- a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/chart_options.tsx +++ b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/chart_options.tsx @@ -11,7 +11,7 @@ import React, { useMemo, useCallback, useEffect, useState } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui'; -import { SelectOption } from '../../../../../../vis_default_editor/public'; +import { SelectOption } from '../../../../../../../vis_default_editor/public'; import { SeriesParam, ValueAxis, ChartMode, AxisMode } from '../../../../types'; import { LineOptions } from './line_options'; diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/custom_extents_options.test.tsx b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/custom_extents_options.test.tsx similarity index 100% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/custom_extents_options.test.tsx rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/custom_extents_options.test.tsx diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/custom_extents_options.tsx b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/custom_extents_options.tsx similarity index 99% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/custom_extents_options.tsx rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/custom_extents_options.tsx index 2d3e819e96024..2152849983513 100644 --- a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/custom_extents_options.tsx +++ b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/custom_extents_options.tsx @@ -10,7 +10,7 @@ import React, { useCallback, useEffect } from 'react'; import { i18n } from '@kbn/i18n'; -import { NumberInputOption, SwitchOption } from '../../../../../../vis_default_editor/public'; +import { NumberInputOption, SwitchOption } from '../../../../../../../vis_default_editor/public'; import { ValueAxis } from '../../../../types'; import { YExtents } from './y_extents'; diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/index.test.tsx b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/index.test.tsx similarity index 100% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/index.test.tsx rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/index.test.tsx diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/index.tsx b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/index.tsx similarity index 99% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/index.tsx rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/index.tsx index 5454df3a165cd..9b4e1c61a201f 100644 --- a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/index.tsx +++ b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/index.tsx @@ -11,7 +11,7 @@ import { cloneDeep, get } from 'lodash'; import { EuiSpacer } from '@elastic/eui'; -import { IAggConfig } from '../../../../../../data/public'; +import { IAggConfig } from '../../../../../../../data/public'; import { VisParams, ValueAxis, SeriesParam, CategoryAxis } from '../../../../types'; import { ValidationVisOptionsProps } from '../../common'; diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/label_options.test.tsx b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/label_options.test.tsx similarity index 100% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/label_options.test.tsx rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/label_options.test.tsx diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/label_options.tsx b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/label_options.tsx similarity index 94% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/label_options.tsx rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/label_options.tsx index bcf4beaa78945..ef48d8b6d7880 100644 --- a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/label_options.tsx +++ b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/label_options.tsx @@ -12,8 +12,8 @@ import { EuiTitle, EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { SelectOption, SwitchOption } from '../../../../../../vis_default_editor/public'; -import { Labels } from '../../../../../../charts/public'; +import { SelectOption, SwitchOption } from '../../../../../../../vis_default_editor/public'; +import { Labels } from '../../../../../../../charts/public'; import { TruncateLabelsOption } from '../../common'; import { getRotateOptions } from '../../../collections'; diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/line_options.test.tsx b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/line_options.test.tsx similarity index 95% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/line_options.test.tsx rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/line_options.test.tsx index 5497c46c1dd34..41bbfec7ee939 100644 --- a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/line_options.test.tsx +++ b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/line_options.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { shallow } from 'enzyme'; -import { NumberInputOption } from '../../../../../../vis_default_editor/public'; +import { NumberInputOption } from '../../../../../../../vis_default_editor/public'; import { LineOptions, LineOptionsParams } from './line_options'; import { seriesParam } from './mocks'; diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/line_options.tsx b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/line_options.tsx similarity index 97% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/line_options.tsx rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/line_options.tsx index 75dfe8627d73e..355b04f07d00d 100644 --- a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/line_options.tsx +++ b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/line_options.tsx @@ -15,7 +15,7 @@ import { NumberInputOption, SelectOption, SwitchOption, -} from '../../../../../../vis_default_editor/public'; +} from '../../../../../../../vis_default_editor/public'; import { SeriesParam } from '../../../../types'; import { SetChart } from './chart_options'; diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/mocks.ts b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/mocks.ts similarity index 93% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/mocks.ts rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/mocks.ts index eed224cf2a514..cbc970c7ed7d8 100644 --- a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/mocks.ts +++ b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/mocks.ts @@ -8,8 +8,8 @@ import { Position } from '@elastic/charts'; -import { Vis } from '../../../../../../visualizations/public'; -import { Style } from '../../../../../../charts/public'; +import { Vis } from '../../../../../../../visualizations/public'; +import { Style } from '../../../../../../../charts/public'; import { ValueAxis, diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/point_options.test.tsx b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/point_options.test.tsx similarity index 100% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/point_options.test.tsx rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/point_options.test.tsx diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/point_options.tsx b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/point_options.tsx similarity index 95% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/point_options.tsx rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/point_options.tsx index d35a5a2374ca3..41d5f7c2c9794 100644 --- a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/point_options.tsx +++ b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/point_options.tsx @@ -11,7 +11,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; import { EuiRange, EuiFormRow, EuiSpacer } from '@elastic/eui'; -import { SwitchOption } from '../../../../../../vis_default_editor/public'; +import { SwitchOption } from '../../../../../../../vis_default_editor/public'; import { SeriesParam } from '../../../../types'; import { SetChart } from './chart_options'; diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/series_panel.tsx b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/series_panel.tsx similarity index 96% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/series_panel.tsx rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/series_panel.tsx index 3adfe3277c969..69fbbcf80e28b 100644 --- a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/series_panel.tsx +++ b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/series_panel.tsx @@ -12,7 +12,7 @@ import { EuiPanel, EuiTitle, EuiSpacer, EuiAccordion } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { Vis } from '../../../../../../visualizations/public'; +import { Vis } from '../../../../../../../visualizations/public'; import { ValueAxis, SeriesParam } from '../../../../types'; import { ChartOptions } from './chart_options'; diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/utils.ts b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/utils.ts similarity index 100% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/utils.ts rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/utils.ts diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/value_axes_panel.test.tsx b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/value_axes_panel.test.tsx similarity index 100% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/value_axes_panel.test.tsx rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/value_axes_panel.test.tsx diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/value_axes_panel.tsx b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/value_axes_panel.tsx similarity index 100% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/value_axes_panel.tsx rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/value_axes_panel.tsx diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/value_axis_options.test.tsx b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/value_axis_options.test.tsx similarity index 97% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/value_axis_options.test.tsx rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/value_axis_options.test.tsx index f2d689126166f..ceb655fa47107 100644 --- a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/value_axis_options.test.tsx +++ b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/value_axis_options.test.tsx @@ -11,7 +11,7 @@ import { shallow } from 'enzyme'; import { Position } from '@elastic/charts'; -import { TextInputOption } from '../../../../../../vis_default_editor/public'; +import { TextInputOption } from '../../../../../../../vis_default_editor/public'; import { ValueAxis, ScaleType } from '../../../../types'; import { LabelOptions } from './label_options'; diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/value_axis_options.tsx b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/value_axis_options.tsx similarity index 99% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/value_axis_options.tsx rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/value_axis_options.tsx index d39bbf5bfa532..751c61f3b1531 100644 --- a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/value_axis_options.tsx +++ b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/value_axis_options.tsx @@ -14,7 +14,7 @@ import { SelectOption, SwitchOption, TextInputOption, -} from '../../../../../../vis_default_editor/public'; +} from '../../../../../../../vis_default_editor/public'; import { ValueAxis } from '../../../../types'; import { LabelOptions, SetAxisLabel } from './label_options'; diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/y_extents.test.tsx b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/y_extents.test.tsx similarity index 97% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/y_extents.test.tsx rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/y_extents.test.tsx index e5ed34d03099d..da7005210865d 100644 --- a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/y_extents.test.tsx +++ b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/y_extents.test.tsx @@ -11,7 +11,7 @@ import { mount, shallow } from 'enzyme'; import { ScaleType } from '../../../../types'; import { YExtents, YExtentsProps } from './y_extents'; -import { NumberInputOption } from '../../../../../../vis_default_editor/public'; +import { NumberInputOption } from '../../../../../../../vis_default_editor/public'; describe('YExtents component', () => { let setMultipleValidity: jest.Mock; diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/y_extents.tsx b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/y_extents.tsx similarity index 97% rename from src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/y_extents.tsx rename to src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/y_extents.tsx index e81f0fff96f49..ce546339a9912 100644 --- a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/y_extents.tsx +++ b/src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/y_extents.tsx @@ -10,7 +10,7 @@ import React, { useEffect, useCallback } from 'react'; import { EuiFlexGroup, EuiFlexItem, EuiFormRow } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { NumberInputOption } from '../../../../../../vis_default_editor/public'; +import { NumberInputOption } from '../../../../../../../vis_default_editor/public'; import { Scale, ScaleType } from '../../../../types'; import { SetScale } from './value_axis_options'; diff --git a/src/plugins/vis_type_xy/public/editor/components/options/point_series/elastic_charts_options.tsx b/src/plugins/vis_types/xy/public/editor/components/options/point_series/elastic_charts_options.tsx similarity index 97% rename from src/plugins/vis_type_xy/public/editor/components/options/point_series/elastic_charts_options.tsx rename to src/plugins/vis_types/xy/public/editor/components/options/point_series/elastic_charts_options.tsx index 271c5445a9580..105cd66799041 100644 --- a/src/plugins/vis_type_xy/public/editor/components/options/point_series/elastic_charts_options.tsx +++ b/src/plugins/vis_types/xy/public/editor/components/options/point_series/elastic_charts_options.tsx @@ -15,8 +15,8 @@ import { SelectOption, SwitchOption, PalettePicker, -} from '../../../../../../vis_default_editor/public'; -import { PaletteRegistry } from '../../../../../../charts/public'; +} from '../../../../../../../vis_default_editor/public'; +import { PaletteRegistry } from '../../../../../../../charts/public'; import { ChartType } from '../../../../../common'; import { VisParams } from '../../../../types'; diff --git a/src/plugins/vis_type_xy/public/editor/components/options/point_series/grid_panel.tsx b/src/plugins/vis_types/xy/public/editor/components/options/point_series/grid_panel.tsx similarity index 97% rename from src/plugins/vis_type_xy/public/editor/components/options/point_series/grid_panel.tsx rename to src/plugins/vis_types/xy/public/editor/components/options/point_series/grid_panel.tsx index 69f6a08946fce..0bf5344ac7f26 100644 --- a/src/plugins/vis_type_xy/public/editor/components/options/point_series/grid_panel.tsx +++ b/src/plugins/vis_types/xy/public/editor/components/options/point_series/grid_panel.tsx @@ -12,7 +12,7 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import { EuiPanel, EuiTitle, EuiSpacer } from '@elastic/eui'; -import { SelectOption, SwitchOption } from '../../../../../../vis_default_editor/public'; +import { SelectOption, SwitchOption } from '../../../../../../../vis_default_editor/public'; import { VisParams, ValueAxis } from '../../../../types'; import { ValidationVisOptionsProps } from '../../common'; diff --git a/src/plugins/vis_type_xy/public/editor/components/options/point_series/index.ts b/src/plugins/vis_types/xy/public/editor/components/options/point_series/index.ts similarity index 100% rename from src/plugins/vis_type_xy/public/editor/components/options/point_series/index.ts rename to src/plugins/vis_types/xy/public/editor/components/options/point_series/index.ts diff --git a/src/plugins/vis_type_xy/public/editor/components/options/point_series/point_series.mocks.ts b/src/plugins/vis_types/xy/public/editor/components/options/point_series/point_series.mocks.ts similarity index 100% rename from src/plugins/vis_type_xy/public/editor/components/options/point_series/point_series.mocks.ts rename to src/plugins/vis_types/xy/public/editor/components/options/point_series/point_series.mocks.ts diff --git a/src/plugins/vis_type_xy/public/editor/components/options/point_series/point_series.test.tsx b/src/plugins/vis_types/xy/public/editor/components/options/point_series/point_series.test.tsx similarity index 100% rename from src/plugins/vis_type_xy/public/editor/components/options/point_series/point_series.test.tsx rename to src/plugins/vis_types/xy/public/editor/components/options/point_series/point_series.test.tsx diff --git a/src/plugins/vis_type_xy/public/editor/components/options/point_series/point_series.tsx b/src/plugins/vis_types/xy/public/editor/components/options/point_series/point_series.tsx similarity index 97% rename from src/plugins/vis_type_xy/public/editor/components/options/point_series/point_series.tsx rename to src/plugins/vis_types/xy/public/editor/components/options/point_series/point_series.tsx index 1fd9b043e87f5..da7bdfb0d7986 100644 --- a/src/plugins/vis_type_xy/public/editor/components/options/point_series/point_series.tsx +++ b/src/plugins/vis_types/xy/public/editor/components/options/point_series/point_series.tsx @@ -15,8 +15,8 @@ import { BasicOptions, SwitchOption, LongLegendOptions, -} from '../../../../../../vis_default_editor/public'; -import { BUCKET_TYPES } from '../../../../../../data/public'; +} from '../../../../../../../vis_default_editor/public'; +import { BUCKET_TYPES } from '../../../../../../../data/public'; import { VisParams } from '../../../../types'; import { GridPanel } from './grid_panel'; diff --git a/src/plugins/vis_type_xy/public/editor/components/options/point_series/threshold_panel.tsx b/src/plugins/vis_types/xy/public/editor/components/options/point_series/threshold_panel.tsx similarity index 98% rename from src/plugins/vis_type_xy/public/editor/components/options/point_series/threshold_panel.tsx rename to src/plugins/vis_types/xy/public/editor/components/options/point_series/threshold_panel.tsx index 00429c6702eeb..347354ac9d4f2 100644 --- a/src/plugins/vis_type_xy/public/editor/components/options/point_series/threshold_panel.tsx +++ b/src/plugins/vis_types/xy/public/editor/components/options/point_series/threshold_panel.tsx @@ -16,7 +16,7 @@ import { SelectOption, SwitchOption, RequiredNumberInputOption, -} from '../../../../../../vis_default_editor/public'; +} from '../../../../../../../vis_default_editor/public'; import { ValidationVisOptionsProps } from '../../common'; import { VisParams } from '../../../../types'; import { getThresholdLineStyles } from '../../../collections'; diff --git a/src/plugins/vis_type_xy/public/editor/index.ts b/src/plugins/vis_types/xy/public/editor/index.ts similarity index 100% rename from src/plugins/vis_type_xy/public/editor/index.ts rename to src/plugins/vis_types/xy/public/editor/index.ts diff --git a/src/plugins/vis_type_xy/public/editor/positions.ts b/src/plugins/vis_types/xy/public/editor/positions.ts similarity index 100% rename from src/plugins/vis_type_xy/public/editor/positions.ts rename to src/plugins/vis_types/xy/public/editor/positions.ts diff --git a/src/plugins/vis_type_xy/public/editor/scale_types.ts b/src/plugins/vis_types/xy/public/editor/scale_types.ts similarity index 100% rename from src/plugins/vis_type_xy/public/editor/scale_types.ts rename to src/plugins/vis_types/xy/public/editor/scale_types.ts diff --git a/src/plugins/vis_type_xy/public/expression_functions/category_axis.ts b/src/plugins/vis_types/xy/public/expression_functions/category_axis.ts similarity index 98% rename from src/plugins/vis_type_xy/public/expression_functions/category_axis.ts rename to src/plugins/vis_types/xy/public/expression_functions/category_axis.ts index 30215d8feb8a3..08958915da4a4 100644 --- a/src/plugins/vis_type_xy/public/expression_functions/category_axis.ts +++ b/src/plugins/vis_types/xy/public/expression_functions/category_axis.ts @@ -11,7 +11,7 @@ import type { ExpressionFunctionDefinition, Datatable, ExpressionValueBoxed, -} from '../../../expressions/public'; +} from '../../../../expressions/public'; import type { CategoryAxis } from '../types'; import type { ExpressionValueScale } from './vis_scale'; import type { ExpressionValueLabel } from './label'; diff --git a/src/plugins/vis_type_xy/public/expression_functions/index.ts b/src/plugins/vis_types/xy/public/expression_functions/index.ts similarity index 100% rename from src/plugins/vis_type_xy/public/expression_functions/index.ts rename to src/plugins/vis_types/xy/public/expression_functions/index.ts diff --git a/src/plugins/vis_type_xy/public/expression_functions/label.ts b/src/plugins/vis_types/xy/public/expression_functions/label.ts similarity index 96% rename from src/plugins/vis_type_xy/public/expression_functions/label.ts rename to src/plugins/vis_types/xy/public/expression_functions/label.ts index 934278d13cff0..e733aebaa627c 100644 --- a/src/plugins/vis_type_xy/public/expression_functions/label.ts +++ b/src/plugins/vis_types/xy/public/expression_functions/label.ts @@ -7,12 +7,12 @@ */ import { i18n } from '@kbn/i18n'; -import type { Labels } from '../../../charts/public'; +import type { Labels } from '../../../../charts/public'; import type { ExpressionFunctionDefinition, Datatable, ExpressionValueBoxed, -} from '../../../expressions/public'; +} from '../../../../expressions/public'; export type ExpressionValueLabel = ExpressionValueBoxed< 'label', diff --git a/src/plugins/vis_type_xy/public/expression_functions/series_param.ts b/src/plugins/vis_types/xy/public/expression_functions/series_param.ts similarity index 98% rename from src/plugins/vis_type_xy/public/expression_functions/series_param.ts rename to src/plugins/vis_types/xy/public/expression_functions/series_param.ts index 3fd62e33e257f..174ed4c057974 100644 --- a/src/plugins/vis_type_xy/public/expression_functions/series_param.ts +++ b/src/plugins/vis_types/xy/public/expression_functions/series_param.ts @@ -11,7 +11,7 @@ import type { ExpressionFunctionDefinition, Datatable, ExpressionValueBoxed, -} from '../../../expressions/public'; +} from '../../../../expressions/public'; import type { SeriesParam } from '../types'; export interface Arguments extends Omit { diff --git a/src/plugins/vis_type_xy/public/expression_functions/threshold_line.ts b/src/plugins/vis_types/xy/public/expression_functions/threshold_line.ts similarity index 98% rename from src/plugins/vis_type_xy/public/expression_functions/threshold_line.ts rename to src/plugins/vis_types/xy/public/expression_functions/threshold_line.ts index 8c01e37503985..a4f5cf98fb968 100644 --- a/src/plugins/vis_type_xy/public/expression_functions/threshold_line.ts +++ b/src/plugins/vis_types/xy/public/expression_functions/threshold_line.ts @@ -11,7 +11,7 @@ import type { ExpressionFunctionDefinition, Datatable, ExpressionValueBoxed, -} from '../../../expressions/public'; +} from '../../../../expressions/public'; import type { ThresholdLine } from '../types'; export type ExpressionValueThresholdLine = ExpressionValueBoxed< diff --git a/src/plugins/vis_type_xy/public/expression_functions/time_marker.ts b/src/plugins/vis_types/xy/public/expression_functions/time_marker.ts similarity index 98% rename from src/plugins/vis_type_xy/public/expression_functions/time_marker.ts rename to src/plugins/vis_types/xy/public/expression_functions/time_marker.ts index 3d9f609292c00..3b673394463f0 100644 --- a/src/plugins/vis_type_xy/public/expression_functions/time_marker.ts +++ b/src/plugins/vis_types/xy/public/expression_functions/time_marker.ts @@ -11,7 +11,7 @@ import type { ExpressionFunctionDefinition, Datatable, ExpressionValueBoxed, -} from '../../../expressions/public'; +} from '../../../../expressions/public'; import type { TimeMarker } from '../types'; export type ExpressionValueTimeMarker = ExpressionValueBoxed< diff --git a/src/plugins/vis_type_xy/public/expression_functions/value_axis.ts b/src/plugins/vis_types/xy/public/expression_functions/value_axis.ts similarity index 98% rename from src/plugins/vis_type_xy/public/expression_functions/value_axis.ts rename to src/plugins/vis_types/xy/public/expression_functions/value_axis.ts index 510ec9bc605d2..a92d35dc9fefd 100644 --- a/src/plugins/vis_type_xy/public/expression_functions/value_axis.ts +++ b/src/plugins/vis_types/xy/public/expression_functions/value_axis.ts @@ -13,7 +13,7 @@ import type { ExpressionFunctionDefinition, Datatable, ExpressionValueBoxed, -} from '../../../expressions/public'; +} from '../../../../expressions/public'; interface Arguments { name: string; diff --git a/src/plugins/vis_type_xy/public/expression_functions/vis_scale.ts b/src/plugins/vis_types/xy/public/expression_functions/vis_scale.ts similarity index 98% rename from src/plugins/vis_type_xy/public/expression_functions/vis_scale.ts rename to src/plugins/vis_types/xy/public/expression_functions/vis_scale.ts index fadf3d80a6e81..ddf14ead20a25 100644 --- a/src/plugins/vis_type_xy/public/expression_functions/vis_scale.ts +++ b/src/plugins/vis_types/xy/public/expression_functions/vis_scale.ts @@ -11,7 +11,7 @@ import type { ExpressionFunctionDefinition, Datatable, ExpressionValueBoxed, -} from '../../../expressions/public'; +} from '../../../../expressions/public'; import type { Scale } from '../types'; export type ExpressionValueScale = ExpressionValueBoxed< diff --git a/src/plugins/vis_type_xy/public/expression_functions/xy_vis_fn.ts b/src/plugins/vis_types/xy/public/expression_functions/xy_vis_fn.ts similarity index 98% rename from src/plugins/vis_type_xy/public/expression_functions/xy_vis_fn.ts rename to src/plugins/vis_types/xy/public/expression_functions/xy_vis_fn.ts index 6d2b860066b07..ccad0c520f8ea 100644 --- a/src/plugins/vis_type_xy/public/expression_functions/xy_vis_fn.ts +++ b/src/plugins/vis_types/xy/public/expression_functions/xy_vis_fn.ts @@ -8,8 +8,12 @@ import { i18n } from '@kbn/i18n'; -import type { ExpressionFunctionDefinition, Datatable, Render } from '../../../expressions/common'; -import { prepareLogTable, Dimension } from '../../../visualizations/public'; +import type { + ExpressionFunctionDefinition, + Datatable, + Render, +} from '../../../../expressions/common'; +import { prepareLogTable, Dimension } from '../../../../visualizations/public'; import type { ChartType } from '../../common'; import type { VisParams, XYVisConfig } from '../types'; diff --git a/src/plugins/vis_type_xy/public/index.ts b/src/plugins/vis_types/xy/public/index.ts similarity index 100% rename from src/plugins/vis_type_xy/public/index.ts rename to src/plugins/vis_types/xy/public/index.ts diff --git a/src/plugins/vis_type_xy/public/plugin.ts b/src/plugins/vis_types/xy/public/plugin.ts similarity index 89% rename from src/plugins/vis_type_xy/public/plugin.ts rename to src/plugins/vis_types/xy/public/plugin.ts index 488e6fd84b4da..57736444f49fe 100644 --- a/src/plugins/vis_type_xy/public/plugin.ts +++ b/src/plugins/vis_types/xy/public/plugin.ts @@ -6,12 +6,12 @@ * Side Public License, v 1. */ -import { CoreSetup, CoreStart, Plugin } from '../../../core/public'; -import { Plugin as ExpressionsPublicPlugin } from '../../expressions/public'; -import { VisualizationsSetup, VisualizationsStart } from '../../visualizations/public'; -import { ChartsPluginSetup, ChartsPluginStart } from '../../charts/public'; -import { DataPublicPluginStart } from '../../data/public'; -import { UsageCollectionSetup } from '../../usage_collection/public'; +import { CoreSetup, CoreStart, Plugin } from '../../../../core/public'; +import { Plugin as ExpressionsPublicPlugin } from '../../../expressions/public'; +import { VisualizationsSetup, VisualizationsStart } from '../../../visualizations/public'; +import { ChartsPluginSetup, ChartsPluginStart } from '../../../charts/public'; +import { DataPublicPluginStart } from '../../../data/public'; +import { UsageCollectionSetup } from '../../../usage_collection/public'; import { setDataActions, setFormatService, diff --git a/src/plugins/vis_type_xy/public/sample_vis.test.mocks.ts b/src/plugins/vis_types/xy/public/sample_vis.test.mocks.ts similarity index 100% rename from src/plugins/vis_type_xy/public/sample_vis.test.mocks.ts rename to src/plugins/vis_types/xy/public/sample_vis.test.mocks.ts diff --git a/src/plugins/vis_type_xy/public/services.ts b/src/plugins/vis_types/xy/public/services.ts similarity index 83% rename from src/plugins/vis_type_xy/public/services.ts rename to src/plugins/vis_types/xy/public/services.ts index 63bc55b288ae3..7f1f7e8728151 100644 --- a/src/plugins/vis_type_xy/public/services.ts +++ b/src/plugins/vis_types/xy/public/services.ts @@ -7,10 +7,10 @@ */ import { UiCounterMetricType } from '@kbn/analytics'; -import { CoreSetup, DocLinksStart } from '../../../core/public'; -import { createGetterSetter } from '../../kibana_utils/public'; -import { DataPublicPluginStart } from '../../data/public'; -import { ChartsPluginSetup, ChartsPluginStart } from '../../charts/public'; +import { CoreSetup, DocLinksStart } from '../../../../core/public'; +import { createGetterSetter } from '../../../kibana_utils/public'; +import { DataPublicPluginStart } from '../../../data/public'; +import { ChartsPluginSetup, ChartsPluginStart } from '../../../charts/public'; export const [getUISettings, setUISettings] = createGetterSetter( 'xy core.uiSettings' diff --git a/src/plugins/vis_type_xy/public/to_ast.test.ts b/src/plugins/vis_types/xy/public/to_ast.test.ts similarity index 83% rename from src/plugins/vis_type_xy/public/to_ast.test.ts rename to src/plugins/vis_types/xy/public/to_ast.test.ts index 4437986eff5f7..cbe25bc1fef6f 100644 --- a/src/plugins/vis_type_xy/public/to_ast.test.ts +++ b/src/plugins/vis_types/xy/public/to_ast.test.ts @@ -6,15 +6,15 @@ * Side Public License, v 1. */ -import { Vis } from '../../visualizations/public'; -import { buildExpression } from '../../expressions/public'; +import { Vis } from '../../../visualizations/public'; +import { buildExpression } from '../../../expressions/public'; import { sampleAreaVis } from './sample_vis.test.mocks'; import { toExpressionAst } from './to_ast'; import { VisParams } from './types'; -jest.mock('../../expressions/public', () => ({ - ...(jest.requireActual('../../expressions/public') as any), +jest.mock('../../../expressions/public', () => ({ + ...(jest.requireActual('../../../expressions/public') as any), buildExpression: jest.fn().mockImplementation(() => ({ toAst: () => ({ type: 'expression', diff --git a/src/plugins/vis_type_xy/public/to_ast.ts b/src/plugins/vis_types/xy/public/to_ast.ts similarity index 97% rename from src/plugins/vis_type_xy/public/to_ast.ts rename to src/plugins/vis_types/xy/public/to_ast.ts index 0b1eb5262d71a..5fc130a08ed27 100644 --- a/src/plugins/vis_type_xy/public/to_ast.ts +++ b/src/plugins/vis_types/xy/public/to_ast.ts @@ -13,10 +13,10 @@ import { getVisSchemas, DateHistogramParams, HistogramParams, -} from '../../visualizations/public'; -import { buildExpression, buildExpressionFunction } from '../../expressions/public'; -import { BUCKET_TYPES } from '../../data/public'; -import { Labels } from '../../charts/public'; +} from '../../../visualizations/public'; +import { buildExpression, buildExpressionFunction } from '../../../expressions/public'; +import { BUCKET_TYPES } from '../../../data/public'; +import { Labels } from '../../../charts/public'; import { Dimensions, @@ -32,7 +32,7 @@ import { import { visName, VisTypeXyExpressionFunctionDefinition } from './expression_functions/xy_vis_fn'; import { XyVisType } from '../common'; import { getEsaggsFn } from './to_ast_esaggs'; -import { TimeRangeBounds } from '../../data/common'; +import { TimeRangeBounds } from '../../../data/common'; const prepareLabel = (data: Labels) => { const label = buildExpressionFunction('label', { diff --git a/src/plugins/vis_type_xy/public/to_ast_esaggs.ts b/src/plugins/vis_types/xy/public/to_ast_esaggs.ts similarity index 91% rename from src/plugins/vis_type_xy/public/to_ast_esaggs.ts rename to src/plugins/vis_types/xy/public/to_ast_esaggs.ts index 71ef78b19e076..ff9dbd9ca7664 100644 --- a/src/plugins/vis_type_xy/public/to_ast_esaggs.ts +++ b/src/plugins/vis_types/xy/public/to_ast_esaggs.ts @@ -6,12 +6,12 @@ * Side Public License, v 1. */ -import { Vis } from '../../visualizations/public'; -import { buildExpression, buildExpressionFunction } from '../../expressions/public'; +import { Vis } from '../../../visualizations/public'; +import { buildExpression, buildExpressionFunction } from '../../../expressions/public'; import { EsaggsExpressionFunctionDefinition, IndexPatternLoadExpressionFunctionDefinition, -} from '../../data/public'; +} from '../../../data/public'; import { VisParams } from './types'; diff --git a/src/plugins/vis_type_xy/public/types/config.ts b/src/plugins/vis_types/xy/public/types/config.ts similarity index 100% rename from src/plugins/vis_type_xy/public/types/config.ts rename to src/plugins/vis_types/xy/public/types/config.ts diff --git a/src/plugins/vis_type_xy/public/types/constants.ts b/src/plugins/vis_types/xy/public/types/constants.ts similarity index 100% rename from src/plugins/vis_type_xy/public/types/constants.ts rename to src/plugins/vis_types/xy/public/types/constants.ts diff --git a/src/plugins/vis_type_xy/public/types/index.ts b/src/plugins/vis_types/xy/public/types/index.ts similarity index 100% rename from src/plugins/vis_type_xy/public/types/index.ts rename to src/plugins/vis_types/xy/public/types/index.ts diff --git a/src/plugins/vis_type_xy/public/types/param.ts b/src/plugins/vis_types/xy/public/types/param.ts similarity index 97% rename from src/plugins/vis_type_xy/public/types/param.ts rename to src/plugins/vis_types/xy/public/types/param.ts index 0687bd2af2cd1..81eeca55108ca 100644 --- a/src/plugins/vis_type_xy/public/types/param.ts +++ b/src/plugins/vis_types/xy/public/types/param.ts @@ -7,14 +7,14 @@ */ import type { Fit, Position } from '@elastic/charts'; -import type { Style, Labels, PaletteOutput } from '../../../charts/public'; +import type { Style, Labels, PaletteOutput } from '../../../../charts/public'; import type { SchemaConfig, ExpressionValueXYDimension, FakeParams, HistogramParams, DateHistogramParams, -} from '../../../visualizations/public'; +} from '../../../../visualizations/public'; import type { ChartType, XyVisType } from '../../common'; import type { ExpressionValueCategoryAxis, diff --git a/src/plugins/vis_type_xy/public/types/vis_type.ts b/src/plugins/vis_types/xy/public/types/vis_type.ts similarity index 88% rename from src/plugins/vis_type_xy/public/types/vis_type.ts rename to src/plugins/vis_types/xy/public/types/vis_type.ts index 849a646cca814..311714ed3587d 100644 --- a/src/plugins/vis_type_xy/public/types/vis_type.ts +++ b/src/plugins/vis_types/xy/public/types/vis_type.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { VisTypeDefinition } from '../../../visualizations/public'; +import { VisTypeDefinition } from '../../../../visualizations/public'; import { ChartType } from '../../common'; import { VisParams } from './param'; diff --git a/src/plugins/vis_type_xy/public/utils/accessors.test.ts b/src/plugins/vis_types/xy/public/utils/accessors.test.ts similarity index 98% rename from src/plugins/vis_type_xy/public/utils/accessors.test.ts rename to src/plugins/vis_types/xy/public/utils/accessors.test.ts index d074263e5bb25..61d175fa8ff7d 100644 --- a/src/plugins/vis_type_xy/public/utils/accessors.test.ts +++ b/src/plugins/vis_types/xy/public/utils/accessors.test.ts @@ -7,7 +7,7 @@ */ import { COMPLEX_SPLIT_ACCESSOR, getComplexAccessor } from './accessors'; -import { BUCKET_TYPES } from '../../../data/common'; +import { BUCKET_TYPES } from '../../../../data/common'; import { AccessorFn, Datum } from '@elastic/charts'; describe('XY chart datum accessors', () => { diff --git a/src/plugins/vis_type_xy/public/utils/accessors.tsx b/src/plugins/vis_types/xy/public/utils/accessors.tsx similarity index 94% rename from src/plugins/vis_type_xy/public/utils/accessors.tsx rename to src/plugins/vis_types/xy/public/utils/accessors.tsx index 4920885f51a07..0356e921a9d5c 100644 --- a/src/plugins/vis_type_xy/public/utils/accessors.tsx +++ b/src/plugins/vis_types/xy/public/utils/accessors.tsx @@ -7,8 +7,8 @@ */ import { AccessorFn, Accessor } from '@elastic/charts'; -import { BUCKET_TYPES } from '../../../data/public'; -import { FakeParams } from '../../../visualizations/public'; +import { BUCKET_TYPES } from '../../../../data/public'; +import { FakeParams } from '../../../../visualizations/public'; import { Aspect } from '../types'; export const COMPLEX_X_ACCESSOR = '__customXAccessor__'; diff --git a/src/plugins/vis_type_xy/public/utils/domain.ts b/src/plugins/vis_types/xy/public/utils/domain.ts similarity index 90% rename from src/plugins/vis_type_xy/public/utils/domain.ts rename to src/plugins/vis_types/xy/public/utils/domain.ts index 48527ec9333ed..fa8dd74e3942a 100644 --- a/src/plugins/vis_type_xy/public/utils/domain.ts +++ b/src/plugins/vis_types/xy/public/utils/domain.ts @@ -11,9 +11,9 @@ import { unitOfTime } from 'moment'; import { DomainRange } from '@elastic/charts'; -import { getAdjustedInterval } from '../../../charts/public'; -import { Datatable } from '../../../expressions/public'; -import { DateHistogramParams, HistogramParams } from '../../../visualizations/public'; +import { getAdjustedInterval } from '../../../../charts/public'; +import { Datatable } from '../../../../expressions/public'; +import { DateHistogramParams, HistogramParams } from '../../../../visualizations/public'; import { Aspect } from '../types'; diff --git a/src/plugins/vis_type_xy/public/utils/get_all_series.test.ts b/src/plugins/vis_types/xy/public/utils/get_all_series.test.ts similarity index 100% rename from src/plugins/vis_type_xy/public/utils/get_all_series.test.ts rename to src/plugins/vis_types/xy/public/utils/get_all_series.test.ts diff --git a/src/plugins/vis_type_xy/public/utils/get_all_series.ts b/src/plugins/vis_types/xy/public/utils/get_all_series.ts similarity index 95% rename from src/plugins/vis_type_xy/public/utils/get_all_series.ts rename to src/plugins/vis_types/xy/public/utils/get_all_series.ts index c9b956f7cd3b5..cdb8f816d7e4f 100644 --- a/src/plugins/vis_type_xy/public/utils/get_all_series.ts +++ b/src/plugins/vis_types/xy/public/utils/get_all_series.ts @@ -7,7 +7,7 @@ */ import { TickFormatter } from '@elastic/charts'; -import { DatatableRow } from '../../../expressions/public'; +import { DatatableRow } from '../../../../expressions/public'; import { Column, Aspect } from '../types'; interface SplitAccessors { diff --git a/src/plugins/vis_type_xy/public/utils/get_color_picker.test.tsx b/src/plugins/vis_types/xy/public/utils/get_color_picker.test.tsx similarity index 96% rename from src/plugins/vis_type_xy/public/utils/get_color_picker.test.tsx rename to src/plugins/vis_types/xy/public/utils/get_color_picker.test.tsx index c2377b42bb1c2..e015521f7436e 100644 --- a/src/plugins/vis_type_xy/public/utils/get_color_picker.test.tsx +++ b/src/plugins/vis_types/xy/public/utils/get_color_picker.test.tsx @@ -12,8 +12,8 @@ import { EuiPopover } from '@elastic/eui'; import { mountWithIntl } from '@kbn/test/jest'; import { ComponentType, ReactWrapper } from 'enzyme'; import { getColorPicker } from './get_color_picker'; -import { ColorPicker } from '../../../charts/public'; -import type { PersistedState } from '../../../visualizations/public'; +import { ColorPicker } from '../../../../charts/public'; +import type { PersistedState } from '../../../../visualizations/public'; jest.mock('@elastic/charts', () => { const original = jest.requireActual('@elastic/charts'); diff --git a/src/plugins/vis_type_xy/public/utils/get_color_picker.tsx b/src/plugins/vis_types/xy/public/utils/get_color_picker.tsx similarity index 95% rename from src/plugins/vis_type_xy/public/utils/get_color_picker.tsx rename to src/plugins/vis_types/xy/public/utils/get_color_picker.tsx index 4805d89068e86..1b5a16a8894aa 100644 --- a/src/plugins/vis_type_xy/public/utils/get_color_picker.tsx +++ b/src/plugins/vis_types/xy/public/utils/get_color_picker.tsx @@ -10,8 +10,8 @@ import React, { useCallback } from 'react'; import { LegendColorPicker, Position, XYChartSeriesIdentifier, SeriesName } from '@elastic/charts'; import { PopoverAnchorPosition, EuiWrappingPopover, EuiOutsideClickDetector } from '@elastic/eui'; -import type { PersistedState } from '../../../visualizations/public'; -import { ColorPicker } from '../../../charts/public'; +import type { PersistedState } from '../../../../visualizations/public'; +import { ColorPicker } from '../../../../charts/public'; function getAnchorPosition(legendPosition: Position): PopoverAnchorPosition { switch (legendPosition) { diff --git a/src/plugins/vis_type_xy/public/utils/get_legend_actions.tsx b/src/plugins/vis_types/xy/public/utils/get_legend_actions.tsx similarity index 98% rename from src/plugins/vis_type_xy/public/utils/get_legend_actions.tsx rename to src/plugins/vis_types/xy/public/utils/get_legend_actions.tsx index c125d8dd075ed..98ace7dd57a39 100644 --- a/src/plugins/vis_type_xy/public/utils/get_legend_actions.tsx +++ b/src/plugins/vis_types/xy/public/utils/get_legend_actions.tsx @@ -12,7 +12,7 @@ import { i18n } from '@kbn/i18n'; import { EuiContextMenuPanelDescriptor, EuiIcon, EuiPopover, EuiContextMenu } from '@elastic/eui'; import { LegendAction, XYChartSeriesIdentifier, SeriesName } from '@elastic/charts'; -import { ClickTriggerEvent } from '../../../charts/public'; +import { ClickTriggerEvent } from '../../../../charts/public'; export const getLegendActions = ( canFilter: (data: ClickTriggerEvent | null) => Promise, diff --git a/src/plugins/vis_type_xy/public/utils/get_series_name_fn.test.ts b/src/plugins/vis_types/xy/public/utils/get_series_name_fn.test.ts similarity index 100% rename from src/plugins/vis_type_xy/public/utils/get_series_name_fn.test.ts rename to src/plugins/vis_types/xy/public/utils/get_series_name_fn.test.ts diff --git a/src/plugins/vis_type_xy/public/utils/get_series_name_fn.ts b/src/plugins/vis_types/xy/public/utils/get_series_name_fn.ts similarity index 100% rename from src/plugins/vis_type_xy/public/utils/get_series_name_fn.ts rename to src/plugins/vis_types/xy/public/utils/get_series_name_fn.ts diff --git a/src/plugins/vis_type_xy/public/utils/get_time_zone.tsx b/src/plugins/vis_types/xy/public/utils/get_time_zone.tsx similarity index 100% rename from src/plugins/vis_type_xy/public/utils/get_time_zone.tsx rename to src/plugins/vis_types/xy/public/utils/get_time_zone.tsx diff --git a/src/plugins/vis_type_xy/public/utils/index.tsx b/src/plugins/vis_types/xy/public/utils/index.tsx similarity index 100% rename from src/plugins/vis_type_xy/public/utils/index.tsx rename to src/plugins/vis_types/xy/public/utils/index.tsx diff --git a/src/plugins/vis_type_xy/public/utils/render_all_series.test.mocks.ts b/src/plugins/vis_types/xy/public/utils/render_all_series.test.mocks.ts similarity index 100% rename from src/plugins/vis_type_xy/public/utils/render_all_series.test.mocks.ts rename to src/plugins/vis_types/xy/public/utils/render_all_series.test.mocks.ts diff --git a/src/plugins/vis_type_xy/public/utils/render_all_series.test.tsx b/src/plugins/vis_types/xy/public/utils/render_all_series.test.tsx similarity index 98% rename from src/plugins/vis_type_xy/public/utils/render_all_series.test.tsx rename to src/plugins/vis_types/xy/public/utils/render_all_series.test.tsx index 23dabef662d55..47b103003b3ed 100644 --- a/src/plugins/vis_type_xy/public/utils/render_all_series.test.tsx +++ b/src/plugins/vis_types/xy/public/utils/render_all_series.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { shallow } from 'enzyme'; import { AreaSeries, BarSeries, CurveType } from '@elastic/charts'; -import { DatatableRow } from '../../../expressions/public'; +import { DatatableRow } from '../../../../expressions/public'; import { renderAllSeries } from './render_all_series'; import { getVisConfig, diff --git a/src/plugins/vis_type_xy/public/utils/render_all_series.tsx b/src/plugins/vis_types/xy/public/utils/render_all_series.tsx similarity index 98% rename from src/plugins/vis_type_xy/public/utils/render_all_series.tsx rename to src/plugins/vis_types/xy/public/utils/render_all_series.tsx index d186617fef2ae..f8ca1d059ae4f 100644 --- a/src/plugins/vis_type_xy/public/utils/render_all_series.tsx +++ b/src/plugins/vis_types/xy/public/utils/render_all_series.tsx @@ -21,8 +21,8 @@ import { LabelOverflowConstraint, } from '@elastic/charts'; -import { DatatableRow } from '../../../expressions/public'; -import { METRIC_TYPES } from '../../../data/public'; +import { DatatableRow } from '../../../../expressions/public'; +import { METRIC_TYPES } from '../../../../data/public'; import { ChartType } from '../../common'; import { SeriesParam, VisConfig } from '../types'; diff --git a/src/plugins/vis_type_xy/public/vis_component.tsx b/src/plugins/vis_types/xy/public/vis_component.tsx similarity index 98% rename from src/plugins/vis_type_xy/public/vis_component.tsx rename to src/plugins/vis_types/xy/public/vis_component.tsx index 346f6cc74a1ac..141174194f1bc 100644 --- a/src/plugins/vis_type_xy/public/vis_component.tsx +++ b/src/plugins/vis_types/xy/public/vis_component.tsx @@ -29,10 +29,10 @@ import { getBrushFromChartBrushEventFn, ClickTriggerEvent, PaletteRegistry, -} from '../../charts/public'; -import { Datatable, IInterpreterRenderHandlers } from '../../expressions/public'; -import type { PersistedState } from '../../visualizations/public'; -import { useActiveCursor } from '../../charts/public'; + useActiveCursor, +} from '../../../charts/public'; +import { Datatable, IInterpreterRenderHandlers } from '../../../expressions/public'; +import type { PersistedState } from '../../../visualizations/public'; import { VisParams } from './types'; import { getAdjustedDomain, diff --git a/src/plugins/vis_type_xy/public/vis_renderer.tsx b/src/plugins/vis_types/xy/public/vis_renderer.tsx similarity index 89% rename from src/plugins/vis_type_xy/public/vis_renderer.tsx rename to src/plugins/vis_types/xy/public/vis_renderer.tsx index df3bee9b3f446..093671307d538 100644 --- a/src/plugins/vis_type_xy/public/vis_renderer.tsx +++ b/src/plugins/vis_types/xy/public/vis_renderer.tsx @@ -10,9 +10,9 @@ import React, { lazy } from 'react'; import { render, unmountComponentAtNode } from 'react-dom'; import { I18nProvider } from '@kbn/i18n/react'; -import { VisualizationContainer } from '../../visualizations/public'; -import type { PersistedState } from '../../visualizations/public'; -import type { ExpressionRenderDefinition } from '../../expressions/public'; +import { VisualizationContainer } from '../../../visualizations/public'; +import type { PersistedState } from '../../../visualizations/public'; +import type { ExpressionRenderDefinition } from '../../../expressions/public'; import type { XyVisType } from '../common'; import type { VisComponentType } from './vis_component'; diff --git a/src/plugins/vis_type_xy/public/vis_types/area.ts b/src/plugins/vis_types/xy/public/vis_types/area.ts similarity index 95% rename from src/plugins/vis_type_xy/public/vis_types/area.ts rename to src/plugins/vis_types/xy/public/vis_types/area.ts index 4d886c0dcb884..b377fd54753da 100644 --- a/src/plugins/vis_type_xy/public/vis_types/area.ts +++ b/src/plugins/vis_types/xy/public/vis_types/area.ts @@ -11,9 +11,9 @@ import { i18n } from '@kbn/i18n'; import { euiPaletteColorBlind } from '@elastic/eui/lib/services'; import { Fit, Position } from '@elastic/charts'; -import { AggGroupNames } from '../../../data/public'; -import { VIS_EVENT_TO_TRIGGER } from '../../../visualizations/public'; -import { defaultCountLabel, LabelRotation } from '../../../charts/public'; +import { AggGroupNames } from '../../../../data/public'; +import { VIS_EVENT_TO_TRIGGER } from '../../../../visualizations/public'; +import { defaultCountLabel, LabelRotation } from '../../../../charts/public'; import { ChartMode, diff --git a/src/plugins/vis_type_xy/public/vis_types/histogram.ts b/src/plugins/vis_types/xy/public/vis_types/histogram.ts similarity index 96% rename from src/plugins/vis_type_xy/public/vis_types/histogram.ts rename to src/plugins/vis_types/xy/public/vis_types/histogram.ts index 9a0a3b43329fd..2d22b7566175c 100644 --- a/src/plugins/vis_type_xy/public/vis_types/histogram.ts +++ b/src/plugins/vis_types/xy/public/vis_types/histogram.ts @@ -11,8 +11,8 @@ import { i18n } from '@kbn/i18n'; import { euiPaletteColorBlind } from '@elastic/eui/lib/services'; import { Position } from '@elastic/charts'; -import { AggGroupNames } from '../../../data/public'; -import { VIS_EVENT_TO_TRIGGER } from '../../../visualizations/public'; +import { AggGroupNames } from '../../../../data/public'; +import { VIS_EVENT_TO_TRIGGER } from '../../../../visualizations/public'; import { ChartMode, @@ -26,7 +26,7 @@ import { import { toExpressionAst } from '../to_ast'; import { ChartType } from '../../common'; import { getOptionTabs } from '../editor/common_config'; -import { defaultCountLabel, LabelRotation } from '../../../charts/public'; +import { defaultCountLabel, LabelRotation } from '../../../../charts/public'; export const getHistogramVisTypeDefinition = ( showElasticChartsOptions = false diff --git a/src/plugins/vis_type_xy/public/vis_types/horizontal_bar.ts b/src/plugins/vis_types/xy/public/vis_types/horizontal_bar.ts similarity index 96% rename from src/plugins/vis_type_xy/public/vis_types/horizontal_bar.ts rename to src/plugins/vis_types/xy/public/vis_types/horizontal_bar.ts index 5238258fcf080..8916f3f94f6ff 100644 --- a/src/plugins/vis_type_xy/public/vis_types/horizontal_bar.ts +++ b/src/plugins/vis_types/xy/public/vis_types/horizontal_bar.ts @@ -11,8 +11,8 @@ import { i18n } from '@kbn/i18n'; import { euiPaletteColorBlind } from '@elastic/eui/lib/services'; import { Position } from '@elastic/charts'; -import { AggGroupNames } from '../../../data/public'; -import { VIS_EVENT_TO_TRIGGER } from '../../../visualizations/public'; +import { AggGroupNames } from '../../../../data/public'; +import { VIS_EVENT_TO_TRIGGER } from '../../../../visualizations/public'; import { ChartMode, @@ -26,7 +26,7 @@ import { import { toExpressionAst } from '../to_ast'; import { ChartType } from '../../common'; import { getOptionTabs } from '../editor/common_config'; -import { defaultCountLabel, LabelRotation } from '../../../charts/public'; +import { defaultCountLabel, LabelRotation } from '../../../../charts/public'; export const getHorizontalBarVisTypeDefinition = ( showElasticChartsOptions = false diff --git a/src/plugins/vis_type_xy/public/vis_types/index.ts b/src/plugins/vis_types/xy/public/vis_types/index.ts similarity index 100% rename from src/plugins/vis_type_xy/public/vis_types/index.ts rename to src/plugins/vis_types/xy/public/vis_types/index.ts diff --git a/src/plugins/vis_type_xy/public/vis_types/line.ts b/src/plugins/vis_types/xy/public/vis_types/line.ts similarity index 95% rename from src/plugins/vis_type_xy/public/vis_types/line.ts rename to src/plugins/vis_types/xy/public/vis_types/line.ts index 239eae83057d4..af75c38d627df 100644 --- a/src/plugins/vis_type_xy/public/vis_types/line.ts +++ b/src/plugins/vis_types/xy/public/vis_types/line.ts @@ -11,9 +11,9 @@ import { i18n } from '@kbn/i18n'; import { euiPaletteColorBlind } from '@elastic/eui/lib/services'; import { Position, Fit } from '@elastic/charts'; -import { AggGroupNames } from '../../../data/public'; -import { VIS_EVENT_TO_TRIGGER } from '../../../visualizations/public'; -import { defaultCountLabel, LabelRotation } from '../../../charts/public'; +import { AggGroupNames } from '../../../../data/public'; +import { VIS_EVENT_TO_TRIGGER } from '../../../../visualizations/public'; +import { defaultCountLabel, LabelRotation } from '../../../../charts/public'; import { ChartMode, diff --git a/src/plugins/vis_type_xy/server/index.ts b/src/plugins/vis_types/xy/server/index.ts similarity index 100% rename from src/plugins/vis_type_xy/server/index.ts rename to src/plugins/vis_types/xy/server/index.ts diff --git a/src/plugins/vis_type_xy/server/plugin.ts b/src/plugins/vis_types/xy/server/plugin.ts similarity index 100% rename from src/plugins/vis_type_xy/server/plugin.ts rename to src/plugins/vis_types/xy/server/plugin.ts diff --git a/src/plugins/vis_types/xy/tsconfig.json b/src/plugins/vis_types/xy/tsconfig.json new file mode 100644 index 0000000000000..f1f65b6218e82 --- /dev/null +++ b/src/plugins/vis_types/xy/tsconfig.json @@ -0,0 +1,24 @@ +{ + "extends": "../../../../tsconfig.base.json", + "compilerOptions": { + "outDir": "./target/types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true + }, + "include": [ + "common/**/*", + "public/**/*", + "server/**/*" + ], + "references": [ + { "path": "../../../core/tsconfig.json" }, + { "path": "../../charts/tsconfig.json" }, + { "path": "../../data/tsconfig.json" }, + { "path": "../../expressions/tsconfig.json" }, + { "path": "../../visualizations/tsconfig.json" }, + { "path": "../../usage_collection/tsconfig.json" }, + { "path": "../../kibana_utils/tsconfig.json" }, + { "path": "../../vis_default_editor/tsconfig.json" }, + ] +} diff --git a/x-pack/plugins/ml/public/application/util/chart_utils.js b/x-pack/plugins/ml/public/application/util/chart_utils.js index c8e7285d8a34d..dacdb5e5d5d10 100644 --- a/x-pack/plugins/ml/public/application/util/chart_utils.js +++ b/x-pack/plugins/ml/public/application/util/chart_utils.js @@ -144,7 +144,7 @@ export function drawLineChartDots(data, lineChartGroup, lineChartValuesLine, rad } // this replicates Kibana's filterAxisLabels() behavior -// which can be found in src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_labels.js +// which can be found in src/plugins/vis_types/vislib/public/vislib/lib/axis/axis_labels.js // axis labels which overflow the chart's boundaries will be removed export function filterAxisLabels(selection, chartWidth) { if (selection === undefined || selection.selectAll === undefined) { From 60af98a1b7cfe4fbb6574f8c65bc23964a2b6433 Mon Sep 17 00:00:00 2001 From: Sergi Massaneda Date: Fri, 20 Aug 2021 11:29:03 +0200 Subject: [PATCH 26/44] fix unit prop and default it only in the tGrid body (#109252) --- .../public/common/components/events_viewer/index.tsx | 3 +++ .../hosts/pages/navigation/events_query_tab_body.tsx | 2 ++ .../public/hosts/pages/translations.ts | 6 ++++++ .../public/components/t_grid/body/index.tsx | 4 ++-- .../public/components/t_grid/body/translations.ts | 6 +++--- .../public/components/t_grid/integrated/index.tsx | 4 ++-- .../public/components/t_grid/standalone/index.tsx | 6 ++---- .../public/components/t_grid/translations.ts | 12 ------------ 8 files changed, 20 insertions(+), 23 deletions(-) diff --git a/x-pack/plugins/security_solution/public/common/components/events_viewer/index.tsx b/x-pack/plugins/security_solution/public/common/components/events_viewer/index.tsx index d85c4464af986..a20055d05afab 100644 --- a/x-pack/plugins/security_solution/public/common/components/events_viewer/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/events_viewer/index.tsx @@ -65,6 +65,7 @@ export interface OwnProps { utilityBar?: (refetch: inputsModel.Refetch, totalCount: number) => React.ReactNode; additionalFilters?: React.ReactNode; hasAlertsCrud?: boolean; + unit?: (n: number) => string; } type Props = OwnProps & PropsFromRedux; @@ -105,6 +106,7 @@ const StatefulEventsViewerComponent: React.FC = ({ // If truthy, the graph viewer (Resolver) is showing graphEventId, hasAlertsCrud = false, + unit, }) => { const { timelines: timelinesUi } = useKibana().services; const { @@ -187,6 +189,7 @@ const StatefulEventsViewerComponent: React.FC = ({ leadingControlColumns, trailingControlColumns, tGridEventRenderedViewEnabled, + unit, }) ) : ( i18n.EVENTS_UNIT(n); export const histogramConfigs: MatrixHistogramConfigs = { defaultStackByOption: @@ -119,6 +120,7 @@ const EventsQueryTabBodyComponent: React.FC = ({ scopeId={SourcererScopeName.default} start={startDate} pageFilters={pageFilters} + unit={unit} /> ); diff --git a/x-pack/plugins/security_solution/public/hosts/pages/translations.ts b/x-pack/plugins/security_solution/public/hosts/pages/translations.ts index b48a6d2193a30..5563dc285ad5a 100644 --- a/x-pack/plugins/security_solution/public/hosts/pages/translations.ts +++ b/x-pack/plugins/security_solution/public/hosts/pages/translations.ts @@ -70,3 +70,9 @@ export const ERROR_FETCHING_EVENTS_DATA = i18n.translate( defaultMessage: 'Failed to query events data', } ); + +export const EVENTS_UNIT = (totalCount: number) => + i18n.translate('xpack.securitySolution.hosts.navigaton.eventsUnit', { + values: { totalCount }, + defaultMessage: `{totalCount, plural, =1 {event} other {events}}`, + }); diff --git a/x-pack/plugins/timelines/public/components/t_grid/body/index.tsx b/x-pack/plugins/timelines/public/components/t_grid/body/index.tsx index 8dbc7f34b530e..236ff6b4f8e6f 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/body/index.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/body/index.tsx @@ -105,7 +105,7 @@ interface OwnProps { hasAlertsCrud?: boolean; } -const basicUnit = (n: number) => i18n.UNIT(n); +const defaultUnit = (n: number) => i18n.ALERTS_UNIT(n); const NUM_OF_ICON_IN_TIMELINE_ROW = 2; export const hasAdditionalActions = (id: TimelineId): boolean => @@ -273,7 +273,7 @@ export const BodyComponent = React.memo( totalItems, totalPages, trailingControlColumns = EMPTY_CONTROL_COLUMNS, - unit = basicUnit, + unit = defaultUnit, hasAlertsCrud, }) => { const dispatch = useDispatch(); diff --git a/x-pack/plugins/timelines/public/components/t_grid/body/translations.ts b/x-pack/plugins/timelines/public/components/t_grid/body/translations.ts index 4eb47afdc1923..b8989bca65330 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/body/translations.ts +++ b/x-pack/plugins/timelines/public/components/t_grid/body/translations.ts @@ -217,8 +217,8 @@ export const INVESTIGATE_IN_RESOLVER_DISABLED = i18n.translate( } ); -export const UNIT = (totalCount: number) => - i18n.translate('xpack.timelines.timeline.body.unit', { +export const ALERTS_UNIT = (totalCount: number) => + i18n.translate('xpack.timelines.timeline.alertsUnit', { values: { totalCount }, - defaultMessage: `{totalCount, plural, =1 {event} other {events}}`, + defaultMessage: `{totalCount, plural, =1 {alert} other {alerts}}`, }); diff --git a/x-pack/plugins/timelines/public/components/t_grid/integrated/index.tsx b/x-pack/plugins/timelines/public/components/t_grid/integrated/index.tsx index b84eff4d2142c..b2e6b592c0f45 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/integrated/index.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/integrated/index.tsx @@ -50,7 +50,6 @@ import { useTimelineEvents } from '../../../container'; import { StatefulBody } from '../body'; import { Footer, footerHeight } from '../footer'; import { SELECTOR_TIMELINE_GLOBAL_CONTAINER, UpdatedFlexGroup, UpdatedFlexItem } from '../styles'; -import * as i18n from '../translations'; import { Sort } from '../body/sort'; import { InspectButton, InspectButtonContainer } from '../../inspect'; import { SummaryViewSelector, ViewSelection } from '../event_rendered_view/selector'; @@ -138,6 +137,7 @@ export interface TGridIntegratedProps { data?: DataPublicPluginStart; tGridEventRenderedViewEnabled: boolean; hasAlertsCrud: boolean; + unit?: (n: number) => string; } const TGridIntegratedComponent: React.FC = ({ @@ -175,6 +175,7 @@ const TGridIntegratedComponent: React.FC = ({ tGridEventRenderedViewEnabled, data, hasAlertsCrud, + unit, }) => { const dispatch = useDispatch(); const columnsHeader = isEmpty(columns) ? defaultHeaders : columns; @@ -183,7 +184,6 @@ const TGridIntegratedComponent: React.FC = ({ const [tableView, setTableView] = useState('gridView'); const getManageTimeline = useMemo(() => tGridSelectors.getManageTimelineById(), []); - const unit = useMemo(() => (n: number) => i18n.ALERTS_UNIT(n), []); const { queryFields, title } = useDeepEqualSelector((state) => getManageTimeline(state, id ?? '') ); diff --git a/x-pack/plugins/timelines/public/components/t_grid/standalone/index.tsx b/x-pack/plugins/timelines/public/components/t_grid/standalone/index.tsx index 9867cd834802e..19c5bd84a551b 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/standalone/index.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/standalone/index.tsx @@ -40,7 +40,6 @@ import { StatefulBody } from '../body'; import { Footer, footerHeight } from '../footer'; import { LastUpdatedAt } from '../..'; import { SELECTOR_TIMELINE_GLOBAL_CONTAINER, UpdatedFlexItem, UpdatedFlexGroup } from '../styles'; -import * as i18n from '../translations'; import { InspectButton, InspectButtonContainer } from '../../inspect'; import { useFetchIndex } from '../../../container/source'; import { AddToCaseAction } from '../../actions/timeline/cases/add_to_case_action'; @@ -113,9 +112,8 @@ export interface TGridStandaloneProps { trailingControlColumns: ControlColumnProps[]; bulkActions?: BulkActionsProp; data?: DataPublicPluginStart; - unit: (total: number) => React.ReactNode; + unit?: (total: number) => React.ReactNode; } -const basicUnit = (n: number) => i18n.UNIT(n); const TGridStandaloneComponent: React.FC = ({ afterCaseSelection, @@ -145,7 +143,7 @@ const TGridStandaloneComponent: React.FC = ({ leadingControlColumns, trailingControlColumns, data, - unit = basicUnit, + unit, }) => { const dispatch = useDispatch(); const columnsHeader = isEmpty(columns) ? defaultHeaders : columns; diff --git a/x-pack/plugins/timelines/public/components/t_grid/translations.ts b/x-pack/plugins/timelines/public/components/t_grid/translations.ts index 4158a02ba3d72..0c4bb5b1eb6a5 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/translations.ts +++ b/x-pack/plugins/timelines/public/components/t_grid/translations.ts @@ -19,18 +19,6 @@ export const EVENTS_TABLE_ARIA_LABEL = ({ defaultMessage: 'events; Page {activePage} of {totalPages}', }); -export const UNIT = (totalCount: number) => - i18n.translate('xpack.timelines.timeline.unit', { - values: { totalCount }, - defaultMessage: `{totalCount, plural, =1 {event} other {events}}`, - }); - -export const ALERTS_UNIT = (totalCount: number) => - i18n.translate('xpack.timelines.timeline.alertsUnit', { - values: { totalCount }, - defaultMessage: `{totalCount, plural, =1 {alert} other {alerts}}`, - }); - export const BULK_ACTION_OPEN_SELECTED = i18n.translate( 'xpack.timelines.timeline.openSelectedTitle', { From 5fd903b7fe5e1c0db1799258543d33d02329fbb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Fern=C3=A1ndez=20G=C3=B3mez?= Date: Fri, 20 Aug 2021 12:07:09 +0200 Subject: [PATCH 27/44] [RAC] Enable workflow status filtering (#108215) Co-authored-by: Jason Rhodes Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../plugins/observability/common/typings.ts | 8 ++- .../pages/alerts/alerts_table_t_grid.tsx | 32 ++++++----- .../public/pages/alerts/index.tsx | 50 ++++++++--------- .../public/pages/alerts/status_filter.tsx | 56 ------------------- ...tsx => workflow_status_filter.stories.tsx} | 12 ++-- ...st.tsx => workflow_status_filter.test.tsx} | 14 ++--- .../pages/alerts/workflow_status_filter.tsx | 55 ++++++++++++++++++ .../observability/public/routes/index.tsx | 4 +- .../server/utils/create_lifecycle_executor.ts | 10 ++-- .../utils/create_lifecycle_rule_type.test.ts | 2 + .../components/alerts_table/index.tsx | 52 +++++++++-------- .../timeline_actions/use_alerts_actions.tsx | 3 +- .../common/types/timeline/actions/index.ts | 4 +- .../translations/translations/ja-JP.json | 4 -- .../translations/translations/zh-CN.json | 4 -- .../tests/alerts/rule_registry.ts | 8 ++- 16 files changed, 162 insertions(+), 156 deletions(-) delete mode 100644 x-pack/plugins/observability/public/pages/alerts/status_filter.tsx rename x-pack/plugins/observability/public/pages/alerts/{status_filter.stories.tsx => workflow_status_filter.stories.tsx} (65%) rename x-pack/plugins/observability/public/pages/alerts/{status_filter.test.tsx => workflow_status_filter.test.tsx} (62%) create mode 100644 x-pack/plugins/observability/public/pages/alerts/workflow_status_filter.tsx diff --git a/x-pack/plugins/observability/common/typings.ts b/x-pack/plugins/observability/common/typings.ts index 305a18903fe7e..71337075e1617 100644 --- a/x-pack/plugins/observability/common/typings.ts +++ b/x-pack/plugins/observability/common/typings.ts @@ -8,8 +8,12 @@ import * as t from 'io-ts'; export type Maybe = T | null | undefined; -export const alertStatusRt = t.union([t.literal('all'), t.literal('open'), t.literal('closed')]); -export type AlertStatus = t.TypeOf; +export const alertWorkflowStatusRt = t.keyof({ + open: null, + acknowledged: null, + closed: null, +}); +export type AlertWorkflowStatus = t.TypeOf; export interface ApmIndicesConfig { /* eslint-disable @typescript-eslint/naming-convention */ diff --git a/x-pack/plugins/observability/public/pages/alerts/alerts_table_t_grid.tsx b/x-pack/plugins/observability/public/pages/alerts/alerts_table_t_grid.tsx index bbbd81b4e49ea..174650fc57c6b 100644 --- a/x-pack/plugins/observability/public/pages/alerts/alerts_table_t_grid.tsx +++ b/x-pack/plugins/observability/public/pages/alerts/alerts_table_t_grid.tsx @@ -13,21 +13,22 @@ import { AlertConsumers as AlertConsumersTyped, ALERT_DURATION as ALERT_DURATION_TYPED, - ALERT_STATUS as ALERT_STATUS_TYPED, ALERT_REASON as ALERT_REASON_TYPED, ALERT_RULE_CONSUMER, + ALERT_STATUS as ALERT_STATUS_TYPED, + ALERT_WORKFLOW_STATUS as ALERT_WORKFLOW_STATUS_TYPED, } from '@kbn/rule-data-utils'; +// @ts-expect-error importing from a place other than root because we want to limit what we import from this package +import { AlertConsumers as AlertConsumersNonTyped } from '@kbn/rule-data-utils/target_node/alerts_as_data_rbac'; import { ALERT_DURATION as ALERT_DURATION_NON_TYPED, - ALERT_STATUS as ALERT_STATUS_NON_TYPED, ALERT_REASON as ALERT_REASON_NON_TYPED, + ALERT_STATUS as ALERT_STATUS_NON_TYPED, + ALERT_WORKFLOW_STATUS as ALERT_WORKFLOW_STATUS_NON_TYPED, TIMESTAMP, // @ts-expect-error importing from a place other than root because we want to limit what we import from this package } from '@kbn/rule-data-utils/target_node/technical_field_names'; -// @ts-expect-error importing from a place other than root because we want to limit what we import from this package -import { AlertConsumers as AlertConsumersNonTyped } from '@kbn/rule-data-utils/target_node/alerts_as_data_rbac'; - import { EuiButtonIcon, EuiDataGridColumn, @@ -47,7 +48,7 @@ import type { TopAlert } from './'; import { useKibana } from '../../../../../../src/plugins/kibana_react/public'; import type { ActionProps, - AlertStatus, + AlertWorkflowStatus, ColumnHeaderOptions, RowRenderer, } from '../../../../timelines/common'; @@ -63,21 +64,22 @@ import { CoreStart } from '../../../../../../src/core/public'; const AlertConsumers: typeof AlertConsumersTyped = AlertConsumersNonTyped; const ALERT_DURATION: typeof ALERT_DURATION_TYPED = ALERT_DURATION_NON_TYPED; -const ALERT_STATUS: typeof ALERT_STATUS_TYPED = ALERT_STATUS_NON_TYPED; const ALERT_REASON: typeof ALERT_REASON_TYPED = ALERT_REASON_NON_TYPED; +const ALERT_STATUS: typeof ALERT_STATUS_TYPED = ALERT_STATUS_NON_TYPED; +const ALERT_WORKFLOW_STATUS: typeof ALERT_WORKFLOW_STATUS_TYPED = ALERT_WORKFLOW_STATUS_NON_TYPED; interface AlertsTableTGridProps { indexName: string; rangeFrom: string; rangeTo: string; kuery: string; - status: string; + workflowStatus: AlertWorkflowStatus; setRefetch: (ref: () => void) => void; addToQuery: (value: string) => void; } interface ObservabilityActionsProps extends ActionProps { - currentStatus: AlertStatus; + currentStatus: AlertWorkflowStatus; setFlyoutAlert: React.Dispatch>; } @@ -288,7 +290,7 @@ function ObservabilityActions({ } export function AlertsTableTGrid(props: AlertsTableTGridProps) { - const { indexName, rangeFrom, rangeTo, kuery, status, setRefetch, addToQuery } = props; + const { indexName, rangeFrom, rangeTo, kuery, workflowStatus, setRefetch, addToQuery } = props; const { timelines } = useKibana<{ timelines: TimelinesUIStart }>().services; const [flyoutAlert, setFlyoutAlert] = useState(undefined); @@ -313,14 +315,14 @@ export function AlertsTableTGrid(props: AlertsTableTGridProps) { return ( ); }, }, ]; - }, [status]); + }, [workflowStatus]); const tGridProps = useMemo(() => { const type: TGridType = 'standalone'; @@ -345,7 +347,7 @@ export function AlertsTableTGrid(props: AlertsTableTGridProps) { defaultMessage: 'alerts', }), query: { - query: `${ALERT_STATUS}: ${status}${kuery !== '' ? ` and ${kuery}` : ''}`, + query: `${ALERT_WORKFLOW_STATUS}: ${workflowStatus}${kuery !== '' ? ` and ${kuery}` : ''}`, language: 'kuery', }, renderCellValue: getRenderCellValue({ rangeFrom, rangeTo, setFlyoutAlert }), @@ -359,7 +361,7 @@ export function AlertsTableTGrid(props: AlertsTableTGridProps) { sortDirection, }, ], - filterStatus: status as AlertStatus, + filterStatus: workflowStatus as AlertWorkflowStatus, leadingControlColumns, trailingControlColumns, unit: (totalAlerts: number) => @@ -376,7 +378,7 @@ export function AlertsTableTGrid(props: AlertsTableTGridProps) { rangeFrom, rangeTo, setRefetch, - status, + workflowStatus, addToQuery, ]); const handleFlyoutClose = () => setFlyoutAlert(undefined); diff --git a/x-pack/plugins/observability/public/pages/alerts/index.tsx b/x-pack/plugins/observability/public/pages/alerts/index.tsx index b3ff3f94dc4db..0d6b4ab9b4cfb 100644 --- a/x-pack/plugins/observability/public/pages/alerts/index.tsx +++ b/x-pack/plugins/observability/public/pages/alerts/index.tsx @@ -10,16 +10,16 @@ import { i18n } from '@kbn/i18n'; import React, { useCallback, useMemo, useRef } from 'react'; import { useHistory } from 'react-router-dom'; import { ParsedTechnicalFields } from '../../../../rule_registry/common/parse_technical_fields'; -import type { AlertStatus } from '../../../common/typings'; +import type { AlertWorkflowStatus } from '../../../common/typings'; import { ExperimentalBadge } from '../../components/shared/experimental_badge'; import { useBreadcrumbs } from '../../hooks/use_breadcrumbs'; +import { useFetcher } from '../../hooks/use_fetcher'; import { usePluginContext } from '../../hooks/use_plugin_context'; import { RouteParams } from '../../routes'; +import { callObservabilityApi } from '../../services/call_observability_api'; import { AlertsSearchBar } from './alerts_search_bar'; import { AlertsTableTGrid } from './alerts_table_t_grid'; -import { StatusFilter } from './status_filter'; -import { useFetcher } from '../../hooks/use_fetcher'; -import { callObservabilityApi } from '../../services/call_observability_api'; +import { WorkflowStatusFilter } from './workflow_status_filter'; import './styles.scss'; export interface TopAlert { @@ -44,7 +44,7 @@ export function AlertsPage({ routeParams }: AlertsPageProps) { rangeFrom = 'now-15m', rangeTo = 'now', kuery = 'kibana.alert.status: "open"', // TODO change hardcoded values as part of another PR - status = 'open', + workflowStatus = 'open', }, } = routeParams; @@ -72,10 +72,10 @@ export function AlertsPage({ routeParams }: AlertsPageProps) { [dynamicIndexPatternResp] ); - const setStatusFilter = useCallback( - (value: AlertStatus) => { + const setWorkflowStatusFilter = useCallback( + (value: AlertWorkflowStatus) => { const nextSearchParams = new URLSearchParams(history.location.search); - nextSearchParams.set('status', value); + nextSearchParams.set('workflowStatus', value); history.push({ ...history.location, search: nextSearchParams.toString(), @@ -172,28 +172,26 @@ export function AlertsPage({ routeParams }: AlertsPageProps) { onQueryChange={onQueryChange} /> + - - - - - - - - - - 0 ? dynamicIndexPattern[0].title : ''} - rangeFrom={rangeFrom} - rangeTo={rangeTo} - kuery={kuery} - status={status} - setRefetch={setRefetch} - addToQuery={addToQuery} - /> + + + + + + 0 ? dynamicIndexPattern[0].title : ''} + rangeFrom={rangeFrom} + rangeTo={rangeTo} + kuery={kuery} + workflowStatus={workflowStatus} + setRefetch={setRefetch} + addToQuery={addToQuery} + /> + ); diff --git a/x-pack/plugins/observability/public/pages/alerts/status_filter.tsx b/x-pack/plugins/observability/public/pages/alerts/status_filter.tsx deleted file mode 100644 index 26169717d2967..0000000000000 --- a/x-pack/plugins/observability/public/pages/alerts/status_filter.tsx +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { EuiFilterButton, EuiFilterGroup } from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; -import React from 'react'; -import type { AlertStatus } from '../../../common/typings'; - -export interface StatusFilterProps { - status: AlertStatus; - onChange: (value: AlertStatus) => void; -} - -export function StatusFilter({ status = 'open', onChange }: StatusFilterProps) { - return ( - - onChange('open')} - withNext={true} - > - {i18n.translate('xpack.observability.alerts.statusFilter.openButtonLabel', { - defaultMessage: 'Open', - })} - - onChange('closed')} - withNext={true} - > - {i18n.translate('xpack.observability.alerts.statusFilter.closedButtonLabel', { - defaultMessage: 'Closed', - })} - - onChange('all')} - > - {i18n.translate('xpack.observability.alerts.statusFilter.allButtonLabel', { - defaultMessage: 'All', - })} - - - ); -} diff --git a/x-pack/plugins/observability/public/pages/alerts/status_filter.stories.tsx b/x-pack/plugins/observability/public/pages/alerts/workflow_status_filter.stories.tsx similarity index 65% rename from x-pack/plugins/observability/public/pages/alerts/status_filter.stories.tsx rename to x-pack/plugins/observability/public/pages/alerts/workflow_status_filter.stories.tsx index 851e0cb6c3ddd..e06b5d333a9a6 100644 --- a/x-pack/plugins/observability/public/pages/alerts/status_filter.stories.tsx +++ b/x-pack/plugins/observability/public/pages/alerts/workflow_status_filter.stories.tsx @@ -6,24 +6,24 @@ */ import React, { ComponentProps, useState } from 'react'; -import type { AlertStatus } from '../../../common/typings'; -import { StatusFilter } from './status_filter'; +import type { AlertWorkflowStatus } from '../../../common/typings'; +import { WorkflowStatusFilter } from './workflow_status_filter'; -type Args = ComponentProps; +type Args = ComponentProps; export default { title: 'app/Alerts/StatusFilter', - component: StatusFilter, + component: WorkflowStatusFilter, argTypes: { onChange: { action: 'change' }, }, }; export function Example({ onChange }: Args) { - const [status, setStatus] = useState('open'); + const [status, setStatus] = useState('open'); return ( - { setStatus(value); diff --git a/x-pack/plugins/observability/public/pages/alerts/status_filter.test.tsx b/x-pack/plugins/observability/public/pages/alerts/workflow_status_filter.test.tsx similarity index 62% rename from x-pack/plugins/observability/public/pages/alerts/status_filter.test.tsx rename to x-pack/plugins/observability/public/pages/alerts/workflow_status_filter.test.tsx index 72e07ebb8cadf..817ca7706df9f 100644 --- a/x-pack/plugins/observability/public/pages/alerts/status_filter.test.tsx +++ b/x-pack/plugins/observability/public/pages/alerts/workflow_status_filter.test.tsx @@ -7,27 +7,27 @@ import { render } from '@testing-library/react'; import React from 'react'; -import type { AlertStatus } from '../../../common/typings'; -import { StatusFilter } from './status_filter'; +import type { AlertWorkflowStatus } from '../../../common/typings'; +import { WorkflowStatusFilter } from './workflow_status_filter'; describe('StatusFilter', () => { describe('render', () => { it('renders', () => { const onChange = jest.fn(); - const status: AlertStatus = 'all'; + const status: AlertWorkflowStatus = 'open'; const props = { onChange, status }; - expect(() => render()).not.toThrowError(); + expect(() => render()).not.toThrowError(); }); - (['all', 'open', 'closed'] as AlertStatus[]).map((status) => { + (['open', 'acknowledged', 'closed'] as AlertWorkflowStatus[]).map((status) => { describe(`when clicking the ${status} button`, () => { it('calls the onChange callback with "${status}"', () => { const onChange = jest.fn(); const props = { onChange, status }; - const { getByTestId } = render(); - const button = getByTestId(`StatusFilter ${status} button`); + const { getByTestId } = render(); + const button = getByTestId(`WorkflowStatusFilter ${status} button`); button.click(); diff --git a/x-pack/plugins/observability/public/pages/alerts/workflow_status_filter.tsx b/x-pack/plugins/observability/public/pages/alerts/workflow_status_filter.tsx new file mode 100644 index 0000000000000..475ba17a9d2f5 --- /dev/null +++ b/x-pack/plugins/observability/public/pages/alerts/workflow_status_filter.tsx @@ -0,0 +1,55 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiButtonGroup, EuiButtonGroupOptionProps } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import React from 'react'; +import type { AlertWorkflowStatus } from '../../../common/typings'; + +export interface WorkflowStatusFilterProps { + status: AlertWorkflowStatus; + onChange: (value: AlertWorkflowStatus) => void; +} + +const options: Array = [ + { + id: 'open', + label: i18n.translate('xpack.observability.alerts.workflowStatusFilter.openButtonLabel', { + defaultMessage: 'Open', + }), + 'data-test-subj': 'WorkflowStatusFilter open button', + }, + { + id: 'acknowledged', + label: i18n.translate( + 'xpack.observability.alerts.workflowStatusFilter.acknowledgedButtonLabel', + { + defaultMessage: 'Acknowledged', + } + ), + 'data-test-subj': 'WorkflowStatusFilter acknowledged button', + }, + { + id: 'closed', + label: i18n.translate('xpack.observability.alerts.workflowStatusFilter.closedButtonLabel', { + defaultMessage: 'Closed', + }), + 'data-test-subj': 'WorkflowStatusFilter closed button', + }, +]; + +export function WorkflowStatusFilter({ status = 'open', onChange }: WorkflowStatusFilterProps) { + return ( + onChange(id as AlertWorkflowStatus)} + /> + ); +} diff --git a/x-pack/plugins/observability/public/routes/index.tsx b/x-pack/plugins/observability/public/routes/index.tsx index f97e3fb996441..00e487da7f9b7 100644 --- a/x-pack/plugins/observability/public/routes/index.tsx +++ b/x-pack/plugins/observability/public/routes/index.tsx @@ -7,7 +7,7 @@ import * as t from 'io-ts'; import React from 'react'; -import { alertStatusRt } from '../../common/typings'; +import { alertWorkflowStatusRt } from '../../common/typings'; import { ExploratoryViewPage } from '../components/shared/exploratory_view'; import { AlertsPage } from '../pages/alerts'; import { AllCasesPage } from '../pages/cases/all_cases'; @@ -93,7 +93,7 @@ export const routes = { rangeFrom: t.string, rangeTo: t.string, kuery: t.string, - status: alertStatusRt, + workflowStatus: alertWorkflowStatusRt, refreshPaused: jsonRt.pipe(t.boolean), refreshInterval: jsonRt.pipe(t.number), }), diff --git a/x-pack/plugins/rule_registry/server/utils/create_lifecycle_executor.ts b/x-pack/plugins/rule_registry/server/utils/create_lifecycle_executor.ts index e6db167d8c6b6..abdffd2aa03cc 100644 --- a/x-pack/plugins/rule_registry/server/utils/create_lifecycle_executor.ts +++ b/x-pack/plugins/rule_registry/server/utils/create_lifecycle_executor.ts @@ -24,16 +24,17 @@ import { ALERT_DURATION, ALERT_END, ALERT_ID, + ALERT_RULE_CONSUMER, + ALERT_RULE_TYPE_ID, + ALERT_RULE_UUID, ALERT_START, ALERT_STATUS, ALERT_UUID, + ALERT_WORKFLOW_STATUS, EVENT_ACTION, EVENT_KIND, - ALERT_RULE_CONSUMER, - ALERT_RULE_TYPE_ID, - ALERT_RULE_UUID, - TIMESTAMP, SPACE_IDS, + TIMESTAMP, } from '../../common/technical_rule_data_field_names'; import { IRuleDataClient } from '../rule_data_client'; import { AlertExecutorOptionsWithExtraServices } from '../types'; @@ -263,6 +264,7 @@ export const createLifecycleExecutor = ( event[ALERT_START] = started; event[ALERT_UUID] = alertUuid; + event[ALERT_WORKFLOW_STATUS] = event[ALERT_WORKFLOW_STATUS] ?? 'open'; // not sure why typescript needs the non-null assertion here // we already assert the value is not undefined with the ternary diff --git a/x-pack/plugins/rule_registry/server/utils/create_lifecycle_rule_type.test.ts b/x-pack/plugins/rule_registry/server/utils/create_lifecycle_rule_type.test.ts index 962a37a2991b0..c2e9454243e0f 100644 --- a/x-pack/plugins/rule_registry/server/utils/create_lifecycle_rule_type.test.ts +++ b/x-pack/plugins/rule_registry/server/utils/create_lifecycle_rule_type.test.ts @@ -199,6 +199,7 @@ describe('createLifecycleRuleTypeFactory', () => { "kibana.alert.rule.uuid": "alertId", "kibana.alert.start": "2021-06-16T09:01:00.000Z", "kibana.alert.status": "open", + "kibana.alert.workflow_status": "open", "kibana.space_ids": Array [ "spaceId", ], @@ -221,6 +222,7 @@ describe('createLifecycleRuleTypeFactory', () => { "kibana.alert.rule.uuid": "alertId", "kibana.alert.start": "2021-06-16T09:01:00.000Z", "kibana.alert.status": "open", + "kibana.alert.workflow_status": "open", "kibana.space_ids": Array [ "spaceId", ], diff --git a/x-pack/plugins/security_solution/public/detections/components/alerts_table/index.tsx b/x-pack/plugins/security_solution/public/detections/components/alerts_table/index.tsx index fc3e1e7f2d69b..3c0bb0e38b153 100644 --- a/x-pack/plugins/security_solution/public/detections/components/alerts_table/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/alerts_table/index.tsx @@ -5,34 +5,47 @@ * 2.0. */ -import { EuiPanel, EuiLoadingContent } from '@elastic/eui'; +import { EuiLoadingContent, EuiPanel } from '@elastic/eui'; import { isEmpty } from 'lodash/fp'; import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { connect, ConnectedProps, useDispatch } from 'react-redux'; import { Dispatch } from 'redux'; +import { esQuery, Filter } from '../../../../../../../src/plugins/data/public'; import { Status } from '../../../../common/detection_engine/schemas/common/schemas'; -import { Filter, esQuery } from '../../../../../../../src/plugins/data/public'; import { RowRendererId, TimelineIdLiteral } from '../../../../common/types/timeline'; -import { useAppToasts } from '../../../common/hooks/use_app_toasts'; import { StatefulEventsViewer } from '../../../common/components/events_viewer'; import { HeaderSection } from '../../../common/components/header_section'; +import { + displayErrorToast, + displaySuccessToast, + useStateToaster, +} from '../../../common/components/toasters'; +import { useSourcererScope } from '../../../common/containers/sourcerer'; +import { useAppToasts } from '../../../common/hooks/use_app_toasts'; import { useIsExperimentalFeatureEnabled } from '../../../common/hooks/use_experimental_features'; -import { combineQueries } from '../../../timelines/components/timeline/helpers'; +import { useInvalidFilterQuery } from '../../../common/hooks/use_invalid_filter_query'; +import { defaultCellActions } from '../../../common/lib/cell_actions/default_cell_actions'; import { useKibana } from '../../../common/lib/kibana'; -import { inputsSelectors, State, inputsModel } from '../../../common/store'; +import { inputsModel, inputsSelectors, State } from '../../../common/store'; +import { SourcererScopeName } from '../../../common/store/sourcerer/model'; +import * as i18nCommon from '../../../common/translations'; +import { DEFAULT_COLUMN_MIN_WIDTH } from '../../../timelines/components/timeline/body/constants'; +import { defaultRowRenderers } from '../../../timelines/components/timeline/body/renderers'; +import { combineQueries } from '../../../timelines/components/timeline/helpers'; import { timelineActions, timelineSelectors } from '../../../timelines/store/timeline'; -import { TimelineModel } from '../../../timelines/store/timeline/model'; import { timelineDefaults } from '../../../timelines/store/timeline/defaults'; +import { TimelineModel } from '../../../timelines/store/timeline/model'; +import { columns, RenderCellValue } from '../../configurations/security_solution_detections'; import { updateAlertStatusAction } from './actions'; +import { AditionalFiltersAction, AlertsUtilityBar } from './alerts_utility_bar'; import { - requiredFieldsForActions, alertsDefaultModel, - buildAlertStatusFilter, alertsDefaultModelRuleRegistry, + buildAlertStatusFilter, buildAlertStatusFilterRuleRegistry, + requiredFieldsForActions, } from './default_config'; -import { AditionalFiltersAction, AlertsUtilityBar } from './alerts_utility_bar'; -import * as i18nCommon from '../../../common/translations'; +import { buildTimeRangeFilter } from './helpers'; import * as i18n from './translations'; import { SetEventsDeletedProps, @@ -40,19 +53,6 @@ import { UpdateAlertsStatusCallback, UpdateAlertsStatusProps, } from './types'; -import { - useStateToaster, - displaySuccessToast, - displayErrorToast, -} from '../../../common/components/toasters'; -import { SourcererScopeName } from '../../../common/store/sourcerer/model'; -import { useSourcererScope } from '../../../common/containers/sourcerer'; -import { buildTimeRangeFilter } from './helpers'; -import { defaultRowRenderers } from '../../../timelines/components/timeline/body/renderers'; -import { columns, RenderCellValue } from '../../configurations/security_solution_detections'; -import { useInvalidFilterQuery } from '../../../common/hooks/use_invalid_filter_query'; -import { DEFAULT_COLUMN_MIN_WIDTH } from '../../../timelines/components/timeline/body/constants'; -import { defaultCellActions } from '../../../common/lib/cell_actions/default_cell_actions'; interface OwnProps { defaultFilters?: Filter[]; @@ -165,7 +165,7 @@ export const AlertsTableComponent: React.FC = ({ text: i18nCommon.UPDATE_ALERT_STATUS_FAILED_DETAILED(updated, conflicts), }); } else { - let title: string; + let title = ''; switch (status) { case 'closed': title = i18n.CLOSED_ALERT_SUCCESS_TOAST(updated); @@ -173,7 +173,6 @@ export const AlertsTableComponent: React.FC = ({ case 'open': title = i18n.OPENED_ALERT_SUCCESS_TOAST(updated); break; - case 'in-progress': case 'acknowledged': title = i18n.ACKNOWLEDGED_ALERT_SUCCESS_TOAST(updated); } @@ -185,7 +184,7 @@ export const AlertsTableComponent: React.FC = ({ const onAlertStatusUpdateFailure = useCallback( (status: Status, error: Error) => { - let title: string; + let title = ''; switch (status) { case 'closed': title = i18n.CLOSED_ALERT_FAILED_TOAST; @@ -193,7 +192,6 @@ export const AlertsTableComponent: React.FC = ({ case 'open': title = i18n.OPENED_ALERT_FAILED_TOAST; break; - case 'in-progress': case 'acknowledged': title = i18n.ACKNOWLEDGED_ALERT_FAILED_TOAST; } diff --git a/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/use_alerts_actions.tsx b/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/use_alerts_actions.tsx index 780cb65ed13d3..3568972aef2e9 100644 --- a/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/use_alerts_actions.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/use_alerts_actions.tsx @@ -9,10 +9,11 @@ import { useCallback } from 'react'; import { useDispatch } from 'react-redux'; import { useGetUserAlertsPermissions } from '@kbn/alerts'; +import { useStatusBulkActionItems } from '../../../../../../timelines/public'; import { Status } from '../../../../../common/detection_engine/schemas/common/schemas'; import { timelineActions } from '../../../../timelines/store/timeline'; import { SetEventsDeletedProps, SetEventsLoadingProps } from '../types'; -import { useStatusBulkActionItems } from '../../../../../../timelines/public'; + import { useKibana } from '../../../../common/lib/kibana'; import { SERVER_APP_ID } from '../../../../../common/constants'; interface Props { diff --git a/x-pack/plugins/timelines/common/types/timeline/actions/index.ts b/x-pack/plugins/timelines/common/types/timeline/actions/index.ts index 4d426272d8621..bd864b9d97487 100644 --- a/x-pack/plugins/timelines/common/types/timeline/actions/index.ts +++ b/x-pack/plugins/timelines/common/types/timeline/actions/index.ts @@ -118,10 +118,12 @@ export interface BulkActionsObjectProp { } export type BulkActionsProp = boolean | BulkActionsObjectProp; +export type AlertWorkflowStatus = 'open' | 'closed' | 'acknowledged'; + /** * @deprecated * TODO: remove when `acknowledged` migrations are finished */ export type InProgressStatus = 'in-progress'; -export type AlertStatus = 'open' | 'closed' | 'acknowledged' | InProgressStatus; +export type AlertStatus = AlertWorkflowStatus | InProgressStatus; diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 1d660f5ab680a..a875c427c17ac 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -18138,10 +18138,6 @@ "xpack.monitoring.updateLicenseTitle": "ライセンスの更新", "xpack.monitoring.useAvailableLicenseDescription": "すでに新しいライセンスがある場合は、今すぐアップロードしてください。", "xpack.observability.alerts.searchBarPlaceholder": "\"domain\": \"ecommerce\" AND (\"service.name\":\"ProductCatalogService\" …)", - "xpack.observability.alerts.statusFilter.allButtonLabel": "すべて", - "xpack.observability.alerts.statusFilter.closedButtonLabel": "終了", - "xpack.observability.alerts.statusFilter.openButtonLabel": "開く", - "xpack.observability.alerts.statusFilterAriaLabel": "未解決および終了ステータスでアラートをフィルター", "xpack.observability.alertsDisclaimerLinkText": "アラートとアクション", "xpack.observability.alertsDisclaimerText": "このページには実験アラートビューが表示されます。ここに表示されるデータは、アラートを正確に表していない可能性があります。アラートの非実験リストは、スタック管理のアラートとアクション設定にあります。", "xpack.observability.alertsDisclaimerTitle": "実験的", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index f7f4822f7ecc4..8a65f954398b1 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -18547,10 +18547,6 @@ "xpack.monitoring.updateLicenseTitle": "更新您的许可证", "xpack.monitoring.useAvailableLicenseDescription": "如果您已经持有新的许可证,请立即上传。", "xpack.observability.alerts.searchBarPlaceholder": "\"domain\": \"ecommerce\" AND (\"service.name\":\"ProductCatalogService\" …)", - "xpack.observability.alerts.statusFilter.allButtonLabel": "全部", - "xpack.observability.alerts.statusFilter.closedButtonLabel": "已关闭", - "xpack.observability.alerts.statusFilter.openButtonLabel": "打开", - "xpack.observability.alerts.statusFilterAriaLabel": "按未结和关闭状态筛选告警", "xpack.observability.alertsDisclaimerLinkText": "告警和操作", "xpack.observability.alertsDisclaimerText": "此页面显示实验性告警视图。此处显示的数据可能无法准确表示告警。在“堆栈管理”的“告警和操作”中提供了告警的非实验性列表。", "xpack.observability.alertsDisclaimerTitle": "实验性", diff --git a/x-pack/test/apm_api_integration/tests/alerts/rule_registry.ts b/x-pack/test/apm_api_integration/tests/alerts/rule_registry.ts index e1bd5a8d05b48..5400c3af64b55 100644 --- a/x-pack/test/apm_api_integration/tests/alerts/rule_registry.ts +++ b/x-pack/test/apm_api_integration/tests/alerts/rule_registry.ts @@ -9,11 +9,11 @@ import expect from '@kbn/expect'; import { ALERT_DURATION, ALERT_END, + ALERT_RULE_UUID, ALERT_START, ALERT_STATUS, ALERT_UUID, EVENT_KIND, - ALERT_RULE_UUID, } from '@kbn/rule-data-utils'; import { merge, omit } from 'lodash'; import { FtrProviderContext } from '../../common/ftr_provider_context'; @@ -393,6 +393,9 @@ export default function ApiTest({ getService }: FtrProviderContext) { "kibana.alert.status": Array [ "open", ], + "kibana.alert.workflow_status": Array [ + "open", + ], "kibana.space_ids": Array [ "default", ], @@ -500,6 +503,9 @@ export default function ApiTest({ getService }: FtrProviderContext) { "kibana.alert.status": Array [ "closed", ], + "kibana.alert.workflow_status": Array [ + "open", + ], "kibana.space_ids": Array [ "default", ], From c6fdef4e0d77addb43132fbd7c85cfaeec404394 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Fri, 20 Aug 2021 11:44:11 +0100 Subject: [PATCH 28/44] skip flaky suite (#102282) --- x-pack/test/api_integration/apis/ml/modules/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/test/api_integration/apis/ml/modules/index.ts b/x-pack/test/api_integration/apis/ml/modules/index.ts index c6a75eccfa4c8..ffb1a14a18469 100644 --- a/x-pack/test/api_integration/apis/ml/modules/index.ts +++ b/x-pack/test/api_integration/apis/ml/modules/index.ts @@ -14,7 +14,8 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { const fleetPackages = ['apache', 'nginx']; - describe('modules', function () { + // FLAKY: https://github.com/elastic/kibana/issues/102282 + describe.skip('modules', function () { before(async () => { // use empty_kibana to make sure the fleet setup is removed correctly after the tests await esArchiver.load('x-pack/test/functional/es_archives/empty_kibana'); From 9c24e8f70fdd73a90806ecb2a725239684ccfd91 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Fri, 20 Aug 2021 11:50:40 +0100 Subject: [PATCH 29/44] chore(NA): moving @kbn/interpreter to babel transpiler (#108512) * chore(NA): moving @kbn/interpreter to babel transpiler * chore(NA): fix imports Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- packages/kbn-interpreter/.babelrc | 3 +++ packages/kbn-interpreter/BUILD.bazel | 18 ++++++++++++------ packages/kbn-interpreter/common/package.json | 4 ++-- .../src/common/lib/ast.from_expression.test.js | 2 +- packages/kbn-interpreter/tsconfig.json | 3 ++- .../public/embeddable/embeddable_factory.ts | 2 +- .../metric_visualization/visualization.tsx | 2 +- .../xy_visualization/to_expression.test.ts | 2 +- 8 files changed, 23 insertions(+), 13 deletions(-) create mode 100644 packages/kbn-interpreter/.babelrc diff --git a/packages/kbn-interpreter/.babelrc b/packages/kbn-interpreter/.babelrc new file mode 100644 index 0000000000000..7da72d1779128 --- /dev/null +++ b/packages/kbn-interpreter/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["@kbn/babel-preset/node_preset"] +} diff --git a/packages/kbn-interpreter/BUILD.bazel b/packages/kbn-interpreter/BUILD.bazel index 903f892b64f3f..52df0f0aa8d85 100644 --- a/packages/kbn-interpreter/BUILD.bazel +++ b/packages/kbn-interpreter/BUILD.bazel @@ -1,6 +1,7 @@ load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project") load("@npm//peggy:index.bzl", "peggy") load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm") +load("//src/dev/bazel:index.bzl", "jsts_transpiler") PKG_BASE_NAME = "kbn-interpreter" PKG_REQUIRE_NAME = "@kbn/interpreter" @@ -25,7 +26,7 @@ NPM_MODULE_EXTRA_FILES = [ "package.json", ] -SRC_DEPS = [ +RUNTIME_DEPS = [ "@npm//lodash", ] @@ -35,7 +36,11 @@ TYPES_DEPS = [ "@npm//@types/node", ] -DEPS = SRC_DEPS + TYPES_DEPS +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) peggy( name = "grammar", @@ -62,14 +67,15 @@ ts_config( ) ts_project( - name = "tsc", + name = "tsc_types", args = ['--pretty'], srcs = SRCS, - deps = DEPS, + deps = TYPES_DEPS, allow_js = True, declaration = True, declaration_map = True, - out_dir = "target", + emit_declaration_only = True, + out_dir = "target_types", source_map = True, root_dir = "src", tsconfig = ":tsconfig", @@ -78,7 +84,7 @@ ts_project( js_library( name = PKG_BASE_NAME, srcs = NPM_MODULE_EXTRA_FILES + [":grammar"], - deps = DEPS + [":tsc"], + deps = RUNTIME_DEPS + [":target_node", ":tsc_types"], package_name = PKG_REQUIRE_NAME, visibility = ["//visibility:public"], ) diff --git a/packages/kbn-interpreter/common/package.json b/packages/kbn-interpreter/common/package.json index 2f5277a8e8652..6d03f2e1c6236 100644 --- a/packages/kbn-interpreter/common/package.json +++ b/packages/kbn-interpreter/common/package.json @@ -1,5 +1,5 @@ { "private": true, - "main": "../target/common/index.js", - "types": "../target/common/index.d.ts" + "main": "../target_node/common/index.js", + "types": "../target_types/common/index.d.ts" } \ No newline at end of file diff --git a/packages/kbn-interpreter/src/common/lib/ast.from_expression.test.js b/packages/kbn-interpreter/src/common/lib/ast.from_expression.test.js index a098a3fdce0f6..4011292178cfa 100644 --- a/packages/kbn-interpreter/src/common/lib/ast.from_expression.test.js +++ b/packages/kbn-interpreter/src/common/lib/ast.from_expression.test.js @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { fromExpression } from '@kbn/interpreter/target/common/lib/ast'; +import { fromExpression } from '@kbn/interpreter/common'; import { getType } from './get_type'; describe('ast fromExpression', () => { diff --git a/packages/kbn-interpreter/tsconfig.json b/packages/kbn-interpreter/tsconfig.json index 74ec484ea63e9..60f8c76cf8809 100644 --- a/packages/kbn-interpreter/tsconfig.json +++ b/packages/kbn-interpreter/tsconfig.json @@ -2,9 +2,10 @@ "extends": "../../tsconfig.bazel.json", "compilerOptions": { "allowJs": true, - "outDir": "./target/types", "declaration": true, "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "./target_types", "rootDir": "src", "sourceMap": true, "sourceRoot": "../../../../packages/kbn-interpreter/src", diff --git a/x-pack/plugins/lens/public/embeddable/embeddable_factory.ts b/x-pack/plugins/lens/public/embeddable/embeddable_factory.ts index dcb72455e0ee9..ca9d830816dbc 100644 --- a/x-pack/plugins/lens/public/embeddable/embeddable_factory.ts +++ b/x-pack/plugins/lens/public/embeddable/embeddable_factory.ts @@ -8,7 +8,7 @@ import type { Capabilities, HttpSetup } from 'kibana/public'; import { i18n } from '@kbn/i18n'; import { RecursiveReadonly } from '@kbn/utility-types'; -import { Ast } from '@kbn/interpreter/target/common'; +import { Ast } from '@kbn/interpreter/common'; import { UsageCollectionSetup } from 'src/plugins/usage_collection/public'; import { IndexPatternsContract, TimefilterContract } from '../../../../../src/plugins/data/public'; import { ReactExpressionRendererType } from '../../../../../src/plugins/expressions/public'; diff --git a/x-pack/plugins/lens/public/metric_visualization/visualization.tsx b/x-pack/plugins/lens/public/metric_visualization/visualization.tsx index 72aa3550e30dd..d832848db06f6 100644 --- a/x-pack/plugins/lens/public/metric_visualization/visualization.tsx +++ b/x-pack/plugins/lens/public/metric_visualization/visualization.tsx @@ -6,7 +6,7 @@ */ import { i18n } from '@kbn/i18n'; -import { Ast } from '@kbn/interpreter/target/common'; +import { Ast } from '@kbn/interpreter/common'; import { getSuggestions } from './metric_suggestions'; import { LensIconChartMetric } from '../assets/chart_metric'; import { Visualization, OperationMetadata, DatasourcePublicAPI } from '../types'; diff --git a/x-pack/plugins/lens/public/xy_visualization/to_expression.test.ts b/x-pack/plugins/lens/public/xy_visualization/to_expression.test.ts index 5ce44db1c4db5..80808a4055f26 100644 --- a/x-pack/plugins/lens/public/xy_visualization/to_expression.test.ts +++ b/x-pack/plugins/lens/public/xy_visualization/to_expression.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Ast } from '@kbn/interpreter/target/common'; +import { Ast } from '@kbn/interpreter/common'; import { Position } from '@elastic/charts'; import { chartPluginMock } from '../../../../../src/plugins/charts/public/mocks'; import { getXyVisualization } from './xy_visualization'; From 9fb152a92fdadcd1f675274c3a30d7ca91bcc21c Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Fri, 20 Aug 2021 11:54:46 +0100 Subject: [PATCH 30/44] chore(NA): moving @kbn/logging to babel transpiler (#108702) * chore(NA): moving @kbn/logging to babel transpiler * chore(NA): fix imports for @kbn/logging Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../kbn-config/src/config_service.test.ts | 2 +- packages/kbn-logging/.babelrc | 3 +++ packages/kbn-logging/BUILD.bazel | 20 +++++++++++++------ packages/kbn-logging/mocks/package.json | 5 +++++ packages/kbn-logging/package.json | 4 ++-- packages/kbn-logging/tsconfig.json | 5 +++-- .../http/integration_tests/router.test.ts | 2 +- src/core/server/logging/logger.mock.ts | 4 ++-- .../server/metrics/collectors/cgroup.test.ts | 2 +- src/core/server/metrics/collectors/os.test.ts | 2 +- .../metrics/ops_metrics_collector.test.ts | 2 +- .../saved_objects/is_rule_exportable.test.ts | 2 +- .../cases/server/services/cases/index.test.ts | 2 +- .../server/services/configure/index.test.ts | 2 +- .../utils/create_lifecycle_executor.test.ts | 2 +- .../utils/create_lifecycle_rule_type.test.ts | 2 +- 16 files changed, 39 insertions(+), 22 deletions(-) create mode 100644 packages/kbn-logging/.babelrc create mode 100644 packages/kbn-logging/mocks/package.json diff --git a/packages/kbn-config/src/config_service.test.ts b/packages/kbn-config/src/config_service.test.ts index d09c61a1c2110..aa520e7189e54 100644 --- a/packages/kbn-config/src/config_service.test.ts +++ b/packages/kbn-config/src/config_service.test.ts @@ -13,7 +13,7 @@ import { mockApplyDeprecations, mockedChangedPaths } from './config_service.test import { rawConfigServiceMock } from './raw/raw_config_service.mock'; import { schema } from '@kbn/config-schema'; -import { MockedLogger, loggerMock } from '@kbn/logging/target/mocks'; +import { MockedLogger, loggerMock } from '@kbn/logging/mocks'; import { ConfigService, Env, RawPackageInfo } from '.'; diff --git a/packages/kbn-logging/.babelrc b/packages/kbn-logging/.babelrc new file mode 100644 index 0000000000000..7da72d1779128 --- /dev/null +++ b/packages/kbn-logging/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["@kbn/babel-preset/node_preset"] +} diff --git a/packages/kbn-logging/BUILD.bazel b/packages/kbn-logging/BUILD.bazel index 1a3fa851a3957..71a7ece15aa73 100644 --- a/packages/kbn-logging/BUILD.bazel +++ b/packages/kbn-logging/BUILD.bazel @@ -1,5 +1,6 @@ load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project") load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm") +load("//src/dev/bazel:index.bzl", "jsts_transpiler") PKG_BASE_NAME = "kbn-logging" PKG_REQUIRE_NAME = "@kbn/logging" @@ -21,20 +22,26 @@ filegroup( ) NPM_MODULE_EXTRA_FILES = [ + "mocks/package.json", "package.json", "README.md" ] -SRC_DEPS = [ +RUNTIME_DEPS = [ "//packages/kbn-std" ] TYPES_DEPS = [ + "//packages/kbn-std", "@npm//@types/jest", "@npm//@types/node", ] -DEPS = SRC_DEPS + TYPES_DEPS +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) ts_config( name = "tsconfig", @@ -46,13 +53,14 @@ ts_config( ) ts_project( - name = "tsc", + name = "tsc_types", args = ['--pretty'], srcs = SRCS, - deps = DEPS, + deps = TYPES_DEPS, declaration = True, declaration_map = True, - out_dir = "target", + emit_declaration_only = True, + out_dir = "target_types", source_map = True, root_dir = "src", tsconfig = ":tsconfig", @@ -61,7 +69,7 @@ ts_project( js_library( name = PKG_BASE_NAME, srcs = NPM_MODULE_EXTRA_FILES, - deps = DEPS + [":tsc"], + deps = RUNTIME_DEPS + [":target_node", ":tsc_types"], package_name = PKG_REQUIRE_NAME, visibility = ["//visibility:public"], ) diff --git a/packages/kbn-logging/mocks/package.json b/packages/kbn-logging/mocks/package.json new file mode 100644 index 0000000000000..8410f557e9524 --- /dev/null +++ b/packages/kbn-logging/mocks/package.json @@ -0,0 +1,5 @@ +{ + "private": true, + "main": "../target_node/mocks/index.js", + "types": "../target_types/mocks/index.d.ts" +} \ No newline at end of file diff --git a/packages/kbn-logging/package.json b/packages/kbn-logging/package.json index d80cc1c40d7e1..c35c2f5d06095 100644 --- a/packages/kbn-logging/package.json +++ b/packages/kbn-logging/package.json @@ -3,6 +3,6 @@ "version": "1.0.0", "private": true, "license": "SSPL-1.0 OR Elastic License 2.0", - "main": "./target/index.js", - "types": "./target/index.d.ts" + "main": "./target_node/index.js", + "types": "./target_types/index.d.ts" } \ No newline at end of file diff --git a/packages/kbn-logging/tsconfig.json b/packages/kbn-logging/tsconfig.json index aaf79da229a86..a6fb0f2f73187 100644 --- a/packages/kbn-logging/tsconfig.json +++ b/packages/kbn-logging/tsconfig.json @@ -1,13 +1,14 @@ { "extends": "../../tsconfig.bazel.json", "compilerOptions": { - "outDir": "target", - "stripInternal": false, "declaration": true, "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "target_types", "rootDir": "src", "sourceMap": true, "sourceRoot": "../../../../packages/kbn-logging/src", + "stripInternal": false, "types": [ "jest", "node" diff --git a/src/core/server/http/integration_tests/router.test.ts b/src/core/server/http/integration_tests/router.test.ts index 5bea371d479ae..a3e872ee3ea87 100644 --- a/src/core/server/http/integration_tests/router.test.ts +++ b/src/core/server/http/integration_tests/router.test.ts @@ -17,7 +17,7 @@ import { loggingSystemMock } from '../../logging/logging_system.mock'; import { createHttpServer } from '../test_utils'; import { HttpService } from '../http_service'; import { Router } from '../router'; -import { loggerMock } from '@kbn/logging/target/mocks'; +import { loggerMock } from '@kbn/logging/mocks'; let server: HttpService; let logger: ReturnType; diff --git a/src/core/server/logging/logger.mock.ts b/src/core/server/logging/logger.mock.ts index efab15b7bf5f4..cfabaeb72adf7 100644 --- a/src/core/server/logging/logger.mock.ts +++ b/src/core/server/logging/logger.mock.ts @@ -6,5 +6,5 @@ * Side Public License, v 1. */ -export { loggerMock } from '@kbn/logging/target/mocks'; -export type { MockedLogger } from '@kbn/logging/target/mocks'; +export { loggerMock } from '@kbn/logging/mocks'; +export type { MockedLogger } from '@kbn/logging/mocks'; diff --git a/src/core/server/metrics/collectors/cgroup.test.ts b/src/core/server/metrics/collectors/cgroup.test.ts index 298a143717d84..269437f026f2f 100644 --- a/src/core/server/metrics/collectors/cgroup.test.ts +++ b/src/core/server/metrics/collectors/cgroup.test.ts @@ -7,7 +7,7 @@ */ import mockFs from 'mock-fs'; -import { loggerMock } from '@kbn/logging/target/mocks'; +import { loggerMock } from '@kbn/logging/mocks'; import { OsCgroupMetricsCollector } from './cgroup'; describe('OsCgroupMetricsCollector', () => { diff --git a/src/core/server/metrics/collectors/os.test.ts b/src/core/server/metrics/collectors/os.test.ts index 37373ea14c339..5592038f1416a 100644 --- a/src/core/server/metrics/collectors/os.test.ts +++ b/src/core/server/metrics/collectors/os.test.ts @@ -8,7 +8,7 @@ jest.mock('getos', () => (cb: Function) => cb(null, { dist: 'distrib', release: 'release' })); -import { loggerMock } from '@kbn/logging/target/mocks'; +import { loggerMock } from '@kbn/logging/mocks'; import os from 'os'; import { cgroupCollectorMock } from './os.test.mocks'; import { OsMetricsCollector } from './os'; diff --git a/src/core/server/metrics/ops_metrics_collector.test.ts b/src/core/server/metrics/ops_metrics_collector.test.ts index e966c7e0a8095..3faa771db1dae 100644 --- a/src/core/server/metrics/ops_metrics_collector.test.ts +++ b/src/core/server/metrics/ops_metrics_collector.test.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { loggerMock } from '@kbn/logging/target/mocks'; +import { loggerMock } from '@kbn/logging/mocks'; import { mockOsCollector, mockProcessCollector, diff --git a/x-pack/plugins/alerting/server/saved_objects/is_rule_exportable.test.ts b/x-pack/plugins/alerting/server/saved_objects/is_rule_exportable.test.ts index 8a22ded2886ff..8322e42b0743c 100644 --- a/x-pack/plugins/alerting/server/saved_objects/is_rule_exportable.test.ts +++ b/x-pack/plugins/alerting/server/saved_objects/is_rule_exportable.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { MockedLogger, loggerMock } from '@kbn/logging/target/mocks'; +import { MockedLogger, loggerMock } from '@kbn/logging/mocks'; import { TaskRunnerFactory } from '../task_runner'; import { RuleTypeRegistry, ConstructorOptions } from '../rule_type_registry'; import { taskManagerMock } from '../../../task_manager/server/mocks'; diff --git a/x-pack/plugins/cases/server/services/cases/index.test.ts b/x-pack/plugins/cases/server/services/cases/index.test.ts index bf7eeda7e0e2e..aec188037f095 100644 --- a/x-pack/plugins/cases/server/services/cases/index.test.ts +++ b/x-pack/plugins/cases/server/services/cases/index.test.ts @@ -29,7 +29,7 @@ import { SavedObjectsUpdateResponse, } from 'kibana/server'; import { ACTION_SAVED_OBJECT_TYPE } from '../../../../actions/server'; -import { loggerMock } from '@kbn/logging/target/mocks'; +import { loggerMock } from '@kbn/logging/mocks'; import { getNoneCaseConnector, CONNECTOR_ID_REFERENCE_NAME } from '../../common'; import { CasesService } from '.'; import { diff --git a/x-pack/plugins/cases/server/services/configure/index.test.ts b/x-pack/plugins/cases/server/services/configure/index.test.ts index 199b541d49f98..045142ea13e11 100644 --- a/x-pack/plugins/cases/server/services/configure/index.test.ts +++ b/x-pack/plugins/cases/server/services/configure/index.test.ts @@ -23,7 +23,7 @@ import { SavedObjectsUpdateResponse, } from 'kibana/server'; import { ACTION_SAVED_OBJECT_TYPE } from '../../../../actions/server'; -import { loggerMock } from '@kbn/logging/target/mocks'; +import { loggerMock } from '@kbn/logging/mocks'; import { CaseConfigureService } from '.'; import { ESCasesConfigureAttributes } from './types'; import { getNoneCaseConnector, CONNECTOR_ID_REFERENCE_NAME } from '../../common'; diff --git a/x-pack/plugins/rule_registry/server/utils/create_lifecycle_executor.test.ts b/x-pack/plugins/rule_registry/server/utils/create_lifecycle_executor.test.ts index 236f3b41d689d..2d0ca3e328a13 100644 --- a/x-pack/plugins/rule_registry/server/utils/create_lifecycle_executor.test.ts +++ b/x-pack/plugins/rule_registry/server/utils/create_lifecycle_executor.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { loggerMock } from '@kbn/logging/target/mocks'; +import { loggerMock } from '@kbn/logging/mocks'; import { elasticsearchServiceMock, savedObjectsClientMock, diff --git a/x-pack/plugins/rule_registry/server/utils/create_lifecycle_rule_type.test.ts b/x-pack/plugins/rule_registry/server/utils/create_lifecycle_rule_type.test.ts index c2e9454243e0f..7d798effcb9e5 100644 --- a/x-pack/plugins/rule_registry/server/utils/create_lifecycle_rule_type.test.ts +++ b/x-pack/plugins/rule_registry/server/utils/create_lifecycle_rule_type.test.ts @@ -7,7 +7,7 @@ import { schema } from '@kbn/config-schema'; import { ALERT_DURATION, ALERT_STATUS, ALERT_UUID } from '@kbn/rule-data-utils'; -import { loggerMock } from '@kbn/logging/target/mocks'; +import { loggerMock } from '@kbn/logging/mocks'; import { castArray, omit, mapValues } from 'lodash'; import { RuleDataClient } from '../rule_data_client'; import { createRuleDataClientMock } from '../rule_data_client/rule_data_client.mock'; From ca6bb4b6d153761afecd178d2e0cbd7acf218cb2 Mon Sep 17 00:00:00 2001 From: Walter Rafelsberger Date: Fri, 20 Aug 2021 12:57:28 +0200 Subject: [PATCH 31/44] [ML] APM Latency Correlations: Fix formatting of duration values for log x axis and selection badge. (#109214) - Fix, clean up and unit tests for the log log charts x axis duration based ticks. This extends existing duration utilities to support a custom threshold to be able to fine tune the formatting for either single values with more detail or chart axis ticks where less detail is required. This is useful for log axis that cover a wider range of units. As can be seen in the screenshot, axis ticks will be formatted as full seconds from 1s onwards instead of 1,000 ms already up to 10 seconds. Because the threshold parameter is optional and defaults to 10, other uses of getDurationFormatter don't need to be changed. - Fixes the formatting of the selection badge. --- .../common/utils/formatters/duration.test.ts | 51 ++++++++++++++++++- .../apm/common/utils/formatters/duration.ts | 45 +++++++++------- .../utils/formatters/formatters.test.ts | 47 ++++++++++++----- .../apm/common/utils/formatters/formatters.ts | 6 +-- .../distribution/index.test.ts | 22 ++++++++ .../distribution/index.tsx | 22 ++++++-- .../transaction_distribution_chart/index.tsx | 49 +++++++----------- 7 files changed, 172 insertions(+), 70 deletions(-) create mode 100644 x-pack/plugins/apm/public/components/app/transaction_details/distribution/index.test.ts diff --git a/x-pack/plugins/apm/common/utils/formatters/duration.test.ts b/x-pack/plugins/apm/common/utils/formatters/duration.test.ts index 42ae4d54bced3..a45582f42b5b2 100644 --- a/x-pack/plugins/apm/common/utils/formatters/duration.test.ts +++ b/x-pack/plugins/apm/common/utils/formatters/duration.test.ts @@ -5,7 +5,12 @@ * 2.0. */ -import { asDuration, toMicroseconds, asMillisecondDuration } from './duration'; +import { + asDuration, + getDurationFormatter, + toMicroseconds, + asMillisecondDuration, +} from './duration'; describe('duration formatters', () => { describe('asDuration', () => { @@ -35,6 +40,50 @@ describe('duration formatters', () => { }); }); + describe('getDurationFormatter', () => { + // Formatting with a default threshold of 10 for more detail for single values + it('formats correctly with defaults', () => { + expect(getDurationFormatter(987654)(987654).formatted).toEqual('988 ms'); + expect(getDurationFormatter(1000000)(1000000).formatted).toEqual( + '1,000 ms' + ); + expect(getDurationFormatter(1234567)(1234567).formatted).toEqual( + '1,235 ms' + ); + expect(getDurationFormatter(9876543)(9876543).formatted).toEqual( + '9,877 ms' + ); + expect(getDurationFormatter(10000000)(10000000).formatted).toEqual( + '10,000 ms' + ); + expect(getDurationFormatter(12345678)(12345678).formatted).toEqual( + '12 s' + ); + }); + + // Formatting useful for axis ticks with a lower threshold where less detail is sufficient + it('formats correctly with a threshold of 0.9999', () => { + expect(getDurationFormatter(987654, 0.9999)(987654).formatted).toEqual( + '988 ms' + ); + expect(getDurationFormatter(1000000, 0.9999)(1000000).formatted).toEqual( + '1 s' + ); + expect(getDurationFormatter(1234567, 0.9999)(1234567).formatted).toEqual( + '1 s' + ); + expect(getDurationFormatter(9876543, 0.9999)(9876543).formatted).toEqual( + '10 s' + ); + expect( + getDurationFormatter(10000000, 0.9999)(10000000).formatted + ).toEqual('10 s'); + expect( + getDurationFormatter(12345678, 0.9999)(12345678).formatted + ).toEqual('12 s'); + }); + }); + describe('toMicroseconds', () => { it('transformes to microseconds', () => { expect(toMicroseconds(1, 'hours')).toEqual(3600000000); diff --git a/x-pack/plugins/apm/common/utils/formatters/duration.ts b/x-pack/plugins/apm/common/utils/formatters/duration.ts index 917521117af4e..bc4d58831ff35 100644 --- a/x-pack/plugins/apm/common/utils/formatters/duration.ts +++ b/x-pack/plugins/apm/common/utils/formatters/duration.ts @@ -33,12 +33,16 @@ export type TimeFormatter = ( options?: FormatterOptions ) => ConvertedDuration; -type TimeFormatterBuilder = (max: number) => TimeFormatter; +type TimeFormatterBuilder = (max: number, threshold?: number) => TimeFormatter; -export function getUnitLabelAndConvertedValue( +// threshold defines the value from which upwards there should be no decimal places. +function getUnitLabelAndConvertedValue( unitKey: DurationTimeUnit, - value: number + value: number, + threshold: number = 10 ) { + const ms = value / 1000; + switch (unitKey) { case 'hours': { return { @@ -46,7 +50,8 @@ export function getUnitLabelAndConvertedValue( defaultMessage: 'h', }), convertedValue: asDecimalOrInteger( - moment.duration(value / 1000).asHours() + moment.duration(ms).asHours(), + threshold ), }; } @@ -56,7 +61,8 @@ export function getUnitLabelAndConvertedValue( defaultMessage: 'min', }), convertedValue: asDecimalOrInteger( - moment.duration(value / 1000).asMinutes() + moment.duration(ms).asMinutes(), + threshold ), }; } @@ -66,7 +72,8 @@ export function getUnitLabelAndConvertedValue( defaultMessage: 's', }), convertedValue: asDecimalOrInteger( - moment.duration(value / 1000).asSeconds() + moment.duration(ms).asSeconds(), + threshold ), }; } @@ -76,7 +83,8 @@ export function getUnitLabelAndConvertedValue( defaultMessage: 'ms', }), convertedValue: asDecimalOrInteger( - moment.duration(value / 1000).asMilliseconds() + moment.duration(ms).asMilliseconds(), + threshold ), }; } @@ -98,10 +106,12 @@ function convertTo({ unit, microseconds, defaultValue = NOT_AVAILABLE_LABEL, + threshold = 10, }: { unit: DurationTimeUnit; microseconds: Maybe; defaultValue?: string; + threshold?: number; }): ConvertedDuration { if (!isFiniteNumber(microseconds)) { return { value: defaultValue, formatted: defaultValue }; @@ -109,7 +119,8 @@ function convertTo({ const { convertedValue, unitLabel } = getUnitLabelAndConvertedValue( unit, - microseconds + microseconds, + threshold ); return { @@ -122,10 +133,7 @@ function convertTo({ export const toMicroseconds = (value: number, timeUnit: TimeUnit) => moment.duration(value, timeUnit).asMilliseconds() * 1000; -export function getDurationUnitKey( - max: number, - threshold = 10 -): DurationTimeUnit { +function getDurationUnitKey(max: number, threshold = 10): DurationTimeUnit { if (max > toMicroseconds(threshold, 'hours')) { return 'hours'; } @@ -141,13 +149,16 @@ export function getDurationUnitKey( return 'microseconds'; } +// memoizer with a custom resolver to consider both arguments max/threshold. +// by default lodash's memoize only considers the first argument. export const getDurationFormatter: TimeFormatterBuilder = memoize( - (max: number) => { - const unit = getDurationUnitKey(max); - return (value, { defaultValue }: FormatterOptions = {}) => { - return convertTo({ unit, microseconds: value, defaultValue }); + (max: number, threshold: number = 10) => { + const unit = getDurationUnitKey(max, threshold); + return (value: Maybe, { defaultValue }: FormatterOptions = {}) => { + return convertTo({ unit, microseconds: value, defaultValue, threshold }); }; - } + }, + (max, threshold) => `${max}_${threshold}` ); export function asTransactionRate(value: Maybe) { diff --git a/x-pack/plugins/apm/common/utils/formatters/formatters.test.ts b/x-pack/plugins/apm/common/utils/formatters/formatters.test.ts index 230912045077d..f876b639c923d 100644 --- a/x-pack/plugins/apm/common/utils/formatters/formatters.test.ts +++ b/x-pack/plugins/apm/common/utils/formatters/formatters.test.ts @@ -36,19 +36,40 @@ describe('formatters', () => { }); describe('asDecimalOrInteger', () => { - it('formats as integer when number equals to 0 ', () => { - expect(asDecimalOrInteger(0)).toEqual('0'); - }); - it('formats as integer when number is above or equals 10 ', () => { - expect(asDecimalOrInteger(10.123)).toEqual('10'); - expect(asDecimalOrInteger(15.123)).toEqual('15'); - }); - it('formats as decimal when number is below 10 ', () => { - expect(asDecimalOrInteger(0.25435632645)).toEqual('0.3'); - expect(asDecimalOrInteger(1)).toEqual('1.0'); - expect(asDecimalOrInteger(3.374329704990765)).toEqual('3.4'); - expect(asDecimalOrInteger(5)).toEqual('5.0'); - expect(asDecimalOrInteger(9)).toEqual('9.0'); + describe('with default threshold of 10', () => { + it('formats as integer when number equals to 0 ', () => { + expect(asDecimalOrInteger(0)).toEqual('0'); + }); + it('formats as integer when number is above or equals 10 ', () => { + expect(asDecimalOrInteger(10.123)).toEqual('10'); + expect(asDecimalOrInteger(15.123)).toEqual('15'); + }); + it('formats as decimal when number is below 10 ', () => { + expect(asDecimalOrInteger(0.25435632645)).toEqual('0.3'); + expect(asDecimalOrInteger(1)).toEqual('1.0'); + expect(asDecimalOrInteger(3.374329704990765)).toEqual('3.4'); + expect(asDecimalOrInteger(5)).toEqual('5.0'); + expect(asDecimalOrInteger(9)).toEqual('9.0'); + }); + }); + + describe('with custom threshold of 1', () => { + it('formats as integer when number equals to 0 ', () => { + expect(asDecimalOrInteger(0, 1)).toEqual('0'); + }); + it('formats as integer when number is above or equals 1 ', () => { + expect(asDecimalOrInteger(1, 1)).toEqual('1'); + expect(asDecimalOrInteger(1.123, 1)).toEqual('1'); + expect(asDecimalOrInteger(3.374329704990765, 1)).toEqual('3'); + expect(asDecimalOrInteger(5, 1)).toEqual('5'); + expect(asDecimalOrInteger(9, 1)).toEqual('9'); + expect(asDecimalOrInteger(10, 1)).toEqual('10'); + expect(asDecimalOrInteger(10.123, 1)).toEqual('10'); + expect(asDecimalOrInteger(15.123, 1)).toEqual('15'); + }); + it('formats as decimal when number is below 1 ', () => { + expect(asDecimalOrInteger(0.25435632645, 1)).toEqual('0.3'); + }); }); }); }); diff --git a/x-pack/plugins/apm/common/utils/formatters/formatters.ts b/x-pack/plugins/apm/common/utils/formatters/formatters.ts index 4da73a6d2c29a..67a259caa2534 100644 --- a/x-pack/plugins/apm/common/utils/formatters/formatters.ts +++ b/x-pack/plugins/apm/common/utils/formatters/formatters.ts @@ -55,9 +55,9 @@ export function asPercent( return numeral(decimal).format('0.0%'); } -export function asDecimalOrInteger(value: number) { - // exact 0 or above 10 should not have decimal - if (value === 0 || value >= 10) { +export function asDecimalOrInteger(value: number, threshold = 10) { + // exact 0 or above threshold should not have decimal + if (value === 0 || value >= threshold) { return asInteger(value); } return asDecimal(value); diff --git a/x-pack/plugins/apm/public/components/app/transaction_details/distribution/index.test.ts b/x-pack/plugins/apm/public/components/app/transaction_details/distribution/index.test.ts new file mode 100644 index 0000000000000..f541c16e655ab --- /dev/null +++ b/x-pack/plugins/apm/public/components/app/transaction_details/distribution/index.test.ts @@ -0,0 +1,22 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { getFormattedSelection } from './index'; + +describe('transaction_details/distribution', () => { + describe('getFormattedSelection', () => { + it('displays only one unit if from and to share the same unit', () => { + expect(getFormattedSelection([10000, 100000])).toEqual('10 - 100 ms'); + }); + + it('displays two units when from and to have different units', () => { + expect(getFormattedSelection([100000, 1000000000])).toEqual( + '100 ms - 17 min' + ); + }); + }); +}); diff --git a/x-pack/plugins/apm/public/components/app/transaction_details/distribution/index.tsx b/x-pack/plugins/apm/public/components/app/transaction_details/distribution/index.tsx index 49d28fec1a136..2506ac69f7aa2 100644 --- a/x-pack/plugins/apm/public/components/app/transaction_details/distribution/index.tsx +++ b/x-pack/plugins/apm/public/components/app/transaction_details/distribution/index.tsx @@ -17,6 +17,7 @@ import { EuiTitle, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; +import { getDurationFormatter } from '../../../../../common/utils/formatters'; import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context'; import { useTransactionDistributionFetcher } from '../../../../hooks/use_transaction_distribution_fetcher'; @@ -28,11 +29,25 @@ import { isErrorMessage } from '../../correlations/utils/is_error_message'; const DEFAULT_PERCENTILE_THRESHOLD = 95; +type Selection = [number, number]; + +// Format the selected latency range for the "Clear selection" badge. +// If the two values share the same unit, it will only displayed once. +// For example: 12 - 23 ms / 12 ms - 3 s +export function getFormattedSelection(selection: Selection): string { + const from = getDurationFormatter(selection[0])(selection[0]); + const to = getDurationFormatter(selection[1])(selection[1]); + + return `${from.unit === to.unit ? from.value : from.formatted} - ${ + to.formatted + }`; +} + interface Props { markerCurrentTransaction?: number; onChartSelection: BrushEndListener; onClearSelection: () => void; - selection?: [number, number]; + selection?: Selection; } export function TransactionDistribution({ @@ -177,10 +192,9 @@ export function TransactionDistribution({ {i18n.translate( 'xpack.apm.transactionDetails.distribution.selectionText', { - defaultMessage: `Selection: {selectionFrom} - {selectionTo}ms`, + defaultMessage: `Selection: {formattedSelection}`, values: { - selectionFrom: Math.round(selection[0] / 1000), - selectionTo: Math.round(selection[1] / 1000), + formattedSelection: getFormattedSelection(selection), }, } )} diff --git a/x-pack/plugins/apm/public/components/shared/charts/transaction_distribution_chart/index.tsx b/x-pack/plugins/apm/public/components/shared/charts/transaction_distribution_chart/index.tsx index 3e8a8cc260a56..c511a708058d3 100644 --- a/x-pack/plugins/apm/public/components/shared/charts/transaction_distribution_chart/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/charts/transaction_distribution_chart/index.tsx @@ -15,11 +15,12 @@ import { CurveType, LineAnnotation, LineAnnotationDatum, + LineAnnotationStyle, Position, RectAnnotation, ScaleType, Settings, - LineAnnotationStyle, + TickFormatter, } from '@elastic/charts'; import { euiPaletteColorBlind } from '@elastic/eui'; @@ -28,10 +29,7 @@ import { i18n } from '@kbn/i18n'; import { useChartTheme } from '../../../../../../observability/public'; -import { - getDurationUnitKey, - getUnitLabelAndConvertedValue, -} from '../../../../../common/utils/formatters'; +import { getDurationFormatter } from '../../../../../common/utils/formatters'; import { HistogramItem } from '../../../../../common/search_strategies/correlations/types'; import { FETCH_STATUS } from '../../../../hooks/use_fetcher'; @@ -39,7 +37,7 @@ import { useTheme } from '../../../../hooks/use_theme'; import { ChartContainer } from '../chart_container'; -interface CorrelationsChartProps { +interface TransactionDistributionChartProps { field?: string; value?: string; histogram?: HistogramItem[]; @@ -90,9 +88,15 @@ export const replaceHistogramDotsWithBars = ( } }; +// Create and call a duration formatter for every value since the durations for the +// x axis might have a wide range of values e.g. from low milliseconds to large seconds. +// This way we can get different suitable units across ticks. +const xAxisTickFormat: TickFormatter = (d) => + getDurationFormatter(d, 0.9999)(d).formatted; + export function TransactionDistributionChart({ - field, - value, + field: fieldName, + value: fieldValue, histogram: originalHistogram, markerCurrentTransaction, markerValue, @@ -100,7 +104,7 @@ export function TransactionDistributionChart({ overallHistogram, onChartSelection, selection, -}: CorrelationsChartProps) { +}: TransactionDistributionChartProps) { const chartTheme = useChartTheme(); const euiTheme = useTheme(); @@ -246,17 +250,7 @@ export function TransactionDistributionChart({ id="x-axis" title="" position={Position.Bottom} - tickFormat={(d) => { - const unit = getDurationUnitKey(d, 1); - const converted = getUnitLabelAndConvertedValue(unit, d); - const convertedValueParts = converted.convertedValue.split('.'); - const convertedValue = - convertedValueParts.length === 2 && - convertedValueParts[1] === '0' - ? convertedValueParts[0] - : converted.convertedValue; - return `${convertedValue}${converted.unitLabel}`; - }} + tickFormat={xAxisTickFormat} gridLine={{ visible: false }} /> {Array.isArray(histogram) && - field !== undefined && - value !== undefined && ( + fieldName !== undefined && + fieldValue !== undefined && ( Date: Fri, 20 Aug 2021 06:10:14 -0600 Subject: [PATCH 32/44] [Maps] fix edit layer settings action showing when readonly (#109321) * [Maps] fix edit layer settings action showing when readonly * remove unneeded file Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../toc_entry_actions_popover.test.tsx.snap | 11 ---------- .../toc_entry_actions_popover.tsx | 22 +++++++++---------- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/x-pack/plugins/maps/public/connected_components/right_side_controls/layer_control/layer_toc/toc_entry/toc_entry_actions_popover/__snapshots__/toc_entry_actions_popover.test.tsx.snap b/x-pack/plugins/maps/public/connected_components/right_side_controls/layer_control/layer_toc/toc_entry/toc_entry_actions_popover/__snapshots__/toc_entry_actions_popover.test.tsx.snap index 6531b8a2f2501..1fdae3b596e00 100644 --- a/x-pack/plugins/maps/public/connected_components/right_side_controls/layer_control/layer_toc/toc_entry/toc_entry_actions_popover/__snapshots__/toc_entry_actions_popover.test.tsx.snap +++ b/x-pack/plugins/maps/public/connected_components/right_side_controls/layer_control/layer_toc/toc_entry/toc_entry_actions_popover/__snapshots__/toc_entry_actions_popover.test.tsx.snap @@ -535,17 +535,6 @@ exports[`TOCEntryActionsPopover should not show edit actions in read only mode 1 "onClick": [Function], "toolTipContent": null, }, - Object { - "data-test-subj": "layerSettingsButton", - "disabled": false, - "icon": , - "name": "Edit layer settings", - "onClick": [Function], - "toolTipContent": null, - }, ], "title": "Layer actions", }, diff --git a/x-pack/plugins/maps/public/connected_components/right_side_controls/layer_control/layer_toc/toc_entry/toc_entry_actions_popover/toc_entry_actions_popover.tsx b/x-pack/plugins/maps/public/connected_components/right_side_controls/layer_control/layer_toc/toc_entry/toc_entry_actions_popover/toc_entry_actions_popover.tsx index ed0946e526c80..322c0540528d7 100644 --- a/x-pack/plugins/maps/public/connected_components/right_side_controls/layer_control/layer_toc/toc_entry/toc_entry_actions_popover/toc_entry_actions_popover.tsx +++ b/x-pack/plugins/maps/public/connected_components/right_side_controls/layer_control/layer_toc/toc_entry/toc_entry_actions_popover/toc_entry_actions_popover.tsx @@ -174,19 +174,19 @@ export class TOCEntryActionsPopover extends Component { }, }); } - actionItems.push({ - disabled: this.props.isEditButtonDisabled, - name: EDIT_LAYER_SETTINGS_LABEL, - icon: , - 'data-test-subj': 'layerSettingsButton', - toolTipContent: null, - onClick: () => { - this._closePopover(); - this.props.openLayerSettings(); - }, - }); if (!this.props.isReadOnly) { + actionItems.push({ + disabled: this.props.isEditButtonDisabled, + name: EDIT_LAYER_SETTINGS_LABEL, + icon: , + 'data-test-subj': 'layerSettingsButton', + toolTipContent: null, + onClick: () => { + this._closePopover(); + this.props.openLayerSettings(); + }, + }); if (this.state.supportsFeatureEditing) { actionItems.push({ name: EDIT_FEATURES_LABEL, From fcd89703f73397be3405426fe59565c32501e386 Mon Sep 17 00:00:00 2001 From: Alison Goryachev Date: Fri, 20 Aug 2021 08:54:50 -0400 Subject: [PATCH 33/44] [Upgrade Assistant] New ES deprecations page (#107053) --- .../schema/xpack_plugins.json | 10 +- .../translations/translations/ja-JP.json | 46 +- .../translations/translations/zh-CN.json | 30 - .../client_integration/cluster.test.ts | 363 -------- .../default_deprecation_flyout.test.ts | 52 ++ .../es_deprecations/deprecations_list.test.ts | 267 ++++++ .../es_deprecations/error_handling.test.ts | 115 +++ .../index_settings_deprecation_flyout.test.ts | 117 +++ .../ml_snapshots_deprecation_flyout.test.ts | 196 ++++ .../es_deprecations/mocked_responses.ts | 119 +++ .../reindex_deprecation_flyout.test.ts | 50 + .../helpers/cluster.helpers.ts | 67 -- .../helpers/elasticsearch.helpers.ts | 171 ++++ .../helpers/http_requests.ts | 20 +- .../client_integration/helpers/index.ts | 3 +- .../helpers/indices.helpers.ts | 75 -- .../helpers/setup_environment.tsx | 7 +- .../client_integration/indices.test.ts | 245 ----- .../client_integration/kibana.test.ts | 6 +- .../review_logs_step/mocked_responses.ts | 15 +- .../review_logs_step.test.tsx | 2 +- .../plugins/upgrade_assistant/common/types.ts | 31 +- .../public/application/app.tsx | 12 +- .../application/components/constants.tsx | 23 + .../__fixtures__/checkup_api_response.json | 870 ------------------ .../components/es_deprecations/_index.scss | 2 +- .../deprecation_tab_content.tsx | 228 ----- .../_index.scss | 1 - .../deprecation_types/default/flyout.tsx | 96 ++ .../default/index.ts} | 2 +- .../deprecation_types/default/table_row.tsx | 73 ++ .../index.tsx | 5 +- .../index_settings/flyout.tsx | 204 ++++ .../index_settings}/index.ts | 2 +- .../index_settings/resolution_table_cell.tsx | 130 +++ .../index_settings/table_row.tsx | 103 +++ .../ml_snapshots/context.tsx | 65 ++ .../ml_snapshots/flyout.tsx} | 129 +-- .../ml_snapshots}/index.ts | 2 +- .../ml_snapshots/resolution_table_cell.tsx | 140 +++ .../ml_snapshots/table_row.tsx | 92 ++ .../ml_snapshots/use_snapshot_state.tsx | 9 +- .../reindex/_index.scss | 1 - .../deprecation_types/reindex/context.tsx | 61 ++ .../checklist_step.test.tsx.snap | 0 .../__snapshots__/warning_step.test.tsx.snap | 0 .../reindex/flyout/_index.scss | 0 .../reindex/flyout/_step_progress.scss | 0 .../reindex/flyout/checklist_step.test.tsx | 2 +- .../reindex/flyout/checklist_step.tsx | 4 +- .../reindex/flyout/container.tsx | 142 +++ .../reindex/flyout/index.tsx | 8 + .../reindex/flyout/progress.test.tsx | 2 +- .../reindex/flyout/progress.tsx | 2 +- .../reindex/flyout/step_progress.tsx | 0 .../reindex/flyout/warning_step.test.tsx | 0 .../reindex/flyout/warning_step_checkbox.tsx | 0 .../reindex/flyout/warnings_step.tsx | 0 .../reindex/index.tsx | 2 +- .../reindex/resolution_table_cell.tsx | 158 ++++ .../deprecation_types/reindex/table_row.tsx | 104 +++ .../reindex/use_reindex_state.tsx | 187 ++++ .../es_deprecations/deprecations/_cell.scss | 4 - .../es_deprecations/deprecations/cell.tsx | 146 --- .../deprecations/deprecation_group_item.tsx | 75 -- .../deprecations/index_settings/button.tsx | 54 -- .../remove_settings_provider.tsx | 131 --- .../deprecations/index_table.test.tsx | 99 -- .../deprecations/index_table.tsx | 200 ---- .../deprecations/list.test.tsx | 129 --- .../es_deprecations/deprecations/list.tsx | 120 --- .../deprecations/ml_snapshots/button.tsx | 125 --- .../deprecations/reindex/_button.scss | 5 - .../deprecations/reindex/button.tsx | 244 ----- .../deprecations/reindex/flyout/container.tsx | 172 ---- .../reindex/polling_service.test.ts | 87 -- .../deprecations/reindex/polling_service.ts | 169 ---- .../es_deprecations/es_deprecation_errors.tsx | 2 +- .../es_deprecations/es_deprecations.tsx | 240 ++--- .../es_deprecations/es_deprecations_table.tsx | 316 +++++++ .../es_deprecations_table_cells.tsx | 74 ++ .../components/es_deprecations/index.ts | 2 +- .../kibana_deprecations.tsx | 2 +- .../components/overview/overview.tsx | 2 +- .../review_logs_step/es_stats/es_stats.tsx | 29 +- .../es_stats/es_stats_error.tsx | 2 +- .../components/shared/no_deprecations.tsx | 19 +- .../public/application/components/types.ts | 32 +- .../public/application/lib/api.ts | 35 +- .../public/application/lib/breadcrumbs.ts | 2 +- ..._errors.ts => get_es_deprecation_error.ts} | 3 +- .../public/shared_imports.ts | 1 + .../lib/__fixtures__/fake_deprecations.json | 42 +- .../es_deprecations_status.test.ts.snap | 60 +- .../server/lib/es_deprecations_status.test.ts | 5 +- .../server/lib/es_deprecations_status.ts | 100 +- .../lib/telemetry/es_ui_open_apis.test.ts | 12 +- .../server/lib/telemetry/es_ui_open_apis.ts | 14 +- .../lib/telemetry/usage_collector.test.ts | 6 +- .../server/lib/telemetry/usage_collector.ts | 18 +- .../server/routes/es_deprecations.test.ts | 16 +- .../server/routes/es_deprecations.ts | 9 +- .../server/routes/telemetry.test.ts | 12 +- .../server/routes/telemetry.ts | 8 +- .../telemetry_saved_object_type.ts | 6 +- 105 files changed, 3520 insertions(+), 4177 deletions(-) delete mode 100644 x-pack/plugins/upgrade_assistant/__jest__/client_integration/cluster.test.ts create mode 100644 x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/default_deprecation_flyout.test.ts create mode 100644 x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/deprecations_list.test.ts create mode 100644 x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/error_handling.test.ts create mode 100644 x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/index_settings_deprecation_flyout.test.ts create mode 100644 x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/ml_snapshots_deprecation_flyout.test.ts create mode 100644 x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/mocked_responses.ts create mode 100644 x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/reindex_deprecation_flyout.test.ts delete mode 100644 x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/cluster.helpers.ts create mode 100644 x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/elasticsearch.helpers.ts delete mode 100644 x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/indices.helpers.ts delete mode 100644 x-pack/plugins/upgrade_assistant/__jest__/client_integration/indices.test.ts delete mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/__fixtures__/checkup_api_response.json delete mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_tab_content.tsx rename x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/{deprecations => deprecation_types}/_index.scss (60%) create mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/default/flyout.tsx rename x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/{deprecations/reindex/flyout/index.tsx => deprecation_types/default/index.ts} (84%) create mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/default/table_row.tsx rename x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/{deprecations => deprecation_types}/index.tsx (55%) create mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/flyout.tsx rename x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/{deprecations/ml_snapshots => deprecation_types/index_settings}/index.ts (82%) create mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/resolution_table_cell.tsx create mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/table_row.tsx create mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/context.tsx rename x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/{deprecations/ml_snapshots/fix_snapshots_flyout.tsx => deprecation_types/ml_snapshots/flyout.tsx} (61%) rename x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/{deprecations/index_settings => deprecation_types/ml_snapshots}/index.ts (83%) create mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/resolution_table_cell.tsx create mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/table_row.tsx rename x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/{deprecations => deprecation_types}/ml_snapshots/use_snapshot_state.tsx (94%) rename x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/{deprecations => deprecation_types}/reindex/_index.scss (57%) create mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/context.tsx rename x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/{deprecations => deprecation_types}/reindex/flyout/__snapshots__/checklist_step.test.tsx.snap (100%) rename x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/{deprecations => deprecation_types}/reindex/flyout/__snapshots__/warning_step.test.tsx.snap (100%) rename x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/{deprecations => deprecation_types}/reindex/flyout/_index.scss (100%) rename x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/{deprecations => deprecation_types}/reindex/flyout/_step_progress.scss (100%) rename x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/{deprecations => deprecation_types}/reindex/flyout/checklist_step.test.tsx (97%) rename x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/{deprecations => deprecation_types}/reindex/flyout/checklist_step.tsx (98%) create mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/container.tsx create mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/index.tsx rename x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/{deprecations => deprecation_types}/reindex/flyout/progress.test.tsx (99%) rename x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/{deprecations => deprecation_types}/reindex/flyout/progress.tsx (99%) rename x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/{deprecations => deprecation_types}/reindex/flyout/step_progress.tsx (100%) rename x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/{deprecations => deprecation_types}/reindex/flyout/warning_step.test.tsx (100%) rename x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/{deprecations => deprecation_types}/reindex/flyout/warning_step_checkbox.tsx (100%) rename x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/{deprecations => deprecation_types}/reindex/flyout/warnings_step.tsx (100%) rename x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/{deprecations => deprecation_types}/reindex/index.tsx (84%) create mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/resolution_table_cell.tsx create mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/table_row.tsx create mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/use_reindex_state.tsx delete mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/_cell.scss delete mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/cell.tsx delete mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/deprecation_group_item.tsx delete mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/index_settings/button.tsx delete mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/index_settings/remove_settings_provider.tsx delete mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/index_table.test.tsx delete mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/index_table.tsx delete mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/list.test.tsx delete mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/list.tsx delete mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/ml_snapshots/button.tsx delete mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/_button.scss delete mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/button.tsx delete mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/container.tsx delete mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/polling_service.test.ts delete mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/polling_service.ts create mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/es_deprecations_table.tsx create mode 100644 x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/es_deprecations_table_cells.tsx rename x-pack/plugins/upgrade_assistant/public/application/lib/{es_deprecation_errors.ts => get_es_deprecation_error.ts} (93%) diff --git a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json index ddb077efda9a0..54a5f22839bfd 100644 --- a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json +++ b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @@ -5827,16 +5827,10 @@ }, "ui_open": { "properties": { - "cluster": { + "elasticsearch": { "type": "long", "_meta": { - "description": "Number of times a user viewed the list of Elasticsearch cluster deprecations." - } - }, - "indices": { - "type": "long", - "_meta": { - "description": "Number of times a user viewed the list of Elasticsearch index deprecations." + "description": "Number of times a user viewed the list of Elasticsearch deprecations." } }, "overview": { diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index a875c427c17ac..dcea8f43a8f54 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -7185,21 +7185,6 @@ "xpack.canvas.workpadTemplates.table.descriptionColumnTitle": "説明", "xpack.canvas.workpadTemplates.table.nameColumnTitle": "テンプレート名", "xpack.canvas.workpadTemplates.table.tagsColumnTitle": "タグ", - "expressionShape.functions.progress.args.barColorHelpText": "背景バーの色です。", - "expressionShape.functions.progress.args.barWeightHelpText": "背景バーの太さです。", - "expressionShape.functions.progress.args.fontHelpText": "ラベルの {CSS} フォントプロパティです。例:{FONT_FAMILY} または {FONT_WEIGHT}。", - "expressionShape.functions.progress.args.labelHelpText": "ラベルの表示・非表示を切り替えるには、{BOOLEAN_TRUE}または{BOOLEAN_FALSE}を使用します。また、ラベルとして表示する文字列を入力することもできます。", - "expressionShape.functions.progress.args.maxHelpText": "進捗エレメントの最高値です。", - "expressionShape.functions.progress.args.shapeHelpText": "{list} または {end} を選択します。", - "expressionShape.functions.progress.args.valueColorHelpText": "進捗バーの色です。", - "expressionShape.functions.progress.args.valueWeightHelpText": "進捗バーの太さです。", - "expressionShape.functions.progress.invalidMaxValueErrorMessage": "無効な {arg} 値:「{max, number}」。「{arg}」は 0 より大きい必要があります", - "expressionShape.functions.progress.invalidValueErrorMessage": "無効な値:「{value, number}」。値は 0 と {max, number} の間でなければなりません", - "expressionShape.functions.progressHelpText": "進捗エレメントを構成します。", - "expressionShape.renderer.progress.displayName": "進捗インジケーター", - "expressionShape.renderer.progress.helpDescription": "エレメントのパーセンテージを示す進捗インジケーターをレンダリングします", - "expressionShape.renderer.shape.displayName": "形状", - "expressionShape.renderer.shape.helpDescription": "基本的な図形をレンダリングします", "expressionRepeatImage.error.repeatImage.missingMaxArgument": "{emptyImageArgument} を指定する場合は、{maxArgument} を設定する必要があります", "expressionRepeatImage.functions.repeatImage.args.emptyImageHelpText": "この画像のエレメントについて、{CONTEXT}および{maxArg}パラメーターの差異を解消します。画像アセットは{BASE64}データ{URL}として提供するか、部分式で渡します。", "expressionRepeatImage.functions.repeatImage.args.imageHelpText": "繰り返す画像です。画像アセットは{BASE64}データ{URL}として提供するか、部分式で渡します。", @@ -7221,6 +7206,8 @@ "expressionMetric.functions.metricHelpText": "ラベルの上に数字を表示します。", "expressionMetric.renderer.metric.displayName": "メトリック", "expressionMetric.renderer.metric.helpDescription": "ラベルの上に数字をレンダリングします", + "expressionShape.renderer.shape.displayName": "形状", + "expressionShape.renderer.shape.helpDescription": "基本的な図形をレンダリングします", "expressionError.errorComponent.description": "表現が失敗し次のメッセージが返されました:", "expressionError.errorComponent.title": "おっと!表現が失敗しました", "expressionError.renderer.debug.displayName": "デバッグ", @@ -24636,24 +24623,13 @@ "xpack.upgradeAssistant.breadcrumb.kibanaDeprecationsLabel": "Kibanaの廃止予定", "xpack.upgradeAssistant.breadcrumb.overviewLabel": "アップグレードアシスタント", "xpack.upgradeAssistant.checkupTab.changeFiltersShowMoreLabel": "より多く表示させるにはフィルターを変更します。", - "xpack.upgradeAssistant.checkupTab.confirmationModal.removeButtonLabel": "削除", "xpack.upgradeAssistant.checkupTab.controls.filterBar.criticalButtonLabel": "重大", "xpack.upgradeAssistant.checkupTab.controls.groupByBar.byIndexLabel": "インデックス別", "xpack.upgradeAssistant.checkupTab.controls.groupByBar.byIssueLabel": "問題別", "xpack.upgradeAssistant.checkupTab.deprecations.criticalActionTooltip": "アップグレード前にこの問題を解決してください。", "xpack.upgradeAssistant.checkupTab.deprecations.criticalLabel": "重大", - "xpack.upgradeAssistant.checkupTab.deprecations.documentationButtonLabel": "ドキュメント", - "xpack.upgradeAssistant.checkupTab.deprecations.indexTable.detailsColumnLabel": "詳細", - "xpack.upgradeAssistant.checkupTab.deprecations.indexTable.indexColumnLabel": "インデックス", "xpack.upgradeAssistant.checkupTab.deprecations.warningActionTooltip": "アップグレード前にこの問題を解決することをお勧めしますが、必須ではありません。", "xpack.upgradeAssistant.checkupTab.deprecations.warningLabel": "警告", - "xpack.upgradeAssistant.checkupTab.indexSettings.confirmationModal.cancelButtonLabel": "キャンセル", - "xpack.upgradeAssistant.checkupTab.indexSettings.confirmationModal.description": "次の廃止予定のインデックス設定が検出されました。これらは削除される予定です。", - "xpack.upgradeAssistant.checkupTab.indexSettings.confirmationModal.errorNotificationText": "インデックス設定の削除エラー", - "xpack.upgradeAssistant.checkupTab.indexSettings.confirmationModal.successNotificationText": "インデックス設定が削除されました", - "xpack.upgradeAssistant.checkupTab.indexSettings.confirmationModal.title": "廃止予定の設定を'{indexName}'から削除しますか?", - "xpack.upgradeAssistant.checkupTab.indexSettings.doneButtonLabel": "完了", - "xpack.upgradeAssistant.checkupTab.indexSettings.fixButtonLabel": "修正", "xpack.upgradeAssistant.checkupTab.noDeprecationsLabel": "説明がありません", "xpack.upgradeAssistant.checkupTab.numDeprecationsShownLabel": "{total} 件中 {numShown} 件を表示中", "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.cancelButtonLabel": "キャンセル", @@ -24681,7 +24657,6 @@ "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.resumeWatcherStepTitle": "Watcher を再開中", "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.stopWatcherStepTitle": "Watcher を停止中", "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklistTitle": "プロセスを再インデックス中", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.flyoutHeader": "{indexName} を再インデックス", "xpack.upgradeAssistant.checkupTab.reindexing.flyout.indexClosedCallout.calloutDetails": "このインデックスは現在閉じています。アップグレードアシスタントが開き、再インデックスを実行してからインデックスを閉じます。 {reindexingMayTakeLongerEmph}。詳細については {docs} をご覧ください。", "xpack.upgradeAssistant.checkupTab.reindexing.flyout.indexClosedCallout.calloutDetails.reindexingTakesLongerEmphasis": "再インデックスには通常よりも時間がかかることがあります", "xpack.upgradeAssistant.checkupTab.reindexing.flyout.indexClosedCallout.calloutTitle": "インデックスが閉じました", @@ -24693,13 +24668,6 @@ "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.destructiveCallout.calloutDetail": "続行する前に、インデックスをバックアップしてください。再インデックスを続行するには、各変更を承諾してください。", "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.destructiveCallout.calloutTitle": "このインデックスには元に戻すことのできない破壊的な変更が含まれています", "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.documentationLinkLabel": "ドキュメント", - "xpack.upgradeAssistant.checkupTab.reindexing.reindexButton.cancelledLabel": "キャンセル済み", - "xpack.upgradeAssistant.checkupTab.reindexing.reindexButton.doneLabel": "完了", - "xpack.upgradeAssistant.checkupTab.reindexing.reindexButton.failedLabel": "失敗", - "xpack.upgradeAssistant.checkupTab.reindexing.reindexButton.indexClosedToolTipDetails": "「{indexName}」は再インデックスが必要ですが現在閉じています。アップグレードアシスタントが開き、再インデックスを実行してからインデックスを閉じます。再インデックスには通常よりも時間がかかることがあります。", - "xpack.upgradeAssistant.checkupTab.reindexing.reindexButton.loadingLabel": "読み込み中…", - "xpack.upgradeAssistant.checkupTab.reindexing.reindexButton.pausedLabel": "一時停止中", - "xpack.upgradeAssistant.checkupTab.reindexing.reindexButton.reindexLabel": "再インデックス", "xpack.upgradeAssistant.deprecationGroupItem.docLinkText": "ドキュメンテーションを表示", "xpack.upgradeAssistant.deprecationGroupItem.fixButtonLabel": "修正する手順を表示", "xpack.upgradeAssistant.deprecationGroupItem.resolveButtonLabel": "クイック解決", @@ -24717,13 +24685,6 @@ "xpack.upgradeAssistant.esDeprecationErrors.partiallyUpgradedWarningMessage": "Kibanaをご使用のElasticsearchクラスターと同じバージョンにアップグレードしてください。クラスターの1つ以上のノードがKibanaとは異なるバージョンを実行しています。", "xpack.upgradeAssistant.esDeprecationErrors.permissionsErrorMessage": "Elasticsearchの廃止予定を表示する権限がありません。", "xpack.upgradeAssistant.esDeprecationErrors.upgradedWarningMessage": "構成は最新です。KibanaおよびすべてのElasticsearchノードは同じバージョンを実行しています。", - "xpack.upgradeAssistant.esDeprecations.backupDataButtonLabel": "データをバックアップ", - "xpack.upgradeAssistant.esDeprecations.backupDataTooltipText": "変更を行う前にスナップショットを作成します。", - "xpack.upgradeAssistant.esDeprecations.clusterLabel": "クラスター", - "xpack.upgradeAssistant.esDeprecations.clusterTabLabel": "クラスター", - "xpack.upgradeAssistant.esDeprecations.docLinkText": "ドキュメント", - "xpack.upgradeAssistant.esDeprecations.indexLabel": "インデックス", - "xpack.upgradeAssistant.esDeprecations.indicesTabLabel": "インデックス", "xpack.upgradeAssistant.esDeprecations.loadingText": "廃止予定を読み込んでいます...", "xpack.upgradeAssistant.esDeprecations.pageDescription": "廃止予定のクラスターとインデックス設定をレビューします。アップグレード前に重要な問題を解決する必要があります。", "xpack.upgradeAssistant.esDeprecations.pageTitle": "Elasticsearch", @@ -24731,7 +24692,6 @@ "xpack.upgradeAssistant.esDeprecationStats.criticalDeprecationsTitle": "重大", "xpack.upgradeAssistant.esDeprecationStats.loadingText": "Elasticsearchの廃止統計情報を読み込んでいます...", "xpack.upgradeAssistant.esDeprecationStats.statsTitle": "Elasticsearch", - "xpack.upgradeAssistant.esDeprecationStats.totalDeprecationsTooltip": "このクラスターは{clusterCount}個の廃止予定のクラスター設定と{indexCount}個の廃止予定のインデックス設定を使用しています。", "xpack.upgradeAssistant.kibanaDeprecationErrors.loadingErrorDescription": "エラーについては、Kibanaサーバーログを確認してください。", "xpack.upgradeAssistant.kibanaDeprecationErrors.loadingErrorTitle": "Kibana廃止予定を取得できませんでした", "xpack.upgradeAssistant.kibanaDeprecationErrors.pluginErrorDescription": "エラーについては、Kibanaサーバーログを確認してください。", @@ -24755,10 +24715,8 @@ "xpack.upgradeAssistant.kibanaDeprecationStats.loadingErrorMessage": "Kibana廃止予定の取得中にエラーが発生しました。", "xpack.upgradeAssistant.kibanaDeprecationStats.loadingText": "Kibana廃止予定統計情報を読み込んでいます…", "xpack.upgradeAssistant.kibanaDeprecationStats.statsTitle": "Kibana", - "xpack.upgradeAssistant.noDeprecationsPrompt.description": "構成は最新です。", "xpack.upgradeAssistant.noDeprecationsPrompt.nextStepsDescription": "他のスタック廃止予定については、{overviewButton}を確認してください。", "xpack.upgradeAssistant.noDeprecationsPrompt.overviewLinkText": "概要ページ", - "xpack.upgradeAssistant.noDeprecationsPrompt.title": "アップグレードする準備ができました。", "xpack.upgradeAssistant.overview.deprecationLogs.disabledToastMessage": "廃止予定のアクションをログに出力しません。", "xpack.upgradeAssistant.overview.deprecationLogs.enabledToastMessage": "廃止予定のアクションをログに出力します。", "xpack.upgradeAssistant.overview.deprecationLogs.fetchErrorMessage": "ログ情報を取得できませんでした。", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 8a65f954398b1..95cd134e16f71 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -25186,25 +25186,13 @@ "xpack.upgradeAssistant.breadcrumb.kibanaDeprecationsLabel": "Kibana 弃用", "xpack.upgradeAssistant.breadcrumb.overviewLabel": "升级助手", "xpack.upgradeAssistant.checkupTab.changeFiltersShowMoreLabel": "更改筛选以显示更多内容。", - "xpack.upgradeAssistant.checkupTab.confirmationModal.removeButtonLabel": "移除", "xpack.upgradeAssistant.checkupTab.controls.filterBar.criticalButtonLabel": "紧急", "xpack.upgradeAssistant.checkupTab.controls.groupByBar.byIndexLabel": "按索引", "xpack.upgradeAssistant.checkupTab.controls.groupByBar.byIssueLabel": "按问题", "xpack.upgradeAssistant.checkupTab.deprecations.criticalActionTooltip": "请解决此问题后再升级。", "xpack.upgradeAssistant.checkupTab.deprecations.criticalLabel": "紧急", - "xpack.upgradeAssistant.checkupTab.deprecations.documentationButtonLabel": "文档", - "xpack.upgradeAssistant.checkupTab.deprecations.indexTable.detailsColumnLabel": "详情", - "xpack.upgradeAssistant.checkupTab.deprecations.indexTable.indexColumnLabel": "索引", "xpack.upgradeAssistant.checkupTab.deprecations.warningActionTooltip": "建议在升级之前先解决此问题,但这不是必需的。", "xpack.upgradeAssistant.checkupTab.deprecations.warningLabel": "警告", - "xpack.upgradeAssistant.checkupTab.indexSettings.confirmationModal.cancelButtonLabel": "取消", - "xpack.upgradeAssistant.checkupTab.indexSettings.confirmationModal.description": "检测到并将移除以下弃用的索引设置:", - "xpack.upgradeAssistant.checkupTab.indexSettings.confirmationModal.errorNotificationText": "移除索引设置时出错", - "xpack.upgradeAssistant.checkupTab.indexSettings.confirmationModal.successNotificationText": "索引设置已移除", - "xpack.upgradeAssistant.checkupTab.indexSettings.confirmationModal.title": "从“{indexName}”移除已弃用的设置?", - "xpack.upgradeAssistant.checkupTab.indexSettings.doneButtonLabel": "完成", - "xpack.upgradeAssistant.checkupTab.indexSettings.fixButtonLabel": "修复", - "xpack.upgradeAssistant.checkupTab.indicesBadgeLabel": "{numIndices, plural, other { 个索引}}", "xpack.upgradeAssistant.checkupTab.noDeprecationsLabel": "无弃用内容", "xpack.upgradeAssistant.checkupTab.numDeprecationsShownLabel": "显示 {numShown} 个,共 {total} 个", "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.cancelButtonLabel": "取消", @@ -25232,7 +25220,6 @@ "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.resumeWatcherStepTitle": "正在恢复 Watcher", "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.stopWatcherStepTitle": "正在停止 Watcher", "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklistTitle": "重新索引过程", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.flyoutHeader": "重新索引 {indexName}", "xpack.upgradeAssistant.checkupTab.reindexing.flyout.indexClosedCallout.calloutDetails": "此索引当前已关闭。升级助手将打开索引,重新索引,然后关闭索引。{reindexingMayTakeLongerEmph}。请参阅文档{docs}以了解更多信息。", "xpack.upgradeAssistant.checkupTab.reindexing.flyout.indexClosedCallout.calloutDetails.reindexingTakesLongerEmphasis": "重新索引可能比通常花费更多的时间", "xpack.upgradeAssistant.checkupTab.reindexing.flyout.indexClosedCallout.calloutTitle": "索引已关闭", @@ -25244,13 +25231,6 @@ "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.destructiveCallout.calloutDetail": "继续前备份索引。要继续重新索引,请接受每个更改。", "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.destructiveCallout.calloutTitle": "此索引需要无法恢复的破坏性更改", "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.documentationLinkLabel": "文档", - "xpack.upgradeAssistant.checkupTab.reindexing.reindexButton.cancelledLabel": "已取消", - "xpack.upgradeAssistant.checkupTab.reindexing.reindexButton.doneLabel": "完成", - "xpack.upgradeAssistant.checkupTab.reindexing.reindexButton.failedLabel": "失败", - "xpack.upgradeAssistant.checkupTab.reindexing.reindexButton.indexClosedToolTipDetails": "“{indexName}”需要重新索引,但当前已关闭。升级助手将打开索引,重新索引,然后关闭索引。重新索引可能比通常花费更多的时间。", - "xpack.upgradeAssistant.checkupTab.reindexing.reindexButton.loadingLabel": "正在加载……", - "xpack.upgradeAssistant.checkupTab.reindexing.reindexButton.pausedLabel": "已暂停", - "xpack.upgradeAssistant.checkupTab.reindexing.reindexButton.reindexLabel": "重新索引", "xpack.upgradeAssistant.deprecationGroupItem.docLinkText": "查看文档", "xpack.upgradeAssistant.deprecationGroupItem.fixButtonLabel": "显示修复步骤", "xpack.upgradeAssistant.deprecationGroupItem.resolveButtonLabel": "快速解决", @@ -25268,13 +25248,6 @@ "xpack.upgradeAssistant.esDeprecationErrors.partiallyUpgradedWarningMessage": "将 Kibana 升级到与您的 Elasticsearch 集群相同的版本。集群中的一个或多个节点正在运行与 Kibana 不同的版本。", "xpack.upgradeAssistant.esDeprecationErrors.permissionsErrorMessage": "您无权查看 Elasticsearch 弃用。", "xpack.upgradeAssistant.esDeprecationErrors.upgradedWarningMessage": "您的配置是最新的。Kibana 和索引 Elasticsearch 节点正在运行相同的版本。", - "xpack.upgradeAssistant.esDeprecations.backupDataButtonLabel": "备份您的数据", - "xpack.upgradeAssistant.esDeprecations.backupDataTooltipText": "在进行任何更改之前拍取快照。", - "xpack.upgradeAssistant.esDeprecations.clusterLabel": "集群", - "xpack.upgradeAssistant.esDeprecations.clusterTabLabel": "集群", - "xpack.upgradeAssistant.esDeprecations.docLinkText": "文档", - "xpack.upgradeAssistant.esDeprecations.indexLabel": "索引", - "xpack.upgradeAssistant.esDeprecations.indicesTabLabel": "索引", "xpack.upgradeAssistant.esDeprecations.loadingText": "正在加载弃用……", "xpack.upgradeAssistant.esDeprecations.pageDescription": "查看已弃用的群集和索引设置。在升级之前必须解决任何紧急问题。", "xpack.upgradeAssistant.esDeprecations.pageTitle": "Elasticsearch", @@ -25282,7 +25255,6 @@ "xpack.upgradeAssistant.esDeprecationStats.criticalDeprecationsTitle": "紧急", "xpack.upgradeAssistant.esDeprecationStats.loadingText": "正在加载 Elasticsearch 弃用统计……", "xpack.upgradeAssistant.esDeprecationStats.statsTitle": "Elasticsearch", - "xpack.upgradeAssistant.esDeprecationStats.totalDeprecationsTooltip": "此集群正在使用 {clusterCount} 个已弃用集群设置和 {indexCount} 个已弃用的索引设置", "xpack.upgradeAssistant.kibanaDeprecationErrors.loadingErrorDescription": "请在 Kibana 服务器日志中查看错误。", "xpack.upgradeAssistant.kibanaDeprecationErrors.loadingErrorTitle": "无法检索 Kibana 弃用", "xpack.upgradeAssistant.kibanaDeprecationErrors.pluginErrorDescription": "请在 Kibana 服务器日志中查看错误。", @@ -25306,10 +25278,8 @@ "xpack.upgradeAssistant.kibanaDeprecationStats.loadingErrorMessage": "检索 Kibana 弃用时发生错误。", "xpack.upgradeAssistant.kibanaDeprecationStats.loadingText": "正在加载 Kibana 弃用统计……", "xpack.upgradeAssistant.kibanaDeprecationStats.statsTitle": "Kibana", - "xpack.upgradeAssistant.noDeprecationsPrompt.description": "您的配置是最新的。", "xpack.upgradeAssistant.noDeprecationsPrompt.nextStepsDescription": "查看{overviewButton}以了解其他 Stack 弃用。", "xpack.upgradeAssistant.noDeprecationsPrompt.overviewLinkText": "“概览”页面", - "xpack.upgradeAssistant.noDeprecationsPrompt.title": "准备好升级!", "xpack.upgradeAssistant.overview.deprecationLogs.disabledToastMessage": "不记录弃用的操作。", "xpack.upgradeAssistant.overview.deprecationLogs.enabledToastMessage": "记录弃用的操作。", "xpack.upgradeAssistant.overview.deprecationLogs.fetchErrorMessage": "无法检索日志记录信息。", diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/cluster.test.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/cluster.test.ts deleted file mode 100644 index 533a74842216a..0000000000000 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/cluster.test.ts +++ /dev/null @@ -1,363 +0,0 @@ -/* - * 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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { act } from 'react-dom/test-utils'; -import { MlAction, ESUpgradeStatus } from '../../common/types'; - -import { ClusterTestBed, setupClusterPage, setupEnvironment } from './helpers'; - -describe('Cluster tab', () => { - let testBed: ClusterTestBed; - const { server, httpRequestsMockHelpers } = setupEnvironment(); - - afterAll(() => { - server.restore(); - }); - - describe('with deprecations', () => { - const snapshotId = '1'; - const jobId = 'deprecation_check_job'; - const esDeprecationsMockResponse: ESUpgradeStatus = { - totalCriticalDeprecations: 1, - cluster: [ - { - level: 'critical', - message: - 'model snapshot [1] for job [deprecation_check_job] needs to be deleted or upgraded', - details: - 'model snapshot [%s] for job [%s] supports minimum version [%s] and needs to be at least [%s]', - url: 'doc_url', - correctiveAction: { - type: 'mlSnapshot', - snapshotId, - jobId, - }, - }, - ], - indices: [], - }; - - beforeEach(async () => { - httpRequestsMockHelpers.setLoadEsDeprecationsResponse(esDeprecationsMockResponse); - httpRequestsMockHelpers.setLoadDeprecationLoggingResponse({ - isDeprecationLogIndexingEnabled: true, - isDeprecationLoggingEnabled: true, - }); - - await act(async () => { - testBed = await setupClusterPage({ isReadOnlyMode: false }); - }); - - const { actions, component } = testBed; - - component.update(); - - // Navigate to the cluster tab - await act(async () => { - actions.clickTab('cluster'); - }); - - component.update(); - }); - - test('renders deprecations', () => { - const { exists } = testBed; - expect(exists('clusterTabContent')).toBe(true); - expect(exists('deprecationsContainer')).toBe(true); - }); - - describe('fix ml snapshots button', () => { - let flyout: Element | null; - - beforeEach(async () => { - const { component, actions, exists, find } = testBed; - - expect(exists('deprecationsContainer')).toBe(true); - - // Open all deprecations - actions.clickExpandAll(); - - // The data-test-subj is derived from the deprecation message - const accordionTestSubj = `depgroup_${esDeprecationsMockResponse.cluster[0].message - .split(' ') - .join('_')}`; - - await act(async () => { - find(`${accordionTestSubj}.fixMlSnapshotsButton`).simulate('click'); - }); - - component.update(); - - // We need to read the document "body" as the flyout is added there and not inside - // the component DOM tree. - flyout = document.body.querySelector('[data-test-subj="fixSnapshotsFlyout"]'); - - expect(flyout).not.toBe(null); - expect(flyout!.textContent).toContain('Upgrade or delete model snapshot'); - }); - - test('upgrades snapshots', async () => { - const { component } = testBed; - - const upgradeButton: HTMLButtonElement | null = flyout!.querySelector( - '[data-test-subj="upgradeSnapshotButton"]' - ); - - httpRequestsMockHelpers.setUpgradeMlSnapshotResponse({ - nodeId: 'my_node', - snapshotId, - jobId, - status: 'in_progress', - }); - - await act(async () => { - upgradeButton!.click(); - }); - - component.update(); - - // First, we expect a POST request to upgrade the snapshot - const upgradeRequest = server.requests[server.requests.length - 2]; - expect(upgradeRequest.method).toBe('POST'); - expect(upgradeRequest.url).toBe('/api/upgrade_assistant/ml_snapshots'); - - // Next, we expect a GET request to check the status of the upgrade - const statusRequest = server.requests[server.requests.length - 1]; - expect(statusRequest.method).toBe('GET'); - expect(statusRequest.url).toBe( - `/api/upgrade_assistant/ml_snapshots/${jobId}/${snapshotId}` - ); - }); - - test('handles upgrade failure', async () => { - const { component, find } = testBed; - - const upgradeButton: HTMLButtonElement | null = flyout!.querySelector( - '[data-test-subj="upgradeSnapshotButton"]' - ); - - const error = { - statusCode: 500, - error: 'Upgrade snapshot error', - message: 'Upgrade snapshot error', - }; - - httpRequestsMockHelpers.setUpgradeMlSnapshotResponse(undefined, error); - - await act(async () => { - upgradeButton!.click(); - }); - - component.update(); - - const upgradeRequest = server.requests[server.requests.length - 1]; - expect(upgradeRequest.method).toBe('POST'); - expect(upgradeRequest.url).toBe('/api/upgrade_assistant/ml_snapshots'); - - const accordionTestSubj = `depgroup_${esDeprecationsMockResponse.cluster[0].message - .split(' ') - .join('_')}`; - - expect(find(`${accordionTestSubj}.fixMlSnapshotsButton`).text()).toEqual('Failed'); - }); - - test('deletes snapshots', async () => { - const { component } = testBed; - - const deleteButton: HTMLButtonElement | null = flyout!.querySelector( - '[data-test-subj="deleteSnapshotButton"]' - ); - - httpRequestsMockHelpers.setDeleteMlSnapshotResponse({ - acknowledged: true, - }); - - await act(async () => { - deleteButton!.click(); - }); - - component.update(); - - const request = server.requests[server.requests.length - 1]; - const mlDeprecation = esDeprecationsMockResponse.cluster[0]; - - expect(request.method).toBe('DELETE'); - expect(request.url).toBe( - `/api/upgrade_assistant/ml_snapshots/${ - (mlDeprecation.correctiveAction! as MlAction).jobId - }/${(mlDeprecation.correctiveAction! as MlAction).snapshotId}` - ); - }); - - test('handles delete failure', async () => { - const { component, find } = testBed; - - const deleteButton: HTMLButtonElement | null = flyout!.querySelector( - '[data-test-subj="deleteSnapshotButton"]' - ); - - const error = { - statusCode: 500, - error: 'Upgrade snapshot error', - message: 'Upgrade snapshot error', - }; - - httpRequestsMockHelpers.setDeleteMlSnapshotResponse(undefined, error); - - await act(async () => { - deleteButton!.click(); - }); - - component.update(); - - const request = server.requests[server.requests.length - 1]; - const mlDeprecation = esDeprecationsMockResponse.cluster[0]; - - expect(request.method).toBe('DELETE'); - expect(request.url).toBe( - `/api/upgrade_assistant/ml_snapshots/${ - (mlDeprecation.correctiveAction! as MlAction).jobId - }/${(mlDeprecation.correctiveAction! as MlAction).snapshotId}` - ); - - const accordionTestSubj = `depgroup_${esDeprecationsMockResponse.cluster[0].message - .split(' ') - .join('_')}`; - - expect(find(`${accordionTestSubj}.fixMlSnapshotsButton`).text()).toEqual('Failed'); - }); - }); - }); - - describe('no deprecations', () => { - beforeEach(async () => { - const noDeprecationsResponse = { - totalCriticalDeprecations: 0, - cluster: [], - indices: [], - }; - - httpRequestsMockHelpers.setLoadEsDeprecationsResponse(noDeprecationsResponse); - - await act(async () => { - testBed = await setupClusterPage({ isReadOnlyMode: false }); - }); - - const { component } = testBed; - - component.update(); - }); - - test('renders prompt', () => { - const { exists, find } = testBed; - expect(exists('noDeprecationsPrompt')).toBe(true); - expect(find('noDeprecationsPrompt').text()).toContain('Ready to upgrade!'); - }); - }); - - describe('error handling', () => { - test('handles 403', async () => { - const error = { - statusCode: 403, - error: 'Forbidden', - message: 'Forbidden', - }; - - httpRequestsMockHelpers.setLoadEsDeprecationsResponse(undefined, error); - - await act(async () => { - testBed = await setupClusterPage({ isReadOnlyMode: false }); - }); - - const { component, exists, find } = testBed; - - component.update(); - - expect(exists('permissionsError')).toBe(true); - expect(find('permissionsError').text()).toContain( - 'You are not authorized to view Elasticsearch deprecations.' - ); - }); - - test('shows upgraded message when all nodes have been upgraded', async () => { - const error = { - statusCode: 426, - error: 'Upgrade required', - message: 'There are some nodes running a different version of Elasticsearch', - attributes: { - // This is marked true in the scenario where none of the nodes have the same major version of Kibana, - // and therefore we assume all have been upgraded - allNodesUpgraded: true, - }, - }; - - httpRequestsMockHelpers.setLoadEsDeprecationsResponse(undefined, error); - - await act(async () => { - testBed = await setupClusterPage({ isReadOnlyMode: false }); - }); - - const { component, exists, find } = testBed; - - component.update(); - - expect(exists('upgradedCallout')).toBe(true); - expect(find('upgradedCallout').text()).toContain( - 'Your configuration is up to date. Kibana and all Elasticsearch nodes are running the same version.' - ); - }); - - test('shows partially upgrade error when nodes are running different versions', async () => { - const error = { - statusCode: 426, - error: 'Upgrade required', - message: 'There are some nodes running a different version of Elasticsearch', - attributes: { - allNodesUpgraded: false, - }, - }; - - httpRequestsMockHelpers.setLoadEsDeprecationsResponse(undefined, error); - - await act(async () => { - testBed = await setupClusterPage({ isReadOnlyMode: false }); - }); - - const { component, exists, find } = testBed; - - component.update(); - - expect(exists('partiallyUpgradedWarning')).toBe(true); - expect(find('partiallyUpgradedWarning').text()).toContain( - 'Upgrade Kibana to the same version as your Elasticsearch cluster. One or more nodes in the cluster is running a different version than Kibana.' - ); - }); - - test('handles generic error', async () => { - const error = { - statusCode: 500, - error: 'Internal server error', - message: 'Internal server error', - }; - - httpRequestsMockHelpers.setLoadEsDeprecationsResponse(undefined, error); - - await act(async () => { - testBed = await setupClusterPage({ isReadOnlyMode: false }); - }); - - const { component, exists, find } = testBed; - - component.update(); - - expect(exists('requestError')).toBe(true); - expect(find('requestError').text()).toContain( - 'Could not retrieve Elasticsearch deprecations.' - ); - }); - }); -}); diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/default_deprecation_flyout.test.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/default_deprecation_flyout.test.ts new file mode 100644 index 0000000000000..917fac8ef666a --- /dev/null +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/default_deprecation_flyout.test.ts @@ -0,0 +1,52 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { act } from 'react-dom/test-utils'; + +import { ElasticsearchTestBed, setupElasticsearchPage, setupEnvironment } from '../helpers'; + +import { esDeprecationsMockResponse, MOCK_SNAPSHOT_ID, MOCK_JOB_ID } from './mocked_responses'; + +describe('Default deprecation flyout', () => { + let testBed: ElasticsearchTestBed; + const { server, httpRequestsMockHelpers } = setupEnvironment(); + + afterAll(() => { + server.restore(); + }); + + beforeEach(async () => { + httpRequestsMockHelpers.setLoadEsDeprecationsResponse(esDeprecationsMockResponse); + httpRequestsMockHelpers.setUpgradeMlSnapshotStatusResponse({ + nodeId: 'my_node', + snapshotId: MOCK_SNAPSHOT_ID, + jobId: MOCK_JOB_ID, + status: 'idle', + }); + + await act(async () => { + testBed = await setupElasticsearchPage({ isReadOnlyMode: false }); + }); + + testBed.component.update(); + }); + + it('renders a flyout with deprecation details', async () => { + const multiFieldsDeprecation = esDeprecationsMockResponse.deprecations[2]; + const { actions, find, exists } = testBed; + + await actions.clickDefaultDeprecationAt(0); + + expect(exists('defaultDeprecationDetails')).toBe(true); + expect(find('defaultDeprecationDetails.flyoutTitle').text()).toContain( + multiFieldsDeprecation.message + ); + expect(find('defaultDeprecationDetails.flyoutDescription').text()).toContain( + multiFieldsDeprecation.index + ); + }); +}); diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/deprecations_list.test.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/deprecations_list.test.ts new file mode 100644 index 0000000000000..ceebc528f0bc4 --- /dev/null +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/deprecations_list.test.ts @@ -0,0 +1,267 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { act } from 'react-dom/test-utils'; + +import { API_BASE_PATH } from '../../../common/constants'; +import type { MlAction } from '../../../common/types'; +import { ElasticsearchTestBed, setupElasticsearchPage, setupEnvironment } from '../helpers'; +import { + esDeprecationsMockResponse, + MOCK_SNAPSHOT_ID, + MOCK_JOB_ID, + createEsDeprecationsMockResponse, +} from './mocked_responses'; + +describe('Deprecations table', () => { + let testBed: ElasticsearchTestBed; + const { server, httpRequestsMockHelpers } = setupEnvironment(); + + afterAll(() => { + server.restore(); + }); + + beforeEach(async () => { + httpRequestsMockHelpers.setLoadEsDeprecationsResponse(esDeprecationsMockResponse); + httpRequestsMockHelpers.setUpgradeMlSnapshotStatusResponse({ + nodeId: 'my_node', + snapshotId: MOCK_SNAPSHOT_ID, + jobId: MOCK_JOB_ID, + status: 'idle', + }); + + await act(async () => { + testBed = await setupElasticsearchPage({ isReadOnlyMode: false }); + }); + + testBed.component.update(); + }); + + it('renders deprecations', () => { + const { exists, find } = testBed; + // Verify container exists + expect(exists('esDeprecationsContent')).toBe(true); + + // Verify all deprecations appear in the table + expect(find('deprecationTableRow').length).toEqual( + esDeprecationsMockResponse.deprecations.length + ); + }); + + it('refreshes deprecation data', async () => { + const { actions } = testBed; + const totalRequests = server.requests.length; + + await actions.clickRefreshButton(); + + const mlDeprecation = esDeprecationsMockResponse.deprecations[0]; + const reindexDeprecation = esDeprecationsMockResponse.deprecations[3]; + + // Since upgradeStatusMockResponse includes ML and reindex actions (which require fetching status), there will be 3 requests made + expect(server.requests.length).toBe(totalRequests + 3); + expect(server.requests[server.requests.length - 3].url).toBe( + `${API_BASE_PATH}/es_deprecations` + ); + expect(server.requests[server.requests.length - 2].url).toBe( + `${API_BASE_PATH}/ml_snapshots/${(mlDeprecation.correctiveAction as MlAction).jobId}/${ + (mlDeprecation.correctiveAction as MlAction).snapshotId + }` + ); + expect(server.requests[server.requests.length - 1].url).toBe( + `${API_BASE_PATH}/reindex/${reindexDeprecation.index}` + ); + }); + + describe('search bar', () => { + it('filters results by "critical" status', async () => { + const { find, actions } = testBed; + + await actions.clickCriticalFilterButton(); + + const criticalDeprecations = esDeprecationsMockResponse.deprecations.filter( + (deprecation) => deprecation.isCritical + ); + + expect(find('deprecationTableRow').length).toEqual(criticalDeprecations.length); + + await actions.clickCriticalFilterButton(); + + expect(find('deprecationTableRow').length).toEqual( + esDeprecationsMockResponse.deprecations.length + ); + }); + + it('filters results by type', async () => { + const { component, find, actions } = testBed; + + await actions.clickTypeFilterDropdownAt(0); + + // We need to read the document "body" as the filter dropdown options are added there and not inside + // the component DOM tree. + const clusterTypeFilterButton: HTMLButtonElement | null = document.body.querySelector( + '.euiFilterSelect__items .euiFilterSelectItem' + ); + + expect(clusterTypeFilterButton).not.toBeNull(); + + await act(async () => { + clusterTypeFilterButton!.click(); + }); + + component.update(); + + const clusterDeprecations = esDeprecationsMockResponse.deprecations.filter( + (deprecation) => deprecation.type === 'cluster_settings' + ); + + expect(find('deprecationTableRow').length).toEqual(clusterDeprecations.length); + }); + + it('filters results by query string', async () => { + const { find, actions } = testBed; + const multiFieldsDeprecation = esDeprecationsMockResponse.deprecations[2]; + + await actions.setSearchInputValue(multiFieldsDeprecation.message); + + expect(find('deprecationTableRow').length).toEqual(1); + expect(find('deprecationTableRow').at(0).text()).toContain(multiFieldsDeprecation.message); + }); + + it('shows error for invalid search queries', async () => { + const { find, exists, actions } = testBed; + + await actions.setSearchInputValue('%'); + + expect(exists('invalidSearchQueryMessage')).toBe(true); + expect(find('invalidSearchQueryMessage').text()).toContain('Invalid search'); + }); + + it('shows message when search query does not return results', async () => { + const { find, actions, exists } = testBed; + + await actions.setSearchInputValue('foobarbaz'); + + expect(exists('noDeprecationsRow')).toBe(true); + expect(find('noDeprecationsRow').text()).toContain( + 'No Elasticsearch deprecation issues found' + ); + }); + }); + + describe('pagination', () => { + const esDeprecationsMockResponseWithManyDeprecations = createEsDeprecationsMockResponse(20); + const { deprecations } = esDeprecationsMockResponseWithManyDeprecations; + + beforeEach(async () => { + httpRequestsMockHelpers.setLoadEsDeprecationsResponse( + esDeprecationsMockResponseWithManyDeprecations + ); + httpRequestsMockHelpers.setUpgradeMlSnapshotStatusResponse({ + nodeId: 'my_node', + snapshotId: MOCK_SNAPSHOT_ID, + jobId: MOCK_JOB_ID, + status: 'idle', + }); + + await act(async () => { + testBed = await setupElasticsearchPage({ isReadOnlyMode: false }); + }); + + testBed.component.update(); + }); + + it('shows the correct number of pages and deprecations per page', async () => { + const { find, actions } = testBed; + + expect(find('esDeprecationsPagination').find('.euiPagination__item').length).toEqual( + Math.round(deprecations.length / 50) // Default rows per page is 50 + ); + expect(find('deprecationTableRow').length).toEqual(50); + + // Navigate to the next page + await actions.clickPaginationAt(1); + + // On the second (last) page, we expect to see the remaining deprecations + expect(find('deprecationTableRow').length).toEqual(deprecations.length - 50); + }); + + it('allows the number of viewable rows to change', async () => { + const { find, actions, component } = testBed; + + await actions.clickRowsPerPageDropdown(); + + // We need to read the document "body" as the rows-per-page dropdown options are added there and not inside + // the component DOM tree. + const rowsPerPageButton: HTMLButtonElement | null = document.body.querySelector( + '[data-test-subj="tablePagination-100-rows"]' + ); + + expect(rowsPerPageButton).not.toBeNull(); + + await act(async () => { + rowsPerPageButton!.click(); + }); + + component.update(); + + expect(find('esDeprecationsPagination').find('.euiPagination__item').length).toEqual( + Math.round(deprecations.length / 100) // Rows per page is now 100 + ); + expect(find('deprecationTableRow').length).toEqual(deprecations.length); + }); + + it('updates pagination when filters change', async () => { + const { actions, find } = testBed; + + const criticalDeprecations = deprecations.filter((deprecation) => deprecation.isCritical); + + await actions.clickCriticalFilterButton(); + + // Only 40 critical deprecations, so only one page should show + expect(find('esDeprecationsPagination').find('.euiPagination__item').length).toEqual(1); + expect(find('deprecationTableRow').length).toEqual(criticalDeprecations.length); + }); + + it('updates pagination on search', async () => { + const { actions, find } = testBed; + const reindexDeprecations = deprecations.filter( + (deprecation) => deprecation.correctiveAction?.type === 'reindex' + ); + + await actions.setSearchInputValue('Index created before 7.0'); + + // Only 20 deprecations that match, so only one page should show + expect(find('esDeprecationsPagination').find('.euiPagination__item').length).toEqual(1); + expect(find('deprecationTableRow').length).toEqual(reindexDeprecations.length); + }); + }); + + describe('no deprecations', () => { + beforeEach(async () => { + const noDeprecationsResponse = { + totalCriticalDeprecations: 0, + deprecations: [], + }; + + httpRequestsMockHelpers.setLoadEsDeprecationsResponse(noDeprecationsResponse); + + await act(async () => { + testBed = await setupElasticsearchPage({ isReadOnlyMode: false }); + }); + + testBed.component.update(); + }); + + test('renders prompt', () => { + const { exists, find } = testBed; + expect(exists('noDeprecationsPrompt')).toBe(true); + expect(find('noDeprecationsPrompt').text()).toContain( + 'Your Elasticsearch configuration is up to date' + ); + }); + }); +}); diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/error_handling.test.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/error_handling.test.ts new file mode 100644 index 0000000000000..8d3616a1b9d6b --- /dev/null +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/error_handling.test.ts @@ -0,0 +1,115 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { act } from 'react-dom/test-utils'; + +import { ElasticsearchTestBed, setupElasticsearchPage, setupEnvironment } from '../helpers'; + +describe('Error handling', () => { + let testBed: ElasticsearchTestBed; + const { server, httpRequestsMockHelpers } = setupEnvironment(); + + afterAll(() => { + server.restore(); + }); + + it('handles 403', async () => { + const error = { + statusCode: 403, + error: 'Forbidden', + message: 'Forbidden', + }; + + httpRequestsMockHelpers.setLoadEsDeprecationsResponse(undefined, error); + + await act(async () => { + testBed = await setupElasticsearchPage({ isReadOnlyMode: false }); + }); + + const { component, exists, find } = testBed; + + component.update(); + + expect(exists('permissionsError')).toBe(true); + expect(find('permissionsError').text()).toContain( + 'You are not authorized to view Elasticsearch deprecations.' + ); + }); + + it('shows upgraded message when all nodes have been upgraded', async () => { + const error = { + statusCode: 426, + error: 'Upgrade required', + message: 'There are some nodes running a different version of Elasticsearch', + attributes: { + // This is marked true in the scenario where none of the nodes have the same major version of Kibana, + // and therefore we assume all have been upgraded + allNodesUpgraded: true, + }, + }; + + httpRequestsMockHelpers.setLoadEsDeprecationsResponse(undefined, error); + + await act(async () => { + testBed = await setupElasticsearchPage({ isReadOnlyMode: false }); + }); + + const { component, exists, find } = testBed; + + component.update(); + + expect(exists('upgradedCallout')).toBe(true); + expect(find('upgradedCallout').text()).toContain('All Elasticsearch nodes have been upgraded.'); + }); + + it('shows partially upgrade error when nodes are running different versions', async () => { + const error = { + statusCode: 426, + error: 'Upgrade required', + message: 'There are some nodes running a different version of Elasticsearch', + attributes: { + allNodesUpgraded: false, + }, + }; + + httpRequestsMockHelpers.setLoadEsDeprecationsResponse(undefined, error); + + await act(async () => { + testBed = await setupElasticsearchPage({ isReadOnlyMode: false }); + }); + + const { component, exists, find } = testBed; + + component.update(); + + expect(exists('partiallyUpgradedWarning')).toBe(true); + expect(find('partiallyUpgradedWarning').text()).toContain( + 'Upgrade Kibana to the same version as your Elasticsearch cluster. One or more nodes in the cluster is running a different version than Kibana.' + ); + }); + + it('handles generic error', async () => { + const error = { + statusCode: 500, + error: 'Internal server error', + message: 'Internal server error', + }; + + httpRequestsMockHelpers.setLoadEsDeprecationsResponse(undefined, error); + + await act(async () => { + testBed = await setupElasticsearchPage({ isReadOnlyMode: false }); + }); + + const { component, exists, find } = testBed; + + component.update(); + + expect(exists('requestError')).toBe(true); + expect(find('requestError').text()).toContain('Could not retrieve Elasticsearch deprecations.'); + }); +}); diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/index_settings_deprecation_flyout.test.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/index_settings_deprecation_flyout.test.ts new file mode 100644 index 0000000000000..efeb78a507160 --- /dev/null +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/index_settings_deprecation_flyout.test.ts @@ -0,0 +1,117 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { act } from 'react-dom/test-utils'; + +import { ElasticsearchTestBed, setupElasticsearchPage, setupEnvironment } from '../helpers'; + +import { esDeprecationsMockResponse, MOCK_SNAPSHOT_ID, MOCK_JOB_ID } from './mocked_responses'; + +describe('Index settings deprecation flyout', () => { + let testBed: ElasticsearchTestBed; + const { server, httpRequestsMockHelpers } = setupEnvironment(); + const indexSettingDeprecation = esDeprecationsMockResponse.deprecations[1]; + + afterAll(() => { + server.restore(); + }); + + beforeEach(async () => { + httpRequestsMockHelpers.setLoadEsDeprecationsResponse(esDeprecationsMockResponse); + httpRequestsMockHelpers.setUpgradeMlSnapshotStatusResponse({ + nodeId: 'my_node', + snapshotId: MOCK_SNAPSHOT_ID, + jobId: MOCK_JOB_ID, + status: 'idle', + }); + + await act(async () => { + testBed = await setupElasticsearchPage({ isReadOnlyMode: false }); + }); + + const { find, exists, actions, component } = testBed; + + component.update(); + + await actions.clickIndexSettingsDeprecationAt(0); + + expect(exists('indexSettingsDetails')).toBe(true); + expect(find('indexSettingsDetails.flyoutTitle').text()).toContain( + indexSettingDeprecation.message + ); + expect(exists('removeSettingsPrompt')).toBe(true); + }); + + it('removes deprecated index settings', async () => { + const { find, actions } = testBed; + + httpRequestsMockHelpers.setUpdateIndexSettingsResponse({ + acknowledged: true, + }); + + await actions.clickDeleteSettingsButton(); + + const request = server.requests[server.requests.length - 1]; + + expect(request.method).toBe('POST'); + expect(request.url).toBe( + `/api/upgrade_assistant/${indexSettingDeprecation.index!}/index_settings` + ); + expect(request.status).toEqual(200); + + // Verify the "Resolution" column of the table is updated + expect(find('indexSettingsResolutionStatusCell').at(0).text()).toEqual( + 'Deprecated settings removed' + ); + + // Reopen the flyout + await actions.clickIndexSettingsDeprecationAt(0); + + // Verify prompt to remove setting no longer displays + expect(find('removeSettingsPrompt').length).toEqual(0); + // Verify the action button no longer displays + expect(find('indexSettingsDetails.deleteSettingsButton').length).toEqual(0); + }); + + it('handles failure', async () => { + const { find, actions } = testBed; + const error = { + statusCode: 500, + error: 'Remove index settings error', + message: 'Remove index settings error', + }; + + httpRequestsMockHelpers.setUpdateIndexSettingsResponse(undefined, error); + + await actions.clickDeleteSettingsButton(); + + const request = server.requests[server.requests.length - 1]; + + expect(request.method).toBe('POST'); + expect(request.url).toBe( + `/api/upgrade_assistant/${indexSettingDeprecation.index!}/index_settings` + ); + expect(request.status).toEqual(500); + + // Verify the "Resolution" column of the table is updated + expect(find('indexSettingsResolutionStatusCell').at(0).text()).toEqual( + 'Settings removal failed' + ); + + // Reopen the flyout + await actions.clickIndexSettingsDeprecationAt(0); + + // Verify the flyout shows an error message + expect(find('indexSettingsDetails.deleteSettingsError').text()).toContain( + 'Error deleting index settings' + ); + // Verify the remove settings button text changes + expect(find('indexSettingsDetails.deleteSettingsButton').text()).toEqual( + 'Retry removing deprecated settings' + ); + }); +}); diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/ml_snapshots_deprecation_flyout.test.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/ml_snapshots_deprecation_flyout.test.ts new file mode 100644 index 0000000000000..909976355cd31 --- /dev/null +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/ml_snapshots_deprecation_flyout.test.ts @@ -0,0 +1,196 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { act } from 'react-dom/test-utils'; + +import type { MlAction } from '../../../common/types'; +import { ElasticsearchTestBed, setupElasticsearchPage, setupEnvironment } from '../helpers'; +import { esDeprecationsMockResponse, MOCK_SNAPSHOT_ID, MOCK_JOB_ID } from './mocked_responses'; + +describe('Machine learning deprecation flyout', () => { + let testBed: ElasticsearchTestBed; + const { server, httpRequestsMockHelpers } = setupEnvironment(); + const mlDeprecation = esDeprecationsMockResponse.deprecations[0]; + + afterAll(() => { + server.restore(); + }); + + beforeEach(async () => { + httpRequestsMockHelpers.setLoadEsDeprecationsResponse(esDeprecationsMockResponse); + httpRequestsMockHelpers.setUpgradeMlSnapshotStatusResponse({ + nodeId: 'my_node', + snapshotId: MOCK_SNAPSHOT_ID, + jobId: MOCK_JOB_ID, + status: 'idle', + }); + + await act(async () => { + testBed = await setupElasticsearchPage({ isReadOnlyMode: false }); + }); + + const { find, exists, actions, component } = testBed; + + component.update(); + + await actions.clickMlDeprecationAt(0); + + expect(exists('mlSnapshotDetails')).toBe(true); + expect(find('mlSnapshotDetails.flyoutTitle').text()).toContain( + 'Upgrade or delete model snapshot' + ); + }); + + describe('upgrade snapshots', () => { + it('successfully upgrades snapshots', async () => { + const { find, actions, exists } = testBed; + + httpRequestsMockHelpers.setUpgradeMlSnapshotResponse({ + nodeId: 'my_node', + snapshotId: MOCK_SNAPSHOT_ID, + jobId: MOCK_JOB_ID, + status: 'in_progress', + }); + + httpRequestsMockHelpers.setUpgradeMlSnapshotStatusResponse({ + nodeId: 'my_node', + snapshotId: MOCK_SNAPSHOT_ID, + jobId: MOCK_JOB_ID, + status: 'complete', + }); + + expect(find('mlSnapshotDetails.upgradeSnapshotButton').text()).toEqual('Upgrade'); + + await actions.clickUpgradeMlSnapshot(); + + // First, we expect a POST request to upgrade the snapshot + const upgradeRequest = server.requests[server.requests.length - 2]; + expect(upgradeRequest.method).toBe('POST'); + expect(upgradeRequest.url).toBe('/api/upgrade_assistant/ml_snapshots'); + + // Next, we expect a GET request to check the status of the upgrade + const statusRequest = server.requests[server.requests.length - 1]; + expect(statusRequest.method).toBe('GET'); + expect(statusRequest.url).toBe( + `/api/upgrade_assistant/ml_snapshots/${MOCK_JOB_ID}/${MOCK_SNAPSHOT_ID}` + ); + + // Verify the "Resolution" column of the table is updated + expect(find('mlActionResolutionCell').text()).toContain('Upgrade complete'); + + // Reopen the flyout + await actions.clickMlDeprecationAt(0); + + // Flyout actions should not be visible if deprecation was resolved + expect(exists('mlSnapshotDetails.upgradeSnapshotButton')).toBe(false); + expect(exists('mlSnapshotDetails.deleteSnapshotButton')).toBe(false); + }); + + it('handles upgrade failure', async () => { + const { find, actions } = testBed; + + const error = { + statusCode: 500, + error: 'Upgrade snapshot error', + message: 'Upgrade snapshot error', + }; + + httpRequestsMockHelpers.setUpgradeMlSnapshotResponse(undefined, error); + httpRequestsMockHelpers.setUpgradeMlSnapshotStatusResponse({ + nodeId: 'my_node', + snapshotId: MOCK_SNAPSHOT_ID, + jobId: MOCK_JOB_ID, + status: 'error', + error, + }); + + await actions.clickUpgradeMlSnapshot(); + + const upgradeRequest = server.requests[server.requests.length - 1]; + expect(upgradeRequest.method).toBe('POST'); + expect(upgradeRequest.url).toBe('/api/upgrade_assistant/ml_snapshots'); + + // Verify the "Resolution" column of the table is updated + expect(find('mlActionResolutionCell').text()).toContain('Upgrade failed'); + + // Reopen the flyout + await actions.clickMlDeprecationAt(0); + + // Verify the flyout shows an error message + expect(find('mlSnapshotDetails.resolveSnapshotError').text()).toContain( + 'Error upgrading snapshot' + ); + // Verify the upgrade button text changes + expect(find('mlSnapshotDetails.upgradeSnapshotButton').text()).toEqual('Retry upgrade'); + }); + }); + + describe('delete snapshots', () => { + it('successfully deletes snapshots', async () => { + const { find, actions } = testBed; + + httpRequestsMockHelpers.setDeleteMlSnapshotResponse({ + acknowledged: true, + }); + + expect(find('mlSnapshotDetails.deleteSnapshotButton').text()).toEqual('Delete'); + + await actions.clickDeleteMlSnapshot(); + + const request = server.requests[server.requests.length - 1]; + + expect(request.method).toBe('DELETE'); + expect(request.url).toBe( + `/api/upgrade_assistant/ml_snapshots/${ + (mlDeprecation.correctiveAction! as MlAction).jobId + }/${(mlDeprecation.correctiveAction! as MlAction).snapshotId}` + ); + + // Verify the "Resolution" column of the table is updated + expect(find('mlActionResolutionCell').at(0).text()).toEqual('Deletion complete'); + + // Reopen the flyout + await actions.clickMlDeprecationAt(0); + }); + + it('handles delete failure', async () => { + const { find, actions } = testBed; + + const error = { + statusCode: 500, + error: 'Upgrade snapshot error', + message: 'Upgrade snapshot error', + }; + + httpRequestsMockHelpers.setDeleteMlSnapshotResponse(undefined, error); + + await actions.clickDeleteMlSnapshot(); + + const request = server.requests[server.requests.length - 1]; + + expect(request.method).toBe('DELETE'); + expect(request.url).toBe( + `/api/upgrade_assistant/ml_snapshots/${ + (mlDeprecation.correctiveAction! as MlAction).jobId + }/${(mlDeprecation.correctiveAction! as MlAction).snapshotId}` + ); + + // Verify the "Resolution" column of the table is updated + expect(find('mlActionResolutionCell').at(0).text()).toEqual('Deletion failed'); + + // Reopen the flyout + await actions.clickMlDeprecationAt(0); + + // Verify the flyout shows an error message + expect(find('mlSnapshotDetails.resolveSnapshotError').text()).toContain( + 'Error deleting snapshot' + ); + // Verify the upgrade button text changes + expect(find('mlSnapshotDetails.deleteSnapshotButton').text()).toEqual('Retry delete'); + }); + }); +}); diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/mocked_responses.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/mocked_responses.ts new file mode 100644 index 0000000000000..ddf477195063c --- /dev/null +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/mocked_responses.ts @@ -0,0 +1,119 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { ESUpgradeStatus, EnrichedDeprecationInfo } from '../../../common/types'; +import { indexSettingDeprecations } from '../../../common/constants'; + +export const MOCK_SNAPSHOT_ID = '1'; +export const MOCK_JOB_ID = 'deprecation_check_job'; + +export const MOCK_ML_DEPRECATION: EnrichedDeprecationInfo = { + isCritical: true, + resolveDuringUpgrade: false, + type: 'ml_settings', + message: 'model snapshot [1] for job [deprecation_check_job] needs to be deleted or upgraded', + details: + 'model snapshot [%s] for job [%s] supports minimum version [%s] and needs to be at least [%s]', + url: 'doc_url', + correctiveAction: { + type: 'mlSnapshot', + snapshotId: MOCK_SNAPSHOT_ID, + jobId: MOCK_JOB_ID, + }, +}; + +const MOCK_REINDEX_DEPRECATION: EnrichedDeprecationInfo = { + isCritical: true, + resolveDuringUpgrade: false, + type: 'index_settings', + message: 'Index created before 7.0', + details: 'deprecation details', + url: 'doc_url', + index: 'reindex_index', + correctiveAction: { + type: 'reindex', + }, +}; + +const MOCK_INDEX_SETTING_DEPRECATION: EnrichedDeprecationInfo = { + isCritical: false, + resolveDuringUpgrade: false, + type: 'index_settings', + message: indexSettingDeprecations.translog.deprecationMessage, + details: 'deprecation details', + url: 'doc_url', + index: 'my_index', + correctiveAction: { + type: 'indexSetting', + deprecatedSettings: indexSettingDeprecations.translog.settings, + }, +}; + +const MOCK_DEFAULT_DEPRECATION: EnrichedDeprecationInfo = { + isCritical: false, + resolveDuringUpgrade: false, + type: 'index_settings', + message: 'multi-fields within multi-fields', + details: 'deprecation details', + url: 'doc_url', + index: 'nested_multi-fields', +}; + +export const esDeprecationsMockResponse: ESUpgradeStatus = { + totalCriticalDeprecations: 2, + deprecations: [ + MOCK_ML_DEPRECATION, + MOCK_INDEX_SETTING_DEPRECATION, + MOCK_DEFAULT_DEPRECATION, + MOCK_REINDEX_DEPRECATION, + ], +}; + +// Useful for testing pagination where a large number of deprecations are needed +export const createEsDeprecationsMockResponse = ( + numDeprecationsPerType: number +): ESUpgradeStatus => { + const mlDeprecations: EnrichedDeprecationInfo[] = Array.from( + { + length: numDeprecationsPerType, + }, + () => MOCK_ML_DEPRECATION + ); + + const indexSettingsDeprecations: EnrichedDeprecationInfo[] = Array.from( + { + length: numDeprecationsPerType, + }, + () => MOCK_INDEX_SETTING_DEPRECATION + ); + + const reindexDeprecations: EnrichedDeprecationInfo[] = Array.from( + { + length: numDeprecationsPerType, + }, + () => MOCK_REINDEX_DEPRECATION + ); + + const defaultDeprecations: EnrichedDeprecationInfo[] = Array.from( + { + length: numDeprecationsPerType, + }, + () => MOCK_DEFAULT_DEPRECATION + ); + + const deprecations: EnrichedDeprecationInfo[] = [ + ...defaultDeprecations, + ...reindexDeprecations, + ...indexSettingsDeprecations, + ...mlDeprecations, + ]; + + return { + totalCriticalDeprecations: mlDeprecations.length + reindexDeprecations.length, + deprecations, + }; +}; diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/reindex_deprecation_flyout.test.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/reindex_deprecation_flyout.test.ts new file mode 100644 index 0000000000000..c93cdcb1f4d97 --- /dev/null +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/es_deprecations/reindex_deprecation_flyout.test.ts @@ -0,0 +1,50 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { act } from 'react-dom/test-utils'; + +import { ElasticsearchTestBed, setupElasticsearchPage, setupEnvironment } from '../helpers'; + +import { esDeprecationsMockResponse, MOCK_SNAPSHOT_ID, MOCK_JOB_ID } from './mocked_responses'; + +// Note: The reindexing flyout UX is subject to change; more tests should be added here once functionality is built out +describe('Reindex deprecation flyout', () => { + let testBed: ElasticsearchTestBed; + const { server, httpRequestsMockHelpers } = setupEnvironment(); + + afterAll(() => { + server.restore(); + }); + + beforeEach(async () => { + httpRequestsMockHelpers.setLoadEsDeprecationsResponse(esDeprecationsMockResponse); + httpRequestsMockHelpers.setUpgradeMlSnapshotStatusResponse({ + nodeId: 'my_node', + snapshotId: MOCK_SNAPSHOT_ID, + jobId: MOCK_JOB_ID, + status: 'idle', + }); + + await act(async () => { + testBed = await setupElasticsearchPage({ isReadOnlyMode: false }); + }); + + testBed.component.update(); + }); + + it('renders a flyout with reindexing details', async () => { + const reindexDeprecation = esDeprecationsMockResponse.deprecations[3]; + const { actions, find, exists } = testBed; + + await actions.clickReindexDeprecationAt(0); + + expect(exists('reindexDetails')).toBe(true); + expect(find('reindexDetails.flyoutTitle').text()).toContain( + `Reindex ${reindexDeprecation.index}` + ); + }); +}); diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/cluster.helpers.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/cluster.helpers.ts deleted file mode 100644 index 2aedface1e32b..0000000000000 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/cluster.helpers.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; -import { EsDeprecationsContent } from '../../../public/application/components/es_deprecations'; -import { WithAppDependencies } from './setup_environment'; - -const testBedConfig: TestBedConfig = { - memoryRouter: { - initialEntries: ['/es_deprecations/cluster'], - componentRoutePath: '/es_deprecations/:tabName', - }, - doMountAsync: true, -}; - -export type ClusterTestBed = TestBed & { - actions: ReturnType; -}; - -const createActions = (testBed: TestBed) => { - /** - * User Actions - */ - const clickTab = (tabName: string) => { - const { find } = testBed; - const camelcaseTabName = tabName.charAt(0).toUpperCase() + tabName.slice(1); - - find(`upgradeAssistant${camelcaseTabName}Tab`).simulate('click'); - }; - - const clickExpandAll = () => { - const { find } = testBed; - find('expandAll').simulate('click'); - }; - - return { - clickTab, - clickExpandAll, - }; -}; - -export const setup = async (overrides?: Record): Promise => { - const initTestBed = registerTestBed( - WithAppDependencies(EsDeprecationsContent, overrides), - testBedConfig - ); - const testBed = await initTestBed(); - - return { - ...testBed, - actions: createActions(testBed), - }; -}; - -export type ClusterTestSubjects = - | 'expandAll' - | 'deprecationsContainer' - | 'permissionsError' - | 'requestError' - | 'upgradedCallout' - | 'partiallyUpgradedWarning' - | 'noDeprecationsPrompt' - | string; diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/elasticsearch.helpers.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/elasticsearch.helpers.ts new file mode 100644 index 0000000000000..86737d4925927 --- /dev/null +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/elasticsearch.helpers.ts @@ -0,0 +1,171 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { act } from 'react-dom/test-utils'; + +import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; +import { EsDeprecations } from '../../../public/application/components/es_deprecations'; +import { WithAppDependencies } from './setup_environment'; + +const testBedConfig: TestBedConfig = { + memoryRouter: { + initialEntries: ['/es_deprecations'], + componentRoutePath: '/es_deprecations', + }, + doMountAsync: true, +}; + +export type ElasticsearchTestBed = TestBed & { + actions: ReturnType; +}; + +const createActions = (testBed: TestBed) => { + const { component, find } = testBed; + + /** + * User Actions + */ + const clickRefreshButton = async () => { + await act(async () => { + find('refreshButton').simulate('click'); + }); + + component.update(); + }; + + const clickMlDeprecationAt = async (index: number) => { + await act(async () => { + find('deprecation-mlSnapshot').at(index).simulate('click'); + }); + + component.update(); + }; + + const clickUpgradeMlSnapshot = async () => { + await act(async () => { + find('mlSnapshotDetails.upgradeSnapshotButton').simulate('click'); + }); + + component.update(); + }; + + const clickDeleteMlSnapshot = async () => { + await act(async () => { + find('mlSnapshotDetails.deleteSnapshotButton').simulate('click'); + }); + + component.update(); + }; + + const clickIndexSettingsDeprecationAt = async (index: number) => { + await act(async () => { + find('deprecation-indexSetting').at(index).simulate('click'); + }); + + component.update(); + }; + + const clickDeleteSettingsButton = async () => { + await act(async () => { + find('deleteSettingsButton').simulate('click'); + }); + + component.update(); + }; + + const clickReindexDeprecationAt = async (index: number) => { + await act(async () => { + find('deprecation-reindex').at(index).simulate('click'); + }); + + component.update(); + }; + + const clickDefaultDeprecationAt = async (index: number) => { + await act(async () => { + find('deprecation-default').at(index).simulate('click'); + }); + + component.update(); + }; + + const clickCriticalFilterButton = async () => { + await act(async () => { + // EUI doesn't support data-test-subj's on the filter buttons, so we must access via CSS selector + find('searchBarContainer').find('.euiFilterButton').at(0).simulate('click'); + }); + + component.update(); + }; + + const clickTypeFilterDropdownAt = async (index: number) => { + await act(async () => { + // EUI doesn't support data-test-subj's on the filter buttons, so we must access via CSS selector + find('searchBarContainer') + .find('.euiPopover') + .find('.euiFilterButton') + .at(index) + .simulate('click'); + }); + + component.update(); + }; + + const setSearchInputValue = async (searchValue: string) => { + await act(async () => { + find('searchBarContainer') + .find('input') + .simulate('keyup', { target: { value: searchValue } }); + }); + + component.update(); + }; + + const clickPaginationAt = async (index: number) => { + await act(async () => { + find(`pagination-button-${index}`).simulate('click'); + }); + + component.update(); + }; + + const clickRowsPerPageDropdown = async () => { + await act(async () => { + find('tablePaginationPopoverButton').simulate('click'); + }); + + component.update(); + }; + + return { + clickRefreshButton, + clickMlDeprecationAt, + clickUpgradeMlSnapshot, + clickDeleteMlSnapshot, + clickIndexSettingsDeprecationAt, + clickDeleteSettingsButton, + clickReindexDeprecationAt, + clickDefaultDeprecationAt, + clickCriticalFilterButton, + clickTypeFilterDropdownAt, + setSearchInputValue, + clickPaginationAt, + clickRowsPerPageDropdown, + }; +}; + +export const setup = async (overrides?: Record): Promise => { + const initTestBed = registerTestBed( + WithAppDependencies(EsDeprecations, overrides), + testBedConfig + ); + const testBed = await initTestBed(); + + return { + ...testBed, + actions: createActions(testBed), + }; +}; diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/http_requests.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/http_requests.ts index 74fcf14fdf597..d0c93d74f31f4 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/http_requests.ts +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/http_requests.ts @@ -51,11 +51,13 @@ const registerHttpRequestMockHelpers = (server: SinonFakeServer) => { ]); }; - const setUpdateIndexSettingsResponse = (response?: object) => { + const setUpdateIndexSettingsResponse = (response?: object, error?: ResponseError) => { + const status = error ? error.statusCode || 400 : 200; + const body = error ? error : response; server.respondWith('POST', `${API_BASE_PATH}/:indexName/index_settings`, [ - 200, + status, { 'Content-Type': 'application/json' }, - JSON.stringify(response), + JSON.stringify(body), ]); }; @@ -70,6 +72,17 @@ const registerHttpRequestMockHelpers = (server: SinonFakeServer) => { ]); }; + const setUpgradeMlSnapshotStatusResponse = (response?: object, error?: ResponseError) => { + const status = error ? error.statusCode || 400 : 200; + const body = error ? error : response; + + server.respondWith('GET', `${API_BASE_PATH}/ml_snapshots/:jobId/:snapshotId`, [ + status, + { 'Content-Type': 'application/json' }, + JSON.stringify(body), + ]); + }; + const setDeleteMlSnapshotResponse = (response?: object, error?: ResponseError) => { const status = error ? error.statusCode || 400 : 200; const body = error ? error : response; @@ -88,6 +101,7 @@ const registerHttpRequestMockHelpers = (server: SinonFakeServer) => { setUpdateIndexSettingsResponse, setUpgradeMlSnapshotResponse, setDeleteMlSnapshotResponse, + setUpgradeMlSnapshotStatusResponse, }; }; diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/index.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/index.ts index 8e256680253be..b19c8b3d0f082 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/index.ts +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/index.ts @@ -6,8 +6,7 @@ */ export { setup as setupOverviewPage, OverviewTestBed } from './overview.helpers'; -export { setup as setupIndicesPage, IndicesTestBed } from './indices.helpers'; -export { setup as setupClusterPage, ClusterTestBed } from './cluster.helpers'; +export { setup as setupElasticsearchPage, ElasticsearchTestBed } from './elasticsearch.helpers'; export { setup as setupKibanaPage, KibanaTestBed } from './kibana.helpers'; export { setupEnvironment } from './setup_environment'; diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/indices.helpers.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/indices.helpers.ts deleted file mode 100644 index 5189ddc420b08..0000000000000 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/indices.helpers.ts +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; -import { EsDeprecationsContent } from '../../../public/application/components/es_deprecations'; -import { WithAppDependencies } from './setup_environment'; - -const testBedConfig: TestBedConfig = { - memoryRouter: { - initialEntries: ['/es_deprecations/indices'], - componentRoutePath: '/es_deprecations/:tabName', - }, - doMountAsync: true, -}; - -export type IndicesTestBed = TestBed & { - actions: ReturnType; -}; - -const createActions = (testBed: TestBed) => { - /** - * User Actions - */ - const clickTab = (tabName: string) => { - const { find } = testBed; - const camelcaseTabName = tabName.charAt(0).toUpperCase() + tabName.slice(1); - - find(`upgradeAssistant${camelcaseTabName}Tab`).simulate('click'); - }; - - const clickFixButton = () => { - const { find } = testBed; - find('removeIndexSettingsButton').simulate('click'); - }; - - const clickExpandAll = () => { - const { find } = testBed; - find('expandAll').simulate('click'); - }; - - return { - clickTab, - clickFixButton, - clickExpandAll, - }; -}; - -export const setup = async (overrides?: Record): Promise => { - const initTestBed = registerTestBed( - WithAppDependencies(EsDeprecationsContent, overrides), - testBedConfig - ); - const testBed = await initTestBed(); - - return { - ...testBed, - actions: createActions(testBed), - }; -}; - -export type IndicesTestSubjects = - | 'expandAll' - | 'removeIndexSettingsButton' - | 'deprecationsContainer' - | 'permissionsError' - | 'requestError' - | 'indexCount' - | 'upgradedCallout' - | 'partiallyUpgradedWarning' - | 'noDeprecationsPrompt' - | string; diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/setup_environment.tsx b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/setup_environment.tsx index 53b4b5d75931b..c5de02bebd512 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/setup_environment.tsx +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/setup_environment.tsx @@ -23,9 +23,12 @@ import { mockKibanaSemverVersion } from '../../../common/constants'; import { AppContextProvider } from '../../../public/application/app_context'; import { apiService } from '../../../public/application/lib/api'; import { breadcrumbService } from '../../../public/application/lib/breadcrumbs'; +import { GlobalFlyout } from '../../../public/shared_imports'; import { servicesMock } from './services_mock'; import { init as initHttpRequests } from './http_requests'; +const { GlobalFlyoutProvider } = GlobalFlyout; + const mockHttpClient = axios.create({ adapter: axiosXhrAdapter }); export const WithAppDependencies = (Comp: any, overrides: Record = {}) => ( @@ -55,7 +58,9 @@ export const WithAppDependencies = (Comp: any, overrides: Record - + + + ); diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/indices.test.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/indices.test.ts deleted file mode 100644 index 89f648c98437e..0000000000000 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/indices.test.ts +++ /dev/null @@ -1,245 +0,0 @@ -/* - * 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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { act } from 'react-dom/test-utils'; -import { indexSettingDeprecations } from '../../common/constants'; -import { ESUpgradeStatus } from '../../common/types'; - -import { IndicesTestBed, setupIndicesPage, setupEnvironment } from './helpers'; - -describe('Indices tab', () => { - let testBed: IndicesTestBed; - const { server, httpRequestsMockHelpers } = setupEnvironment(); - - afterAll(() => { - server.restore(); - }); - - describe('with deprecations', () => { - const esDeprecationsMockResponse: ESUpgradeStatus = { - totalCriticalDeprecations: 0, - cluster: [], - indices: [ - { - level: 'warning', - message: indexSettingDeprecations.translog.deprecationMessage, - url: 'doc_url', - index: 'my_index', - correctiveAction: { - type: 'indexSetting', - deprecatedSettings: indexSettingDeprecations.translog.settings, - }, - }, - ], - }; - - beforeEach(async () => { - httpRequestsMockHelpers.setLoadEsDeprecationsResponse(esDeprecationsMockResponse); - httpRequestsMockHelpers.setLoadDeprecationLoggingResponse({ - isDeprecationLogIndexingEnabled: true, - isDeprecationLoggingEnabled: true, - }); - - await act(async () => { - testBed = await setupIndicesPage({ isReadOnlyMode: false }); - }); - - const { actions, component } = testBed; - - component.update(); - - // Navigate to the indices tab - await act(async () => { - actions.clickTab('indices'); - }); - - component.update(); - }); - - test('renders deprecations', () => { - const { exists, find } = testBed; - expect(exists('indexTabContent')).toBe(true); - expect(exists('deprecationsContainer')).toBe(true); - expect(find('indexCount').text()).toEqual('1'); - }); - - describe('fix indices button', () => { - test('removes deprecated index settings', async () => { - const { component, actions, exists, find } = testBed; - - expect(exists('deprecationsContainer')).toBe(true); - - // Open all deprecations - actions.clickExpandAll(); - - const accordionTestSubj = `depgroup_${indexSettingDeprecations.translog.deprecationMessage - .split(' ') - .join('_')}`; - - await act(async () => { - find(`${accordionTestSubj}.removeIndexSettingsButton`).simulate('click'); - }); - - // We need to read the document "body" as the modal is added there and not inside - // the component DOM tree. - const modal = document.body.querySelector( - '[data-test-subj="indexSettingsDeleteConfirmModal"]' - ); - const confirmButton: HTMLButtonElement | null = modal!.querySelector( - '[data-test-subj="confirmModalConfirmButton"]' - ); - - expect(modal).not.toBe(null); - expect(modal!.textContent).toContain('Remove deprecated settings'); - - const indexName = esDeprecationsMockResponse.indices[0].index; - - httpRequestsMockHelpers.setUpdateIndexSettingsResponse({ - acknowledged: true, - }); - - await act(async () => { - confirmButton!.click(); - }); - - component.update(); - - const request = server.requests[server.requests.length - 1]; - - expect(request.method).toBe('POST'); - expect(request.url).toBe(`/api/upgrade_assistant/${indexName}/index_settings`); - expect(request.status).toEqual(200); - }); - }); - }); - - describe('no deprecations', () => { - beforeEach(async () => { - const noDeprecationsResponse = { - totalCriticalDeprecations: 0, - cluster: [], - indices: [], - }; - - httpRequestsMockHelpers.setLoadEsDeprecationsResponse(noDeprecationsResponse); - - await act(async () => { - testBed = await setupIndicesPage({ isReadOnlyMode: false }); - }); - - const { component } = testBed; - - component.update(); - }); - - test('renders prompt', () => { - const { exists, find } = testBed; - expect(exists('noDeprecationsPrompt')).toBe(true); - expect(find('noDeprecationsPrompt').text()).toContain('Ready to upgrade!'); - }); - }); - - describe('error handling', () => { - test('handles 403', async () => { - const error = { - statusCode: 403, - error: 'Forbidden', - message: 'Forbidden', - }; - - httpRequestsMockHelpers.setLoadEsDeprecationsResponse(undefined, error); - - await act(async () => { - testBed = await setupIndicesPage({ isReadOnlyMode: false }); - }); - - const { component, exists, find } = testBed; - - component.update(); - - expect(exists('permissionsError')).toBe(true); - expect(find('permissionsError').text()).toContain( - 'You are not authorized to view Elasticsearch deprecations.' - ); - }); - - test('handles upgrade error', async () => { - const error = { - statusCode: 426, - error: 'Upgrade required', - message: 'There are some nodes running a different version of Elasticsearch', - attributes: { - allNodesUpgraded: true, - }, - }; - - httpRequestsMockHelpers.setLoadEsDeprecationsResponse(undefined, error); - - await act(async () => { - testBed = await setupIndicesPage({ isReadOnlyMode: false }); - }); - - const { component, exists, find } = testBed; - - component.update(); - - expect(exists('upgradedCallout')).toBe(true); - expect(find('upgradedCallout').text()).toContain( - 'Your configuration is up to date. Kibana and all Elasticsearch nodes are running the same version.' - ); - }); - - test('handles partially upgrade error', async () => { - const error = { - statusCode: 426, - error: 'Upgrade required', - message: 'There are some nodes running a different version of Elasticsearch', - attributes: { - allNodesUpgraded: false, - }, - }; - - httpRequestsMockHelpers.setLoadEsDeprecationsResponse(undefined, error); - - await act(async () => { - testBed = await setupIndicesPage({ isReadOnlyMode: false }); - }); - - const { component, exists, find } = testBed; - - component.update(); - - expect(exists('partiallyUpgradedWarning')).toBe(true); - expect(find('partiallyUpgradedWarning').text()).toContain( - 'Upgrade Kibana to the same version as your Elasticsearch cluster. One or more nodes in the cluster is running a different version than Kibana.' - ); - }); - - test('handles generic error', async () => { - const error = { - statusCode: 500, - error: 'Internal server error', - message: 'Internal server error', - }; - - httpRequestsMockHelpers.setLoadEsDeprecationsResponse(undefined, error); - - await act(async () => { - testBed = await setupIndicesPage({ isReadOnlyMode: false }); - }); - - const { component, exists, find } = testBed; - - component.update(); - - expect(exists('requestError')).toBe(true); - expect(find('requestError').text()).toContain( - 'Could not retrieve Elasticsearch deprecations.' - ); - }); - }); -}); diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana.test.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana.test.ts index b14ec26e5c8af..5de290e325fe4 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana.test.ts +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/kibana.test.ts @@ -78,7 +78,7 @@ describe('Kibana deprecations', () => { // the component DOM tree. let modal = document.body.querySelector('[data-test-subj="stepsModal"]'); - expect(modal).not.toBe(null); + expect(modal).not.toBeNull(); expect(modal!.textContent).toContain(`Resolve deprecation in '${deprecation.domainId}'`); const steps: NodeListOf | null = modal!.querySelectorAll( @@ -160,7 +160,9 @@ describe('Kibana deprecations', () => { test('renders prompt', () => { const { exists, find } = testBed; expect(exists('noDeprecationsPrompt')).toBe(true); - expect(find('noDeprecationsPrompt').text()).toContain('Ready to upgrade!'); + expect(find('noDeprecationsPrompt').text()).toContain( + 'Your Kibana configuration is up to date' + ); }); }); diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/review_logs_step/mocked_responses.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/review_logs_step/mocked_responses.ts index ba8f9f8b67d0c..0bf9f9932b8a1 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/review_logs_step/mocked_responses.ts +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/review_logs_step/mocked_responses.ts @@ -10,19 +10,21 @@ import { ESUpgradeStatus } from '../../../../common/types'; export const esDeprecations: ESUpgradeStatus = { totalCriticalDeprecations: 1, - cluster: [ + deprecations: [ { - level: 'critical', + isCritical: true, + type: 'cluster_settings', + resolveDuringUpgrade: false, message: 'Index Lifecycle Management poll interval is set too low', url: 'https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-8.0.html#ilm-poll-interval-limit', details: 'The Index Lifecycle Management poll interval setting [indices.lifecycle.poll_interval] is currently set to [500ms], but must be 1s or greater', }, - ], - indices: [ { - level: 'warning', + isCritical: false, + type: 'index_settings', + resolveDuringUpgrade: false, message: 'translog retention settings are ignored', url: 'https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-translog.html', @@ -35,8 +37,7 @@ export const esDeprecations: ESUpgradeStatus = { export const esDeprecationsEmpty: ESUpgradeStatus = { totalCriticalDeprecations: 0, - cluster: [], - indices: [], + deprecations: [], }; export const kibanaDeprecations: DomainDeprecationDetails[] = [ diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/review_logs_step/review_logs_step.test.tsx b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/review_logs_step/review_logs_step.test.tsx index 254242ab338a0..2afffe989ed1b 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/review_logs_step/review_logs_step.test.tsx +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/overview/review_logs_step/review_logs_step.test.tsx @@ -84,7 +84,7 @@ describe('Overview - Fix deprecated settings step', () => { component.update(); expect(exists('esStatsPanel')).toBe(true); - expect(find('esStatsPanel').find('a').props().href).toBe('/es_deprecations/cluster'); + expect(find('esStatsPanel').find('a').props().href).toBe('/es_deprecations'); }); describe('Renders ES errors', () => { diff --git a/x-pack/plugins/upgrade_assistant/common/types.ts b/x-pack/plugins/upgrade_assistant/common/types.ts index 35c514a0a95bb..a390dd26a0747 100644 --- a/x-pack/plugins/upgrade_assistant/common/types.ts +++ b/x-pack/plugins/upgrade_assistant/common/types.ts @@ -5,6 +5,10 @@ * 2.0. */ +import { + MigrationDeprecationInfoDeprecation, + MigrationDeprecationInfoResponse, +} from '@elastic/elasticsearch/api/types'; import { SavedObject, SavedObjectAttributes } from 'src/core/public'; export enum ReindexStep { @@ -116,13 +120,12 @@ export enum IndexGroup { // Telemetry types export const UPGRADE_ASSISTANT_TYPE = 'upgrade-assistant-telemetry'; export const UPGRADE_ASSISTANT_DOC_ID = 'upgrade-assistant-telemetry'; -export type UIOpenOption = 'overview' | 'cluster' | 'indices' | 'kibana'; +export type UIOpenOption = 'overview' | 'elasticsearch' | 'kibana'; export type UIReindexOption = 'close' | 'open' | 'start' | 'stop'; export interface UIOpen { overview: boolean; - cluster: boolean; - indices: boolean; + elasticsearch: boolean; kibana: boolean; } @@ -136,8 +139,7 @@ export interface UIReindex { export interface UpgradeAssistantTelemetrySavedObject { ui_open: { overview: number; - cluster: number; - indices: number; + elasticsearch: number; kibana: number; }; ui_reindex: { @@ -151,8 +153,7 @@ export interface UpgradeAssistantTelemetrySavedObject { export interface UpgradeAssistantTelemetry { ui_open: { overview: number; - cluster: number; - indices: number; + elasticsearch: number; kibana: number; }; ui_reindex: { @@ -186,13 +187,6 @@ export interface DeprecationInfo { export interface IndexSettingsDeprecationInfo { [indexName: string]: DeprecationInfo[]; } -export interface DeprecationAPIResponse { - cluster_settings: DeprecationInfo[]; - ml_settings: DeprecationInfo[]; - node_settings: DeprecationInfo[]; - index_settings: IndexSettingsDeprecationInfo; -} - export interface ReindexAction { type: 'reindex'; /** @@ -215,15 +209,18 @@ export interface IndexSettingAction { type: 'indexSetting'; deprecatedSettings: string[]; } -export interface EnrichedDeprecationInfo extends DeprecationInfo { +export interface EnrichedDeprecationInfo + extends Omit { + type: keyof MigrationDeprecationInfoResponse; + isCritical: boolean; index?: string; correctiveAction?: ReindexAction | MlAction | IndexSettingAction; + resolveDuringUpgrade: boolean; } export interface ESUpgradeStatus { totalCriticalDeprecations: number; - cluster: EnrichedDeprecationInfo[]; - indices: EnrichedDeprecationInfo[]; + deprecations: EnrichedDeprecationInfo[]; } export interface ResolveIndexResponseFromES { diff --git a/x-pack/plugins/upgrade_assistant/public/application/app.tsx b/x-pack/plugins/upgrade_assistant/public/application/app.tsx index b1571b9e45461..864be6e5d996d 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/app.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/app.tsx @@ -8,17 +8,19 @@ import React from 'react'; import { Router, Switch, Route, Redirect } from 'react-router-dom'; import { I18nStart, ScopedHistory } from 'src/core/public'; - import { ApplicationStart } from 'kibana/public'; +import { GlobalFlyout } from '../shared_imports'; + import { KibanaContextProvider } from '../shared_imports'; import { AppServicesContext } from '../types'; import { AppContextProvider, ContextValue, useAppContext } from './app_context'; import { ComingSoonPrompt } from './components/coming_soon_prompt'; -import { EsDeprecationsContent } from './components/es_deprecations'; +import { EsDeprecations } from './components/es_deprecations'; import { KibanaDeprecationsContent } from './components/kibana_deprecations'; import { Overview } from './components/overview'; import { RedirectAppLinks } from '../../../../../src/plugins/kibana_react/public'; +const { GlobalFlyoutProvider } = GlobalFlyout; export interface AppDependencies extends ContextValue { i18n: I18nStart; history: ScopedHistory; @@ -37,7 +39,7 @@ const App: React.FunctionComponent = () => { return ( - + @@ -64,7 +66,9 @@ export const RootComponent = ({ - + + + diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/constants.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/constants.tsx index 7b4bee75bc757..c7f974fab6a89 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/constants.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/constants.tsx @@ -7,6 +7,8 @@ import { IconColor } from '@elastic/eui'; import { invert } from 'lodash'; +import { i18n } from '@kbn/i18n'; + import { DeprecationInfo } from '../../../common/types'; export const LEVEL_MAP: { [level: string]: number } = { @@ -26,3 +28,24 @@ export const COLOR_MAP: { [level: string]: IconColor } = { }; export const DEPRECATIONS_PER_PAGE = 25; + +export const DEPRECATION_TYPE_MAP = { + cluster_settings: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.clusterDeprecationTypeLabel', + { + defaultMessage: 'Cluster', + } + ), + index_settings: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.indexDeprecationTypeLabel', + { + defaultMessage: 'Index', + } + ), + node_settings: i18n.translate('xpack.upgradeAssistant.esDeprecations.nodeDeprecationTypeLabel', { + defaultMessage: 'Node', + }), + ml_settings: i18n.translate('xpack.upgradeAssistant.esDeprecations.mlDeprecationTypeLabel', { + defaultMessage: 'Machine Learning', + }), +}; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/__fixtures__/checkup_api_response.json b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/__fixtures__/checkup_api_response.json deleted file mode 100644 index 531bc229b39ea..0000000000000 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/__fixtures__/checkup_api_response.json +++ /dev/null @@ -1,870 +0,0 @@ -{ - "cluster": [ - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 1", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 1", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 1", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 1", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 2", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 2", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 2", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 2", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 1 2", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 1 2", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 1 2", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 1 2", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 3", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 3", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 3", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 3", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 1 3", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 1 3", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 1 3", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 1 3", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 2 3", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 2 3", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 2 3", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 2 3", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 1 2 3", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 1 2 3", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 1 2 3", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 1 2 3", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 1 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 1 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 1 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 1 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 2 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 2 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 2 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 2 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 1 2 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 1 2 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 1 2 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 1 2 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 3 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 3 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 3 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 3 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 1 3 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 1 3 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 1 3 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 1 3 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 2 3 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 2 3 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 2 3 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 2 3 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 1 2 3 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 1 2 3 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 1 2 3 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 1 2 3 4", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 1 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 1 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 1 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 1 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 2 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 2 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 2 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 2 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 1 2 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 1 2 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 1 2 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 1 2 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 3 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 3 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 3 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 3 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 1 3 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 1 3 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 1 3 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 1 3 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 2 3 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 2 3 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 2 3 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 2 3 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 1 2 3 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 1 2 3 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 1 2 3 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 1 2 3 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 1 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 1 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 1 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 1 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 2 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 2 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 2 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 2 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 1 2 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 1 2 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 1 2 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 1 2 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 3 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 3 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 3 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 3 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 1 3 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 1 3 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 1 3 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 1 3 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 2 3 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 2 3 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 2 3 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 2 3 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 1 2 3 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 1 2 3 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - }, - { - "level": "warning", - "message": "Template patterns are no longer using `template` field, but `index_patterns` instead 0 1 2 3 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" - }, - { - "level": "warning", - "message": "one or more templates use deprecated mapping settings 0 1 2 3 4 5", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" - } - ], - "nodes": [], - "indices": [ - { - "level": "warning", - "message": "Coercion of boolean fields", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_mappings_changes.html#_coercion_of_boolean_fields", - "details": "[[type: doc, field: spins], [type: doc, field: mlockall], [type: doc, field: node_master], [type: doc, field: primary]]", - "index": ".monitoring-es-6-2018.11.07" - }, - { - "level": "warning", - "message": "Coercion of boolean fields", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_mappings_changes.html#_coercion_of_boolean_fields", - "details": "[[type: tweet, field: liked]]", - "index": "twitter" - }, - { - "level": "warning", - "message": "Coercion of boolean fields", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_mappings_changes.html#_coercion_of_boolean_fields", - "details": "[[type: index-pattern, field: notExpandable], [type: config, field: xPackMonitoring:allowReport], [type: config, field: xPackMonitoring:showBanner], [type: dashboard, field: pause], [type: dashboard, field: timeRestore]]", - "index": ".kibana" - }, - { - "level": "warning", - "message": "Coercion of boolean fields", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_mappings_changes.html#_coercion_of_boolean_fields", - "details": "[[type: doc, field: notify], [type: doc, field: created], [type: doc, field: attach_payload], [type: doc, field: met]]", - "index": ".watcher-history-6-2018.11.07" - }, - { - "level": "warning", - "message": "Coercion of boolean fields", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_mappings_changes.html#_coercion_of_boolean_fields", - "details": "[[type: doc, field: snapshot]]", - "index": ".monitoring-kibana-6-2018.11.07" - }, - { - "level": "warning", - "message": "Coercion of boolean fields", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_mappings_changes.html#_coercion_of_boolean_fields", - "details": "[[type: tweet, field: liked]]", - "index": "twitter2" - }, - { - "index": "twitter", - "level": "critical", - "message": "This index must be reindexed in order to upgrade the Elastic Stack.", - "details": "Reindexing is irreversible, so always back up your index before proceeding.", - "actions": [ - { - "label": "Reindex in Console", - "url": "/app/dev_tools#/console?load_from=%2Fapi%2Fupgrade_assistant%2Freindex%2Fconsole_template%2Ftwitter.json" - } - ], - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/reindex-upgrade.html" - }, - { - "index": ".triggered_watches", - "level": "critical", - "message": "This index must be upgraded in order to upgrade the Elastic Stack.", - "details": "Upgrading is irreversible, so always back up your index before proceeding.", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-upgrade.html" - }, - { - "index": ".reindex-status", - "level": "critical", - "message": "This index must be reindexed in order to upgrade the Elastic Stack.", - "details": "Reindexing is irreversible, so always back up your index before proceeding.", - "actions": [ - { - "label": "Reindex in Console", - "url": "/app/dev_tools#/console?load_from=%2Fapi%2Fupgrade_assistant%2Freindex%2Fconsole_template%2F.reindex-status.json" - } - ], - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/reindex-upgrade.html" - }, - { - "index": "twitter2", - "level": "critical", - "message": "This index must be reindexed in order to upgrade the Elastic Stack.", - "details": "Reindexing is irreversible, so always back up your index before proceeding.", - "actions": [ - { - "label": "Reindex in Console", - "url": "/app/dev_tools#/console?load_from=%2Fapi%2Fupgrade_assistant%2Freindex%2Fconsole_template%2Ftwitter2.json" - } - ], - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/reindex-upgrade.html" - }, - { - "index": ".watches", - "level": "critical", - "message": "This index must be upgraded in order to upgrade the Elastic Stack.", - "details": "Upgrading is irreversible, so always back up your index before proceeding.", - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-upgrade.html" - } - ] -} diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/_index.scss b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/_index.scss index d64400a8abdcf..4865e977f5261 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/_index.scss +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/_index.scss @@ -1 +1 @@ -@import 'deprecations/index'; +@import 'deprecation_types/index'; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_tab_content.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_tab_content.tsx deleted file mode 100644 index 8be407371f038..0000000000000 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_tab_content.tsx +++ /dev/null @@ -1,228 +0,0 @@ -/* - * 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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { find, groupBy } from 'lodash'; -import React, { FunctionComponent, useState, useEffect } from 'react'; -import { i18n } from '@kbn/i18n'; - -import { EuiSpacer, EuiHorizontalRule } from '@elastic/eui'; - -import { EnrichedDeprecationInfo } from '../../../../common/types'; -import { SectionLoading } from '../../../shared_imports'; -import { GroupByOption, LevelFilterOption, UpgradeAssistantTabProps } from '../types'; -import { - NoDeprecationsPrompt, - SearchBar, - DeprecationPagination, - DeprecationListBar, -} from '../shared'; -import { DEPRECATIONS_PER_PAGE } from '../constants'; -import { EsDeprecationErrors } from './es_deprecation_errors'; -import { EsDeprecationAccordion } from './deprecations'; - -const i18nTexts = { - isLoading: i18n.translate('xpack.upgradeAssistant.esDeprecations.loadingText', { - defaultMessage: 'Loading deprecations…', - }), -}; - -export interface CheckupTabProps extends UpgradeAssistantTabProps { - checkupLabel: string; -} - -export const createDependenciesFilter = (level: LevelFilterOption, search: string = '') => { - const conditions: Array<(dep: EnrichedDeprecationInfo) => boolean> = []; - - if (level !== 'all') { - conditions.push((dep: EnrichedDeprecationInfo) => dep.level === level); - } - - if (search.length > 0) { - conditions.push((dep) => { - try { - // 'i' is used for case-insensitive matching - const searchReg = new RegExp(search, 'i'); - return searchReg.test(dep.message); - } catch (e) { - // ignore any regexp errors. - return true; - } - }); - } - - // Return true if every condition function returns true (boolean AND) - return (dep: EnrichedDeprecationInfo) => conditions.map((c) => c(dep)).every((t) => t); -}; - -const filterDeprecations = ( - deprecations: EnrichedDeprecationInfo[] = [], - currentFilter: LevelFilterOption, - search: string -) => deprecations.filter(createDependenciesFilter(currentFilter, search)); - -const groupDeprecations = ( - deprecations: EnrichedDeprecationInfo[], - currentFilter: LevelFilterOption, - search: string, - currentGroupBy: GroupByOption -) => groupBy(filterDeprecations(deprecations, currentFilter, search), currentGroupBy); - -const getPageCount = ( - deprecations: EnrichedDeprecationInfo[], - currentFilter: LevelFilterOption, - search: string, - currentGroupBy: GroupByOption -) => - Math.ceil( - Object.keys(groupDeprecations(deprecations, currentFilter, search, currentGroupBy)).length / - DEPRECATIONS_PER_PAGE - ); - -/** - * Displays a list of deprecations that are filterable and groupable. Can be used for cluster, - * nodes, or indices deprecations. - */ -export const DeprecationTabContent: FunctionComponent = ({ - checkupLabel, - deprecations, - error, - isLoading, - refreshCheckupData, - navigateToOverviewPage, -}) => { - const [currentFilter, setCurrentFilter] = useState('all'); - const [search, setSearch] = useState(''); - const [currentGroupBy, setCurrentGroupBy] = useState(GroupByOption.message); - const [expandState, setExpandState] = useState({ - forceExpand: false, - expandNumber: 0, - }); - const [currentPage, setCurrentPage] = useState(0); - - const getAvailableGroupByOptions = () => { - if (!deprecations) { - return []; - } - - return Object.keys(GroupByOption).filter((opt) => find(deprecations, opt)) as GroupByOption[]; - }; - - const setExpandAll = (expandAll: boolean) => { - setExpandState({ forceExpand: expandAll, expandNumber: expandState.expandNumber + 1 }); - }; - - useEffect(() => { - if (deprecations) { - const pageCount = getPageCount(deprecations, currentFilter, search, currentGroupBy); - - if (currentPage >= pageCount) { - setCurrentPage(0); - } - } - }, [currentPage, deprecations, currentFilter, search, currentGroupBy]); - - if (deprecations && deprecations.length === 0) { - return ( -
- -
- ); - } - - let content: React.ReactNode; - - if (isLoading) { - content = {i18nTexts.isLoading}; - } else if (deprecations?.length) { - const levelGroups = groupBy(deprecations, 'level'); - const levelToDeprecationCountMap = Object.keys(levelGroups).reduce((counts, level) => { - counts[level] = levelGroups[level].length; - return counts; - }, {} as Record); - - const filteredDeprecations = filterDeprecations(deprecations, currentFilter, search); - - const groups = groupDeprecations(deprecations, currentFilter, search, currentGroupBy); - - content = ( -
- - - - - - - <> - {Object.keys(groups) - .sort() - // Apply pagination - .slice(currentPage * DEPRECATIONS_PER_PAGE, (currentPage + 1) * DEPRECATIONS_PER_PAGE) - .map((groupName, index) => [ -
- - -
, - ])} - - {/* Only show pagination if we have more than DEPRECATIONS_PER_PAGE. */} - {Object.keys(groups).length > DEPRECATIONS_PER_PAGE && ( - <> - - - - - )} - -
- ); - } else if (error) { - content = ; - } - - return ( -
- - - {content} -
- ); -}; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/_index.scss b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/_index.scss similarity index 60% rename from x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/_index.scss rename to x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/_index.scss index 1f4f0352e7939..c3e842941a250 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/_index.scss +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/_index.scss @@ -1,2 +1 @@ -@import 'cell'; @import 'reindex/index'; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/default/flyout.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/default/flyout.tsx new file mode 100644 index 0000000000000..439062e027650 --- /dev/null +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/default/flyout.tsx @@ -0,0 +1,96 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { i18n } from '@kbn/i18n'; +import { + EuiButtonEmpty, + EuiFlyoutBody, + EuiFlyoutFooter, + EuiFlyoutHeader, + EuiFlexGroup, + EuiFlexItem, + EuiTitle, + EuiText, + EuiTextColor, + EuiLink, +} from '@elastic/eui'; + +import { EnrichedDeprecationInfo } from '../../../../../../common/types'; + +export interface DefaultDeprecationFlyoutProps { + deprecation: EnrichedDeprecationInfo; + closeFlyout: () => void; +} + +const i18nTexts = { + getFlyoutDescription: (indexName: string) => + i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.deprecationDetailsFlyout.secondaryDescription', + { + defaultMessage: 'Index: {indexName}', + values: { + indexName, + }, + } + ), + learnMoreLinkLabel: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.deprecationDetailsFlyout.learnMoreLinkLabel', + { + defaultMessage: 'Learn more about this deprecation', + } + ), + closeButtonLabel: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.deprecationDetailsFlyout.closeButtonLabel', + { + defaultMessage: 'Close', + } + ), +}; + +export const DefaultDeprecationFlyout = ({ + deprecation, + closeFlyout, +}: DefaultDeprecationFlyoutProps) => { + const { message, url, details, index } = deprecation; + + return ( + <> + + +

{message}

+
+ {index && ( + +

+ {i18nTexts.getFlyoutDescription(index)} +

+
+ )} +
+ + +

{details}

+

+ + {i18nTexts.learnMoreLinkLabel} + +

+
+
+ + + + + {i18nTexts.closeButtonLabel} + + + + + + ); +}; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/index.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/default/index.ts similarity index 84% rename from x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/index.tsx rename to x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/default/index.ts index facc830234667..ea537b642d8e4 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/index.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/default/index.ts @@ -5,4 +5,4 @@ * 2.0. */ -export { ReindexFlyout } from './container'; +export { DefaultTableRow } from './table_row'; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/default/table_row.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/default/table_row.tsx new file mode 100644 index 0000000000000..7f4b2e3be3479 --- /dev/null +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/default/table_row.tsx @@ -0,0 +1,73 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useState, useEffect, useCallback } from 'react'; +import { EuiTableRowCell } from '@elastic/eui'; +import { GlobalFlyout } from '../../../../../shared_imports'; +import { EnrichedDeprecationInfo } from '../../../../../../common/types'; +import { DeprecationTableColumns } from '../../../types'; +import { EsDeprecationsTableCells } from '../../es_deprecations_table_cells'; +import { DefaultDeprecationFlyout, DefaultDeprecationFlyoutProps } from './flyout'; + +const { useGlobalFlyout } = GlobalFlyout; + +interface Props { + rowFieldNames: DeprecationTableColumns[]; + deprecation: EnrichedDeprecationInfo; +} + +export const DefaultTableRow: React.FunctionComponent = ({ rowFieldNames, deprecation }) => { + const [showFlyout, setShowFlyout] = useState(false); + + const { + addContent: addContentToGlobalFlyout, + removeContent: removeContentFromGlobalFlyout, + } = useGlobalFlyout(); + + const closeFlyout = useCallback(() => { + setShowFlyout(false); + removeContentFromGlobalFlyout('deprecationDetails'); + }, [removeContentFromGlobalFlyout]); + + useEffect(() => { + if (showFlyout) { + addContentToGlobalFlyout({ + id: 'deprecationDetails', + Component: DefaultDeprecationFlyout, + props: { + deprecation, + closeFlyout, + }, + flyoutProps: { + onClose: closeFlyout, + 'data-test-subj': 'defaultDeprecationDetails', + 'aria-labelledby': 'defaultDeprecationDetailsFlyoutTitle', + }, + }); + } + }, [addContentToGlobalFlyout, closeFlyout, deprecation, showFlyout]); + + return ( + <> + {rowFieldNames.map((field) => { + return ( + + setShowFlyout(true)} + deprecation={deprecation} + /> + + ); + })} + + ); +}; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/index.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index.tsx similarity index 55% rename from x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/index.tsx rename to x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index.tsx index a4152e52a35b7..eb0221a722a30 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/index.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index.tsx @@ -5,4 +5,7 @@ * 2.0. */ -export { EsDeprecationAccordion } from './deprecation_group_item'; +export { MlSnapshotsTableRow } from './ml_snapshots'; +export { IndexSettingsTableRow } from './index_settings'; +export { DefaultTableRow } from './default'; +export { ReindexTableRow } from './reindex'; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/flyout.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/flyout.tsx new file mode 100644 index 0000000000000..1567562db53ee --- /dev/null +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/flyout.tsx @@ -0,0 +1,204 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { i18n } from '@kbn/i18n'; +import { + EuiButton, + EuiButtonEmpty, + EuiCode, + EuiFlyoutBody, + EuiFlyoutFooter, + EuiFlyoutHeader, + EuiFlexGroup, + EuiFlexItem, + EuiTitle, + EuiText, + EuiTextColor, + EuiLink, + EuiSpacer, + EuiCallOut, +} from '@elastic/eui'; +import { EnrichedDeprecationInfo, IndexSettingAction } from '../../../../../../common/types'; +import type { ResponseError } from '../../../../lib/api'; +import type { Status } from '../../../types'; + +export interface RemoveIndexSettingsFlyoutProps { + deprecation: EnrichedDeprecationInfo; + closeFlyout: () => void; + removeIndexSettings: (index: string, settings: string[]) => Promise; + status: { + statusType: Status; + details?: ResponseError; + }; +} + +const i18nTexts = { + getFlyoutDescription: (indexName: string) => + i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.removeSettingsFlyout.secondaryDescription', + { + defaultMessage: 'Index: {indexName}', + values: { + indexName, + }, + } + ), + learnMoreLinkLabel: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.removeSettingsFlyout.learnMoreLinkLabel', + { + defaultMessage: 'Learn more about this deprecation', + } + ), + removeButtonLabel: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.removeSettingsFlyout.removeButtonLabel', + { + defaultMessage: 'Remove deprecated settings', + } + ), + retryRemoveButtonLabel: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.removeSettingsFlyout.retryRemoveButtonLabel', + { + defaultMessage: 'Retry removing deprecated settings', + } + ), + resolvedButtonLabel: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.removeSettingsFlyout.resolvedButtonLabel', + { + defaultMessage: 'Resolved', + } + ), + closeButtonLabel: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.removeSettingsFlyout.closeButtonLabel', + { + defaultMessage: 'Close', + } + ), + getConfirmationText: (indexSettingsCount: number) => + i18n.translate('xpack.upgradeAssistant.esDeprecations.removeSettingsFlyout.description', { + defaultMessage: + 'Remove the following deprecated index {indexSettingsCount, plural, one {setting} other {settings}}?', + values: { + indexSettingsCount, + }, + }), + errorTitle: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.removeSettingsFlyout.deleteErrorTitle', + { + defaultMessage: 'Error deleting index settings', + } + ), +}; + +export const RemoveIndexSettingsFlyout = ({ + deprecation, + closeFlyout, + removeIndexSettings, + status, +}: RemoveIndexSettingsFlyoutProps) => { + const { index, message, details, url, correctiveAction } = deprecation; + const { statusType, details: statusDetails } = status; + + // Flag used to hide certain parts of the UI if the deprecation has been resolved or is in progress + const isResolvable = ['idle', 'error'].includes(statusType); + + return ( + <> + + +

{message}

+
+ +

+ {i18nTexts.getFlyoutDescription(index!)} +

+
+
+ + {statusType === 'error' && ( + <> + + {statusDetails!.message} + + + + )} + + +

{details}

+

+ + {i18nTexts.learnMoreLinkLabel} + +

+
+ + {isResolvable && ( +
+ + + +

+ {i18nTexts.getConfirmationText( + (correctiveAction as IndexSettingAction).deprecatedSettings.length + )} +

+
+ + + + +
    + {(correctiveAction as IndexSettingAction).deprecatedSettings.map( + (setting, settingIndex) => ( +
  • + {setting} +
  • + ) + )} +
+
+
+ )} +
+ + + + + {i18nTexts.closeButtonLabel} + + + + {isResolvable && ( + + + removeIndexSettings( + index!, + (correctiveAction as IndexSettingAction).deprecatedSettings + ) + } + > + {statusType === 'error' + ? i18nTexts.retryRemoveButtonLabel + : i18nTexts.removeButtonLabel} + + + )} + + + + ); +}; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/ml_snapshots/index.ts b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/index.ts similarity index 82% rename from x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/ml_snapshots/index.ts rename to x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/index.ts index d537c94cf67ae..282b8308f403f 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/ml_snapshots/index.ts +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/index.ts @@ -5,4 +5,4 @@ * 2.0. */ -export { FixMlSnapshotsButton } from './button'; +export { IndexSettingsTableRow } from './table_row'; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/resolution_table_cell.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/resolution_table_cell.tsx new file mode 100644 index 0000000000000..a5a586927c811 --- /dev/null +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/resolution_table_cell.tsx @@ -0,0 +1,130 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; + +import { + EuiFlexItem, + EuiText, + EuiFlexGroup, + EuiIcon, + EuiLoadingSpinner, + EuiToolTip, +} from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { Status } from '../../../types'; + +const i18nTexts = { + deleteInProgressText: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.indexSettings.deletingButtonLabel', + { + defaultMessage: 'Settings removal in progress…', + } + ), + deleteCompleteText: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.indexSettings.deleteCompleteText', + { + defaultMessage: 'Deprecated settings removed', + } + ), + deleteFailedText: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.indexSettings.deleteFailedText', + { + defaultMessage: 'Settings removal failed', + } + ), + resolutionText: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.indexSettings.resolutionText', + { + defaultMessage: 'Remove settings', + } + ), + resolutionTooltipLabel: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.indexSettings.resolutionTooltipLabel', + { + defaultMessage: + 'Resolve this deprecation by removing settings from this index. This is an automated resolution.', + } + ), +}; + +interface Props { + status: { + statusType: Status; + }; +} + +export const IndexSettingsResolutionCell: React.FunctionComponent = ({ status }) => { + const { statusType } = status; + if (statusType === 'in_progress') { + return ( + + + + + + {i18nTexts.deleteInProgressText} + + + ); + } + + if (statusType === 'complete') { + return ( + + + + + + {i18nTexts.deleteCompleteText} + + + ); + } + + if (statusType === 'error') { + return ( + + + + + + {i18nTexts.deleteFailedText} + + + ); + } + + return ( + + + + + + + {i18nTexts.resolutionText} + + + + ); +}; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/table_row.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/table_row.tsx new file mode 100644 index 0000000000000..3a1706b08c0ee --- /dev/null +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/table_row.tsx @@ -0,0 +1,103 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useState, useEffect, useCallback } from 'react'; +import { EuiTableRowCell } from '@elastic/eui'; +import { EnrichedDeprecationInfo } from '../../../../../../common/types'; +import { GlobalFlyout } from '../../../../../shared_imports'; +import { useAppContext } from '../../../../app_context'; +import type { ResponseError } from '../../../../lib/api'; +import { EsDeprecationsTableCells } from '../../es_deprecations_table_cells'; +import { DeprecationTableColumns, Status } from '../../../types'; +import { IndexSettingsResolutionCell } from './resolution_table_cell'; +import { RemoveIndexSettingsFlyout, RemoveIndexSettingsFlyoutProps } from './flyout'; + +const { useGlobalFlyout } = GlobalFlyout; + +interface Props { + deprecation: EnrichedDeprecationInfo; + rowFieldNames: DeprecationTableColumns[]; +} + +export const IndexSettingsTableRow: React.FunctionComponent = ({ + rowFieldNames, + deprecation, +}) => { + const [showFlyout, setShowFlyout] = useState(false); + const [status, setStatus] = useState<{ + statusType: Status; + details?: ResponseError; + }>({ statusType: 'idle' }); + + const { api } = useAppContext(); + + const { + addContent: addContentToGlobalFlyout, + removeContent: removeContentFromGlobalFlyout, + } = useGlobalFlyout(); + + const closeFlyout = useCallback(() => { + setShowFlyout(false); + removeContentFromGlobalFlyout('indexSettingsFlyout'); + }, [removeContentFromGlobalFlyout]); + + const removeIndexSettings = useCallback( + async (index: string, settings: string[]) => { + setStatus({ statusType: 'in_progress' }); + + const { error } = await api.updateIndexSettings(index, settings); + + setStatus({ + statusType: error ? 'error' : 'complete', + details: error ?? undefined, + }); + closeFlyout(); + }, + [api, closeFlyout] + ); + + useEffect(() => { + if (showFlyout) { + addContentToGlobalFlyout({ + id: 'indexSettingsFlyout', + Component: RemoveIndexSettingsFlyout, + props: { + closeFlyout, + deprecation, + removeIndexSettings, + status, + }, + flyoutProps: { + onClose: closeFlyout, + 'data-test-subj': 'indexSettingsDetails', + 'aria-labelledby': 'indexSettingsDetailsFlyoutTitle', + }, + }); + } + }, [addContentToGlobalFlyout, deprecation, removeIndexSettings, showFlyout, closeFlyout, status]); + + return ( + <> + {rowFieldNames.map((field: DeprecationTableColumns) => { + return ( + + setShowFlyout(true)} + deprecation={deprecation} + resolutionTableCell={} + /> + + ); + })} + + ); +}; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/context.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/context.tsx new file mode 100644 index 0000000000000..972d640d18c5a --- /dev/null +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/context.tsx @@ -0,0 +1,65 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useEffect, createContext, useContext } from 'react'; +import { ApiService } from '../../../../lib/api'; + +import { useSnapshotState, SnapshotState } from './use_snapshot_state'; + +export interface MlSnapshotContext { + snapshotState: SnapshotState; + upgradeSnapshot: () => Promise; + deleteSnapshot: () => Promise; +} + +const MlSnapshotsContext = createContext(undefined); + +export const useMlSnapshotContext = () => { + const context = useContext(MlSnapshotsContext); + if (context === undefined) { + throw new Error('useMlSnapshotContext must be used within a '); + } + return context; +}; + +interface Props { + api: ApiService; + children: React.ReactNode; + snapshotId: string; + jobId: string; +} + +export const MlSnapshotsStatusProvider: React.FunctionComponent = ({ + api, + snapshotId, + jobId, + children, +}) => { + const { updateSnapshotStatus, snapshotState, upgradeSnapshot, deleteSnapshot } = useSnapshotState( + { + jobId, + snapshotId, + api, + } + ); + + useEffect(() => { + updateSnapshotStatus(); + }, [updateSnapshotStatus]); + + return ( + + {children} + + ); +}; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/ml_snapshots/fix_snapshots_flyout.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/flyout.tsx similarity index 61% rename from x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/ml_snapshots/fix_snapshots_flyout.tsx rename to x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/flyout.tsx index 7dafab011a69a..ba72faf2f8c3f 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/ml_snapshots/fix_snapshots_flyout.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/flyout.tsx @@ -13,28 +13,22 @@ import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem, - EuiFlyout, EuiFlyoutBody, EuiFlyoutFooter, EuiFlyoutHeader, - EuiPortal, EuiTitle, EuiText, EuiCallOut, EuiSpacer, + EuiLink, } from '@elastic/eui'; -import { SnapshotStatus } from './use_snapshot_state'; -import { ResponseError } from '../../../../lib/api'; -interface SnapshotState extends SnapshotStatus { - error?: ResponseError; -} -interface Props { - upgradeSnapshot: () => Promise; - deleteSnapshot: () => Promise; - description: string; +import { EnrichedDeprecationInfo } from '../../../../../../common/types'; +import { MlSnapshotContext } from './context'; + +export interface FixSnapshotsFlyoutProps extends MlSnapshotContext { + deprecation: EnrichedDeprecationInfo; closeFlyout: () => void; - snapshotState: SnapshotState; } const i18nTexts = { @@ -51,7 +45,7 @@ const i18nTexts = { } ), closeButtonLabel: i18n.translate( - 'xpack.upgradeAssistant.esDeprecations.mlSnapshots.flyout.cancelButtonLabel', + 'xpack.upgradeAssistant.esDeprecations.mlSnapshots.flyout.closeButtonLabel', { defaultMessage: 'Close', } @@ -83,15 +77,24 @@ const i18nTexts = { defaultMessage: 'Error upgrading snapshot', } ), + learnMoreLinkLabel: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.mlSnapshots.learnMoreLinkLabel', + { + defaultMessage: 'Learn more about this deprecation', + } + ), }; export const FixSnapshotsFlyout = ({ - upgradeSnapshot, - deleteSnapshot, - description, + deprecation, closeFlyout, snapshotState, -}: Props) => { + upgradeSnapshot, + deleteSnapshot, +}: FixSnapshotsFlyoutProps) => { + // Flag used to hide certain parts of the UI if the deprecation has been resolved or is in progress + const isResolvable = ['idle', 'error'].includes(snapshotState.status); + const onUpgradeSnapshot = () => { upgradeSnapshot(); closeFlyout(); @@ -103,48 +106,48 @@ export const FixSnapshotsFlyout = ({ }; return ( - - - - -

{i18nTexts.flyoutTitle}

-
-
- - {snapshotState.error && ( - <> - - {snapshotState.error.message} - - - - )} - -

{description}

-
-
- - - - - {i18nTexts.closeButtonLabel} - - + <> + + +

{i18nTexts.flyoutTitle}

+
+
+ + {snapshotState.error && ( + <> + + {snapshotState.error.message} + + + + )} + +

{deprecation.details}

+

+ + {i18nTexts.learnMoreLinkLabel} + +

+
+
+ + + + + {i18nTexts.closeButtonLabel} + + + + {isResolvable && ( @@ -173,9 +176,9 @@ export const FixSnapshotsFlyout = ({ - - -
-
+ )} + + + ); }; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/index_settings/index.ts b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/index.ts similarity index 83% rename from x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/index_settings/index.ts rename to x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/index.ts index e8a83790ee2a6..d523184454533 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/index_settings/index.ts +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/index.ts @@ -5,4 +5,4 @@ * 2.0. */ -export { FixIndexSettingsButton } from './button'; +export { MlSnapshotsTableRow } from './table_row'; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/resolution_table_cell.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/resolution_table_cell.tsx new file mode 100644 index 0000000000000..7963701b5c543 --- /dev/null +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/resolution_table_cell.tsx @@ -0,0 +1,140 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; + +import { + EuiToolTip, + EuiFlexItem, + EuiText, + EuiFlexGroup, + EuiIcon, + EuiLoadingSpinner, +} from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; + +import { useMlSnapshotContext } from './context'; + +const i18nTexts = { + upgradeInProgressText: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.mlSnapshots.upgradeInProgressText', + { + defaultMessage: 'Upgrade in progress…', + } + ), + deleteInProgressText: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.mlSnapshots.deletingButtonLabel', + { + defaultMessage: 'Deletion in progress…', + } + ), + upgradeCompleteText: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.mlSnapshots.upgradeCompleteText', + { + defaultMessage: 'Upgrade complete', + } + ), + deleteCompleteText: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.mlSnapshots.deleteCompleteText', + { + defaultMessage: 'Deletion complete', + } + ), + upgradeFailedText: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.mlSnapshots.upgradeFailedText', + { + defaultMessage: 'Upgrade failed', + } + ), + deleteFailedText: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.mlSnapshots.deleteFailedText', + { + defaultMessage: 'Deletion failed', + } + ), + resolutionText: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.mlSnapshots.resolutionText', + { + defaultMessage: 'Upgrade or delete snapshots', + } + ), + resolutionTooltipLabel: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.mlSnapshots.resolutionTooltipLabel', + { + defaultMessage: + 'Resolve this deprecation by upgrading or deleting a job model snapshot. This is an automated resolution.', + } + ), +}; + +export const MlSnapshotsResolutionCell: React.FunctionComponent = () => { + const { snapshotState } = useMlSnapshotContext(); + + if (snapshotState.status === 'in_progress') { + return ( + + + + + + + {snapshotState.action === 'delete' + ? i18nTexts.deleteInProgressText + : i18nTexts.upgradeInProgressText} + + + + ); + } + + if (snapshotState.status === 'complete') { + return ( + + + + + + + {snapshotState.action === 'delete' + ? i18nTexts.deleteCompleteText + : i18nTexts.upgradeCompleteText} + + + + ); + } + + if (snapshotState.status === 'error') { + return ( + + + + + + + {snapshotState.action === 'delete' + ? i18nTexts.deleteFailedText + : i18nTexts.upgradeFailedText} + + + + ); + } + + return ( + + + + + + + {i18nTexts.resolutionText} + + + + ); +}; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/table_row.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/table_row.tsx new file mode 100644 index 0000000000000..73921b235d88c --- /dev/null +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/table_row.tsx @@ -0,0 +1,92 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useState, useEffect, useCallback } from 'react'; +import { EuiTableRowCell } from '@elastic/eui'; +import { EnrichedDeprecationInfo, MlAction } from '../../../../../../common/types'; +import { GlobalFlyout } from '../../../../../shared_imports'; +import { useAppContext } from '../../../../app_context'; +import { DeprecationTableColumns } from '../../../types'; +import { EsDeprecationsTableCells } from '../../es_deprecations_table_cells'; +import { MlSnapshotsResolutionCell } from './resolution_table_cell'; +import { FixSnapshotsFlyout, FixSnapshotsFlyoutProps } from './flyout'; +import { MlSnapshotsStatusProvider, useMlSnapshotContext } from './context'; + +const { useGlobalFlyout } = GlobalFlyout; + +interface TableRowProps { + deprecation: EnrichedDeprecationInfo; + rowFieldNames: DeprecationTableColumns[]; +} + +export const MlSnapshotsTableRowCells: React.FunctionComponent = ({ + rowFieldNames, + deprecation, +}) => { + const [showFlyout, setShowFlyout] = useState(false); + const snapshotState = useMlSnapshotContext(); + + const { + addContent: addContentToGlobalFlyout, + removeContent: removeContentFromGlobalFlyout, + } = useGlobalFlyout(); + + const closeFlyout = useCallback(() => { + setShowFlyout(false); + removeContentFromGlobalFlyout('mlFlyout'); + }, [removeContentFromGlobalFlyout]); + + useEffect(() => { + if (showFlyout) { + addContentToGlobalFlyout({ + id: 'mlFlyout', + Component: FixSnapshotsFlyout, + props: { + deprecation, + closeFlyout, + ...snapshotState, + }, + flyoutProps: { + onClose: closeFlyout, + 'data-test-subj': 'mlSnapshotDetails', + 'aria-labelledby': 'mlSnapshotDetailsFlyoutTitle', + }, + }); + } + }, [snapshotState, addContentToGlobalFlyout, showFlyout, deprecation, closeFlyout]); + + return ( + <> + {rowFieldNames.map((field: DeprecationTableColumns) => { + return ( + + setShowFlyout(true)} + deprecation={deprecation} + resolutionTableCell={} + /> + + ); + })} + + ); +}; + +export const MlSnapshotsTableRow: React.FunctionComponent = (props) => { + const { api } = useAppContext(); + + return ( + + + + ); +}; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/ml_snapshots/use_snapshot_state.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/use_snapshot_state.tsx similarity index 94% rename from x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/ml_snapshots/use_snapshot_state.tsx rename to x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/use_snapshot_state.tsx index 2dd4638c772b3..a724922563e05 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/ml_snapshots/use_snapshot_state.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/use_snapshot_state.tsx @@ -8,16 +8,21 @@ import { useRef, useCallback, useState, useEffect } from 'react'; import { ApiService, ResponseError } from '../../../../lib/api'; +import { Status } from '../../../types'; const POLL_INTERVAL_MS = 1000; -export interface SnapshotStatus { +interface SnapshotStatus { snapshotId: string; jobId: string; - status: 'complete' | 'in_progress' | 'error' | 'idle'; + status: Status; action?: 'upgrade' | 'delete'; } +export interface SnapshotState extends SnapshotStatus { + error: ResponseError | undefined; +} + export const useSnapshotState = ({ jobId, snapshotId, diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/_index.scss b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/_index.scss similarity index 57% rename from x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/_index.scss rename to x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/_index.scss index 014edc96b0565..4cd55614ab4e6 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/_index.scss +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/_index.scss @@ -1,2 +1 @@ -@import 'button'; @import 'flyout/index'; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/context.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/context.tsx new file mode 100644 index 0000000000000..2d34253d2c426 --- /dev/null +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/context.tsx @@ -0,0 +1,61 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useEffect, createContext, useContext } from 'react'; + +import { ApiService } from '../../../../lib/api'; +import { useReindexStatus, ReindexState } from './use_reindex_state'; + +export interface ReindexStateContext { + reindexState: ReindexState; + startReindex: () => Promise; + cancelReindex: () => Promise; +} + +const ReindexContext = createContext(undefined); + +export const useReindexContext = () => { + const context = useContext(ReindexContext); + if (context === undefined) { + throw new Error('useReindexContext must be used within a '); + } + return context; +}; + +interface Props { + api: ApiService; + children: React.ReactNode; + indexName: string; +} + +export const ReindexStatusProvider: React.FunctionComponent = ({ + api, + indexName, + children, +}) => { + const { reindexState, startReindex, cancelReindex, updateStatus } = useReindexStatus({ + indexName, + api, + }); + + useEffect(() => { + updateStatus(); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + + return ( + + {children} + + ); +}; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/__snapshots__/checklist_step.test.tsx.snap b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/__snapshots__/checklist_step.test.tsx.snap similarity index 100% rename from x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/__snapshots__/checklist_step.test.tsx.snap rename to x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/__snapshots__/checklist_step.test.tsx.snap diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/__snapshots__/warning_step.test.tsx.snap b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/__snapshots__/warning_step.test.tsx.snap similarity index 100% rename from x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/__snapshots__/warning_step.test.tsx.snap rename to x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/__snapshots__/warning_step.test.tsx.snap diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/_index.scss b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/_index.scss similarity index 100% rename from x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/_index.scss rename to x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/_index.scss diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/_step_progress.scss b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/_step_progress.scss similarity index 100% rename from x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/_step_progress.scss rename to x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/_step_progress.scss diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/checklist_step.test.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/checklist_step.test.tsx similarity index 97% rename from x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/checklist_step.test.tsx rename to x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/checklist_step.test.tsx index f8d72addc2d18..a3a0f15188fca 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/checklist_step.test.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/checklist_step.test.tsx @@ -11,7 +11,7 @@ import React from 'react'; import { ReindexStatus } from '../../../../../../../common/types'; import { LoadingState } from '../../../../types'; -import { ReindexState } from '../polling_service'; +import type { ReindexState } from '../use_reindex_state'; import { ChecklistFlyoutStep } from './checklist_step'; describe('ChecklistFlyout', () => { diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/checklist_step.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/checklist_step.tsx similarity index 98% rename from x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/checklist_step.tsx rename to x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/checklist_step.tsx index e852171a696b4..856e2a57649df 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/checklist_step.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/checklist_step.tsx @@ -22,7 +22,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { ReindexStatus } from '../../../../../../../common/types'; import { LoadingState } from '../../../../types'; -import { ReindexState } from '../polling_service'; +import type { ReindexState } from '../use_reindex_state'; import { ReindexProgress } from './progress'; const buttonLabel = (status?: ReindexStatus) => { @@ -45,7 +45,7 @@ const buttonLabel = (status?: ReindexStatus) => { return ( ); case ReindexStatus.paused: diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/container.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/container.tsx new file mode 100644 index 0000000000000..f10e7b4cc687e --- /dev/null +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/container.tsx @@ -0,0 +1,142 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useState } from 'react'; +import { DocLinksStart } from 'kibana/public'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { EuiCallOut, EuiFlyoutHeader, EuiLink, EuiSpacer, EuiTitle } from '@elastic/eui'; + +import { + EnrichedDeprecationInfo, + ReindexAction, + ReindexStatus, +} from '../../../../../../../common/types'; +import { useAppContext } from '../../../../../app_context'; + +import type { ReindexStateContext } from '../context'; +import { ChecklistFlyoutStep } from './checklist_step'; +import { WarningsFlyoutStep } from './warnings_step'; + +enum ReindexFlyoutStep { + reindexWarnings, + checklist, +} + +export interface ReindexFlyoutProps extends ReindexStateContext { + deprecation: EnrichedDeprecationInfo; + closeFlyout: () => void; +} + +const getOpenAndCloseIndexDocLink = (docLinks: DocLinksStart) => ( + + {i18n.translate( + 'xpack.upgradeAssistant.checkupTab.reindexing.flyout.openAndCloseDocumentation', + { defaultMessage: 'documentation' } + )} + +); + +const getIndexClosedCallout = (docLinks: DocLinksStart) => ( + <> + +

+ + {i18n.translate( + 'xpack.upgradeAssistant.checkupTab.reindexing.flyout.indexClosedCallout.calloutDetails.reindexingTakesLongerEmphasis', + { defaultMessage: 'Reindexing may take longer than usual' } + )} + + ), + }} + /> +

+
+ + +); + +export const ReindexFlyout: React.FunctionComponent = ({ + reindexState, + startReindex, + cancelReindex, + closeFlyout, + deprecation, +}) => { + const { status, reindexWarnings } = reindexState; + const { index, correctiveAction } = deprecation; + const { docLinks } = useAppContext(); + // If there are any warnings and we haven't started reindexing, show the warnings step first. + const [currentFlyoutStep, setCurrentFlyoutStep] = useState( + reindexWarnings && reindexWarnings.length > 0 && status === undefined + ? ReindexFlyoutStep.reindexWarnings + : ReindexFlyoutStep.checklist + ); + + let flyoutContents: React.ReactNode; + + const globalCallout = + (correctiveAction as ReindexAction).blockerForReindexing === 'index-closed' && + reindexState.status !== ReindexStatus.completed + ? getIndexClosedCallout(docLinks) + : undefined; + switch (currentFlyoutStep) { + case ReindexFlyoutStep.reindexWarnings: + flyoutContents = ( + globalCallout} + closeFlyout={closeFlyout} + warnings={reindexState.reindexWarnings!} + advanceNextStep={() => setCurrentFlyoutStep(ReindexFlyoutStep.checklist)} + /> + ); + break; + case ReindexFlyoutStep.checklist: + flyoutContents = ( + globalCallout} + closeFlyout={closeFlyout} + reindexState={reindexState} + startReindex={startReindex} + cancelReindex={cancelReindex} + /> + ); + break; + default: + throw new Error(`Invalid flyout step: ${currentFlyoutStep}`); + } + + return ( + <> + + +

+ +

+
+
+ {flyoutContents} + + ); +}; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/index.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/index.tsx new file mode 100644 index 0000000000000..6b9eee80acb57 --- /dev/null +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/index.tsx @@ -0,0 +1,8 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { ReindexFlyout, ReindexFlyoutProps } from './container'; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/progress.test.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/progress.test.tsx similarity index 99% rename from x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/progress.test.tsx rename to x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/progress.test.tsx index 24a00af7a9fee..b49d816302213 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/progress.test.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/progress.test.tsx @@ -9,7 +9,7 @@ import { shallow } from 'enzyme'; import React from 'react'; import { IndexGroup, ReindexStatus, ReindexStep } from '../../../../../../../common/types'; -import { ReindexState } from '../polling_service'; +import type { ReindexState } from '../use_reindex_state'; import { ReindexProgress } from './progress'; describe('ReindexProgress', () => { diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/progress.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/progress.tsx similarity index 99% rename from x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/progress.tsx rename to x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/progress.tsx index 088266f3a4840..65a790fe96691 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/progress.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/progress.tsx @@ -19,7 +19,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { IndexGroup, ReindexStatus, ReindexStep } from '../../../../../../../common/types'; import { LoadingState } from '../../../../types'; -import { ReindexState } from '../polling_service'; +import type { ReindexState } from '../use_reindex_state'; import { StepProgress, StepProgressStep } from './step_progress'; const ErrorCallout: React.FunctionComponent<{ errorMessage: string | null }> = ({ diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/step_progress.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/step_progress.tsx similarity index 100% rename from x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/step_progress.tsx rename to x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/step_progress.tsx diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/warning_step.test.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/warning_step.test.tsx similarity index 100% rename from x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/warning_step.test.tsx rename to x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/warning_step.test.tsx diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/warning_step_checkbox.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/warning_step_checkbox.tsx similarity index 100% rename from x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/warning_step_checkbox.tsx rename to x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/warning_step_checkbox.tsx diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/warnings_step.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/warnings_step.tsx similarity index 100% rename from x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/warnings_step.tsx rename to x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/warnings_step.tsx diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/index.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/index.tsx similarity index 84% rename from x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/index.tsx rename to x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/index.tsx index 6fbb38b04bbd6..bbb1493f15bcc 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/index.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/index.tsx @@ -5,4 +5,4 @@ * 2.0. */ -export { ReindexButton } from './button'; +export { ReindexTableRow } from './table_row'; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/resolution_table_cell.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/resolution_table_cell.tsx new file mode 100644 index 0000000000000..6ea9a0277059a --- /dev/null +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/resolution_table_cell.tsx @@ -0,0 +1,158 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { i18n } from '@kbn/i18n'; + +import { + EuiIcon, + EuiLoadingSpinner, + EuiText, + EuiFlexGroup, + EuiFlexItem, + EuiToolTip, +} from '@elastic/eui'; +import { ReindexStatus } from '../../../../../../common/types'; +import { LoadingState } from '../../../types'; +import { useReindexContext } from './context'; + +const i18nTexts = { + reindexLoadingStatusText: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.reindex.reindexLoadingStatusText', + { + defaultMessage: 'Loading status…', + } + ), + reindexInProgressText: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.reindex.reindexInProgressText', + { + defaultMessage: 'Reindexing in progress…', + } + ), + reindexCompleteText: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.reindex.reindexCompleteText', + { + defaultMessage: 'Reindex complete', + } + ), + reindexFailedText: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.reindex.reindexFailedText', + { + defaultMessage: 'Reindex failed', + } + ), + reindexCanceledText: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.reindex.reindexCanceledText', + { + defaultMessage: 'Reindex canceled', + } + ), + reindexPausedText: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.reindex.reindexPausedText', + { + defaultMessage: 'Reindex paused', + } + ), + resolutionText: i18n.translate('xpack.upgradeAssistant.esDeprecations.reindex.resolutionLabel', { + defaultMessage: 'Reindex', + }), + resolutionTooltipLabel: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.reindex.resolutionTooltipLabel', + { + defaultMessage: + 'Resolve this deprecation by reindexing this index. This is an automated resolution.', + } + ), +}; + +export const ReindexResolutionCell: React.FunctionComponent = () => { + const { reindexState } = useReindexContext(); + + if (reindexState.loadingState === LoadingState.Loading) { + return ( + + + + + + {i18nTexts.reindexLoadingStatusText} + + + ); + } + + switch (reindexState.status) { + case ReindexStatus.inProgress: + return ( + + + + + + {i18nTexts.reindexInProgressText} + + + ); + case ReindexStatus.completed: + return ( + + + + + + {i18nTexts.reindexCompleteText} + + + ); + case ReindexStatus.failed: + return ( + + + + + + {i18nTexts.reindexFailedText} + + + ); + case ReindexStatus.paused: + return ( + + + + + + {i18nTexts.reindexPausedText} + + + ); + case ReindexStatus.cancelled: + return ( + + + + + + {i18nTexts.reindexCanceledText} + + + ); + } + + return ( + + + + + + + {i18nTexts.resolutionText} + + + + ); +}; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/table_row.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/table_row.tsx new file mode 100644 index 0000000000000..95d65f1e77771 --- /dev/null +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/table_row.tsx @@ -0,0 +1,104 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useState, useEffect, useCallback } from 'react'; +import { EuiTableRowCell } from '@elastic/eui'; +import { EnrichedDeprecationInfo } from '../../../../../../common/types'; +import { GlobalFlyout } from '../../../../../shared_imports'; +import { useAppContext } from '../../../../app_context'; +import { DeprecationTableColumns } from '../../../types'; +import { EsDeprecationsTableCells } from '../../es_deprecations_table_cells'; +import { ReindexResolutionCell } from './resolution_table_cell'; +import { ReindexFlyout, ReindexFlyoutProps } from './flyout'; +import { ReindexStatusProvider, useReindexContext } from './context'; + +const { useGlobalFlyout } = GlobalFlyout; + +interface TableRowProps { + deprecation: EnrichedDeprecationInfo; + rowFieldNames: DeprecationTableColumns[]; +} + +const ReindexTableRowCells: React.FunctionComponent = ({ + rowFieldNames, + deprecation, +}) => { + const [showFlyout, setShowFlyout] = useState(false); + const reindexState = useReindexContext(); + const { api } = useAppContext(); + + const { + addContent: addContentToGlobalFlyout, + removeContent: removeContentFromGlobalFlyout, + } = useGlobalFlyout(); + + const closeFlyout = useCallback(async () => { + removeContentFromGlobalFlyout('reindexFlyout'); + setShowFlyout(false); + await api.sendReindexTelemetryData({ close: true }); + }, [api, removeContentFromGlobalFlyout]); + + useEffect(() => { + if (showFlyout) { + addContentToGlobalFlyout({ + id: 'reindexFlyout', + Component: ReindexFlyout, + props: { + deprecation, + closeFlyout, + ...reindexState, + }, + flyoutProps: { + onClose: closeFlyout, + 'data-test-subj': 'reindexDetails', + 'aria-labelledby': 'reindexDetailsFlyoutTitle', + }, + }); + } + }, [addContentToGlobalFlyout, deprecation, showFlyout, reindexState, closeFlyout]); + + useEffect(() => { + if (showFlyout) { + async function sendTelemetry() { + await api.sendReindexTelemetryData({ open: true }); + } + + sendTelemetry(); + } + }, [showFlyout, api]); + + return ( + <> + {rowFieldNames.map((field: DeprecationTableColumns) => { + return ( + + setShowFlyout(true)} + deprecation={deprecation} + resolutionTableCell={} + /> + + ); + })} + + ); +}; + +export const ReindexTableRow: React.FunctionComponent = (props) => { + const { api } = useAppContext(); + + return ( + + + + ); +}; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/use_reindex_state.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/use_reindex_state.tsx new file mode 100644 index 0000000000000..b87a509d25a55 --- /dev/null +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/use_reindex_state.tsx @@ -0,0 +1,187 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { useRef, useCallback, useState, useEffect } from 'react'; + +import { + IndexGroup, + ReindexOperation, + ReindexStatus, + ReindexStep, + ReindexWarning, +} from '../../../../../../common/types'; +import { LoadingState } from '../../../types'; +import { ApiService } from '../../../../lib/api'; + +const POLL_INTERVAL = 1000; + +export interface ReindexState { + loadingState: LoadingState; + cancelLoadingState?: LoadingState; + lastCompletedStep?: ReindexStep; + status?: ReindexStatus; + reindexTaskPercComplete: number | null; + errorMessage: string | null; + reindexWarnings?: ReindexWarning[]; + hasRequiredPrivileges?: boolean; + indexGroup?: IndexGroup; +} + +interface StatusResponse { + warnings?: ReindexWarning[]; + reindexOp?: ReindexOperation; + hasRequiredPrivileges?: boolean; + indexGroup?: IndexGroup; +} + +const getReindexState = ( + reindexState: ReindexState, + { reindexOp, warnings, hasRequiredPrivileges, indexGroup }: StatusResponse +) => { + const newReindexState = { + ...reindexState, + loadingState: LoadingState.Success, + }; + + if (warnings) { + newReindexState.reindexWarnings = warnings; + } + + if (hasRequiredPrivileges !== undefined) { + newReindexState.hasRequiredPrivileges = hasRequiredPrivileges; + } + + if (indexGroup) { + newReindexState.indexGroup = indexGroup; + } + + if (reindexOp) { + // Prevent the UI flickering back to inProgress after cancelling + newReindexState.lastCompletedStep = reindexOp.lastCompletedStep; + newReindexState.status = reindexOp.status; + newReindexState.reindexTaskPercComplete = reindexOp.reindexTaskPercComplete; + newReindexState.errorMessage = reindexOp.errorMessage; + + if (reindexOp.status === ReindexStatus.cancelled) { + newReindexState.cancelLoadingState = LoadingState.Success; + } + } + + return newReindexState; +}; + +export const useReindexStatus = ({ indexName, api }: { indexName: string; api: ApiService }) => { + const [reindexState, setReindexState] = useState({ + loadingState: LoadingState.Loading, + errorMessage: null, + reindexTaskPercComplete: null, + }); + + const pollIntervalIdRef = useRef | null>(null); + const isMounted = useRef(false); + + const clearPollInterval = useCallback(() => { + if (pollIntervalIdRef.current) { + clearTimeout(pollIntervalIdRef.current); + pollIntervalIdRef.current = null; + } + }, []); + + const updateStatus = useCallback(async () => { + clearPollInterval(); + + const { data, error } = await api.getReindexStatus(indexName); + + if (error) { + setReindexState({ + ...reindexState, + loadingState: LoadingState.Error, + status: ReindexStatus.failed, + }); + return; + } + + setReindexState(getReindexState(reindexState, data)); + + // Only keep polling if it exists and is in progress. + if (data.reindexOp && data.reindexOp.status === ReindexStatus.inProgress) { + pollIntervalIdRef.current = setTimeout(updateStatus, POLL_INTERVAL); + } + }, [clearPollInterval, api, indexName, reindexState]); + + const startReindex = useCallback(async () => { + const currentReindexState = { + ...reindexState, + }; + + setReindexState({ + ...currentReindexState, + // Only reset last completed step if we aren't currently paused + lastCompletedStep: + currentReindexState.status === ReindexStatus.paused + ? currentReindexState.lastCompletedStep + : undefined, + status: ReindexStatus.inProgress, + reindexTaskPercComplete: null, + errorMessage: null, + cancelLoadingState: undefined, + }); + + api.sendReindexTelemetryData({ start: true }); + + const { data, error } = await api.startReindexTask(indexName); + + if (error) { + setReindexState({ + ...reindexState, + loadingState: LoadingState.Error, + status: ReindexStatus.failed, + }); + return; + } + + setReindexState(getReindexState(reindexState, data)); + updateStatus(); + }, [api, indexName, reindexState, updateStatus]); + + const cancelReindex = useCallback(async () => { + api.sendReindexTelemetryData({ stop: true }); + + const { error } = await api.cancelReindexTask(indexName); + + setReindexState({ + ...reindexState, + cancelLoadingState: LoadingState.Loading, + }); + + if (error) { + setReindexState({ + ...reindexState, + cancelLoadingState: LoadingState.Error, + }); + return; + } + }, [api, indexName, reindexState]); + + useEffect(() => { + isMounted.current = true; + + return () => { + isMounted.current = false; + + // Clean up on unmount. + clearPollInterval(); + }; + }, [clearPollInterval]); + + return { + reindexState, + startReindex, + cancelReindex, + updateStatus, + }; +}; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/_cell.scss b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/_cell.scss deleted file mode 100644 index e53fd9b254cf0..0000000000000 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/_cell.scss +++ /dev/null @@ -1,4 +0,0 @@ -.upgDeprecationCell { - overflow: hidden; - padding: $euiSize 0 0 $euiSizeL; -} diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/cell.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/cell.tsx deleted file mode 100644 index 4324379f456ea..0000000000000 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/cell.tsx +++ /dev/null @@ -1,146 +0,0 @@ -/* - * 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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React, { ReactNode, FunctionComponent } from 'react'; - -import { - EuiFlexGroup, - EuiFlexItem, - EuiIcon, - EuiLink, - EuiSpacer, - EuiText, - EuiTitle, -} from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; -import { - EnrichedDeprecationInfo, - MlAction, - ReindexAction, - IndexSettingAction, -} from '../../../../../common/types'; -import { AppContext } from '../../../app_context'; -import { ReindexButton } from './reindex'; -import { FixIndexSettingsButton } from './index_settings'; -import { FixMlSnapshotsButton } from './ml_snapshots'; - -interface DeprecationCellProps { - items?: Array<{ title?: string; body: string }>; - docUrl?: string; - headline?: string; - healthColor?: string; - children?: ReactNode; - correctiveAction?: EnrichedDeprecationInfo['correctiveAction']; - indexName?: string; -} - -interface CellActionProps { - correctiveAction: EnrichedDeprecationInfo['correctiveAction']; - indexName?: string; - items: Array<{ title?: string; body: string }>; -} - -const CellAction: FunctionComponent = ({ correctiveAction, indexName, items }) => { - const { type: correctiveActionType } = correctiveAction!; - switch (correctiveActionType) { - case 'mlSnapshot': - const { jobId, snapshotId } = correctiveAction as MlAction; - return ( - - ); - - case 'reindex': - const { blockerForReindexing } = correctiveAction as ReindexAction; - - return ( - - {({ http, docLinks }) => ( - - )} - - ); - - case 'indexSetting': - const { deprecatedSettings } = correctiveAction as IndexSettingAction; - - return ; - - default: - throw new Error(`No UI defined for corrective action: ${correctiveActionType}`); - } -}; - -/** - * Used to display a deprecation with links to docs, a health indicator, and other descriptive information. - */ -export const DeprecationCell: FunctionComponent = ({ - headline, - healthColor, - correctiveAction, - indexName, - docUrl, - items = [], - children, -}) => ( -
- - {healthColor && ( - - - - )} - - - {headline && ( - -

{headline}

-
- )} - - {items.map((item, index) => ( - - {item.title &&
{item.title}
} -

{item.body}

-
- ))} - - {docUrl && ( - <> - - - - - - - )} -
- - {correctiveAction && ( - - - - )} -
- - - - {children} -
-); diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/deprecation_group_item.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/deprecation_group_item.tsx deleted file mode 100644 index 66e2a5d25998b..0000000000000 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/deprecation_group_item.tsx +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ -import React, { FunctionComponent } from 'react'; -import { EuiAccordion, EuiBadge } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; - -import { EnrichedDeprecationInfo } from '../../../../../common/types'; -import { DeprecationHealth } from '../../shared'; -import { GroupByOption } from '../../types'; -import { EsDeprecationList } from './list'; -import { LEVEL_MAP } from '../../constants'; - -export interface Props { - id: string; - deprecations: EnrichedDeprecationInfo[]; - title: string; - currentGroupBy: GroupByOption; - forceExpand: boolean; - dataTestSubj: string; -} - -/** - * A single accordion item for a grouped deprecation item. - */ -export const EsDeprecationAccordion: FunctionComponent = ({ - id, - deprecations, - title, - currentGroupBy, - forceExpand, - dataTestSubj, -}) => { - const hasIndices = Boolean( - currentGroupBy === GroupByOption.message && - (deprecations as EnrichedDeprecationInfo[]).filter((d) => d.index).length - ); - const numIndices = hasIndices ? deprecations.length : null; - - return ( - - {hasIndices && ( - <> - - {numIndices}{' '} - - -   - - )} - LEVEL_MAP[d.level])} - /> - - } - > - - - ); -}; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/index_settings/button.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/index_settings/button.tsx deleted file mode 100644 index e63e26f3ecc61..0000000000000 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/index_settings/button.tsx +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; - -import { EuiButton } from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; - -import { RemoveIndexSettingsProvider } from './remove_settings_provider'; - -const i18nTexts = { - fixButtonLabel: i18n.translate('xpack.upgradeAssistant.checkupTab.indexSettings.fixButtonLabel', { - defaultMessage: 'Fix', - }), - doneButtonLabel: i18n.translate( - 'xpack.upgradeAssistant.checkupTab.indexSettings.doneButtonLabel', - { - defaultMessage: 'Done', - } - ), -}; - -interface Props { - settings: string[]; - index: string; -} - -/** - * Renders a button if the given index contains deprecated index settings - */ -export const FixIndexSettingsButton: React.FunctionComponent = ({ settings, index }) => { - return ( - - {(removeIndexSettingsPrompt, successfulRequests) => { - const isSuccessfulRequest = successfulRequests[index] === true; - return ( - removeIndexSettingsPrompt(index, settings)} - isDisabled={isSuccessfulRequest} - iconType={isSuccessfulRequest ? 'check' : undefined} - > - {isSuccessfulRequest ? i18nTexts.doneButtonLabel : i18nTexts.fixButtonLabel} - - ); - }} - - ); -}; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/index_settings/remove_settings_provider.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/index_settings/remove_settings_provider.tsx deleted file mode 100644 index 1fd0c79dbbef3..0000000000000 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/index_settings/remove_settings_provider.tsx +++ /dev/null @@ -1,131 +0,0 @@ -/* - * 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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React, { useState, useRef } from 'react'; -import { i18n } from '@kbn/i18n'; -import { EuiCode, EuiConfirmModal } from '@elastic/eui'; -import { useAppContext } from '../../../../app_context'; - -interface Props { - children: ( - removeSettingsPrompt: (index: string, settings: string[]) => void, - successfulRequests: { [key: string]: boolean } - ) => React.ReactNode; -} - -const i18nTexts = { - removeButtonLabel: i18n.translate( - 'xpack.upgradeAssistant.checkupTab.confirmationModal.removeButtonLabel', - { - defaultMessage: 'Remove', - } - ), - cancelButtonLabel: i18n.translate( - 'xpack.upgradeAssistant.checkupTab.indexSettings.confirmationModal.cancelButtonLabel', - { - defaultMessage: 'Cancel', - } - ), - modalDescription: i18n.translate( - 'xpack.upgradeAssistant.checkupTab.indexSettings.confirmationModal.description', - { - defaultMessage: 'The following deprecated index settings were detected and will be removed:', - } - ), - successNotificationText: i18n.translate( - 'xpack.upgradeAssistant.checkupTab.indexSettings.confirmationModal.successNotificationText', - { - defaultMessage: 'Index settings removed', - } - ), - errorNotificationText: i18n.translate( - 'xpack.upgradeAssistant.checkupTab.indexSettings.confirmationModal.errorNotificationText', - { - defaultMessage: 'Error removing index settings', - } - ), -}; - -export const RemoveIndexSettingsProvider = ({ children }: Props) => { - const [isModalOpen, setIsModalOpen] = useState(false); - const [successfulRequests, setSuccessfulRequests] = useState<{ [key: string]: boolean }>({}); - const [isLoading, setIsLoading] = useState(false); - - const deprecatedSettings = useRef([]); - const indexName = useRef(undefined); - - const { api, notifications } = useAppContext(); - - const removeIndexSettings = async () => { - setIsLoading(true); - - const { error } = await api.updateIndexSettings(indexName.current!, deprecatedSettings.current); - - setIsLoading(false); - closeModal(); - - if (error) { - notifications.toasts.addDanger(i18nTexts.errorNotificationText); - } else { - setSuccessfulRequests({ - [indexName.current!]: true, - }); - notifications.toasts.addSuccess(i18nTexts.successNotificationText); - } - }; - - const closeModal = () => { - setIsModalOpen(false); - }; - - const removeSettingsPrompt = (index: string, settings: string[]) => { - setIsModalOpen(true); - setSuccessfulRequests({ - [index]: false, - }); - indexName.current = index; - deprecatedSettings.current = settings; - }; - - return ( - <> - {children(removeSettingsPrompt, successfulRequests)} - - {isModalOpen && ( - - <> -

{i18nTexts.modalDescription}

-
    - {deprecatedSettings.current.map((setting, index) => ( -
  • - {setting} -
  • - ))} -
- -
- )} - - ); -}; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/index_table.test.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/index_table.test.tsx deleted file mode 100644 index f4ac573d86b11..0000000000000 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/index_table.test.tsx +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; -import { shallow } from 'enzyme'; - -import { IndexDeprecationTableProps, IndexDeprecationTable } from './index_table'; - -describe('IndexDeprecationTable', () => { - const defaultProps = { - indices: [ - { index: 'index1', details: 'Index 1 deets', correctiveAction: { type: 'reindex' } }, - { index: 'index2', details: 'Index 2 deets', correctiveAction: { type: 'reindex' } }, - { index: 'index3', details: 'Index 3 deets', correctiveAction: { type: 'reindex' } }, - ], - } as IndexDeprecationTableProps; - - // Relying pretty heavily on EUI to implement the table functionality correctly. - // This test simply verifies that the props passed to EuiBaseTable are the ones - // expected. - test('render', () => { - expect(shallow()).toMatchInlineSnapshot(` - - `); - }); -}); diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/index_table.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/index_table.tsx deleted file mode 100644 index 6b0f94ea24bc7..0000000000000 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/index_table.tsx +++ /dev/null @@ -1,200 +0,0 @@ -/* - * 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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { sortBy } from 'lodash'; -import React from 'react'; - -import { EuiBasicTable } from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; -import { - EnrichedDeprecationInfo, - IndexSettingAction, - ReindexAction, -} from '../../../../../common/types'; -import { AppContext } from '../../../app_context'; -import { ReindexButton } from './reindex'; -import { FixIndexSettingsButton } from './index_settings'; - -const PAGE_SIZES = [10, 25, 50, 100, 250, 500, 1000]; - -export interface IndexDeprecationDetails { - index: string; - correctiveAction?: EnrichedDeprecationInfo['correctiveAction']; - details?: string; -} - -export interface IndexDeprecationTableProps { - indices: IndexDeprecationDetails[]; -} - -interface IndexDeprecationTableState { - sortField: string; - sortDirection: 'asc' | 'desc'; - pageIndex: number; - pageSize: number; -} - -export class IndexDeprecationTable extends React.Component< - IndexDeprecationTableProps, - IndexDeprecationTableState -> { - constructor(props: IndexDeprecationTableProps) { - super(props); - - this.state = { - sortField: 'index', - sortDirection: 'asc', - pageIndex: 0, - pageSize: 10, - }; - } - - public render() { - const { pageIndex, pageSize, sortField, sortDirection } = this.state; - - const columns = [ - { - field: 'index', - name: i18n.translate( - 'xpack.upgradeAssistant.checkupTab.deprecations.indexTable.indexColumnLabel', - { - defaultMessage: 'Index', - } - ), - sortable: true, - }, - { - field: 'details', - name: i18n.translate( - 'xpack.upgradeAssistant.checkupTab.deprecations.indexTable.detailsColumnLabel', - { - defaultMessage: 'Details', - } - ), - }, - ]; - - const actionsColumn = this.generateActionsColumn(); - - if (actionsColumn) { - columns.push(actionsColumn as any); - } - - const sorting = { - sort: { field: sortField as keyof IndexDeprecationDetails, direction: sortDirection }, - }; - const pagination = { - pageIndex, - pageSize, - ...this.pageSizeOptions(), - }; - - return ( - { - return { - 'data-test-subj': `indexTableRow-${indexDetails.index}`, - }; - }} - /> - ); - } - - private getRows() { - const { sortField, sortDirection, pageIndex, pageSize } = this.state; - const { indices } = this.props; - - let sorted = sortBy(indices, sortField); - if (sortDirection === 'desc') { - sorted = sorted.reverse(); - } - - const start = pageIndex * pageSize; - return sorted.slice(start, start + pageSize); - } - - private onTableChange = (tableProps: any) => { - this.setState({ - sortField: tableProps.sort.field, - sortDirection: tableProps.sort.direction, - pageIndex: tableProps.page.index, - pageSize: tableProps.page.size, - }); - }; - - private pageSizeOptions() { - const { indices } = this.props; - const totalItemCount = indices.length; - - // If we only have that smallest page size, don't show any page size options. - if (totalItemCount <= PAGE_SIZES[0]) { - return { totalItemCount, pageSizeOptions: [], hidePerPageOptions: true }; - } - - // Keep a size option if the # of items is larger than the previous option. - // This avoids having a long list of useless page sizes. - const pageSizeOptions = PAGE_SIZES.filter((perPage, idx) => { - return idx === 0 || totalItemCount > PAGE_SIZES[idx - 1]; - }); - - return { totalItemCount, pageSizeOptions, hidePerPageOptions: false }; - } - - private generateActionsColumn() { - // NOTE: this naive implementation assumes all indices in the table - // should show the reindex button or fix indices button. This should work for known use cases. - const { indices } = this.props; - const showReindexButton = Boolean(indices.find((i) => i.correctiveAction?.type === 'reindex')); - const showFixSettingsButton = Boolean( - indices.find((i) => i.correctiveAction?.type === 'indexSetting') - ); - - if (showReindexButton === false && showFixSettingsButton === false) { - return null; - } - - return { - actions: [ - { - render(indexDep: IndexDeprecationDetails) { - if (showReindexButton) { - return ( - - {({ http, docLinks }) => { - return ( - - ); - }} - - ); - } - - return ( - - ); - }, - }, - ], - }; - } -} diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/list.test.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/list.test.tsx deleted file mode 100644 index 2bfa8119e41bc..0000000000000 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/list.test.tsx +++ /dev/null @@ -1,129 +0,0 @@ -/* - * 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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { shallow } from 'enzyme'; -import React from 'react'; - -import { EnrichedDeprecationInfo } from '../../../../../common/types'; -import { GroupByOption } from '../../types'; -import { EsDeprecationList } from './list'; - -describe('EsDeprecationList', () => { - describe('group by message', () => { - const defaultProps = { - deprecations: [ - { message: 'Issue 1', url: '', level: 'warning' }, - { message: 'Issue 1', url: '', level: 'warning' }, - ] as EnrichedDeprecationInfo[], - currentGroupBy: GroupByOption.message, - }; - - test('shows simple messages when index field is not present', () => { - expect(shallow()).toMatchInlineSnapshot(` -
- - -
- `); - }); - - test('shows index deprecation when index field is present', () => { - // Add index fields to deprecation items - const props = { - ...defaultProps, - deprecations: defaultProps.deprecations.map((d, index) => ({ - ...d, - index: index.toString(), - })), - }; - const wrapper = shallow(); - expect(wrapper).toMatchInlineSnapshot(` - - `); - }); - }); - - describe('group by index', () => { - const defaultProps = { - deprecations: [ - { message: 'Issue 1', index: 'index1', url: '', level: 'warning' }, - { message: 'Issue 2', index: 'index1', url: '', level: 'warning' }, - ] as EnrichedDeprecationInfo[], - currentGroupBy: GroupByOption.index, - }; - - test('shows detailed messages', () => { - expect(shallow()).toMatchInlineSnapshot(` -
- - -
- `); - }); - }); -}); diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/list.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/list.tsx deleted file mode 100644 index 7b543a7e94b33..0000000000000 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/list.tsx +++ /dev/null @@ -1,120 +0,0 @@ -/* - * 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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React, { FunctionComponent } from 'react'; - -import { DeprecationInfo, EnrichedDeprecationInfo } from '../../../../../common/types'; -import { GroupByOption } from '../../types'; - -import { COLOR_MAP, LEVEL_MAP } from '../../constants'; -import { DeprecationCell } from './cell'; -import { IndexDeprecationDetails, IndexDeprecationTable } from './index_table'; - -const sortByLevelDesc = (a: DeprecationInfo, b: DeprecationInfo) => { - return -1 * (LEVEL_MAP[a.level] - LEVEL_MAP[b.level]); -}; - -/** - * Used to show a single deprecation message with any detailed information. - */ -const MessageDeprecation: FunctionComponent<{ - deprecation: EnrichedDeprecationInfo; -}> = ({ deprecation }) => { - const items = []; - - if (deprecation.details) { - items.push({ body: deprecation.details }); - } - - return ( - - ); -}; - -/** - * Used to show a single (simple) deprecation message with any detailed information. - */ -const SimpleMessageDeprecation: FunctionComponent<{ deprecation: EnrichedDeprecationInfo }> = ({ - deprecation, -}) => { - const items = []; - - if (deprecation.details) { - items.push({ body: deprecation.details }); - } - - return ( - - ); -}; - -interface IndexDeprecationProps { - deprecation: EnrichedDeprecationInfo; - indices: IndexDeprecationDetails[]; -} - -/** - * Shows a single deprecation and table of affected indices with details for each index. - */ -const IndexDeprecation: FunctionComponent = ({ deprecation, indices }) => { - return ( - - - - ); -}; - -/** - * A list of deprecations that is either shown as individual deprecation cells or as a - * deprecation summary for a list of indices. - */ -export const EsDeprecationList: FunctionComponent<{ - deprecations: EnrichedDeprecationInfo[]; - currentGroupBy: GroupByOption; -}> = ({ deprecations, currentGroupBy }) => { - // If we're grouping by message and the first deprecation has an index field, show an index - // group deprecation. Otherwise, show each message. - if (currentGroupBy === GroupByOption.message && deprecations[0].index !== undefined) { - // We assume that every deprecation message is the same issue (since they have the same - // message) and that each deprecation will have an index associated with it. - - const indices = deprecations.map((dep) => ({ - index: dep.index!, - details: dep.details, - correctiveAction: dep.correctiveAction, - })); - return ; - } else if (currentGroupBy === GroupByOption.index) { - return ( -
- {deprecations.sort(sortByLevelDesc).map((dep, index) => ( - - ))} -
- ); - } else { - return ( -
- {deprecations.sort(sortByLevelDesc).map((dep, index) => ( - - ))} -
- ); - } -}; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/ml_snapshots/button.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/ml_snapshots/button.tsx deleted file mode 100644 index 13b7dacc3b598..0000000000000 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/ml_snapshots/button.tsx +++ /dev/null @@ -1,125 +0,0 @@ -/* - * 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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React, { useEffect, useState } from 'react'; - -import { ButtonSize, EuiButton } from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; - -import { FixSnapshotsFlyout } from './fix_snapshots_flyout'; -import { useAppContext } from '../../../../app_context'; -import { useSnapshotState } from './use_snapshot_state'; - -const i18nTexts = { - fixButtonLabel: i18n.translate( - 'xpack.upgradeAssistant.esDeprecations.mlSnapshots.fixButtonLabel', - { - defaultMessage: 'Fix', - } - ), - upgradingButtonLabel: i18n.translate( - 'xpack.upgradeAssistant.esDeprecations.mlSnapshots.upgradingButtonLabel', - { - defaultMessage: 'Upgrading…', - } - ), - deletingButtonLabel: i18n.translate( - 'xpack.upgradeAssistant.esDeprecations.mlSnapshots.deletingButtonLabel', - { - defaultMessage: 'Deleting…', - } - ), - doneButtonLabel: i18n.translate( - 'xpack.upgradeAssistant.esDeprecations.mlSnapshots.doneButtonLabel', - { - defaultMessage: 'Done', - } - ), - failedButtonLabel: i18n.translate( - 'xpack.upgradeAssistant.esDeprecations.mlSnapshots.failedButtonLabel', - { - defaultMessage: 'Failed', - } - ), -}; - -interface Props { - snapshotId: string; - jobId: string; - description: string; -} - -export const FixMlSnapshotsButton: React.FunctionComponent = ({ - snapshotId, - jobId, - description, -}) => { - const { api } = useAppContext(); - const { snapshotState, upgradeSnapshot, deleteSnapshot, updateSnapshotStatus } = useSnapshotState( - { - jobId, - snapshotId, - api, - } - ); - - const [showFlyout, setShowFlyout] = useState(false); - - useEffect(() => { - updateSnapshotStatus(); - }, [updateSnapshotStatus]); - - const commonButtonProps = { - size: 's' as ButtonSize, - onClick: () => setShowFlyout(true), - 'data-test-subj': 'fixMlSnapshotsButton', - }; - - let button = {i18nTexts.fixButtonLabel}; - - switch (snapshotState.status) { - case 'in_progress': - button = ( - - {snapshotState.action === 'delete' - ? i18nTexts.deletingButtonLabel - : i18nTexts.upgradingButtonLabel} - - ); - break; - case 'complete': - button = ( - - {i18nTexts.doneButtonLabel} - - ); - break; - case 'error': - button = ( - - {i18nTexts.failedButtonLabel} - - ); - break; - } - - return ( - <> - {button} - - {showFlyout && ( - setShowFlyout(false)} - /> - )} - - ); -}; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/_button.scss b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/_button.scss deleted file mode 100644 index f12149f9e88cb..0000000000000 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/_button.scss +++ /dev/null @@ -1,5 +0,0 @@ -.upgReindexButton__spinner { - position: relative; - top: $euiSizeXS / 2; - margin-right: $euiSizeXS; -} diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/button.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/button.tsx deleted file mode 100644 index 646f253931664..0000000000000 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/button.tsx +++ /dev/null @@ -1,244 +0,0 @@ -/* - * 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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { set } from '@elastic/safer-lodash-set'; -import React, { Fragment, ReactNode } from 'react'; -import { i18n } from '@kbn/i18n'; -import { Subscription } from 'rxjs'; - -import { EuiButton, EuiLoadingSpinner, EuiText, EuiToolTip } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; -import { DocLinksStart, HttpSetup } from 'src/core/public'; -import { API_BASE_PATH } from '../../../../../../common/constants'; -import { ReindexAction, ReindexStatus, UIReindexOption } from '../../../../../../common/types'; -import { LoadingState } from '../../../types'; -import { ReindexFlyout } from './flyout'; -import { ReindexPollingService, ReindexState } from './polling_service'; - -interface ReindexButtonProps { - indexName: string; - http: HttpSetup; - docLinks: DocLinksStart; - reindexBlocker?: ReindexAction['blockerForReindexing']; -} - -interface ReindexButtonState { - flyoutVisible: boolean; - reindexState: ReindexState; -} - -/** - * Displays a button that will display a flyout when clicked with the reindexing status for - * the given `indexName`. - */ -export class ReindexButton extends React.Component { - private service: ReindexPollingService; - private subscription?: Subscription; - - constructor(props: ReindexButtonProps) { - super(props); - - this.service = this.newService(); - this.state = { - flyoutVisible: false, - reindexState: this.service.status$.value, - }; - } - - public async componentDidMount() { - this.subscribeToUpdates(); - } - - public async componentWillUnmount() { - this.unsubscribeToUpdates(); - } - - public componentDidUpdate(prevProps: ReindexButtonProps) { - if (prevProps.indexName !== this.props.indexName) { - this.unsubscribeToUpdates(); - this.service = this.newService(); - this.subscribeToUpdates(); - } - } - - public render() { - const { indexName, reindexBlocker, docLinks } = this.props; - const { flyoutVisible, reindexState } = this.state; - - const buttonProps: any = { size: 's', onClick: this.showFlyout }; - let buttonContent: ReactNode = ( - - ); - - if (reindexState.loadingState === LoadingState.Loading) { - buttonProps.disabled = true; - buttonContent = ( - - ); - } else { - switch (reindexState.status) { - case ReindexStatus.inProgress: - buttonContent = ( - - Reindexing… - - ); - break; - case ReindexStatus.completed: - buttonProps.color = 'secondary'; - buttonProps.iconSide = 'left'; - buttonProps.iconType = 'check'; - buttonContent = ( - - ); - break; - case ReindexStatus.failed: - buttonProps.color = 'danger'; - buttonProps.iconSide = 'left'; - buttonProps.iconType = 'cross'; - buttonContent = ( - - ); - break; - case ReindexStatus.paused: - buttonProps.color = 'warning'; - buttonProps.iconSide = 'left'; - buttonProps.iconType = 'pause'; - buttonContent = ( - - ); - case ReindexStatus.cancelled: - buttonProps.color = 'danger'; - buttonProps.iconSide = 'left'; - buttonProps.iconType = 'cross'; - buttonContent = ( - - ); - break; - } - } - - const showIndexedClosedWarning = - reindexBlocker === 'index-closed' && reindexState.status !== ReindexStatus.completed; - - if (showIndexedClosedWarning) { - buttonProps.color = 'warning'; - buttonProps.iconType = 'alert'; - } - - const button = {buttonContent}; - - return ( - - {showIndexedClosedWarning ? ( - - {i18n.translate( - 'xpack.upgradeAssistant.checkupTab.reindexing.reindexButton.indexClosedToolTipDetails', - { - defaultMessage: - '"{indexName}" needs to be reindexed, but it is currently closed. The Upgrade Assistant will open, reindex and then close the index. Reindexing may take longer than usual.', - values: { indexName }, - } - )} - - } - > - {button} - - ) : ( - button - )} - - {flyoutVisible && ( - - )} - - ); - } - - private newService() { - const { indexName, http } = this.props; - return new ReindexPollingService(indexName, http); - } - - private subscribeToUpdates() { - this.service.updateStatus(); - this.subscription = this.service!.status$.subscribe((reindexState) => - this.setState({ reindexState }) - ); - } - - private unsubscribeToUpdates() { - if (this.subscription) { - this.subscription.unsubscribe(); - delete this.subscription; - } - - if (this.service) { - this.service.stopPolling(); - } - } - - private startReindex = async () => { - if (!this.state.reindexState.status) { - // if status didn't exist we are starting a reindex action - this.sendUIReindexTelemetryInfo('start'); - } - - await this.service.startReindex(); - }; - - private cancelReindex = async () => { - this.sendUIReindexTelemetryInfo('stop'); - await this.service.cancelReindex(); - }; - - private showFlyout = () => { - this.sendUIReindexTelemetryInfo('open'); - this.setState({ flyoutVisible: true }); - }; - - private closeFlyout = () => { - this.sendUIReindexTelemetryInfo('close'); - this.setState({ flyoutVisible: false }); - }; - - private async sendUIReindexTelemetryInfo(uiReindexAction: UIReindexOption) { - await this.props.http.put(`${API_BASE_PATH}/stats/ui_reindex`, { - body: JSON.stringify(set({}, uiReindexAction, true)), - }); - } -} diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/container.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/container.tsx deleted file mode 100644 index 97031dd08ee2a..0000000000000 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/flyout/container.tsx +++ /dev/null @@ -1,172 +0,0 @@ -/* - * 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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; -import { DocLinksStart } from 'kibana/public'; -import { i18n } from '@kbn/i18n'; -import { FormattedMessage } from '@kbn/i18n/react'; -import { - EuiCallOut, - EuiFlyout, - EuiFlyoutHeader, - EuiLink, - EuiPortal, - EuiSpacer, - EuiTitle, -} from '@elastic/eui'; - -import { ReindexAction, ReindexStatus } from '../../../../../../../common/types'; - -import { ReindexState } from '../polling_service'; -import { ChecklistFlyoutStep } from './checklist_step'; -import { WarningsFlyoutStep } from './warnings_step'; - -enum ReindexFlyoutStep { - reindexWarnings, - checklist, -} - -interface ReindexFlyoutProps { - indexName: string; - closeFlyout: () => void; - reindexState: ReindexState; - startReindex: () => void; - cancelReindex: () => void; - docLinks: DocLinksStart; - reindexBlocker?: ReindexAction['blockerForReindexing']; -} - -interface ReindexFlyoutState { - currentFlyoutStep: ReindexFlyoutStep; -} - -const getOpenAndCloseIndexDocLink = (docLinks: DocLinksStart) => ( - - {i18n.translate( - 'xpack.upgradeAssistant.checkupTab.reindexing.flyout.openAndCloseDocumentation', - { defaultMessage: 'documentation' } - )} - -); - -const getIndexClosedCallout = (docLinks: DocLinksStart) => ( - <> - -

- - {i18n.translate( - 'xpack.upgradeAssistant.checkupTab.reindexing.flyout.indexClosedCallout.calloutDetails.reindexingTakesLongerEmphasis', - { defaultMessage: 'Reindexing may take longer than usual' } - )} - - ), - }} - /> -

-
- - -); - -/** - * Wrapper for the contents of the flyout that manages which step of the flyout to show. - */ -export class ReindexFlyout extends React.Component { - constructor(props: ReindexFlyoutProps) { - super(props); - const { status, reindexWarnings } = props.reindexState; - - this.state = { - // If there are any warnings and we haven't started reindexing, show the warnings step first. - currentFlyoutStep: - reindexWarnings && reindexWarnings.length > 0 && status === undefined - ? ReindexFlyoutStep.reindexWarnings - : ReindexFlyoutStep.checklist, - }; - } - - public render() { - const { - closeFlyout, - indexName, - reindexState, - startReindex, - cancelReindex, - reindexBlocker, - docLinks, - } = this.props; - const { currentFlyoutStep } = this.state; - - let flyoutContents: React.ReactNode; - - const globalCallout = - reindexBlocker === 'index-closed' && reindexState.status !== ReindexStatus.completed - ? getIndexClosedCallout(docLinks) - : undefined; - switch (currentFlyoutStep) { - case ReindexFlyoutStep.reindexWarnings: - flyoutContents = ( - globalCallout} - closeFlyout={closeFlyout} - warnings={reindexState.reindexWarnings!} - advanceNextStep={this.advanceNextStep} - /> - ); - break; - case ReindexFlyoutStep.checklist: - flyoutContents = ( - globalCallout} - closeFlyout={closeFlyout} - reindexState={reindexState} - startReindex={startReindex} - cancelReindex={cancelReindex} - /> - ); - break; - default: - throw new Error(`Invalid flyout step: ${currentFlyoutStep}`); - } - - return ( - - - - -

- -

-
-
- {flyoutContents} -
-
- ); - } - - public advanceNextStep = () => { - this.setState({ currentFlyoutStep: ReindexFlyoutStep.checklist }); - }; -} diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/polling_service.test.ts b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/polling_service.test.ts deleted file mode 100644 index 13818e864783e..0000000000000 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/polling_service.test.ts +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { ReindexStatus, ReindexStep } from '../../../../../../common/types'; -import { ReindexPollingService } from './polling_service'; -import { httpServiceMock } from 'src/core/public/mocks'; - -const mockClient = httpServiceMock.createSetupContract(); - -describe('ReindexPollingService', () => { - beforeEach(() => { - mockClient.post.mockReset(); - mockClient.get.mockReset(); - }); - - it('does not poll when reindexOp is null', async () => { - mockClient.get.mockResolvedValueOnce({ - warnings: [], - reindexOp: null, - }); - - const service = new ReindexPollingService('myIndex', mockClient); - service.updateStatus(); - await new Promise((resolve) => setTimeout(resolve, 1200)); // wait for poll interval - - expect(mockClient.get).toHaveBeenCalledTimes(1); - service.stopPolling(); - }); - - it('does not poll when first check is a 200 and status is failed', async () => { - mockClient.get.mockResolvedValue({ - warnings: [], - reindexOp: { - lastCompletedStep: ReindexStep.created, - status: ReindexStatus.failed, - errorMessage: `Oh no!`, - }, - }); - - const service = new ReindexPollingService('myIndex', mockClient); - service.updateStatus(); - await new Promise((resolve) => setTimeout(resolve, 1200)); // wait for poll interval - - expect(mockClient.get).toHaveBeenCalledTimes(1); - expect(service.status$.value.errorMessage).toEqual(`Oh no!`); - service.stopPolling(); - }); - - it('begins to poll when first check is a 200 and status is inProgress', async () => { - mockClient.get.mockResolvedValue({ - warnings: [], - reindexOp: { - lastCompletedStep: ReindexStep.created, - status: ReindexStatus.inProgress, - }, - }); - - const service = new ReindexPollingService('myIndex', mockClient); - service.updateStatus(); - await new Promise((resolve) => setTimeout(resolve, 1200)); // wait for poll interval - - expect(mockClient.get).toHaveBeenCalledTimes(2); - service.stopPolling(); - }); - - describe('startReindex', () => { - it('posts to endpoint', async () => { - const service = new ReindexPollingService('myIndex', mockClient); - await service.startReindex(); - - expect(mockClient.post).toHaveBeenCalledWith('/api/upgrade_assistant/reindex/myIndex'); - }); - }); - - describe('cancelReindex', () => { - it('posts to cancel endpoint', async () => { - const service = new ReindexPollingService('myIndex', mockClient); - await service.cancelReindex(); - - expect(mockClient.post).toHaveBeenCalledWith('/api/upgrade_assistant/reindex/myIndex/cancel'); - }); - }); -}); diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/polling_service.ts b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/polling_service.ts deleted file mode 100644 index 239bd56bd2fa5..0000000000000 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecations/reindex/polling_service.ts +++ /dev/null @@ -1,169 +0,0 @@ -/* - * 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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { BehaviorSubject } from 'rxjs'; - -import { HttpSetup } from 'src/core/public'; -import { API_BASE_PATH } from '../../../../../../common/constants'; -import { - IndexGroup, - ReindexOperation, - ReindexStatus, - ReindexStep, - ReindexWarning, -} from '../../../../../../common/types'; -import { LoadingState } from '../../../types'; - -const POLL_INTERVAL = 1000; - -export interface ReindexState { - loadingState: LoadingState; - cancelLoadingState?: LoadingState; - lastCompletedStep?: ReindexStep; - status?: ReindexStatus; - reindexTaskPercComplete: number | null; - errorMessage: string | null; - reindexWarnings?: ReindexWarning[]; - hasRequiredPrivileges?: boolean; - indexGroup?: IndexGroup; -} - -interface StatusResponse { - warnings?: ReindexWarning[]; - reindexOp?: ReindexOperation; - hasRequiredPrivileges?: boolean; - indexGroup?: IndexGroup; -} - -/** - * Service used by the frontend to start reindexing and get updates on the state of a reindex - * operation. Exposes an Observable that can be used to subscribe to state updates. - */ -export class ReindexPollingService { - public status$: BehaviorSubject; - private pollTimeout?: NodeJS.Timeout; - - constructor(private indexName: string, private http: HttpSetup) { - this.status$ = new BehaviorSubject({ - loadingState: LoadingState.Loading, - errorMessage: null, - reindexTaskPercComplete: null, - }); - } - - public updateStatus = async () => { - // Prevent two loops from being started. - this.stopPolling(); - - try { - const data = await this.http.get( - `${API_BASE_PATH}/reindex/${this.indexName}` - ); - this.updateWithResponse(data); - - // Only keep polling if it exists and is in progress. - if (data.reindexOp && data.reindexOp.status === ReindexStatus.inProgress) { - this.pollTimeout = setTimeout(this.updateStatus, POLL_INTERVAL); - } - } catch (e) { - this.status$.next({ - ...this.status$.value, - status: ReindexStatus.failed, - }); - } - }; - - public stopPolling = () => { - if (this.pollTimeout) { - clearTimeout(this.pollTimeout); - } - }; - - public startReindex = async () => { - try { - // Optimistically assume it will start, reset other state. - const currentValue = this.status$.value; - this.status$.next({ - ...currentValue, - // Only reset last completed step if we aren't currently paused - lastCompletedStep: - currentValue.status === ReindexStatus.paused ? currentValue.lastCompletedStep : undefined, - status: ReindexStatus.inProgress, - reindexTaskPercComplete: null, - errorMessage: null, - cancelLoadingState: undefined, - }); - - const data = await this.http.post( - `${API_BASE_PATH}/reindex/${this.indexName}` - ); - - this.updateWithResponse({ reindexOp: data }); - this.updateStatus(); - } catch (e) { - this.status$.next({ ...this.status$.value, status: ReindexStatus.failed }); - } - }; - - public cancelReindex = async () => { - try { - this.status$.next({ - ...this.status$.value, - cancelLoadingState: LoadingState.Loading, - }); - - await this.http.post(`${API_BASE_PATH}/reindex/${this.indexName}/cancel`); - } catch (e) { - this.status$.next({ - ...this.status$.value, - cancelLoadingState: LoadingState.Error, - }); - } - }; - - private updateWithResponse = ({ - reindexOp, - warnings, - hasRequiredPrivileges, - indexGroup, - }: StatusResponse) => { - const currentValue = this.status$.value; - // Next value should always include the entire state, not just what changes. - // We make a shallow copy as a starting new state. - const nextValue = { - ...currentValue, - // If we're getting any updates, set to success. - loadingState: LoadingState.Success, - }; - - if (warnings) { - nextValue.reindexWarnings = warnings; - } - - if (hasRequiredPrivileges !== undefined) { - nextValue.hasRequiredPrivileges = hasRequiredPrivileges; - } - - if (indexGroup) { - nextValue.indexGroup = indexGroup; - } - - if (reindexOp) { - // Prevent the UI flickering back to inProgres after cancelling. - nextValue.lastCompletedStep = reindexOp.lastCompletedStep; - nextValue.status = reindexOp.status; - nextValue.reindexTaskPercComplete = reindexOp.reindexTaskPercComplete; - nextValue.errorMessage = reindexOp.errorMessage; - - if (reindexOp.status === ReindexStatus.cancelled) { - nextValue.cancelLoadingState = LoadingState.Success; - } - } - - this.status$.next(nextValue); - }; -} diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/es_deprecation_errors.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/es_deprecation_errors.tsx index 239433808c5af..5e3c7a5fe6cef 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/es_deprecation_errors.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/es_deprecation_errors.tsx @@ -10,7 +10,7 @@ import React from 'react'; import { EuiCallOut } from '@elastic/eui'; import { ResponseError } from '../../lib/api'; -import { getEsDeprecationError } from '../../lib/es_deprecation_errors'; +import { getEsDeprecationError } from '../../lib/get_es_deprecation_error'; interface Props { error: ResponseError; } diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/es_deprecations.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/es_deprecations.tsx index 4fc4d691c4038..38367bd3cfaff 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/es_deprecations.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/es_deprecations.tsx @@ -5,204 +5,88 @@ * 2.0. */ -import React, { useMemo, useEffect, useState } from 'react'; +import React, { useEffect } from 'react'; import { withRouter, RouteComponentProps } from 'react-router-dom'; -import { - EuiButton, - EuiButtonEmpty, - EuiPageHeader, - EuiTabbedContent, - EuiTabbedContentTab, - EuiToolTip, - EuiNotificationBadge, - EuiSpacer, -} from '@elastic/eui'; +import { EuiPageHeader, EuiSpacer, EuiPageContent } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; +import { SectionLoading } from '../../../shared_imports'; import { useAppContext } from '../../app_context'; -import { UpgradeAssistantTabProps, EsTabs, TelemetryState } from '../types'; -import { DeprecationTabContent } from './deprecation_tab_content'; +import { EsDeprecationsTable } from './es_deprecations_table'; +import { EsDeprecationErrors } from './es_deprecation_errors'; +import { NoDeprecationsPrompt } from '../shared'; const i18nTexts = { pageTitle: i18n.translate('xpack.upgradeAssistant.esDeprecations.pageTitle', { - defaultMessage: 'Elasticsearch', + defaultMessage: 'Elasticsearch deprecation warnings', }), pageDescription: i18n.translate('xpack.upgradeAssistant.esDeprecations.pageDescription', { defaultMessage: - 'Review the deprecated cluster and index settings. You must resolve any critical issues before upgrading.', + 'You must resolve all critical issues before upgrading. Back up recommended. Make sure you have a current snapshot before modifying your configuration or reindexing.', }), - docLinkText: i18n.translate('xpack.upgradeAssistant.esDeprecations.docLinkText', { - defaultMessage: 'Documentation', + isLoading: i18n.translate('xpack.upgradeAssistant.esDeprecations.loadingText', { + defaultMessage: 'Loading deprecations…', }), - backupDataButton: { - label: i18n.translate('xpack.upgradeAssistant.esDeprecations.backupDataButtonLabel', { - defaultMessage: 'Back up your data', - }), - tooltipText: i18n.translate('xpack.upgradeAssistant.esDeprecations.backupDataTooltipText', { - defaultMessage: 'Take a snapshot before you make any changes.', - }), - }, - clusterTab: { - tabName: i18n.translate('xpack.upgradeAssistant.esDeprecations.clusterTabLabel', { - defaultMessage: 'Cluster', - }), - deprecationType: i18n.translate('xpack.upgradeAssistant.esDeprecations.clusterLabel', { - defaultMessage: 'cluster', - }), - }, - indicesTab: { - tabName: i18n.translate('xpack.upgradeAssistant.esDeprecations.indicesTabLabel', { - defaultMessage: 'Indices', - }), - deprecationType: i18n.translate('xpack.upgradeAssistant.esDeprecations.indexLabel', { - defaultMessage: 'index', - }), - }, }; -interface MatchParams { - tabName: EsTabs; -} - -export const EsDeprecationsContent = withRouter( - ({ - match: { - params: { tabName }, - }, - history, - }: RouteComponentProps) => { - const [telemetryState, setTelemetryState] = useState(TelemetryState.Complete); - - const { api, breadcrumbs, getUrlForApp, docLinks } = useAppContext(); - - const { data: checkupData, isLoading, error, resendRequest } = api.useLoadUpgradeStatus(); - - const onTabClick = (selectedTab: EuiTabbedContentTab) => { - history.push(`/es_deprecations/${selectedTab.id}`); - }; - - const tabs = useMemo(() => { - const commonTabProps: UpgradeAssistantTabProps = { - error, - isLoading, - refreshCheckupData: resendRequest, - navigateToOverviewPage: () => history.push('/overview'), - }; - - return [ - { - id: 'cluster', - 'data-test-subj': 'upgradeAssistantClusterTab', - name: ( - - {i18nTexts.clusterTab.tabName} - {checkupData && checkupData.cluster.length > 0 && ( - <> - {' '} - {checkupData.cluster.length} - - )} - - ), - content: ( - - ), - }, - { - id: 'indices', - 'data-test-subj': 'upgradeAssistantIndicesTab', - name: ( - - {i18nTexts.indicesTab.tabName} - {checkupData && checkupData.indices.length > 0 && ( - <> - {' '} - {checkupData.indices.length} - - )} - - ), - content: ( - - ), - }, - ]; - }, [checkupData, error, history, isLoading, resendRequest]); - - useEffect(() => { - breadcrumbs.setBreadcrumbs('esDeprecations'); - }, [breadcrumbs]); - - useEffect(() => { - if (isLoading === false) { - setTelemetryState(TelemetryState.Running); +export const EsDeprecations = withRouter(({ history }: RouteComponentProps) => { + const { api, breadcrumbs } = useAppContext(); + + const { + data: esDeprecations, + isLoading, + error, + resendRequest, + isInitialRequest, + } = api.useLoadEsDeprecations(); + + useEffect(() => { + breadcrumbs.setBreadcrumbs('esDeprecations'); + }, [breadcrumbs]); + + useEffect(() => { + if (isLoading === false && isInitialRequest) { + async function sendTelemetryData() { + await api.sendPageTelemetryData({ + elasticsearch: true, + }); + } - async function sendTelemetryData() { - await api.sendTelemetryData({ - [tabName]: true, - }); - setTelemetryState(TelemetryState.Complete); - } + sendTelemetryData(); + } + }, [api, isLoading, isInitialRequest]); - sendTelemetryData(); - } - }, [api, tabName, isLoading]); + if (error) { + return ; + } + if (isLoading) { return ( - <> - - {i18nTexts.docLinkText} - , - ]} - > - - - {i18nTexts.backupDataButton.label} - - - - - + + {i18nTexts.isLoading} + + ); + } - tab.id === tabName)} + if (esDeprecations?.deprecations?.length === 0) { + return ( + + history.push('/overview')} /> - + ); } -); + + return ( +
+ + + + + +
+ ); +}); diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/es_deprecations_table.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/es_deprecations_table.tsx new file mode 100644 index 0000000000000..5f742a3c63ae6 --- /dev/null +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/es_deprecations_table.tsx @@ -0,0 +1,316 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useState, useEffect, useCallback, useMemo } from 'react'; +import { i18n } from '@kbn/i18n'; +import { sortBy } from 'lodash'; +import { + EuiButton, + EuiFlexGroup, + EuiTable, + EuiTableRow, + EuiTableHeaderCell, + EuiTableHeader, + EuiSearchBar, + EuiSpacer, + EuiFlexItem, + EuiTableBody, + EuiTablePagination, + EuiCallOut, + EuiTableRowCell, + Pager, + Query, +} from '@elastic/eui'; +import { EnrichedDeprecationInfo } from '../../../../common/types'; +import { + MlSnapshotsTableRow, + DefaultTableRow, + IndexSettingsTableRow, + ReindexTableRow, +} from './deprecation_types'; +import { DeprecationTableColumns } from '../types'; +import { DEPRECATION_TYPE_MAP } from '../constants'; + +const i18nTexts = { + refreshButtonLabel: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.table.refreshButtonLabel', + { + defaultMessage: 'Refresh', + } + ), + noDeprecationsMessage: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.table.noDeprecationsMessage', + { + defaultMessage: 'No Elasticsearch deprecation issues found', + } + ), + typeFilterLabel: i18n.translate('xpack.upgradeAssistant.esDeprecations.table.typeFilterLabel', { + defaultMessage: 'Type', + }), + criticalFilterLabel: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.table.criticalFilterLabel', + { + defaultMessage: 'Critical', + } + ), + searchPlaceholderLabel: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.table.searchPlaceholderLabel', + { + defaultMessage: 'Filter', + } + ), +}; + +const cellToLabelMap = { + isCritical: { + label: i18n.translate('xpack.upgradeAssistant.esDeprecations.table.statusColumnTitle', { + defaultMessage: 'Status', + }), + width: '8px', + }, + message: { + label: i18n.translate('xpack.upgradeAssistant.esDeprecations.table.issueColumnTitle', { + defaultMessage: 'Issue', + }), + width: '36px', + }, + type: { + label: i18n.translate('xpack.upgradeAssistant.esDeprecations.table.typeColumnTitle', { + defaultMessage: 'Type', + }), + width: '10px', + }, + index: { + label: i18n.translate('xpack.upgradeAssistant.esDeprecations.table.nameColumnTitle', { + defaultMessage: 'Name', + }), + width: '24px', + }, + correctiveAction: { + label: i18n.translate('xpack.upgradeAssistant.esDeprecations.table.resolutionColumnTitle', { + defaultMessage: 'Resolution', + }), + width: '24px', + }, +}; + +const cellTypes = Object.keys(cellToLabelMap) as DeprecationTableColumns[]; +const pageSizeOptions = [50, 100, 200]; + +const renderTableRowCells = (deprecation: EnrichedDeprecationInfo) => { + switch (deprecation.correctiveAction?.type) { + case 'mlSnapshot': + return ; + + case 'indexSetting': + return ; + + case 'reindex': + return ; + + default: + return ; + } +}; + +interface Props { + deprecations?: EnrichedDeprecationInfo[]; + reload: () => void; +} + +interface SortConfig { + isSortAscending: boolean; + sortField: DeprecationTableColumns; +} + +const getSortedItems = (deprecations: EnrichedDeprecationInfo[], sortConfig: SortConfig) => { + const { isSortAscending, sortField } = sortConfig; + const sorted = sortBy(deprecations, [ + (deprecation) => { + if (sortField === 'isCritical') { + // Critical deprecations should take precendence in ascending order + return deprecation.isCritical !== true; + } + return deprecation[sortField]; + }, + ]); + + return isSortAscending ? sorted : sorted.reverse(); +}; + +export const EsDeprecationsTable: React.FunctionComponent = ({ + deprecations = [], + reload, +}) => { + const [sortConfig, setSortConfig] = useState({ + isSortAscending: true, + sortField: 'isCritical', + }); + + const [itemsPerPage, setItemsPerPage] = useState(pageSizeOptions[0]); + const [currentPageIndex, setCurrentPageIndex] = useState(0); + const [searchQuery, setSearchQuery] = useState(EuiSearchBar.Query.MATCH_ALL); + const [searchError, setSearchError] = useState<{ message: string } | undefined>(undefined); + + const [filteredDeprecations, setFilteredDeprecations] = useState( + getSortedItems(deprecations, sortConfig) + ); + + const pager = useMemo(() => new Pager(deprecations.length, itemsPerPage, currentPageIndex), [ + currentPageIndex, + deprecations, + itemsPerPage, + ]); + + const visibleDeprecations = useMemo( + () => filteredDeprecations.slice(pager.firstItemIndex, pager.lastItemIndex + 1), + [filteredDeprecations, pager] + ); + + const handleSort = useCallback( + (fieldName: DeprecationTableColumns) => { + const newSortConfig = { + isSortAscending: sortConfig.sortField === fieldName ? !sortConfig.isSortAscending : true, + sortField: fieldName, + }; + setSortConfig(newSortConfig); + }, + [sortConfig] + ); + + const handleSearch = useCallback(({ query, error }) => { + if (error) { + setSearchError(error); + } else { + setSearchError(undefined); + setSearchQuery(query); + } + }, []); + + useEffect(() => { + const { setTotalItems, goToPageIndex } = pager; + const deprecationsFilteredByQuery = EuiSearchBar.Query.execute(searchQuery, deprecations); + const deprecationsSortedByFieldType = getSortedItems(deprecationsFilteredByQuery, sortConfig); + + setTotalItems(deprecationsSortedByFieldType.length); + setFilteredDeprecations(deprecationsSortedByFieldType); + + // Reset pagination if the filtered results return a different length + if (deprecationsSortedByFieldType.length !== filteredDeprecations.length) { + goToPageIndex(0); + } + }, [deprecations, sortConfig, pager, searchQuery, filteredDeprecations.length]); + + return ( + <> + + + ).map((type) => ({ + value: type, + name: DEPRECATION_TYPE_MAP[type], + })), + }, + ]} + onChange={handleSearch} + /> + + + + {i18nTexts.refreshButtonLabel} + + + + + {searchError && ( +
+ + + +
+ )} + + + + + + {Object.entries(cellToLabelMap).map(([fieldName, cell]) => { + return ( + handleSort(fieldName as DeprecationTableColumns)} + isSorted={sortConfig.sortField === fieldName} + isSortAscending={sortConfig.isSortAscending} + > + {cell.label} + + ); + })} + + + {filteredDeprecations.length === 0 ? ( + + + + {i18nTexts.noDeprecationsMessage} + + + + ) : ( + + {visibleDeprecations.map((deprecation, index) => { + return ( + + {renderTableRowCells(deprecation)} + + ); + })} + + )} + + + + + + + ); +}; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/es_deprecations_table_cells.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/es_deprecations_table_cells.tsx new file mode 100644 index 0000000000000..dd187f19d5e96 --- /dev/null +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/es_deprecations_table_cells.tsx @@ -0,0 +1,74 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { i18n } from '@kbn/i18n'; +import { EuiBadge, EuiLink } from '@elastic/eui'; +import { EnrichedDeprecationInfo } from '../../../../common/types'; +import { DEPRECATION_TYPE_MAP } from '../constants'; +import { DeprecationTableColumns } from '../types'; + +interface Props { + resolutionTableCell?: React.ReactNode; + fieldName: DeprecationTableColumns; + deprecation: EnrichedDeprecationInfo; + openFlyout: () => void; +} + +const i18nTexts = { + criticalBadgeLabel: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.defaultDeprecation.criticalBadgeLabel', + { + defaultMessage: 'Critical', + } + ), +}; + +export const EsDeprecationsTableCells: React.FunctionComponent = ({ + resolutionTableCell, + fieldName, + deprecation, + openFlyout, +}) => { + // "Status column" + if (fieldName === 'isCritical') { + if (deprecation.isCritical === true) { + return {i18nTexts.criticalBadgeLabel}; + } + + return <>{''}; + } + + // "Issue" column + if (fieldName === 'message') { + return ( + + {deprecation.message} + + ); + } + + // "Type" column + if (fieldName === 'type') { + return <>{DEPRECATION_TYPE_MAP[deprecation.type as EnrichedDeprecationInfo['type']]}; + } + + // "Resolution column" + if (fieldName === 'correctiveAction') { + if (resolutionTableCell) { + return <>{resolutionTableCell}; + } + + return <>{''}; + } + + // Default behavior: render value or empty string if undefined + return <>{deprecation[fieldName] ?? ''}; +}; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/index.ts b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/index.ts index 0e69259adc609..1783745843070 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/index.ts +++ b/x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/index.ts @@ -5,4 +5,4 @@ * 2.0. */ -export { EsDeprecationsContent } from './es_deprecations'; +export { EsDeprecations } from './es_deprecations'; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/kibana_deprecations.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/kibana_deprecations.tsx index 31b5c80d5b377..56d6e23d9d4f3 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/kibana_deprecations.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/kibana_deprecations/kibana_deprecations.tsx @@ -112,7 +112,7 @@ export const KibanaDeprecationsContent = withRouter(({ history }: RouteComponent useEffect(() => { async function sendTelemetryData() { - await api.sendTelemetryData({ + await api.sendPageTelemetryData({ kibana: true, }); } diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/overview/overview.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/overview/overview.tsx index b7cac67ca5a96..f900416873b83 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/overview/overview.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/overview/overview.tsx @@ -31,7 +31,7 @@ export const Overview: FunctionComponent = () => { useEffect(() => { async function sendTelemetryData() { - await api.sendTelemetryData({ + await api.sendPageTelemetryData({ overview: true, }); } diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/overview/review_logs_step/es_stats/es_stats.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/overview/review_logs_step/es_stats/es_stats.tsx index 97306dac287ba..ef0b3f438da03 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/overview/review_logs_step/es_stats/es_stats.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/overview/review_logs_step/es_stats/es_stats.tsx @@ -50,13 +50,12 @@ const i18nTexts = { criticalDeprecations, }, }), - getWarningDeprecationMessage: (clusterCount: number, indexCount: number) => - i18n.translate('xpack.upgradeAssistant.esDeprecationStats.totalDeprecationsTooltip', { + getWarningDeprecationMessage: (warningDeprecations: number) => + i18n.translate('xpack.upgradeAssistant.esDeprecationStats.warningDeprecationsTooltip', { defaultMessage: - 'This cluster is using {clusterCount} deprecated cluster settings and {indexCount} deprecated index settings', + 'This cluster has {warningDeprecations} non-critical {warningDeprecations, plural, one {deprecation} other {deprecations}}', values: { - clusterCount, - indexCount, + warningDeprecations, }, }), }; @@ -65,15 +64,12 @@ export const ESDeprecationStats: FunctionComponent = () => { const history = useHistory(); const { api } = useAppContext(); - const { data: esDeprecations, isLoading, error } = api.useLoadUpgradeStatus(); + const { data: esDeprecations, isLoading, error } = api.useLoadEsDeprecations(); - const allDeprecations = esDeprecations?.cluster?.concat(esDeprecations?.indices) ?? []; - const warningDeprecations = allDeprecations.filter( - (deprecation) => deprecation.level === 'warning' - ); - const criticalDeprecations = allDeprecations.filter( - (deprecation) => deprecation.level === 'critical' - ); + const warningDeprecations = + esDeprecations?.deprecations?.filter((deprecation) => deprecation.isCritical === false) || []; + const criticalDeprecations = + esDeprecations?.deprecations?.filter((deprecation) => deprecation.isCritical) || []; const hasWarnings = warningDeprecations.length > 0; const hasCritical = criticalDeprecations.length > 0; @@ -90,7 +86,7 @@ export const ESDeprecationStats: FunctionComponent = () => { {error && } } - {...(!hasNoDeprecations && reactRouterNavigate(history, '/es_deprecations/cluster'))} + {...(!hasNoDeprecations && reactRouterNavigate(history, '/es_deprecations'))} > @@ -137,10 +133,7 @@ export const ESDeprecationStats: FunctionComponent = () => {

{isLoading ? i18nTexts.loadingText - : i18nTexts.getWarningDeprecationMessage( - esDeprecations?.cluster.length ?? 0, - esDeprecations?.indices.length ?? 0 - )} + : i18nTexts.getWarningDeprecationMessage(warningDeprecations.length)}

)} diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/overview/review_logs_step/es_stats/es_stats_error.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/overview/review_logs_step/es_stats/es_stats_error.tsx index 5db5b80cc42eb..c717a8a2e12e8 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/overview/review_logs_step/es_stats/es_stats_error.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/overview/review_logs_step/es_stats/es_stats_error.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { EuiIconTip } from '@elastic/eui'; import { ResponseError } from '../../../../lib/api'; -import { getEsDeprecationError } from '../../../../lib/es_deprecation_errors'; +import { getEsDeprecationError } from '../../../../lib/get_es_deprecation_error'; interface Props { error: ResponseError; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/shared/no_deprecations.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/shared/no_deprecations.tsx index 3626151b63bbf..7763450c6cfcf 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/shared/no_deprecations.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/shared/no_deprecations.tsx @@ -12,14 +12,14 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; const i18nTexts = { - emptyPromptTitle: i18n.translate('xpack.upgradeAssistant.noDeprecationsPrompt.title', { - defaultMessage: 'Ready to upgrade!', - }), - getEmptyPromptDescription: (deprecationType: string) => + getEmptyPromptTitle: (deprecationType: string) => i18n.translate('xpack.upgradeAssistant.noDeprecationsPrompt.description', { - defaultMessage: 'Your configuration is up to date.', + defaultMessage: 'Your {deprecationType} configuration is up to date', + values: { + deprecationType, + }, }), - getEmptyPromptNextStepsDescription: (navigateToOverviewPage: () => void) => ( + getEmptyPromptDescription: (navigateToOverviewPage: () => void) => ( = ({ }) => { return ( {i18nTexts.emptyPromptTitle}} + title={

{i18nTexts.getEmptyPromptTitle(deprecationType)}

} body={ <>

- {i18nTexts.getEmptyPromptDescription(deprecationType)} + {i18nTexts.getEmptyPromptDescription(navigateToOverviewPage)}

-

{i18nTexts.getEmptyPromptNextStepsDescription(navigateToOverviewPage)}

} /> diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/types.ts b/x-pack/plugins/upgrade_assistant/public/application/components/types.ts index b4fd78252b2ff..b46bb583244f0 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/types.ts +++ b/x-pack/plugins/upgrade_assistant/public/application/components/types.ts @@ -5,27 +5,8 @@ * 2.0. */ -import React from 'react'; - -import { EnrichedDeprecationInfo, ESUpgradeStatus } from '../../../common/types'; import { ResponseError } from '../lib/api'; -export interface UpgradeAssistantTabProps { - alertBanner?: React.ReactNode; - checkupData?: ESUpgradeStatus | null; - deprecations?: EnrichedDeprecationInfo[]; - refreshCheckupData: () => void; - error: ResponseError | null; - isLoading: boolean; - navigateToOverviewPage: () => void; -} - -// eslint-disable-next-line react/prefer-stateless-function -export class UpgradeAssistantTabComponent< - T extends UpgradeAssistantTabProps = UpgradeAssistantTabProps, - S = {} -> extends React.Component {} - export enum LoadingState { Loading, Success, @@ -40,13 +21,14 @@ export enum GroupByOption { node = 'node', } -export enum TelemetryState { - Running, - Complete, -} - -export type EsTabs = 'cluster' | 'indices'; +export type DeprecationTableColumns = + | 'type' + | 'index' + | 'message' + | 'correctiveAction' + | 'isCritical'; +export type Status = 'in_progress' | 'complete' | 'idle' | 'error'; export interface DeprecationLoggingPreviewProps { isDeprecationLogIndexingEnabled: boolean; onlyDeprecationLogWritingEnabled: boolean; diff --git a/x-pack/plugins/upgrade_assistant/public/application/lib/api.ts b/x-pack/plugins/upgrade_assistant/public/application/lib/api.ts index 1b22d26ea7218..78070c5717496 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/lib/api.ts +++ b/x-pack/plugins/upgrade_assistant/public/application/lib/api.ts @@ -45,14 +45,14 @@ export class ApiService { this.client = httpClient; } - public useLoadUpgradeStatus() { + public useLoadEsDeprecations() { return this.useRequest({ path: `${API_BASE_PATH}/es_deprecations`, method: 'get', }); } - public async sendTelemetryData(telemetryData: { [tabName: string]: boolean }) { + public async sendPageTelemetryData(telemetryData: { [tabName: string]: boolean }) { const result = await this.sendRequest({ path: `${API_BASE_PATH}/stats/ui_open`, method: 'put', @@ -125,6 +125,37 @@ export class ApiService { method: 'get', }); } + + public async sendReindexTelemetryData(telemetryData: { [key: string]: boolean }) { + const result = await this.sendRequest({ + path: `${API_BASE_PATH}/stats/ui_reindex`, + method: 'put', + body: JSON.stringify(telemetryData), + }); + + return result; + } + + public async getReindexStatus(indexName: string) { + return await this.sendRequest({ + path: `${API_BASE_PATH}/reindex/${indexName}`, + method: 'get', + }); + } + + public async startReindexTask(indexName: string) { + return await this.sendRequest({ + path: `${API_BASE_PATH}/reindex/${indexName}`, + method: 'post', + }); + } + + public async cancelReindexTask(indexName: string) { + return await this.sendRequest({ + path: `${API_BASE_PATH}/reindex/${indexName}/cancel`, + method: 'post', + }); + } } export const apiService = new ApiService(); diff --git a/x-pack/plugins/upgrade_assistant/public/application/lib/breadcrumbs.ts b/x-pack/plugins/upgrade_assistant/public/application/lib/breadcrumbs.ts index 00359988d5e2a..f36dc2096ddc7 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/lib/breadcrumbs.ts +++ b/x-pack/plugins/upgrade_assistant/public/application/lib/breadcrumbs.ts @@ -16,7 +16,7 @@ const i18nTexts = { defaultMessage: 'Upgrade Assistant', }), esDeprecations: i18n.translate('xpack.upgradeAssistant.breadcrumb.esDeprecationsLabel', { - defaultMessage: 'Elasticsearch deprecations', + defaultMessage: 'Elasticsearch deprecation warnings', }), kibanaDeprecations: i18n.translate( 'xpack.upgradeAssistant.breadcrumb.kibanaDeprecationsLabel', diff --git a/x-pack/plugins/upgrade_assistant/public/application/lib/es_deprecation_errors.ts b/x-pack/plugins/upgrade_assistant/public/application/lib/get_es_deprecation_error.ts similarity index 93% rename from x-pack/plugins/upgrade_assistant/public/application/lib/es_deprecation_errors.ts rename to x-pack/plugins/upgrade_assistant/public/application/lib/get_es_deprecation_error.ts index 4220f0eef8d42..85cfd2a3fd16c 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/lib/es_deprecation_errors.ts +++ b/x-pack/plugins/upgrade_assistant/public/application/lib/get_es_deprecation_error.ts @@ -25,8 +25,7 @@ const i18nTexts = { upgradedMessage: i18n.translate( 'xpack.upgradeAssistant.esDeprecationErrors.upgradedWarningMessage', { - defaultMessage: - 'Your configuration is up to date. Kibana and all Elasticsearch nodes are running the same version.', + defaultMessage: 'All Elasticsearch nodes have been upgraded.', } ), loadingError: i18n.translate('xpack.upgradeAssistant.esDeprecationErrors.loadingErrorMessage', { diff --git a/x-pack/plugins/upgrade_assistant/public/shared_imports.ts b/x-pack/plugins/upgrade_assistant/public/shared_imports.ts index c3ffd44662ec2..64b52065f63e6 100644 --- a/x-pack/plugins/upgrade_assistant/public/shared_imports.ts +++ b/x-pack/plugins/upgrade_assistant/public/shared_imports.ts @@ -15,6 +15,7 @@ export { useRequest, UseRequestConfig, SectionLoading, + GlobalFlyout, } from '../../../../src/plugins/es_ui_shared/public/'; export { KibanaContextProvider } from '../../../../src/plugins/kibana_react/public'; diff --git a/x-pack/plugins/upgrade_assistant/server/lib/__fixtures__/fake_deprecations.json b/x-pack/plugins/upgrade_assistant/server/lib/__fixtures__/fake_deprecations.json index ef724e3bf892e..617bb02ff9dfc 100644 --- a/x-pack/plugins/upgrade_assistant/server/lib/__fixtures__/fake_deprecations.json +++ b/x-pack/plugins/upgrade_assistant/server/lib/__fixtures__/fake_deprecations.json @@ -4,13 +4,15 @@ "level": "warning", "message": "Template patterns are no longer using `template` field, but `index_patterns` instead", "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", - "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template" + "details": "templates using `template` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template", + "resolve_during_rolling_upgrade": false }, { "level": "warning", "message": "one or more templates use deprecated mapping settings", "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", - "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}" + "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}", + "resolve_during_rolling_upgrade": false } ], "ml_settings": [ @@ -18,7 +20,8 @@ "level": "warning", "message": "Datafeed [deprecation-datafeed] uses deprecated query options", "url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-7.0.html#breaking_70_search_changes", - "details": "[Deprecated field [use_dis_max] used, replaced by [Set [tie_breaker] to 1 instead]]" + "details": "[Deprecated field [use_dis_max] used, replaced by [Set [tie_breaker] to 1 instead]]", + "resolve_during_rolling_upgrade": false }, { "level": "critical", @@ -28,7 +31,8 @@ "_meta": { "snapshot_id": "1", "job_id": "deprecation_check_job" - } + }, + "resolve_during_rolling_upgrade": false } ], "node_settings": [ @@ -36,7 +40,8 @@ "level": "critical", "message": "A node-level issue", "url": "http://nodeissue.com", - "details": "This node thing is wrong" + "details": "This node thing is wrong", + "resolve_during_rolling_upgrade": true } ], "index_settings": { @@ -45,7 +50,8 @@ "level": "warning", "message": "Coercion of boolean fields", "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_mappings_changes.html#_coercion_of_boolean_fields", - "details": "[[type: doc, field: spins], [type: doc, field: mlockall], [type: doc, field: node_master], [type: doc, field: primary]]" + "details": "[[type: doc, field: spins], [type: doc, field: mlockall], [type: doc, field: node_master], [type: doc, field: primary]]", + "resolve_during_rolling_upgrade": false } ], "twitter": [ @@ -53,7 +59,8 @@ "level": "warning", "message": "Coercion of boolean fields", "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_mappings_changes.html#_coercion_of_boolean_fields", - "details": "[[type: tweet, field: liked]]" + "details": "[[type: tweet, field: liked]]", + "resolve_during_rolling_upgrade": false } ], "old_index": [ @@ -62,7 +69,8 @@ "message": "Index created before 7.0", "url": "https: //www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-8.0.html", - "details": "This index was created using version: 6.8.13" + "details": "This index was created using version: 6.8.13", + "resolve_during_rolling_upgrade": false } ], "closed_index": [ @@ -70,7 +78,8 @@ "level": "critical", "message": "Index created before 7.0", "url": "https: //www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-8.0.html", - "details": "This index was created using version: 6.8.13" + "details": "This index was created using version: 6.8.13", + "resolve_during_rolling_upgrade": false } ], "deprecated_settings": [ @@ -80,7 +89,8 @@ "url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-translog.html", "details": - "translog retention settings [index.translog.retention.size] and [index.translog.retention.age] are ignored because translog is no longer used in peer recoveries with soft-deletes enabled (default in 7.0 or later)" + "translog retention settings [index.translog.retention.size] and [index.translog.retention.age] are ignored because translog is no longer used in peer recoveries with soft-deletes enabled (default in 7.0 or later)", + "resolve_during_rolling_upgrade": false } ], ".kibana": [ @@ -88,7 +98,8 @@ "level": "warning", "message": "Coercion of boolean fields", "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_mappings_changes.html#_coercion_of_boolean_fields", - "details": "[[type: index-pattern, field: notExpandable], [type: config, field: xPackMonitoring:allowReport], [type: config, field: xPackMonitoring:showBanner], [type: dashboard, field: pause], [type: dashboard, field: timeRestore]]" + "details": "[[type: index-pattern, field: notExpandable], [type: config, field: xPackMonitoring:allowReport], [type: config, field: xPackMonitoring:showBanner], [type: dashboard, field: pause], [type: dashboard, field: timeRestore]]", + "resolve_during_rolling_upgrade": false } ], ".watcher-history-6-2018.11.07": [ @@ -96,7 +107,8 @@ "level": "warning", "message": "Coercion of boolean fields", "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_mappings_changes.html#_coercion_of_boolean_fields", - "details": "[[type: doc, field: notify], [type: doc, field: created], [type: doc, field: attach_payload], [type: doc, field: met]]" + "details": "[[type: doc, field: notify], [type: doc, field: created], [type: doc, field: attach_payload], [type: doc, field: met]]", + "resolve_during_rolling_upgrade": false } ], ".monitoring-kibana-6-2018.11.07": [ @@ -104,7 +116,8 @@ "level": "warning", "message": "Coercion of boolean fields", "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_mappings_changes.html#_coercion_of_boolean_fields", - "details": "[[type: doc, field: snapshot]]" + "details": "[[type: doc, field: snapshot]]", + "resolve_during_rolling_upgrade": false } ], "twitter2": [ @@ -112,7 +125,8 @@ "level": "warning", "message": "Coercion of boolean fields", "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_mappings_changes.html#_coercion_of_boolean_fields", - "details": "[[type: tweet, field: liked]]" + "details": "[[type: tweet, field: liked]]", + "resolve_during_rolling_upgrade": false } ] } diff --git a/x-pack/plugins/upgrade_assistant/server/lib/__snapshots__/es_deprecations_status.test.ts.snap b/x-pack/plugins/upgrade_assistant/server/lib/__snapshots__/es_deprecations_status.test.ts.snap index 3e847eef18f07..be9ea11a4886e 100644 --- a/x-pack/plugins/upgrade_assistant/server/lib/__snapshots__/es_deprecations_status.test.ts.snap +++ b/x-pack/plugins/upgrade_assistant/server/lib/__snapshots__/es_deprecations_status.test.ts.snap @@ -2,26 +2,32 @@ exports[`getESUpgradeStatus returns the correct shape of data 1`] = ` Object { - "cluster": Array [ + "deprecations": Array [ Object { "correctiveAction": undefined, "details": "templates using \`template\` field: security_audit_log,watches,.monitoring-alerts,triggered_watches,.ml-anomalies-,.ml-notifications,.ml-meta,.monitoring-kibana,.monitoring-es,.monitoring-logstash,.watch-history-6,.ml-state,security-index-template", - "level": "warning", + "isCritical": false, "message": "Template patterns are no longer using \`template\` field, but \`index_patterns\` instead", + "resolveDuringUpgrade": false, + "type": "cluster_settings", "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal", }, Object { "correctiveAction": undefined, "details": "{.monitoring-logstash=[Coercion of boolean fields], .monitoring-es=[Coercion of boolean fields], .ml-anomalies-=[Coercion of boolean fields], .watch-history-6=[Coercion of boolean fields], .monitoring-kibana=[Coercion of boolean fields], security-index-template=[Coercion of boolean fields]}", - "level": "warning", + "isCritical": false, "message": "one or more templates use deprecated mapping settings", + "resolveDuringUpgrade": false, + "type": "cluster_settings", "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_indices_changes.html", }, Object { "correctiveAction": undefined, "details": "[Deprecated field [use_dis_max] used, replaced by [Set [tie_breaker] to 1 instead]]", - "level": "warning", + "isCritical": false, "message": "Datafeed [deprecation-datafeed] uses deprecated query options", + "resolveDuringUpgrade": false, + "type": "ml_settings", "url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-7.0.html#breaking_70_search_changes", }, Object { @@ -31,33 +37,39 @@ Object { "type": "mlSnapshot", }, "details": "details", - "level": "critical", + "isCritical": true, "message": "model snapshot [1] for job [deprecation_check_job] needs to be deleted or upgraded", + "resolveDuringUpgrade": false, + "type": "ml_settings", "url": "", }, Object { "correctiveAction": undefined, "details": "This node thing is wrong", - "level": "critical", + "isCritical": true, "message": "A node-level issue", + "resolveDuringUpgrade": true, + "type": "node_settings", "url": "http://nodeissue.com", }, - ], - "indices": Array [ Object { "correctiveAction": undefined, "details": "[[type: doc, field: spins], [type: doc, field: mlockall], [type: doc, field: node_master], [type: doc, field: primary]]", "index": ".monitoring-es-6-2018.11.07", - "level": "warning", + "isCritical": false, "message": "Coercion of boolean fields", + "resolveDuringUpgrade": false, + "type": "index_settings", "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_mappings_changes.html#_coercion_of_boolean_fields", }, Object { "correctiveAction": undefined, "details": "[[type: tweet, field: liked]]", "index": "twitter", - "level": "warning", + "isCritical": false, "message": "Coercion of boolean fields", + "resolveDuringUpgrade": false, + "type": "index_settings", "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_mappings_changes.html#_coercion_of_boolean_fields", }, Object { @@ -67,8 +79,10 @@ Object { }, "details": "This index was created using version: 6.8.13", "index": "old_index", - "level": "critical", + "isCritical": true, "message": "Index created before 7.0", + "resolveDuringUpgrade": false, + "type": "index_settings", "url": "https: //www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-8.0.html", }, Object { @@ -78,8 +92,10 @@ Object { }, "details": "This index was created using version: 6.8.13", "index": "closed_index", - "level": "critical", + "isCritical": true, "message": "Index created before 7.0", + "resolveDuringUpgrade": false, + "type": "index_settings", "url": "https: //www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-8.0.html", }, Object { @@ -92,40 +108,50 @@ Object { }, "details": "translog retention settings [index.translog.retention.size] and [index.translog.retention.age] are ignored because translog is no longer used in peer recoveries with soft-deletes enabled (default in 7.0 or later)", "index": "deprecated_settings", - "level": "warning", + "isCritical": false, "message": "translog retention settings are ignored", + "resolveDuringUpgrade": false, + "type": "index_settings", "url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-translog.html", }, Object { "correctiveAction": undefined, "details": "[[type: index-pattern, field: notExpandable], [type: config, field: xPackMonitoring:allowReport], [type: config, field: xPackMonitoring:showBanner], [type: dashboard, field: pause], [type: dashboard, field: timeRestore]]", "index": ".kibana", - "level": "warning", + "isCritical": false, "message": "Coercion of boolean fields", + "resolveDuringUpgrade": false, + "type": "index_settings", "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_mappings_changes.html#_coercion_of_boolean_fields", }, Object { "correctiveAction": undefined, "details": "[[type: doc, field: notify], [type: doc, field: created], [type: doc, field: attach_payload], [type: doc, field: met]]", "index": ".watcher-history-6-2018.11.07", - "level": "warning", + "isCritical": false, "message": "Coercion of boolean fields", + "resolveDuringUpgrade": false, + "type": "index_settings", "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_mappings_changes.html#_coercion_of_boolean_fields", }, Object { "correctiveAction": undefined, "details": "[[type: doc, field: snapshot]]", "index": ".monitoring-kibana-6-2018.11.07", - "level": "warning", + "isCritical": false, "message": "Coercion of boolean fields", + "resolveDuringUpgrade": false, + "type": "index_settings", "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_mappings_changes.html#_coercion_of_boolean_fields", }, Object { "correctiveAction": undefined, "details": "[[type: tweet, field: liked]]", "index": "twitter2", - "level": "warning", + "isCritical": false, "message": "Coercion of boolean fields", + "resolveDuringUpgrade": false, + "type": "index_settings", "url": "https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_mappings_changes.html#_coercion_of_boolean_fields", }, ], diff --git a/x-pack/plugins/upgrade_assistant/server/lib/es_deprecations_status.test.ts b/x-pack/plugins/upgrade_assistant/server/lib/es_deprecations_status.test.ts index f87a8916e1a52..e1a348f8ed8ee 100644 --- a/x-pack/plugins/upgrade_assistant/server/lib/es_deprecations_status.test.ts +++ b/x-pack/plugins/upgrade_assistant/server/lib/es_deprecations_status.test.ts @@ -8,7 +8,7 @@ import _ from 'lodash'; import { RequestEvent } from '@elastic/elasticsearch/lib/Transport'; import { elasticsearchServiceMock } from 'src/core/server/mocks'; -import { DeprecationAPIResponse } from '../../common/types'; +import { MigrationDeprecationInfoResponse } from '@elastic/elasticsearch/api/types'; import { getESUpgradeStatus } from './es_deprecations_status'; import fakeDeprecations from './__fixtures__/fake_deprecations.json'; @@ -32,12 +32,11 @@ describe('getESUpgradeStatus', () => { }; // @ts-expect-error mock data is too loosely typed - const deprecationsResponse: DeprecationAPIResponse = _.cloneDeep(fakeDeprecations); + const deprecationsResponse: MigrationDeprecationInfoResponse = _.cloneDeep(fakeDeprecations); const esClient = elasticsearchServiceMock.createScopedClusterClient(); esClient.asCurrentUser.migration.deprecations.mockResolvedValue( - // @ts-expect-error not full interface asApiResponse(deprecationsResponse) ); diff --git a/x-pack/plugins/upgrade_assistant/server/lib/es_deprecations_status.ts b/x-pack/plugins/upgrade_assistant/server/lib/es_deprecations_status.ts index b87d63ae36ec1..cd719cc0f32b5 100644 --- a/x-pack/plugins/upgrade_assistant/server/lib/es_deprecations_status.ts +++ b/x-pack/plugins/upgrade_assistant/server/lib/es_deprecations_status.ts @@ -5,13 +5,13 @@ * 2.0. */ +import { + MigrationDeprecationInfoDeprecation, + MigrationDeprecationInfoResponse, +} from '@elastic/elasticsearch/api/types'; import { IScopedClusterClient } from 'src/core/server'; import { indexSettingDeprecations } from '../../common/constants'; -import { - DeprecationAPIResponse, - EnrichedDeprecationInfo, - ESUpgradeStatus, -} from '../../common/types'; +import { EnrichedDeprecationInfo, ESUpgradeStatus } from '../../common/types'; import { esIndicesStateCheck } from './es_indices_state_check'; @@ -20,33 +20,82 @@ export async function getESUpgradeStatus( ): Promise { const { body: deprecations } = await dataClient.asCurrentUser.migration.deprecations(); - const cluster = getClusterDeprecations(deprecations); - const indices = await getCombinedIndexInfos(deprecations, dataClient); + const getCombinedDeprecations = async () => { + const indices = await getCombinedIndexInfos(deprecations, dataClient); + + return Object.keys(deprecations).reduce((combinedDeprecations, deprecationType) => { + if (deprecationType === 'index_settings') { + combinedDeprecations = combinedDeprecations.concat(indices); + } else { + const deprecationsByType = deprecations[ + deprecationType as keyof MigrationDeprecationInfoResponse + ] as MigrationDeprecationInfoDeprecation[]; + + const enrichedDeprecationInfo = deprecationsByType.map( + ({ + details, + level, + message, + url, + // @ts-expect-error @elastic/elasticsearch _meta not available yet in MigrationDeprecationInfoResponse + _meta: metadata, + // @ts-expect-error @elastic/elasticsearch resolve_during_rolling_upgrade not available yet in MigrationDeprecationInfoResponse + resolve_during_rolling_upgrade: resolveDuringUpgrade, + }) => { + return { + details, + message, + url, + type: deprecationType as keyof MigrationDeprecationInfoResponse, + isCritical: level === 'critical', + resolveDuringUpgrade, + correctiveAction: getCorrectiveAction(message, metadata), + }; + } + ); + + combinedDeprecations = combinedDeprecations.concat(enrichedDeprecationInfo); + } + + return combinedDeprecations; + }, [] as EnrichedDeprecationInfo[]); + }; - const totalCriticalDeprecations = cluster.concat(indices).filter((d) => d.level === 'critical') - .length; + const combinedDeprecations = await getCombinedDeprecations(); + const criticalWarnings = combinedDeprecations.filter(({ isCritical }) => isCritical === true); return { - totalCriticalDeprecations, - cluster, - indices, + totalCriticalDeprecations: criticalWarnings.length, + deprecations: combinedDeprecations, }; } // Reformats the index deprecations to an array of deprecation warnings extended with an index field. const getCombinedIndexInfos = async ( - deprecations: DeprecationAPIResponse, + deprecations: MigrationDeprecationInfoResponse, dataClient: IScopedClusterClient ) => { const indices = Object.keys(deprecations.index_settings).reduce( (indexDeprecations, indexName) => { return indexDeprecations.concat( deprecations.index_settings[indexName].map( - (d) => + ({ + details, + message, + url, + level, + // @ts-expect-error @elastic/elasticsearch resolve_during_rolling_upgrade not available yet in MigrationDeprecationInfoResponse + resolve_during_rolling_upgrade: resolveDuringUpgrade, + }) => ({ - ...d, + details, + message, + url, index: indexName, - correctiveAction: getCorrectiveAction(d.message), + type: 'index_settings', + isCritical: level === 'critical', + correctiveAction: getCorrectiveAction(message), + resolveDuringUpgrade, } as EnrichedDeprecationInfo) ) ); @@ -71,21 +120,10 @@ const getCombinedIndexInfos = async ( return indices as EnrichedDeprecationInfo[]; }; -const getClusterDeprecations = (deprecations: DeprecationAPIResponse) => { - const combinedDeprecations = deprecations.cluster_settings - .concat(deprecations.ml_settings) - .concat(deprecations.node_settings); - - return combinedDeprecations.map((deprecation) => { - const { _meta: metadata, ...deprecationInfo } = deprecation; - return { - ...deprecationInfo, - correctiveAction: getCorrectiveAction(deprecation.message, metadata), - }; - }) as EnrichedDeprecationInfo[]; -}; - -const getCorrectiveAction = (message: string, metadata?: { [key: string]: string }) => { +const getCorrectiveAction = ( + message: string, + metadata?: { [key: string]: string } +): EnrichedDeprecationInfo['correctiveAction'] => { const indexSettingDeprecation = Object.values(indexSettingDeprecations).find( ({ deprecationMessage }) => deprecationMessage === message ); diff --git a/x-pack/plugins/upgrade_assistant/server/lib/telemetry/es_ui_open_apis.test.ts b/x-pack/plugins/upgrade_assistant/server/lib/telemetry/es_ui_open_apis.test.ts index a911c5810dd0a..caff78390b9d1 100644 --- a/x-pack/plugins/upgrade_assistant/server/lib/telemetry/es_ui_open_apis.test.ts +++ b/x-pack/plugins/upgrade_assistant/server/lib/telemetry/es_ui_open_apis.test.ts @@ -22,13 +22,12 @@ describe('Upgrade Assistant Telemetry SavedObject UIOpen', () => { await upsertUIOpenOption({ overview: true, - cluster: true, - indices: true, + elasticsearch: true, kibana: true, savedObjects: { createInternalRepository: () => internalRepo } as any, }); - expect(internalRepo.incrementCounter).toHaveBeenCalledTimes(4); + expect(internalRepo.incrementCounter).toHaveBeenCalledTimes(3); expect(internalRepo.incrementCounter).toHaveBeenCalledWith( UPGRADE_ASSISTANT_TYPE, UPGRADE_ASSISTANT_DOC_ID, @@ -37,12 +36,7 @@ describe('Upgrade Assistant Telemetry SavedObject UIOpen', () => { expect(internalRepo.incrementCounter).toHaveBeenCalledWith( UPGRADE_ASSISTANT_TYPE, UPGRADE_ASSISTANT_DOC_ID, - ['ui_open.cluster'] - ); - expect(internalRepo.incrementCounter).toHaveBeenCalledWith( - UPGRADE_ASSISTANT_TYPE, - UPGRADE_ASSISTANT_DOC_ID, - ['ui_open.indices'] + ['ui_open.elasticsearch'] ); expect(internalRepo.incrementCounter).toHaveBeenCalledWith( UPGRADE_ASSISTANT_TYPE, diff --git a/x-pack/plugins/upgrade_assistant/server/lib/telemetry/es_ui_open_apis.ts b/x-pack/plugins/upgrade_assistant/server/lib/telemetry/es_ui_open_apis.ts index ab876828a343c..3d463fe4b03ed 100644 --- a/x-pack/plugins/upgrade_assistant/server/lib/telemetry/es_ui_open_apis.ts +++ b/x-pack/plugins/upgrade_assistant/server/lib/telemetry/es_ui_open_apis.ts @@ -33,8 +33,7 @@ type UpsertUIOpenOptionDependencies = UIOpen & { savedObjects: SavedObjectsServi export async function upsertUIOpenOption({ overview, - cluster, - indices, + elasticsearch, savedObjects, kibana, }: UpsertUIOpenOptionDependencies): Promise { @@ -42,12 +41,8 @@ export async function upsertUIOpenOption({ await incrementUIOpenOptionCounter({ savedObjects, uiOpenOptionCounter: 'overview' }); } - if (cluster) { - await incrementUIOpenOptionCounter({ savedObjects, uiOpenOptionCounter: 'cluster' }); - } - - if (indices) { - await incrementUIOpenOptionCounter({ savedObjects, uiOpenOptionCounter: 'indices' }); + if (elasticsearch) { + await incrementUIOpenOptionCounter({ savedObjects, uiOpenOptionCounter: 'elasticsearch' }); } if (kibana) { @@ -56,8 +51,7 @@ export async function upsertUIOpenOption({ return { overview, - cluster, - indices, + elasticsearch, kibana, }; } diff --git a/x-pack/plugins/upgrade_assistant/server/lib/telemetry/usage_collector.test.ts b/x-pack/plugins/upgrade_assistant/server/lib/telemetry/usage_collector.test.ts index 2227139c53cda..50c5b358aa5cb 100644 --- a/x-pack/plugins/upgrade_assistant/server/lib/telemetry/usage_collector.test.ts +++ b/x-pack/plugins/upgrade_assistant/server/lib/telemetry/usage_collector.test.ts @@ -54,8 +54,7 @@ describe('Upgrade Assistant Usage Collector', () => { return { attributes: { 'ui_open.overview': 10, - 'ui_open.cluster': 20, - 'ui_open.indices': 30, + 'ui_open.elasticsearch': 20, 'ui_open.kibana': 15, 'ui_reindex.close': 1, 'ui_reindex.open': 4, @@ -94,8 +93,7 @@ describe('Upgrade Assistant Usage Collector', () => { expect(upgradeAssistantStats).toEqual({ ui_open: { overview: 10, - cluster: 20, - indices: 30, + elasticsearch: 20, kibana: 15, }, ui_reindex: { diff --git a/x-pack/plugins/upgrade_assistant/server/lib/telemetry/usage_collector.ts b/x-pack/plugins/upgrade_assistant/server/lib/telemetry/usage_collector.ts index a6253ab1091da..ee997f5da7ab7 100644 --- a/x-pack/plugins/upgrade_assistant/server/lib/telemetry/usage_collector.ts +++ b/x-pack/plugins/upgrade_assistant/server/lib/telemetry/usage_collector.ts @@ -77,8 +77,7 @@ export async function fetchUpgradeAssistantMetrics( const defaultTelemetrySavedObject = { ui_open: { overview: 0, - cluster: 0, - indices: 0, + elasticsearch: 0, kibana: 0, }, ui_reindex: { @@ -96,8 +95,7 @@ export async function fetchUpgradeAssistantMetrics( return { ui_open: { overview: get(upgradeAssistantTelemetrySavedObjectAttrs, 'ui_open.overview', 0), - cluster: get(upgradeAssistantTelemetrySavedObjectAttrs, 'ui_open.cluster', 0), - indices: get(upgradeAssistantTelemetrySavedObjectAttrs, 'ui_open.indices', 0), + elasticsearch: get(upgradeAssistantTelemetrySavedObjectAttrs, 'ui_open.elasticsearch', 0), kibana: get(upgradeAssistantTelemetrySavedObjectAttrs, 'ui_open.kibana', 0), }, ui_reindex: { @@ -146,18 +144,10 @@ export function registerUpgradeAssistantUsageCollector({ }, }, ui_open: { - cluster: { + elasticsearch: { type: 'long', _meta: { - description: - 'Number of times a user viewed the list of Elasticsearch cluster deprecations.', - }, - }, - indices: { - type: 'long', - _meta: { - description: - 'Number of times a user viewed the list of Elasticsearch index deprecations.', + description: 'Number of times a user viewed the list of Elasticsearch deprecations.', }, }, overview: { diff --git a/x-pack/plugins/upgrade_assistant/server/routes/es_deprecations.test.ts b/x-pack/plugins/upgrade_assistant/server/routes/es_deprecations.test.ts index 9603eae18d9c1..bea74f116e0e2 100644 --- a/x-pack/plugins/upgrade_assistant/server/routes/es_deprecations.test.ts +++ b/x-pack/plugins/upgrade_assistant/server/routes/es_deprecations.test.ts @@ -44,9 +44,8 @@ describe('ES deprecations API', () => { describe('GET /api/upgrade_assistant/es_deprecations', () => { it('returns state', async () => { ESUpgradeStatusApis.getESUpgradeStatus.mockResolvedValue({ - cluster: [], - indices: [], - nodes: [], + deprecations: [], + totalCriticalDeprecations: 0, }); const resp = await routeDependencies.router.getHandler({ method: 'get', @@ -55,15 +54,18 @@ describe('ES deprecations API', () => { expect(resp.status).toEqual(200); expect(JSON.stringify(resp.payload)).toMatchInlineSnapshot( - `"{\\"cluster\\":[],\\"indices\\":[],\\"nodes\\":[]}"` + `"{\\"deprecations\\":[],\\"totalCriticalDeprecations\\":0}"` ); }); it('returns an 403 error if it throws forbidden', async () => { - const e: any = new Error(`you can't go here!`); - e.statusCode = 403; + const error = { + name: 'ResponseError', + message: `you can't go here!`, + statusCode: 403, + }; - ESUpgradeStatusApis.getESUpgradeStatus.mockRejectedValue(e); + ESUpgradeStatusApis.getESUpgradeStatus.mockRejectedValue(error); const resp = await routeDependencies.router.getHandler({ method: 'get', pathPattern: '/api/upgrade_assistant/es_deprecations', diff --git a/x-pack/plugins/upgrade_assistant/server/routes/es_deprecations.ts b/x-pack/plugins/upgrade_assistant/server/routes/es_deprecations.ts index 395fa04af9173..eb0ade26de766 100644 --- a/x-pack/plugins/upgrade_assistant/server/routes/es_deprecations.ts +++ b/x-pack/plugins/upgrade_assistant/server/routes/es_deprecations.ts @@ -11,6 +11,7 @@ import { versionCheckHandlerWrapper } from '../lib/es_version_precheck'; import { RouteDependencies } from '../types'; import { reindexActionsFactory } from '../lib/reindexing/reindex_actions'; import { reindexServiceFactory } from '../lib/reindexing'; +import { handleEsError } from '../shared_imports'; export function registerESDeprecationRoutes({ router, licensing, log }: RouteDependencies) { router.get( @@ -40,7 +41,7 @@ export function registerESDeprecationRoutes({ router, licensing, log }: RouteDep log, licensing ); - const indexNames = status.indices + const indexNames = status.deprecations .filter(({ index }) => typeof index !== 'undefined') .map(({ index }) => index as string); @@ -50,11 +51,7 @@ export function registerESDeprecationRoutes({ router, licensing, log }: RouteDep body: status, }); } catch (e) { - if (e.statusCode === 403) { - return response.forbidden(e.message); - } - - throw e; + return handleEsError({ error: e, response }); } } ) diff --git a/x-pack/plugins/upgrade_assistant/server/routes/telemetry.test.ts b/x-pack/plugins/upgrade_assistant/server/routes/telemetry.test.ts index 05ad542ec9c00..578cceb702751 100644 --- a/x-pack/plugins/upgrade_assistant/server/routes/telemetry.test.ts +++ b/x-pack/plugins/upgrade_assistant/server/routes/telemetry.test.ts @@ -44,8 +44,8 @@ describe('Upgrade Assistant Telemetry API', () => { it('returns correct payload with single option', async () => { const returnPayload = { overview: true, - cluster: false, - indices: false, + elasticsearch: false, + kibana: false, }; (upsertUIOpenOption as jest.Mock).mockResolvedValue(returnPayload); @@ -65,8 +65,8 @@ describe('Upgrade Assistant Telemetry API', () => { it('returns correct payload with multiple option', async () => { const returnPayload = { overview: true, - cluster: true, - indices: true, + elasticsearch: true, + kibana: true, }; (upsertUIOpenOption as jest.Mock).mockResolvedValue(returnPayload); @@ -79,8 +79,8 @@ describe('Upgrade Assistant Telemetry API', () => { createRequestMock({ body: { overview: true, - cluster: true, - indices: true, + elasticsearch: true, + kibana: true, }, }), kibanaResponseFactory diff --git a/x-pack/plugins/upgrade_assistant/server/routes/telemetry.ts b/x-pack/plugins/upgrade_assistant/server/routes/telemetry.ts index 4e9b4b9a472a9..d083b38c7c240 100644 --- a/x-pack/plugins/upgrade_assistant/server/routes/telemetry.ts +++ b/x-pack/plugins/upgrade_assistant/server/routes/telemetry.ts @@ -18,19 +18,17 @@ export function registerTelemetryRoutes({ router, getSavedObjectsService }: Rout validate: { body: schema.object({ overview: schema.boolean({ defaultValue: false }), - cluster: schema.boolean({ defaultValue: false }), - indices: schema.boolean({ defaultValue: false }), + elasticsearch: schema.boolean({ defaultValue: false }), kibana: schema.boolean({ defaultValue: false }), }), }, }, async (ctx, request, response) => { - const { cluster, indices, overview, kibana } = request.body; + const { elasticsearch, overview, kibana } = request.body; return response.ok({ body: await upsertUIOpenOption({ savedObjects: getSavedObjectsService(), - cluster, - indices, + elasticsearch, overview, kibana, }), diff --git a/x-pack/plugins/upgrade_assistant/server/saved_object_types/telemetry_saved_object_type.ts b/x-pack/plugins/upgrade_assistant/server/saved_object_types/telemetry_saved_object_type.ts index f76c07da678da..42d5d339dd050 100644 --- a/x-pack/plugins/upgrade_assistant/server/saved_object_types/telemetry_saved_object_type.ts +++ b/x-pack/plugins/upgrade_assistant/server/saved_object_types/telemetry_saved_object_type.ts @@ -21,11 +21,7 @@ export const telemetrySavedObjectType: SavedObjectsType = { type: 'long', null_value: 0, }, - cluster: { - type: 'long', - null_value: 0, - }, - indices: { + elasticsearch: { type: 'long', null_value: 0, }, From 0f75573b0fba47296e0b872826706448fdf852cd Mon Sep 17 00:00:00 2001 From: Pete Hampton Date: Fri, 20 Aug 2021 14:03:37 +0100 Subject: [PATCH 34/44] Exception List Telemetry (#107765) --- .../server/lib/telemetry/constants.ts | 14 ++ .../server/lib/telemetry/endpoint_task.ts | 3 +- .../server/lib/telemetry/helpers.test.ts | 69 +++++++++ .../server/lib/telemetry/helpers.ts | 79 +++++++++- .../server/lib/telemetry/mocks.ts | 6 +- ...sk.test.ts => security_lists_task.test.ts} | 41 +++--- .../lib/telemetry/security_lists_task.ts | 138 ++++++++++++++++++ .../server/lib/telemetry/sender.ts | 39 ++++- .../server/lib/telemetry/trusted_apps_task.ts | 122 ---------------- .../server/lib/telemetry/types.ts | 43 ++++++ 10 files changed, 402 insertions(+), 152 deletions(-) create mode 100644 x-pack/plugins/security_solution/server/lib/telemetry/constants.ts rename x-pack/plugins/security_solution/server/lib/telemetry/{trusted_apps_task.test.ts => security_lists_task.test.ts} (66%) create mode 100644 x-pack/plugins/security_solution/server/lib/telemetry/security_lists_task.ts delete mode 100644 x-pack/plugins/security_solution/server/lib/telemetry/trusted_apps_task.ts diff --git a/x-pack/plugins/security_solution/server/lib/telemetry/constants.ts b/x-pack/plugins/security_solution/server/lib/telemetry/constants.ts new file mode 100644 index 0000000000000..3ef45a554e7a5 --- /dev/null +++ b/x-pack/plugins/security_solution/server/lib/telemetry/constants.ts @@ -0,0 +1,14 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export const TELEMETRY_CHANNEL_LISTS = 'security-lists'; + +export const TELEMETRY_CHANNEL_ENDPOINT_META = 'endpoint-metadata'; + +export const LIST_ENDPOINT_EXCEPTION = 'endpoint_exception'; + +export const LIST_ENDPOINT_EVENT_FILTER = 'endpoint_event_filter'; diff --git a/x-pack/plugins/security_solution/server/lib/telemetry/endpoint_task.ts b/x-pack/plugins/security_solution/server/lib/telemetry/endpoint_task.ts index 13b4ebf0b3efb..668696f0dce1d 100644 --- a/x-pack/plugins/security_solution/server/lib/telemetry/endpoint_task.ts +++ b/x-pack/plugins/security_solution/server/lib/telemetry/endpoint_task.ts @@ -25,6 +25,7 @@ import { EndpointPolicyResponseAggregation, EndpointPolicyResponseDocument, } from './types'; +import { TELEMETRY_CHANNEL_ENDPOINT_META } from './constants'; export const TelemetryEndpointTaskConstants = { TIMEOUT: '5m', @@ -326,7 +327,7 @@ export class TelemetryEndpointTask { * Send the documents in a batches of 100 */ batchTelemetryRecords(telemetryPayloads, 100).forEach((telemetryBatch) => - this.sender.sendOnDemand('endpoint-metadata', telemetryBatch) + this.sender.sendOnDemand(TELEMETRY_CHANNEL_ENDPOINT_META, telemetryBatch) ); return telemetryPayloads.length; } catch (err) { diff --git a/x-pack/plugins/security_solution/server/lib/telemetry/helpers.test.ts b/x-pack/plugins/security_solution/server/lib/telemetry/helpers.test.ts index bee673fc8725f..a4d11b71f2a8e 100644 --- a/x-pack/plugins/security_solution/server/lib/telemetry/helpers.test.ts +++ b/x-pack/plugins/security_solution/server/lib/telemetry/helpers.test.ts @@ -7,12 +7,17 @@ import moment from 'moment'; import { createMockPackagePolicy } from './mocks'; +import { TrustedApp } from '../../../common/endpoint/types'; +import { LIST_ENDPOINT_EXCEPTION, LIST_ENDPOINT_EVENT_FILTER } from './constants'; import { getPreviousDiagTaskTimestamp, getPreviousEpMetaTaskTimestamp, batchTelemetryRecords, isPackagePolicyList, + templateTrustedApps, + templateEndpointExceptions, } from './helpers'; +import { EndpointExceptionListItem } from './types'; describe('test diagnostic telemetry scheduled task timing helper', () => { test('test -5 mins is returned when there is no previous task run', async () => { @@ -125,3 +130,67 @@ describe('test package policy type guard', () => { expect(result).toEqual(true); }); }); + +describe('list telemetry schema', () => { + test('trusted apps document is correctly formed', () => { + const data = [{ id: 'test_1' }] as TrustedApp[]; + const templatedItems = templateTrustedApps(data); + + expect(templatedItems[0]?.trusted_application.length).toEqual(1); + expect(templatedItems[0]?.endpoint_exception.length).toEqual(0); + expect(templatedItems[0]?.endpoint_event_filter.length).toEqual(0); + }); + + test('trusted apps document is correctly formed with multiple entries', () => { + const data = [{ id: 'test_2' }, { id: 'test_2' }] as TrustedApp[]; + const templatedItems = templateTrustedApps(data); + + expect(templatedItems[0]?.trusted_application.length).toEqual(1); + expect(templatedItems[1]?.trusted_application.length).toEqual(1); + expect(templatedItems[0]?.endpoint_exception.length).toEqual(0); + expect(templatedItems[0]?.endpoint_event_filter.length).toEqual(0); + }); + + test('endpoint exception document is correctly formed', () => { + const data = [{ id: 'test_3' }] as EndpointExceptionListItem[]; + const templatedItems = templateEndpointExceptions(data, LIST_ENDPOINT_EXCEPTION); + + expect(templatedItems[0]?.trusted_application.length).toEqual(0); + expect(templatedItems[0]?.endpoint_exception.length).toEqual(1); + expect(templatedItems[0]?.endpoint_event_filter.length).toEqual(0); + }); + + test('endpoint exception document is correctly formed with multiple entries', () => { + const data = [ + { id: 'test_4' }, + { id: 'test_4' }, + { id: 'test_4' }, + ] as EndpointExceptionListItem[]; + const templatedItems = templateEndpointExceptions(data, LIST_ENDPOINT_EXCEPTION); + + expect(templatedItems[0]?.trusted_application.length).toEqual(0); + expect(templatedItems[0]?.endpoint_exception.length).toEqual(1); + expect(templatedItems[1]?.endpoint_exception.length).toEqual(1); + expect(templatedItems[2]?.endpoint_exception.length).toEqual(1); + expect(templatedItems[0]?.endpoint_event_filter.length).toEqual(0); + }); + + test('endpoint event filters document is correctly formed', () => { + const data = [{ id: 'test_5' }] as EndpointExceptionListItem[]; + const templatedItems = templateEndpointExceptions(data, LIST_ENDPOINT_EVENT_FILTER); + + expect(templatedItems[0]?.trusted_application.length).toEqual(0); + expect(templatedItems[0]?.endpoint_exception.length).toEqual(0); + expect(templatedItems[0]?.endpoint_event_filter.length).toEqual(1); + }); + + test('endpoint event filters document is correctly formed with multiple entries', () => { + const data = [{ id: 'test_6' }, { id: 'test_6' }] as EndpointExceptionListItem[]; + const templatedItems = templateEndpointExceptions(data, LIST_ENDPOINT_EVENT_FILTER); + + expect(templatedItems[0]?.trusted_application.length).toEqual(0); + expect(templatedItems[0]?.endpoint_exception.length).toEqual(0); + expect(templatedItems[0]?.endpoint_event_filter.length).toEqual(1); + expect(templatedItems[1]?.endpoint_event_filter.length).toEqual(1); + }); +}); diff --git a/x-pack/plugins/security_solution/server/lib/telemetry/helpers.ts b/x-pack/plugins/security_solution/server/lib/telemetry/helpers.ts index 6af258a4cbe64..bb2cc4f42ca90 100644 --- a/x-pack/plugins/security_solution/server/lib/telemetry/helpers.ts +++ b/x-pack/plugins/security_solution/server/lib/telemetry/helpers.ts @@ -6,7 +6,11 @@ */ import moment from 'moment'; +import type { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types'; +import { TrustedApp } from '../../../common/endpoint/types'; import { PackagePolicy } from '../../../../fleet/common/types/models/package_policy'; +import { EndpointExceptionListItem, ListTemplate } from './types'; +import { LIST_ENDPOINT_EXCEPTION, LIST_ENDPOINT_EVENT_FILTER } from './constants'; /** * Determines the when the last run was in order to execute to. @@ -84,9 +88,82 @@ export function isPackagePolicyList( return (data as PackagePolicy[])[0].inputs !== undefined; } +/** + * Maps Exception list item to parsable object + * + * @param exceptionListItem + * @returns collection of endpoint exceptions + */ +export const exceptionListItemToEndpointEntry = (exceptionListItem: ExceptionListItemSchema) => { + return { + id: exceptionListItem.id, + version: exceptionListItem._version || '', + name: exceptionListItem.name, + description: exceptionListItem.description, + created_at: exceptionListItem.created_at, + created_by: exceptionListItem.created_by, + updated_at: exceptionListItem.updated_at, + updated_by: exceptionListItem.updated_by, + entries: exceptionListItem.entries, + os_types: exceptionListItem.os_types, + } as EndpointExceptionListItem; +}; + +/** + * Constructs the lists telemetry schema from a collection of Trusted Apps + * + * @param listData + * @returns lists telemetry schema + */ +export const templateTrustedApps = (listData: TrustedApp[]) => { + return listData.map((item) => { + const template: ListTemplate = { + trusted_application: [], + endpoint_exception: [], + endpoint_event_filter: [], + }; + + template.trusted_application.push(item); + return template; + }); +}; + +/** + * Consructs the list telemetry schema from a collection of endpoint exceptions + * + * @param listData + * @param listType + * @returns lists telemetry schema + */ +export const templateEndpointExceptions = ( + listData: EndpointExceptionListItem[], + listType: string +) => { + return listData.map((item) => { + const template: ListTemplate = { + trusted_application: [], + endpoint_exception: [], + endpoint_event_filter: [], + }; + + if (listType === LIST_ENDPOINT_EXCEPTION) { + template.endpoint_exception.push(item); + return template; + } + + if (listType === LIST_ENDPOINT_EVENT_FILTER) { + template.endpoint_event_filter.push(item); + return template; + } + + return null; + }); +}; + /** * Convert counter label list to kebab case - * @params label_list the list of labels to create standardized UsageCounter from + * + * @param label_list the list of labels to create standardized UsageCounter from * @returns a string label for usage in the UsageCounter */ export function createUsageCounterLabel(labelList: string[]): string { diff --git a/x-pack/plugins/security_solution/server/lib/telemetry/mocks.ts b/x-pack/plugins/security_solution/server/lib/telemetry/mocks.ts index 642be5fc737f7..a38042e214ceb 100644 --- a/x-pack/plugins/security_solution/server/lib/telemetry/mocks.ts +++ b/x-pack/plugins/security_solution/server/lib/telemetry/mocks.ts @@ -9,7 +9,7 @@ import { TelemetryEventsSender } from './sender'; import { TelemetryDiagTask } from './diagnostic_task'; import { TelemetryEndpointTask } from './endpoint_task'; -import { TelemetryTrustedAppsTask } from './trusted_apps_task'; +import { TelemetryExceptionListsTask } from './security_lists_task'; import { PackagePolicy } from '../../../../fleet/common/types/models/package_policy'; /** @@ -69,8 +69,8 @@ export class MockTelemetryEndpointTask extends TelemetryEndpointTask { } /** - * Creates a mocked Telemetry trusted app Task + * Creates a mocked Telemetry exception lists Task */ -export class MockTelemetryTrustedAppTask extends TelemetryTrustedAppsTask { +export class MockExceptionListsTask extends TelemetryExceptionListsTask { public runTask = jest.fn(); } diff --git a/x-pack/plugins/security_solution/server/lib/telemetry/trusted_apps_task.test.ts b/x-pack/plugins/security_solution/server/lib/telemetry/security_lists_task.test.ts similarity index 66% rename from x-pack/plugins/security_solution/server/lib/telemetry/trusted_apps_task.test.ts rename to x-pack/plugins/security_solution/server/lib/telemetry/security_lists_task.test.ts index 5cd67a9c9c215..20d89c9721b27 100644 --- a/x-pack/plugins/security_solution/server/lib/telemetry/trusted_apps_task.test.ts +++ b/x-pack/plugins/security_solution/server/lib/telemetry/security_lists_task.test.ts @@ -9,10 +9,13 @@ import { loggingSystemMock } from 'src/core/server/mocks'; import { TaskStatus } from '../../../../task_manager/server'; import { taskManagerMock } from '../../../../task_manager/server/mocks'; -import { TelemetryTrustedAppsTask, TelemetryTrustedAppsTaskConstants } from './trusted_apps_task'; -import { createMockTelemetryEventsSender, MockTelemetryTrustedAppTask } from './mocks'; +import { + TelemetryExceptionListsTask, + TelemetrySecuityListsTaskConstants, +} from './security_lists_task'; +import { createMockTelemetryEventsSender, MockExceptionListsTask } from './mocks'; -describe('test trusted apps telemetry task functionality', () => { +describe('test exception list telemetry task functionality', () => { let logger: ReturnType; beforeEach(() => { @@ -20,25 +23,25 @@ describe('test trusted apps telemetry task functionality', () => { }); test('the trusted apps task can register', () => { - const telemetryTrustedAppsTask = new TelemetryTrustedAppsTask( + const telemetryTrustedAppsTask = new TelemetryExceptionListsTask( logger, taskManagerMock.createSetup(), createMockTelemetryEventsSender(true) ); - expect(telemetryTrustedAppsTask).toBeInstanceOf(TelemetryTrustedAppsTask); + expect(telemetryTrustedAppsTask).toBeInstanceOf(TelemetryExceptionListsTask); }); - test('the trusted apps task should be registered', () => { + test('the exception list task should be registered', () => { const mockTaskManager = taskManagerMock.createSetup(); - new TelemetryTrustedAppsTask(logger, mockTaskManager, createMockTelemetryEventsSender(true)); + new TelemetryExceptionListsTask(logger, mockTaskManager, createMockTelemetryEventsSender(true)); expect(mockTaskManager.registerTaskDefinitions).toHaveBeenCalled(); }); - test('the trusted apps task should be scheduled', async () => { + test('the exception list task should be scheduled', async () => { const mockTaskManagerSetup = taskManagerMock.createSetup(); - const telemetryTrustedAppsTask = new TelemetryTrustedAppsTask( + const telemetryTrustedAppsTask = new TelemetryExceptionListsTask( logger, mockTaskManagerSetup, createMockTelemetryEventsSender(true) @@ -49,13 +52,13 @@ describe('test trusted apps telemetry task functionality', () => { expect(mockTaskManagerStart.ensureScheduled).toHaveBeenCalled(); }); - test('the trusted apps task should not query elastic if telemetry is not opted in', async () => { + test('the exception list task should not query elastic if telemetry is not opted in', async () => { const mockSender = createMockTelemetryEventsSender(false); const mockTaskManager = taskManagerMock.createSetup(); - new MockTelemetryTrustedAppTask(logger, mockTaskManager, mockSender); + new MockExceptionListsTask(logger, mockTaskManager, mockSender); const mockTaskInstance = { - id: TelemetryTrustedAppsTaskConstants.TYPE, + id: TelemetrySecuityListsTaskConstants.TYPE, runAt: new Date(), attempts: 0, ownerId: '', @@ -65,28 +68,28 @@ describe('test trusted apps telemetry task functionality', () => { retryAt: new Date(), params: {}, state: {}, - taskType: TelemetryTrustedAppsTaskConstants.TYPE, + taskType: TelemetrySecuityListsTaskConstants.TYPE, }; const createTaskRunner = mockTaskManager.registerTaskDefinitions.mock.calls[0][0][ - TelemetryTrustedAppsTaskConstants.TYPE + TelemetrySecuityListsTaskConstants.TYPE ].createTaskRunner; const taskRunner = createTaskRunner({ taskInstance: mockTaskInstance }); await taskRunner.run(); expect(mockSender.fetchTrustedApplications).not.toHaveBeenCalled(); }); - test('the trusted apps task should query elastic if telemetry opted in', async () => { + test('the exception list task should query elastic if telemetry opted in', async () => { const mockSender = createMockTelemetryEventsSender(true); const mockTaskManager = taskManagerMock.createSetup(); - const telemetryTrustedAppsTask = new MockTelemetryTrustedAppTask( + const telemetryTrustedAppsTask = new MockExceptionListsTask( logger, mockTaskManager, mockSender ); const mockTaskInstance = { - id: TelemetryTrustedAppsTaskConstants.TYPE, + id: TelemetrySecuityListsTaskConstants.TYPE, runAt: new Date(), attempts: 0, ownerId: '', @@ -96,11 +99,11 @@ describe('test trusted apps telemetry task functionality', () => { retryAt: new Date(), params: {}, state: {}, - taskType: TelemetryTrustedAppsTaskConstants.TYPE, + taskType: TelemetrySecuityListsTaskConstants.TYPE, }; const createTaskRunner = mockTaskManager.registerTaskDefinitions.mock.calls[0][0][ - TelemetryTrustedAppsTaskConstants.TYPE + TelemetrySecuityListsTaskConstants.TYPE ].createTaskRunner; const taskRunner = createTaskRunner({ taskInstance: mockTaskInstance }); await taskRunner.run(); diff --git a/x-pack/plugins/security_solution/server/lib/telemetry/security_lists_task.ts b/x-pack/plugins/security_solution/server/lib/telemetry/security_lists_task.ts new file mode 100644 index 0000000000000..1c4dc28f1c5a5 --- /dev/null +++ b/x-pack/plugins/security_solution/server/lib/telemetry/security_lists_task.ts @@ -0,0 +1,138 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import moment from 'moment'; +import { Logger } from 'src/core/server'; +import { + ENDPOINT_LIST_ID, + ENDPOINT_EVENT_FILTERS_LIST_ID, +} from '@kbn/securitysolution-list-constants'; +import { + ConcreteTaskInstance, + TaskManagerSetupContract, + TaskManagerStartContract, +} from '../../../../task_manager/server'; +import { + LIST_ENDPOINT_EXCEPTION, + LIST_ENDPOINT_EVENT_FILTER, + TELEMETRY_CHANNEL_LISTS, +} from './constants'; +import { batchTelemetryRecords, templateEndpointExceptions, templateTrustedApps } from './helpers'; +import { TelemetryEventsSender } from './sender'; + +export const TelemetrySecuityListsTaskConstants = { + TIMEOUT: '3m', + TYPE: 'security:telemetry-lists', + INTERVAL: '24h', + VERSION: '1.0.0', +}; + +const MAX_TELEMETRY_BATCH = 1_000; + +export class TelemetryExceptionListsTask { + private readonly logger: Logger; + private readonly sender: TelemetryEventsSender; + + constructor( + logger: Logger, + taskManager: TaskManagerSetupContract, + sender: TelemetryEventsSender + ) { + this.logger = logger; + this.sender = sender; + + taskManager.registerTaskDefinitions({ + [TelemetrySecuityListsTaskConstants.TYPE]: { + title: 'Security Solution Lists Telemetry', + timeout: TelemetrySecuityListsTaskConstants.TIMEOUT, + createTaskRunner: ({ taskInstance }: { taskInstance: ConcreteTaskInstance }) => { + const { state } = taskInstance; + + return { + run: async () => { + const taskExecutionTime = moment().utc().toISOString(); + const hits = await this.runTask(taskInstance.id); + + return { + state: { + lastExecutionTimestamp: taskExecutionTime, + runs: (state.runs || 0) + 1, + hits, + }, + }; + }, + cancel: async () => {}, + }; + }, + }, + }); + } + + public start = async (taskManager: TaskManagerStartContract) => { + try { + await taskManager.ensureScheduled({ + id: this.getTaskId(), + taskType: TelemetrySecuityListsTaskConstants.TYPE, + scope: ['securitySolution'], + schedule: { + interval: TelemetrySecuityListsTaskConstants.INTERVAL, + }, + state: { runs: 0 }, + params: { version: TelemetrySecuityListsTaskConstants.VERSION }, + }); + } catch (e) { + this.logger.error(`Error scheduling task, received ${e.message}`); + } + }; + + private getTaskId = (): string => { + return `${TelemetrySecuityListsTaskConstants.TYPE}:${TelemetrySecuityListsTaskConstants.VERSION}`; + }; + + public runTask = async (taskId: string) => { + if (taskId !== this.getTaskId()) { + return 0; + } + + const isOptedIn = await this.sender.isTelemetryOptedIn(); + if (!isOptedIn) { + return 0; + } + + // Lists Telemetry: Trusted Applications + + const trustedApps = await this.sender.fetchTrustedApplications(); + const trustedAppsJson = templateTrustedApps(trustedApps.data); + this.logger.debug(`Trusted Apps: ${trustedAppsJson}`); + + batchTelemetryRecords(trustedAppsJson, MAX_TELEMETRY_BATCH).forEach((batch) => + this.sender.sendOnDemand(TELEMETRY_CHANNEL_LISTS, batch) + ); + + // Lists Telemetry: Endpoint Exceptions + + const epExceptions = await this.sender.fetchEndpointList(ENDPOINT_LIST_ID); + const epExceptionsJson = templateEndpointExceptions(epExceptions.data, LIST_ENDPOINT_EXCEPTION); + this.logger.debug(`EP Exceptions: ${epExceptionsJson}`); + + batchTelemetryRecords(epExceptionsJson, MAX_TELEMETRY_BATCH).forEach((batch) => + this.sender.sendOnDemand(TELEMETRY_CHANNEL_LISTS, batch) + ); + + // Lists Telemetry: Endpoint Event Filters + + const epFilters = await this.sender.fetchEndpointList(ENDPOINT_EVENT_FILTERS_LIST_ID); + const epFiltersJson = templateEndpointExceptions(epFilters.data, LIST_ENDPOINT_EVENT_FILTER); + this.logger.debug(`EP Event Filters: ${epFiltersJson}`); + + batchTelemetryRecords(epFiltersJson, MAX_TELEMETRY_BATCH).forEach((batch) => + this.sender.sendOnDemand(TELEMETRY_CHANNEL_LISTS, batch) + ); + + return trustedAppsJson.length + epExceptionsJson.length + epFiltersJson.length; + }; +} diff --git a/x-pack/plugins/security_solution/server/lib/telemetry/sender.ts b/x-pack/plugins/security_solution/server/lib/telemetry/sender.ts index 5724c61bfcee7..c7bb58dd2251b 100644 --- a/x-pack/plugins/security_solution/server/lib/telemetry/sender.ts +++ b/x-pack/plugins/security_solution/server/lib/telemetry/sender.ts @@ -18,14 +18,15 @@ import { TaskManagerSetupContract, TaskManagerStartContract, } from '../../../../task_manager/server'; -import { createUsageCounterLabel } from './helpers'; import { TelemetryDiagTask } from './diagnostic_task'; import { TelemetryEndpointTask } from './endpoint_task'; -import { TelemetryTrustedAppsTask } from './trusted_apps_task'; +import { TelemetryExceptionListsTask } from './security_lists_task'; import { EndpointAppContextService } from '../../endpoint/endpoint_app_context_services'; import { AgentService, AgentPolicyServiceInterface } from '../../../../fleet/server'; -import { ExceptionListClient } from '../../../../lists/server'; import { getTrustedAppsList } from '../../endpoint/routes/trusted_apps/service'; +import { ExceptionListClient } from '../../../../lists/server'; +import { GetEndpointListResponse } from './types'; +import { createUsageCounterLabel, exceptionListItemToEndpointEntry } from './helpers'; type BaseSearchTypes = string | number | boolean | object; export type SearchTypes = BaseSearchTypes | BaseSearchTypes[] | undefined; @@ -63,7 +64,7 @@ export class TelemetryEventsSender { private isOptedIn?: boolean = true; // Assume true until the first check private diagTask?: TelemetryDiagTask; private epMetricsTask?: TelemetryEndpointTask; - private trustedAppsTask?: TelemetryTrustedAppsTask; + private exceptionListTask?: TelemetryExceptionListsTask; private agentService?: AgentService; private agentPolicyService?: AgentPolicyServiceInterface; private esClient?: ElasticsearchClient; @@ -86,7 +87,7 @@ export class TelemetryEventsSender { if (taskManager) { this.diagTask = new TelemetryDiagTask(this.logger, taskManager, this); this.epMetricsTask = new TelemetryEndpointTask(this.logger, taskManager, this); - this.trustedAppsTask = new TelemetryTrustedAppsTask(this.logger, taskManager, this); + this.exceptionListTask = new TelemetryExceptionListsTask(this.logger, taskManager, this); } } @@ -108,7 +109,7 @@ export class TelemetryEventsSender { this.logger.debug(`Starting diagnostic and endpoint telemetry tasks`); this.diagTask.start(taskManager); this.epMetricsTask.start(taskManager); - this.trustedAppsTask?.start(taskManager); + this.exceptionListTask?.start(taskManager); } this.logger.debug(`Starting local task`); @@ -279,6 +280,32 @@ export class TelemetryEventsSender { return getTrustedAppsList(this.exceptionListClient, { page: 1, per_page: 10_000 }); } + public async fetchEndpointList(listId: string): Promise { + if (this?.exceptionListClient === undefined || this?.exceptionListClient === null) { + throw Error('could not fetch trusted applications. exception list client not available.'); + } + + // Ensure list is created if it does not exist + await this.exceptionListClient.createTrustedAppsList(); + + const results = await this.exceptionListClient.findExceptionListItem({ + listId, + page: 1, + perPage: this.max_records, + filter: undefined, + namespaceType: 'agnostic', + sortField: 'name', + sortOrder: 'asc', + }); + + return { + data: results?.data.map(exceptionListItemToEndpointEntry) ?? [], + total: results?.total ?? 0, + page: results?.page ?? 1, + per_page: results?.per_page ?? this.max_records, + }; + } + public queueTelemetryEvents(events: TelemetryEvent[]) { const qlength = this.queue.length; diff --git a/x-pack/plugins/security_solution/server/lib/telemetry/trusted_apps_task.ts b/x-pack/plugins/security_solution/server/lib/telemetry/trusted_apps_task.ts deleted file mode 100644 index f91f3e8428d04..0000000000000 --- a/x-pack/plugins/security_solution/server/lib/telemetry/trusted_apps_task.ts +++ /dev/null @@ -1,122 +0,0 @@ -/* - * 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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import moment from 'moment'; -import { Logger } from 'src/core/server'; -import { - ConcreteTaskInstance, - TaskManagerSetupContract, - TaskManagerStartContract, -} from '../../../../task_manager/server'; - -import { getPreviousEpMetaTaskTimestamp, batchTelemetryRecords } from './helpers'; -import { TelemetryEventsSender } from './sender'; - -export const TelemetryTrustedAppsTaskConstants = { - TIMEOUT: '1m', - TYPE: 'security:trusted-apps-telemetry', - INTERVAL: '24h', - VERSION: '1.0.0', -}; - -/** Telemetry Trusted Apps Task - * - * The Trusted Apps task is a daily batch job that collects and transmits non-sensitive - * trusted apps hashes + file paths for supported operating systems. This helps test - * efficacy of our protections. - */ -export class TelemetryTrustedAppsTask { - private readonly logger: Logger; - private readonly sender: TelemetryEventsSender; - - constructor( - logger: Logger, - taskManager: TaskManagerSetupContract, - sender: TelemetryEventsSender - ) { - this.logger = logger; - this.sender = sender; - - taskManager.registerTaskDefinitions({ - [TelemetryTrustedAppsTaskConstants.TYPE]: { - title: 'Security Solution Telemetry Endpoint Metrics and Info task', - timeout: TelemetryTrustedAppsTaskConstants.TIMEOUT, - createTaskRunner: ({ taskInstance }: { taskInstance: ConcreteTaskInstance }) => { - const { state } = taskInstance; - - return { - run: async () => { - const taskExecutionTime = moment().utc().toISOString(); - const lastExecutionTimestamp = getPreviousEpMetaTaskTimestamp( - taskExecutionTime, - taskInstance.state?.lastExecutionTimestamp - ); - - const hits = await this.runTask( - taskInstance.id, - lastExecutionTimestamp, - taskExecutionTime - ); - - return { - state: { - lastExecutionTimestamp: taskExecutionTime, - runs: (state.runs || 0) + 1, - hits, - }, - }; - }, - cancel: async () => {}, - }; - }, - }, - }); - } - - public start = async (taskManager: TaskManagerStartContract) => { - try { - await taskManager.ensureScheduled({ - id: this.getTaskId(), - taskType: TelemetryTrustedAppsTaskConstants.TYPE, - scope: ['securitySolution'], - schedule: { - interval: TelemetryTrustedAppsTaskConstants.INTERVAL, - }, - state: { runs: 0 }, - params: { version: TelemetryTrustedAppsTaskConstants.VERSION }, - }); - } catch (e) { - this.logger.error(`Error scheduling task, received ${e.message}`); - } - }; - - private getTaskId = (): string => { - return `${TelemetryTrustedAppsTaskConstants.TYPE}:${TelemetryTrustedAppsTaskConstants.VERSION}`; - }; - - public runTask = async (taskId: string, executeFrom: string, executeTo: string) => { - if (taskId !== this.getTaskId()) { - this.logger.debug(`Outdated task running: ${taskId}`); - return 0; - } - - const isOptedIn = await this.sender.isTelemetryOptedIn(); - if (!isOptedIn) { - this.logger.debug(`Telemetry is not opted-in.`); - return 0; - } - - const response = await this.sender.fetchTrustedApplications(); - this.logger.debug(`Trusted Apps: ${response}`); - - batchTelemetryRecords(response.data, 1_000).forEach((telemetryBatch) => - this.sender.sendOnDemand('lists-trustedapps', telemetryBatch) - ); - - return response.data.length; - }; -} diff --git a/x-pack/plugins/security_solution/server/lib/telemetry/types.ts b/x-pack/plugins/security_solution/server/lib/telemetry/types.ts index 355393145fa0b..d1d7740071e1f 100644 --- a/x-pack/plugins/security_solution/server/lib/telemetry/types.ts +++ b/x-pack/plugins/security_solution/server/lib/telemetry/types.ts @@ -5,6 +5,9 @@ * 2.0. */ +import { schema, TypeOf } from '@kbn/config-schema'; +import { TrustedApp } from '../../../common/endpoint/types'; + // EP Policy Response export interface EndpointPolicyResponseAggregation { @@ -138,3 +141,43 @@ interface EndpointMetricOS { platform: string; full: string; } + +// List HTTP Types + +export const GetTrustedAppsRequestSchema = { + query: schema.object({ + page: schema.maybe(schema.number({ defaultValue: 1, min: 1 })), + per_page: schema.maybe(schema.number({ defaultValue: 20, min: 1 })), + kuery: schema.maybe(schema.string()), + }), +}; + +export type GetEndpointListRequest = TypeOf; + +export interface GetEndpointListResponse { + per_page: number; + page: number; + total: number; + data: EndpointExceptionListItem[]; +} + +// Telemetry List types + +export interface EndpointExceptionListItem { + id: string; + version: string; + name: string; + description: string; + created_at: string; + created_by: string; + updated_at: string; + updated_by: string; + entries: object; + os_types: object; +} + +export interface ListTemplate { + trusted_application: TrustedApp[]; + endpoint_exception: EndpointExceptionListItem[]; + endpoint_event_filter: EndpointExceptionListItem[]; +} From 0e39eeb8a968d5239bc599e7f87a5c355ac4a685 Mon Sep 17 00:00:00 2001 From: Aleh Zasypkin Date: Fri, 20 Aug 2021 16:07:09 +0200 Subject: [PATCH 35/44] Remove dashbord_only_user role asserting from the reserved roles test. (#109422) --- .../functional/apps/security/{users.js => users.ts} | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) rename x-pack/test/functional/apps/security/{users.js => users.ts} (93%) diff --git a/x-pack/test/functional/apps/security/users.js b/x-pack/test/functional/apps/security/users.ts similarity index 93% rename from x-pack/test/functional/apps/security/users.js rename to x-pack/test/functional/apps/security/users.ts index 6f9af40badd05..2c64e9ab5bb70 100644 --- a/x-pack/test/functional/apps/security/users.js +++ b/x-pack/test/functional/apps/security/users.ts @@ -7,13 +7,14 @@ import expect from '@kbn/expect'; import { keyBy } from 'lodash'; -export default function ({ getService, getPageObjects }) { +import { FtrProviderContext } from '../../ftr_provider_context'; + +export default function ({ getService, getPageObjects }: FtrProviderContext) { const PageObjects = getPageObjects(['security', 'settings']); const config = getService('config'); const log = getService('log'); - // FAILING ES PROMOTION: https://github.com/elastic/kibana/issues/109349 - describe.skip('users', function () { + describe('users', function () { before(async () => { log.debug('users'); await PageObjects.settings.navigateTo(); @@ -105,9 +106,6 @@ export default function ({ getService, getPageObjects }) { expect(roles.kibana_user.reserved).to.be(true); expect(roles.kibana_user.deprecated).to.be(true); - expect(roles.kibana_dashboard_only_user.reserved).to.be(true); - expect(roles.kibana_dashboard_only_user.deprecated).to.be(true); - expect(roles.kibana_system.reserved).to.be(true); expect(roles.kibana_system.deprecated).to.be(false); From ff1714017977503fb853bbd427326271649dccbf Mon Sep 17 00:00:00 2001 From: Devon Thomson Date: Fri, 20 Aug 2021 10:38:59 -0400 Subject: [PATCH 36/44] [Input Controls] Options List Data Fetch In Embeddable (#108226) Moved data fetching from react component into embeddable class. This cleans up the component, and allows for more accurate comparison before firing async requests --- .../options_list/options_list_component.tsx | 151 +++++------------ .../options_list/options_list_embeddable.tsx | 152 +++++++++++++++++- .../options_list_popover_component.tsx | 10 +- .../input_controls/use_state_observable.ts | 23 +++ 4 files changed, 214 insertions(+), 122 deletions(-) create mode 100644 src/plugins/presentation_util/public/components/input_controls/use_state_observable.ts diff --git a/src/plugins/presentation_util/public/components/input_controls/control_types/options_list/options_list_component.tsx b/src/plugins/presentation_util/public/components/input_controls/control_types/options_list/options_list_component.tsx index 2feb527ff9160..4aff1ff4eee96 100644 --- a/src/plugins/presentation_util/public/components/input_controls/control_types/options_list/options_list_component.tsx +++ b/src/plugins/presentation_util/public/components/input_controls/control_types/options_list/options_list_component.tsx @@ -6,133 +6,63 @@ * Side Public License, v 1. */ -import React, { useMemo, useEffect, useState, useCallback, useRef } from 'react'; -import { debounceTime, tap } from 'rxjs/operators'; -import useMount from 'react-use/lib/useMount'; +import React, { useState } from 'react'; import classNames from 'classnames'; -import { Subject } from 'rxjs'; -import { EuiFilterButton, EuiFilterGroup, EuiPopover, EuiSelectableOption } from '@elastic/eui'; -import { - OptionsListDataFetcher, - OptionsListEmbeddable, - OptionsListEmbeddableInput, -} from './options_list_embeddable'; +import { EuiFilterButton, EuiFilterGroup, EuiPopover, EuiSelectableOption } from '@elastic/eui'; +import { Subject } from 'rxjs'; import { OptionsListStrings } from './options_list_strings'; -import { InputControlOutput } from '../../embeddable/types'; import { OptionsListPopover } from './options_list_popover_component'; -import { withEmbeddableSubscription } from '../../../../../../embeddable/public'; import './options_list.scss'; - -const toggleAvailableOptions = ( - indices: number[], - availableOptions: EuiSelectableOption[], - enabled: boolean -) => { - const newAvailableOptions = [...availableOptions]; - indices.forEach((index) => (newAvailableOptions[index].checked = enabled ? 'on' : undefined)); - return newAvailableOptions; -}; - -interface OptionsListProps { - input: OptionsListEmbeddableInput; - fetchData: OptionsListDataFetcher; +import { useStateObservable } from '../../use_state_observable'; + +export interface OptionsListComponentState { + availableOptions?: EuiSelectableOption[]; + selectedOptionsString?: string; + selectedOptionsCount?: number; + twoLineLayout?: boolean; + searchString?: string; + loading: boolean; } -export const OptionsListInner = ({ input, fetchData }: OptionsListProps) => { - const [availableOptions, setAvailableOptions] = useState([]); - const selectedOptions = useRef>(new Set()); - - // raw search string is stored here so it is remembered when popover is closed. - const [searchString, setSearchString] = useState(''); - const [debouncedSearchString, setDebouncedSearchString] = useState(); - +export const OptionsListComponent = ({ + componentStateSubject, + typeaheadSubject, + updateOption, +}: { + componentStateSubject: Subject; + typeaheadSubject: Subject; + updateOption: (index: number) => void; +}) => { const [isPopoverOpen, setIsPopoverOpen] = useState(false); - const [loading, setIsLoading] = useState(false); - - const typeaheadSubject = useMemo(() => new Subject(), []); - - useMount(() => { - typeaheadSubject - .pipe( - tap((rawSearchText) => setSearchString(rawSearchText)), - debounceTime(100) - ) - .subscribe((search) => setDebouncedSearchString(search)); - // default selections can be applied here... + const optionsListState = useStateObservable(componentStateSubject, { + loading: true, }); - const { indexPattern, timeRange, filters, field, query } = input; - useEffect(() => { - let canceled = false; - setIsLoading(true); - fetchData({ - search: debouncedSearchString, - indexPattern, - timeRange, - filters, - field, - query, - }).then((newOptions) => { - if (canceled) return; - setIsLoading(false); - // We now have new 'availableOptions', we need to ensure the previously selected options are still selected. - const enabledIndices: number[] = []; - selectedOptions.current?.forEach((selectedOption) => { - const optionIndex = newOptions.findIndex( - (availableOption) => availableOption.label === selectedOption - ); - if (optionIndex >= 0) enabledIndices.push(optionIndex); - }); - newOptions = toggleAvailableOptions(enabledIndices, newOptions, true); - setAvailableOptions(newOptions); - }); - return () => { - canceled = true; - }; - }, [indexPattern, timeRange, filters, field, query, debouncedSearchString, fetchData]); - - const updateItem = useCallback( - (index: number) => { - const item = availableOptions?.[index]; - if (!item) return; - - const toggleOff = availableOptions[index].checked === 'on'; - - const newAvailableOptions = toggleAvailableOptions([index], availableOptions, !toggleOff); - setAvailableOptions(newAvailableOptions); - - if (toggleOff) { - selectedOptions.current.delete(item.label); - } else { - selectedOptions.current.add(item.label); - } - }, - [availableOptions] - ); - - const selectedOptionsString = Array.from(selectedOptions.current).join( - OptionsListStrings.summary.getSeparator() - ); - const selectedOptionsLength = Array.from(selectedOptions.current).length; - - const { twoLineLayout } = input; + const { + selectedOptionsString, + selectedOptionsCount, + availableOptions, + twoLineLayout, + searchString, + loading, + } = optionsListState; const button = ( setIsPopoverOpen((openState) => !openState)} isSelected={isPopoverOpen} - numFilters={availableOptions.length} - hasActiveFilters={selectedOptionsLength > 0} - numActiveFilters={selectedOptionsLength} + numFilters={availableOptions?.length ?? 0} + hasActiveFilters={(selectedOptionsCount ?? 0) > 0} + numActiveFilters={selectedOptionsCount} > - {!selectedOptionsLength ? OptionsListStrings.summary.getPlaceholder() : selectedOptionsString} + {!selectedOptionsCount ? OptionsListStrings.summary.getPlaceholder() : selectedOptionsString} ); @@ -155,7 +85,7 @@ export const OptionsListInner = ({ input, fetchData }: OptionsListProps) => { > { ); }; - -export const OptionsListComponent = withEmbeddableSubscription< - OptionsListEmbeddableInput, - InputControlOutput, - OptionsListEmbeddable, - { fetchData: OptionsListDataFetcher } ->(OptionsListInner); diff --git a/src/plugins/presentation_util/public/components/input_controls/control_types/options_list/options_list_embeddable.tsx b/src/plugins/presentation_util/public/components/input_controls/control_types/options_list/options_list_embeddable.tsx index 4dcc4a75dc1f0..bdd3660606b7e 100644 --- a/src/plugins/presentation_util/public/components/input_controls/control_types/options_list/options_list_embeddable.tsx +++ b/src/plugins/presentation_util/public/components/input_controls/control_types/options_list/options_list_embeddable.tsx @@ -8,12 +8,39 @@ import React from 'react'; import ReactDOM from 'react-dom'; +import { merge, Subject } from 'rxjs'; +import deepEqual from 'fast-deep-equal'; import { EuiSelectableOption } from '@elastic/eui'; +import { tap, debounceTime, map, distinctUntilChanged } from 'rxjs/operators'; -import { OptionsListComponent } from './options_list_component'; +import { esFilters } from '../../../../../../data/public'; +import { OptionsListStrings } from './options_list_strings'; +import { OptionsListComponent, OptionsListComponentState } from './options_list_component'; import { Embeddable } from '../../../../../../embeddable/public'; import { InputControlInput, InputControlOutput } from '../../embeddable/types'; +const toggleAvailableOptions = ( + indices: number[], + availableOptions: EuiSelectableOption[], + enabled?: boolean +) => { + const newAvailableOptions = [...availableOptions]; + indices.forEach((index) => (newAvailableOptions[index].checked = enabled ? 'on' : undefined)); + return newAvailableOptions; +}; + +const diffDataFetchProps = ( + current?: OptionsListDataFetchProps, + last?: OptionsListDataFetchProps +) => { + if (!current || !last) return false; + const { filters: currentFilters, ...currentWithoutFilters } = current; + const { filters: lastFilters, ...lastWithoutFilters } = last; + if (!deepEqual(currentWithoutFilters, lastWithoutFilters)) return false; + if (!esFilters.compareFilters(lastFilters ?? [], currentFilters ?? [])) return false; + return true; +}; + interface OptionsListDataFetchProps { field: string; search?: string; @@ -32,6 +59,7 @@ export interface OptionsListEmbeddableInput extends InputControlInput { field: string; indexPattern: string; multiSelect: boolean; + defaultSelections?: string[]; } export class OptionsListEmbeddable extends Embeddable< OptionsListEmbeddableInput, @@ -42,6 +70,21 @@ export class OptionsListEmbeddable extends Embeddable< private node?: HTMLElement; private fetchData: OptionsListDataFetcher; + // internal state for this input control. + private selectedOptions: Set; + private typeaheadSubject: Subject = new Subject(); + private searchString: string = ''; + + private componentState: OptionsListComponentState; + private componentStateSubject$ = new Subject(); + private updateComponentState(changes: Partial) { + this.componentState = { + ...this.componentState, + ...changes, + }; + this.componentStateSubject$.next(this.componentState); + } + constructor( input: OptionsListEmbeddableInput, output: InputControlOutput, @@ -49,15 +92,118 @@ export class OptionsListEmbeddable extends Embeddable< ) { super(input, output); this.fetchData = fetchData; + + // populate default selections from input + this.selectedOptions = new Set(input.defaultSelections ?? []); + const { selectedOptionsCount, selectedOptionsString } = this.buildSelectedOptionsString(); + + // fetch available options when input changes or when search string has changed + const typeaheadPipe = this.typeaheadSubject.pipe( + tap((newSearchString) => (this.searchString = newSearchString)), + debounceTime(100) + ); + const inputPipe = this.getInput$().pipe( + map( + (newInput) => ({ + field: newInput.field, + indexPattern: newInput.indexPattern, + query: newInput.query, + filters: newInput.filters, + timeRange: newInput.timeRange, + }), + distinctUntilChanged(diffDataFetchProps) + ) + ); + merge(typeaheadPipe, inputPipe).subscribe(this.fetchAvailableOptions); + + // push changes from input into component state + this.getInput$().subscribe((newInput) => { + if (newInput.twoLineLayout !== this.componentState.twoLineLayout) + this.updateComponentState({ twoLineLayout: newInput.twoLineLayout }); + }); + + this.componentState = { + loading: true, + selectedOptionsCount, + selectedOptionsString, + twoLineLayout: input.twoLineLayout, + }; + this.updateComponentState(this.componentState); + } + + private fetchAvailableOptions = async () => { + this.updateComponentState({ loading: true }); + + const { indexPattern, timeRange, filters, field, query } = this.getInput(); + let newOptions = await this.fetchData({ + search: this.searchString, + indexPattern, + timeRange, + filters, + field, + query, + }); + + // We now have new 'availableOptions', we need to ensure the selected options are still selected in the new list. + const enabledIndices: number[] = []; + this.selectedOptions?.forEach((selectedOption) => { + const optionIndex = newOptions.findIndex( + (availableOption) => availableOption.label === selectedOption + ); + if (optionIndex >= 0) enabledIndices.push(optionIndex); + }); + newOptions = toggleAvailableOptions(enabledIndices, newOptions, true); + this.updateComponentState({ loading: false, availableOptions: newOptions }); + }; + + private updateOption = (index: number) => { + const item = this.componentState.availableOptions?.[index]; + if (!item) return; + const toggleOff = item.checked === 'on'; + + // update availableOptions to show selection check marks + const newAvailableOptions = toggleAvailableOptions( + [index], + this.componentState.availableOptions ?? [], + !toggleOff + ); + this.componentState.availableOptions = newAvailableOptions; + + // update selectedOptions string + if (toggleOff) this.selectedOptions.delete(item.label); + else this.selectedOptions.add(item.label); + const { selectedOptionsString, selectedOptionsCount } = this.buildSelectedOptionsString(); + this.updateComponentState({ selectedOptionsString, selectedOptionsCount }); + }; + + private buildSelectedOptionsString(): { + selectedOptionsString: string; + selectedOptionsCount: number; + } { + const selectedOptionsArray = Array.from(this.selectedOptions ?? []); + const selectedOptionsString = selectedOptionsArray.join( + OptionsListStrings.summary.getSeparator() + ); + const selectedOptionsCount = selectedOptionsArray.length; + return { selectedOptionsString, selectedOptionsCount }; } - reload = () => {}; + reload = () => { + this.fetchAvailableOptions(); + }; public render = (node: HTMLElement) => { if (this.node) { ReactDOM.unmountComponentAtNode(this.node); } this.node = node; - ReactDOM.render(, node); + ReactDOM.render( + , + node + ); }; } diff --git a/src/plugins/presentation_util/public/components/input_controls/control_types/options_list/options_list_popover_component.tsx b/src/plugins/presentation_util/public/components/input_controls/control_types/options_list/options_list_popover_component.tsx index cd558b99f9aa1..4bfce9eb377e9 100644 --- a/src/plugins/presentation_util/public/components/input_controls/control_types/options_list/options_list_popover_component.tsx +++ b/src/plugins/presentation_util/public/components/input_controls/control_types/options_list/options_list_popover_component.tsx @@ -23,14 +23,14 @@ import { OptionsListStrings } from './options_list_strings'; interface OptionsListPopoverProps { loading: boolean; typeaheadSubject: Subject; - searchString: string; - updateItem: (index: number) => void; - availableOptions: EuiSelectableOption[]; + searchString?: string; + updateOption: (index: number) => void; + availableOptions?: EuiSelectableOption[]; } export const OptionsListPopover = ({ loading, - updateItem, + updateOption, searchString, typeaheadSubject, availableOptions, @@ -53,7 +53,7 @@ export const OptionsListPopover = ({ updateItem(index)} + onClick={() => updateOption(index)} > {item.label} diff --git a/src/plugins/presentation_util/public/components/input_controls/use_state_observable.ts b/src/plugins/presentation_util/public/components/input_controls/use_state_observable.ts new file mode 100644 index 0000000000000..c317f11979f54 --- /dev/null +++ b/src/plugins/presentation_util/public/components/input_controls/use_state_observable.ts @@ -0,0 +1,23 @@ +/* + * 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 { useEffect, useState } from 'react'; +import { Observable } from 'rxjs'; + +export const useStateObservable = ( + stateObservable: Observable, + initialState: T +) => { + useEffect(() => { + const subscription = stateObservable.subscribe((newState) => setInnerState(newState)); + return () => subscription.unsubscribe(); + }, [stateObservable]); + const [innerState, setInnerState] = useState(initialState); + + return innerState; +}; From aa2897ce51ac60553d4eb9073369bfbeb1ac51ba Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Fri, 20 Aug 2021 16:50:05 +0200 Subject: [PATCH 37/44] [Discover] Fix runtime fields editor test in cloud environment (#109367) --- test/functional/apps/discover/_runtime_fields_editor.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/functional/apps/discover/_runtime_fields_editor.ts b/test/functional/apps/discover/_runtime_fields_editor.ts index 46fe5c34f4cf3..a77bc4c77568a 100644 --- a/test/functional/apps/discover/_runtime_fields_editor.ts +++ b/test/functional/apps/discover/_runtime_fields_editor.ts @@ -10,7 +10,6 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from './ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { - const log = getService('log'); const retry = getService('retry'); const testSubjects = getService('testSubjects'); const kibanaServer = getService('kibanaServer'); @@ -33,12 +32,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('discover integration with runtime fields editor', function describeIndexTests() { before(async function () { - await esArchiver.load('test/functional/fixtures/es_archiver/discover'); + await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover.json'); await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional'); await kibanaServer.uiSettings.replace(defaultSettings); - log.debug('discover'); + await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); await PageObjects.common.navigateToApp('discover'); - await PageObjects.timePicker.setDefaultAbsoluteRange(); }); it('allows adding custom label to existing fields', async function () { From 8ab068ae1eac4f933efcabb6a309d771b399b4e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Casper=20H=C3=BCbertz?= Date: Fri, 20 Aug 2021 16:55:25 +0200 Subject: [PATCH 38/44] [APM] Change panel style for license prompt (#109386) --- .../public/components/app/Settings/anomaly_detection/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/apm/public/components/app/Settings/anomaly_detection/index.tsx b/x-pack/plugins/apm/public/components/app/Settings/anomaly_detection/index.tsx index 57d141d763909..7293fb81f3303 100644 --- a/x-pack/plugins/apm/public/components/app/Settings/anomaly_detection/index.tsx +++ b/x-pack/plugins/apm/public/components/app/Settings/anomaly_detection/index.tsx @@ -45,7 +45,7 @@ export function AnomalyDetection() { if (!hasValidLicense) { return ( - + ); From 970cf589c59f179181eaa26b4aaeebcee5e14f0d Mon Sep 17 00:00:00 2001 From: Kaarina Tungseth Date: Fri, 20 Aug 2021 10:03:21 -0500 Subject: [PATCH 39/44] [DOCS] Reformats the Graph settings tables into definition lists (#108065) --- docs/settings/graph-settings.asciidoc | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/docs/settings/graph-settings.asciidoc b/docs/settings/graph-settings.asciidoc index 876e3dc936ccf..093edb0d08547 100644 --- a/docs/settings/graph-settings.asciidoc +++ b/docs/settings/graph-settings.asciidoc @@ -7,13 +7,5 @@ You do not need to configure any settings to use the {graph-features}. -[float] -[[general-graph-settings]] -==== General graph settings - -[cols="2*<"] -|=== -| `xpack.graph.enabled` {ess-icon} - | Set to `false` to disable the {graph-features}. - -|=== +`xpack.graph.enabled` {ess-icon}:: +Set to `false` to disable the {graph-features}. From 385d24b48a3ebcec893f500d23d98e458c688e5b Mon Sep 17 00:00:00 2001 From: Kaarina Tungseth Date: Fri, 20 Aug 2021 10:03:31 -0500 Subject: [PATCH 40/44] [DOCS] Reformats the Development tools settings tables into definition lists (#107967) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- docs/settings/dev-settings.asciidoc | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/docs/settings/dev-settings.asciidoc b/docs/settings/dev-settings.asciidoc index 810694f46b317..b7edf36851d91 100644 --- a/docs/settings/dev-settings.asciidoc +++ b/docs/settings/dev-settings.asciidoc @@ -12,31 +12,20 @@ They are enabled by default. [[grok-settings]] ==== Grok Debugger settings -[cols="2*<"] -|=== -| `xpack.grokdebugger.enabled` {ess-icon} - | Set to `true` to enable the <>. Defaults to `true`. +`xpack.grokdebugger.enabled` {ess-icon}:: +Set to `true` to enable the <>. Defaults to `true`. -|=== [float] [[profiler-settings]] ==== {searchprofiler} settings -[cols="2*<"] -|=== -| `xpack.searchprofiler.enabled` - | Set to `true` to enable the <>. Defaults to `true`. - -|=== +`xpack.searchprofiler.enabled`:: +Set to `true` to enable the <>. Defaults to `true`. [float] [[painless_lab-settings]] ==== Painless Lab settings -[cols="2*<"] -|=== -| `xpack.painless_lab.enabled` - | When set to `true`, enables the <>. Defaults to `true`. - -|=== +`xpack.painless_lab.enabled`:: +When set to `true`, enables the <>. Defaults to `true`. From 132f55d362d8cb6cd6adeb1df90fce3d1d73397a Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Fri, 20 Aug 2021 17:03:38 +0200 Subject: [PATCH 41/44] fix check for security and added jest test (#109429) --- .../server/routes/deprecations.test.ts | 83 +++++++++++++++++++ .../reporting/server/routes/deprecations.ts | 2 +- 2 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 x-pack/plugins/reporting/server/routes/deprecations.test.ts diff --git a/x-pack/plugins/reporting/server/routes/deprecations.test.ts b/x-pack/plugins/reporting/server/routes/deprecations.test.ts new file mode 100644 index 0000000000000..5367b6bd531ed --- /dev/null +++ b/x-pack/plugins/reporting/server/routes/deprecations.test.ts @@ -0,0 +1,83 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { of } from 'rxjs'; +import { UnwrapPromise } from '@kbn/utility-types'; +import { setupServer } from 'src/core/server/test_utils'; +import { API_GET_ILM_POLICY_STATUS } from '../../common/constants'; +import { securityMock } from '../../../security/server/mocks'; + +import supertest from 'supertest'; + +import { + createMockConfigSchema, + createMockPluginSetup, + createMockReportingCore, + createMockLevelLogger, +} from '../test_helpers'; + +import { registerDeprecationsRoutes } from './deprecations'; + +type SetupServerReturn = UnwrapPromise>; + +describe(`GET ${API_GET_ILM_POLICY_STATUS}`, () => { + const reportingSymbol = Symbol('reporting'); + let server: SetupServerReturn['server']; + let httpSetup: SetupServerReturn['httpSetup']; + + const createReportingCore = ({ + security, + }: { + security?: ReturnType; + }) => + createMockReportingCore( + createMockConfigSchema({ + queue: { + indexInterval: 'year', + timeout: 10000, + pollEnabled: true, + }, + index: '.reporting', + }), + createMockPluginSetup({ + security, + router: httpSetup.createRouter(''), + licensing: { license$: of({ isActive: true, isAvailable: true, type: 'gold' }) }, + }) + ); + + beforeEach(async () => { + jest.clearAllMocks(); + ({ server, httpSetup } = await setupServer(reportingSymbol)); + }); + + it('correctly handles authz when security is unavailable', async () => { + const core = await createReportingCore({}); + + registerDeprecationsRoutes(core, createMockLevelLogger()); + await server.start(); + + await supertest(httpSetup.server.listener) + .get(API_GET_ILM_POLICY_STATUS) + .expect(200) + .then(/* Ignore result */); + }); + + it('correctly handles authz when security is disabled', async () => { + const security = securityMock.createSetup(); + security.license.isEnabled.mockReturnValue(false); + const core = await createReportingCore({ security }); + + registerDeprecationsRoutes(core, createMockLevelLogger()); + await server.start(); + + await supertest(httpSetup.server.listener) + .get(API_GET_ILM_POLICY_STATUS) + .expect(200) + .then(/* Ignore result */); + }); +}); diff --git a/x-pack/plugins/reporting/server/routes/deprecations.ts b/x-pack/plugins/reporting/server/routes/deprecations.ts index 0daa56274cc00..874885e2258ae 100644 --- a/x-pack/plugins/reporting/server/routes/deprecations.ts +++ b/x-pack/plugins/reporting/server/routes/deprecations.ts @@ -22,7 +22,7 @@ export const registerDeprecationsRoutes = (reporting: ReportingCore, logger: Log const authzWrapper = (handler: RequestHandler): RequestHandler => { return async (ctx, req, res) => { const { security } = reporting.getPluginSetupDeps(); - if (!security) { + if (!security?.license.isEnabled()) { return handler(ctx, req, res); } From 7323cdbbb91b8cab85798ace95de40fd726a3cc3 Mon Sep 17 00:00:00 2001 From: Kaarina Tungseth Date: Fri, 20 Aug 2021 10:03:51 -0500 Subject: [PATCH 42/44] [DOCS] Reformats the AleBanner settings tables into definition lists (#107966) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- docs/settings/banners-settings.asciidoc | 28 +++++++++---------------- 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/docs/settings/banners-settings.asciidoc b/docs/settings/banners-settings.asciidoc index ce56d4dbe7a4d..43f1724403595 100644 --- a/docs/settings/banners-settings.asciidoc +++ b/docs/settings/banners-settings.asciidoc @@ -14,25 +14,17 @@ You can configure the `xpack.banners` settings in your `kibana.yml` file. Banners are a https://www.elastic.co/subscriptions[subscription feature]. ==== -[[general-banners-settings-kb]] -==== General banner settings +`xpack.banners.placement`:: +Set to `top` to display a banner above the Elastic header. Defaults to `disabled`. -[cols="2*<"] -|=== +`xpack.banners.textContent`:: +The text to display inside the banner, either plain text or Markdown. -| `xpack.banners.placement` -| Set to `top` to display a banner above the Elastic header. Defaults to `disabled`. +`xpack.banners.textColor`:: +The color for the banner text. Defaults to `#8A6A0A`. -| `xpack.banners.textContent` -| The text to display inside the banner, either plain text or Markdown. +`xpack.banners.backgroundColor`:: +The color of the banner background. Defaults to `#FFF9E8`. -| `xpack.banners.textColor` -| The color for the banner text. Defaults to `#8A6A0A`. - -| `xpack.banners.backgroundColor` -| The color of the banner background. Defaults to `#FFF9E8`. - -| `xpack.banners.disableSpaceBanners` -| If true, per-space banner overrides will be disabled. Defaults to `false`. - -|=== +`xpack.banners.disableSpaceBanners`:: +If true, per-space banner overrides will be disabled. Defaults to `false`. From 958a3ba28a67f6181a82ed1d1d72a805e3aebbc0 Mon Sep 17 00:00:00 2001 From: Marco Vettorello Date: Fri, 20 Aug 2021 17:09:22 +0200 Subject: [PATCH 43/44] fix(heatmap): remove duplicate legend items (#109338) --- package.json | 2 +- .../heatmap_visualization/chart_component.tsx | 18 +++++-- .../explorer/swimlane_container.tsx | 46 ++++++++++------ .../test/functional/apps/lens/chart_data.ts | 9 ++-- x-pack/test/functional/apps/lens/heatmap.ts | 54 +++++++++---------- yarn.lock | 27 ++-------- 6 files changed, 78 insertions(+), 78 deletions(-) diff --git a/package.json b/package.json index 6d604bc20cadd..9a8e7c5e73211 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,7 @@ "dependencies": { "@elastic/apm-rum": "^5.8.0", "@elastic/apm-rum-react": "^1.2.11", - "@elastic/charts": "34.0.0", + "@elastic/charts": "34.1.1", "@elastic/datemath": "link:bazel-bin/packages/elastic-datemath", "@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@^8.0.0-canary.17", "@elastic/ems-client": "7.15.0", diff --git a/x-pack/plugins/lens/public/heatmap_visualization/chart_component.tsx b/x-pack/plugins/lens/public/heatmap_visualization/chart_component.tsx index d38afc17b2b07..c666d27e780b5 100644 --- a/x-pack/plugins/lens/public/heatmap_visualization/chart_component.tsx +++ b/x-pack/plugins/lens/public/heatmap_visualization/chart_component.tsx @@ -174,6 +174,17 @@ export const HeatmapComponent: FC = ({ minMaxByColumnId[args.valueAccessor!] ); + const bands = ranges.map((start, index, array) => { + return { + // with the default continuity:above the every range is left-closed + start, + // with the default continuity:above the last range is right-open + end: index === array.length - 1 ? Infinity : array[index + 1], + // the current colors array contains a duplicated color at the beginning that we need to skip + color: colors[index + 1], + }; + }); + const onElementClick = ((e: HeatmapElementEvent[]) => { const cell = e[0][0]; const { x, y } = cell.datum; @@ -331,9 +342,10 @@ export const HeatmapComponent: FC = ({ = ({ Date: Fri, 20 Aug 2021 10:29:37 -0500 Subject: [PATCH 44/44] [DOCS] Reformats the Alerting and action settings tables into definition lists (#107964) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- docs/settings/alert-action-settings.asciidoc | 289 ++++++++----------- 1 file changed, 126 insertions(+), 163 deletions(-) diff --git a/docs/settings/alert-action-settings.asciidoc b/docs/settings/alert-action-settings.asciidoc index f168195e10ef5..050d14e4992d6 100644 --- a/docs/settings/alert-action-settings.asciidoc +++ b/docs/settings/alert-action-settings.asciidoc @@ -13,59 +13,48 @@ Alerts and actions are enabled by default in {kib}, but require you configure th You can configure the following settings in the `kibana.yml` file. - [float] [[general-alert-action-settings]] ==== General settings -[cols="2*<"] -|=== - -| `xpack.encryptedSavedObjects` -`.encryptionKey` - | A string of 32 or more characters used to encrypt sensitive properties on alerting rules and actions before they're stored in {es}. Third party credentials — such as the username and password used to connect to an SMTP service — are an example of encrypted properties. + - + - {kib} offers a <> to help generate this encryption key. + - + - If not set, {kib} will generate a random key on startup, but all alerting and action functions will be blocked. Generated keys are not allowed for alerting and actions because when a new key is generated on restart, existing encrypted data becomes inaccessible. For the same reason, alerting and actions in high-availability deployments of {kib} will behave unexpectedly if the key isn't the same on all instances of {kib}. + - + - Although the key can be specified in clear text in `kibana.yml`, it's recommended to store this key securely in the <>. - Be sure to back up the encryption key value somewhere safe, as your alerting rules and actions will cease to function due to decryption failures should you lose it. If you want to rotate the encryption key, be sure to follow the instructions on <>. - -|=== +`xpack.encryptedSavedObjects.encryptionKey`:: +A string of 32 or more characters used to encrypt sensitive properties on alerting rules and actions before they're stored in {es}. Third party credentials — such as the username and password used to connect to an SMTP service — are an example of encrypted properties. ++ +{kib} offers a <> to help generate this encryption key. ++ +If not set, {kib} will generate a random key on startup, but all alerting and action functions will be blocked. Generated keys are not allowed for alerting and actions because when a new key is generated on restart, existing encrypted data becomes inaccessible. For the same reason, alerting and actions in high-availability deployments of {kib} will behave unexpectedly if the key isn't the same on all instances of {kib}. ++ +Although the key can be specified in clear text in `kibana.yml`, it's recommended to store this key securely in the <>. +Be sure to back up the encryption key value somewhere safe, as your alerting rules and actions will cease to function due to decryption failures should you lose it. If you want to rotate the encryption key, be sure to follow the instructions on <>. [float] [[action-settings]] ==== Action settings -[cols="2*<"] -|=== -| `xpack.actions.enabled` - | Deprecated. This will be removed in 8.0. Feature toggle that enables Actions in {kib}. - If `false`, all features dependent on Actions are disabled, including the *Observability* and *Security* apps. Default: `true`. - -| `xpack.actions.allowedHosts` {ess-icon} - | A list of hostnames that {kib} is allowed to connect to when built-in actions are triggered. It defaults to `[*]`, allowing any host, but keep in mind the potential for SSRF attacks when hosts are not explicitly added to the allowed hosts. An empty list `[]` can be used to block built-in actions from making any external connections. + - + - Note that hosts associated with built-in actions, such as Slack and PagerDuty, are not automatically added to allowed hosts. If you are not using the default `[*]` setting, you must ensure that the corresponding endpoints are added to the allowed hosts as well. - -| `xpack.actions.customHostSettings` {ess-icon} - | A list of custom host settings to override existing global settings. - Default: an empty list. + - + - Each entry in the list must have a `url` property, to associate a connection - type (mail or https), hostname and port with the remaining options in the - entry. - + - In the following example, two custom host settings - are defined. The first provides a custom host setting for mail server - `mail.example.com` using port 465 that supplies server certificate authorization - data from both a file and inline, and requires TLS for the - connection. The second provides a custom host setting for https server - `webhook.example.com` which turns off server certificate authorization. - -|=== - +`xpack.actions.enabled`:: +Feature toggle that enables Actions in {kib}. +If `false`, all features dependent on Actions are disabled, including the *Observability* and *Security* apps. Default: `true`. + +`xpack.actions.allowedHosts` {ess-icon}:: +A list of hostnames that {kib} is allowed to connect to when built-in actions are triggered. It defaults to `[*]`, allowing any host, but keep in mind the potential for SSRF attacks when hosts are not explicitly added to the allowed hosts. An empty list `[]` can be used to block built-in actions from making any external connections. ++ +Note that hosts associated with built-in actions, such as Slack and PagerDuty, are not automatically added to allowed hosts. If you are not using the default `[*]` setting, you must ensure that the corresponding endpoints are added to the allowed hosts as well. + +`xpack.actions.customHostSettings` {ess-icon}:: +A list of custom host settings to override existing global settings. +Default: an empty list. ++ +Each entry in the list must have a `url` property, to associate a connection +type (mail or https), hostname and port with the remaining options in the +entry. ++ +In the following example, two custom host settings +are defined. The first provides a custom host setting for mail server +`mail.example.com` using port 465 that supplies server certificate authorization +data from both a file and inline, and requires TLS for the +connection. The second provides a custom host setting for https server +`webhook.example.com` which turns off server certificate authorization. ++ [source,yaml] -- xpack.actions.customHostSettings: @@ -86,132 +75,106 @@ xpack.actions.customHostSettings: verificationMode: 'none' -- -[cols="2*<"] -|=== - -| `xpack.actions.customHostSettings[n]` -`.url` {ess-icon} - | A URL associated with this custom host setting. Should be in the form of - `protocol://hostname:port`, where `protocol` is `https` or `smtp`. If the - port is not provided, 443 is used for `https` and 25 is used for - `smtp`. The `smtp` URLs are used for the Email actions that use this - server, and the `https` URLs are used for actions which use `https` to - connect to services. + - + - Entries with `https` URLs can use the `ssl` options, and entries with `smtp` - URLs can use both the `ssl` and `smtp` options. + - + - No other URL values should be part of this URL, including paths, - query strings, and authentication information. When an http or smtp request - is made as part of executing an action, only the protocol, hostname, and - port of the URL for that request are used to look up these configuration - values. - -| `xpack.actions.customHostSettings[n]` -`.smtp.ignoreTLS` {ess-icon} - | A boolean value indicating that TLS must not be used for this connection. - The options `smtp.ignoreTLS` and `smtp.requireTLS` can not both be set to true. - -| `xpack.actions.customHostSettings[n]` -`.smtp.requireTLS` {ess-icon} - | A boolean value indicating that TLS must be used for this connection. - The options `smtp.ignoreTLS` and `smtp.requireTLS` can not both be set to true. - -| `xpack.actions.customHostSettings[n]` -`.ssl.rejectUnauthorized` - | Deprecated. Use <> instead. A boolean value indicating whether to bypass server certificate validation. - Overrides the general `xpack.actions.rejectUnauthorized` configuration - for requests made for this hostname/port. - -|[[action-config-custom-host-verification-mode]] `xpack.actions.customHostSettings[n]` -`.ssl.verificationMode` {ess-icon} - | Controls the verification of the server certificate that {hosted-ems} receives when making an outbound SSL/TLS connection to the host server. Valid values are `full`, `certificate`, and `none`. - Use `full` to perform hostname verification, `certificate` to skip hostname verification, and `none` to skip verification. Default: `full`. <>. Overrides the general `xpack.actions.ssl.verificationMode` configuration - for requests made for this hostname/port. - -| `xpack.actions.customHostSettings[n]` -`.ssl.certificateAuthoritiesFiles` - | A file name or list of file names of PEM-encoded certificate files to use - to validate the server. - -| `xpack.actions.customHostSettings[n]` -`.ssl.certificateAuthoritiesData` {ess-icon} - | The contents of a PEM-encoded certificate file, or multiple files appended - into a single string. This configuration can be used for environments where - the files cannot be made available. - -| `xpack.actions.enabledActionTypes` {ess-icon} - | A list of action types that are enabled. It defaults to `[*]`, enabling all types. The names for built-in {kib} action types are prefixed with a `.` and include: `.server-log`, `.slack`, `.email`, `.index`, `.pagerduty`, and `.webhook`. An empty list `[]` will disable all action types. + - + - Disabled action types will not appear as an option when creating new connectors, but existing connectors and actions of that type will remain in {kib} and will not function. - -| `xpack.actions` -`.preconfiguredAlertHistoryEsIndex` {ess-icon} - | Enables a preconfigured alert history {es} <> connector. Default: `false`. - -| `xpack.actions.preconfigured` - | Specifies preconfigured connector IDs and configs. Default: {}. - -| `xpack.actions.proxyUrl` {ess-icon} - | Specifies the proxy URL to use, if using a proxy for actions. By default, no proxy is used. - -| `xpack.actions.proxyBypassHosts` {ess-icon} - | Specifies hostnames which should not use the proxy, if using a proxy for actions. The value is an array of hostnames as strings. By default, all hosts will use the proxy, but if an action's hostname is in this list, the proxy will not be used. The settings `xpack.actions.proxyBypassHosts` and `xpack.actions.proxyOnlyHosts` cannot be used at the same time. - -| `xpack.actions.proxyOnlyHosts` {ess-icon} - | Specifies hostnames which should only use the proxy, if using a proxy for actions. The value is an array of hostnames as strings. By default, no hosts will use the proxy, but if an action's hostname is in this list, the proxy will be used. The settings `xpack.actions.proxyBypassHosts` and `xpack.actions.proxyOnlyHosts` cannot be used at the same time. - -| `xpack.actions.proxyHeaders` {ess-icon} - | Specifies HTTP headers for the proxy, if using a proxy for actions. Default: {}. - -a|`xpack.actions.` -`proxyRejectUnauthorizedCertificates` {ess-icon} - | Deprecated. Use <> instead. Set to `false` to bypass certificate validation for the proxy, if using a proxy for actions. Default: `true`. - -|[[action-config-proxy-verification-mode]] -`xpack.actions[n]` -`.ssl.proxyVerificationMode` {ess-icon} -| Controls the verification for the proxy server certificate that {hosted-ems} receives when making an outbound SSL/TLS connection to the proxy server. Valid values are `full`, `certificate`, and `none`. +`xpack.actions.customHostSettings[n].url` {ess-icon}:: +A URL associated with this custom host setting. Should be in the form of +`protocol://hostname:port`, where `protocol` is `https` or `smtp`. If the +port is not provided, 443 is used for `https` and 25 is used for +`smtp`. The `smtp` URLs are used for the Email actions that use this +server, and the `https` URLs are used for actions which use `https` to +connect to services. ++ +Entries with `https` URLs can use the `ssl` options, and entries with `smtp` +URLs can use both the `ssl` and `smtp` options. ++ +No other URL values should be part of this URL, including paths, +query strings, and authentication information. When an http or smtp request +is made as part of executing an action, only the protocol, hostname, and +port of the URL for that request are used to look up these configuration +values. + +`xpack.actions.customHostSettings[n].smtp.ignoreTLS` {ess-icon}:: +A boolean value indicating that TLS must not be used for this connection. +The options `smtp.ignoreTLS` and `smtp.requireTLS` can not both be set to true. + +`xpack.actions.customHostSettings[n].smtp.requireTLS` {ess-icon}:: +A boolean value indicating that TLS must be used for this connection. +The options `smtp.ignoreTLS` and `smtp.requireTLS` can not both be set to true. + +`xpack.actions.customHostSettings[n].ssl.rejectUnauthorized`:: +Deprecated. Use <> instead. A boolean value indicating whether to bypass server certificate validation. +Overrides the general `xpack.actions.rejectUnauthorized` configuration +for requests made for this hostname/port. + +[[action-config-custom-host-verification-mode]] `xpack.actions.customHostSettings[n].ssl.verificationMode` {ess-icon}:: +Controls the verification of the server certificate that {hosted-ems} receives when making an outbound SSL/TLS connection to the host server. Valid values are `full`, `certificate`, and `none`. +Use `full` to perform hostname verification, `certificate` to skip hostname verification, and `none` to skip verification. Default: `full`. <>. Overrides the general `xpack.actions.ssl.verificationMode` configuration +for requests made for this hostname/port. + +`xpack.actions.customHostSettings[n].ssl.certificateAuthoritiesFiles`:: +A file name or list of file names of PEM-encoded certificate files to use +to validate the server. + +`xpack.actions.customHostSettings[n].ssl.certificateAuthoritiesData` {ess-icon}:: +The contents of a PEM-encoded certificate file, or multiple files appended +into a single string. This configuration can be used for environments where +the files cannot be made available. + +`xpack.actions.enabledActionTypes` {ess-icon}:: +A list of action types that are enabled. It defaults to `[*]`, enabling all types. The names for built-in {kib} action types are prefixed with a `.` and include: `.server-log`, `.slack`, `.email`, `.index`, `.pagerduty`, and `.webhook`. An empty list `[]` will disable all action types. ++ +Disabled action types will not appear as an option when creating new connectors, but existing connectors and actions of that type will remain in {kib} and will not function. + +`xpack.actions.preconfiguredAlertHistoryEsIndex` {ess-icon}:: +Enables a preconfigured alert history {es} <> connector. Default: `false`. + +`xpack.actions.preconfigured`:: +Specifies preconfigured connector IDs and configs. Default: {}. + +`xpack.actions.proxyUrl` {ess-icon}:: +Specifies the proxy URL to use, if using a proxy for actions. By default, no proxy is used. + +`xpack.actions.proxyBypassHosts` {ess-icon}:: +Specifies hostnames which should not use the proxy, if using a proxy for actions. The value is an array of hostnames as strings. By default, all hosts will use the proxy, but if an action's hostname is in this list, the proxy will not be used. The settings `xpack.actions.proxyBypassHosts` and `xpack.actions.proxyOnlyHosts` cannot be used at the same time. + +`xpack.actions.proxyOnlyHosts` {ess-icon}:: +Specifies hostnames which should only use the proxy, if using a proxy for actions. The value is an array of hostnames as strings. By default, no hosts will use the proxy, but if an action's hostname is in this list, the proxy will be used. The settings `xpack.actions.proxyBypassHosts` and `xpack.actions.proxyOnlyHosts` cannot be used at the same time. + +`xpack.actions.proxyHeaders` {ess-icon}:: +Specifies HTTP headers for the proxy, if using a proxy for actions. Default: {}. + +`xpack.actions.proxyRejectUnauthorizedCertificates` {ess-icon}:: +Deprecated. Use <> instead. Set to `false` to bypass certificate validation for the proxy, if using a proxy for actions. Default: `true`. + +[[action-config-proxy-verification-mode]]`xpack.actions[n].ssl.proxyVerificationMode` {ess-icon}:: +Controls the verification for the proxy server certificate that {hosted-ems} receives when making an outbound SSL/TLS connection to the proxy server. Valid values are `full`, `certificate`, and `none`. Use `full` to perform hostname verification, `certificate` to skip hostname verification, and `none` to skip verification. Default: `full`. <>. -| `xpack.actions.rejectUnauthorized` {ess-icon} - | Deprecated. Use <> instead. Set to `false` to bypass certificate validation for actions. Default: `true`. + - + - As an alternative to setting `xpack.actions.rejectUnauthorized`, you can use the setting - `xpack.actions.customHostSettings` to set SSL options for specific servers. - -|[[action-config-verification-mode]] -`xpack.actions[n]` -`.ssl.verificationMode` {ess-icon} -| Controls the verification for the server certificate that {hosted-ems} receives when making an outbound SSL/TLS connection for actions. Valid values are `full`, `certificate`, and `none`. - Use `full` to perform hostname verification, `certificate` to skip hostname verification, and `none` to skip verification. Default: `full`. <>. + - + - As an alternative to setting `xpack.actions.ssl.verificationMode`, you can use the setting - `xpack.actions.customHostSettings` to set SSL options for specific servers. - +`xpack.actions.rejectUnauthorized` {ess-icon}:: +Deprecated. Use <> instead. Set to `false` to bypass certificate validation for actions. Default: `true`. ++ +As an alternative to setting `xpack.actions.rejectUnauthorized`, you can use the setting +`xpack.actions.customHostSettings` to set SSL options for specific servers. +[[action-config-verification-mode]] `xpack.actions[n].ssl.verificationMode` {ess-icon}:: +Controls the verification for the server certificate that {hosted-ems} receives when making an outbound SSL/TLS connection for actions. Valid values are `full`, `certificate`, and `none`. +Use `full` to perform hostname verification, `certificate` to skip hostname verification, and `none` to skip verification. Default: `full`. <>. ++ +As an alternative to setting `xpack.actions.ssl.verificationMode`, you can use the setting +`xpack.actions.customHostSettings` to set SSL options for specific servers. -| `xpack.actions.maxResponseContentLength` {ess-icon} - | Specifies the max number of bytes of the http response for requests to external resources. Default: 1000000 (1MB). - -| `xpack.actions.responseTimeout` {ess-icon} - | Specifies the time allowed for requests to external resources. Requests that take longer are aborted. The time is formatted as: + - + - `[ms,s,m,h,d,w,M,Y]` + - + - For example, `20m`, `24h`, `7d`, `1w`. Default: `60s`. - +`xpack.actions.maxResponseContentLength` {ess-icon}:: +Specifies the max number of bytes of the http response for requests to external resources. Default: 1000000 (1MB). -|=== +`xpack.actions.responseTimeout` {ess-icon}:: +Specifies the time allowed for requests to external resources. Requests that take longer are aborted. The time is formatted as: ++ +`[ms,s,m,h,d,w,M,Y]` ++ +For example, `20m`, `24h`, `7d`, `1w`. Default: `60s`. [float] [[alert-settings]] ==== Alerting settings -[cols="2*<"] -|=== - -| `xpack.alerting.maxEphemeralActionsPerAlert` - | Sets the number of actions that will be executed ephemerally. To use this, enable ephemeral tasks in task manager first with <> - -|=== +`xpack.alerting.maxEphemeralActionsPerAlert`:: +Sets the number of actions that will be executed ephemerally. To use this, enable ephemeral tasks in task manager first with <>