diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index ca21e7958226a7..8269acd9242c4c 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 d19226e6b6f8cb..2670e0554a0d95 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 6598263c5b7543..4addef8fbb9319 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 bd1e865a7e64a5..6cb23b279925ed 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/packages/kbn-config/src/config_service.test.ts b/packages/kbn-config/src/config_service.test.ts index d09c61a1c21105..aa520e7189e545 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-interpreter/.babelrc b/packages/kbn-interpreter/.babelrc new file mode 100644 index 00000000000000..7da72d17791281 --- /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 903f892b64f3ff..52df0f0aa8d85f 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 2f5277a8e86520..6d03f2e1c62364 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 a098a3fdce0f6b..4011292178cfab 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 74ec484ea63e99..60f8c76cf8809b 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/packages/kbn-logging/.babelrc b/packages/kbn-logging/.babelrc new file mode 100644 index 00000000000000..7da72d17791281 --- /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 1a3fa851a3957f..71a7ece15aa739 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 00000000000000..8410f557e95249 --- /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 d80cc1c40d7e1e..c35c2f5d060956 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 aaf79da229a86f..a6fb0f2f731871 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 5bea371d479ae5..a3e872ee3ea875 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 efab15b7bf5f47..cfabaeb72adf70 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 298a143717d84f..269437f026f2ff 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 37373ea14c339e..5592038f1416a8 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 e966c7e0a80958..3faa771db1dae6 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/src/dev/typescript/projects.ts b/src/dev/typescript/projects.ts index 0244cb2cd91150..58234be1317a78 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/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 2feb527ff9160a..4aff1ff4eee96c 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 4dcc4a75dc1f04..bdd3660606b7ea 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 cd558b99f9aa17..4bfce9eb377e9c 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 00000000000000..c317f11979f54f --- /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; +}; diff --git a/src/plugins/vis_type_pie/tsconfig.json b/src/plugins/vis_type_pie/tsconfig.json deleted file mode 100644 index 9640447b35d986..00000000000000 --- 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 0d2a4094f04be3..00000000000000 --- 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 0e4e41c286bd22..00000000000000 --- 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 00000000000000..db3d426d4bb485 --- /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 a14203b7b757fd..505ea97f489f7e 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 46f841113c03d4..563d9e9234b66d 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 6bc31208fbdb0e..5f7c744db07169 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 d37f4c10ea9ea8..ee8d0bf19ecac7 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 3bf28ba58d4eb1..78ae9527da3f9a 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 269d5d5f779d6c..eeda49bce4c4c1 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 6cf291b8bf3705..f7ba4056c77e41 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 177396f25adb67..c70cad285f2ae6 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 9119f2f2ecd6c3..a5475a76e27cde 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 33b5f38cbe630f..d0e0af9807f343 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 c5987001d4494d..74e81277123996 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 bcd4cad4efa66f..e8fb6311904a68 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 787f49c19aca3f..12be6dd5de10fa 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 019c6e21767105..9d1dba32f26233 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 b360e375bf40dd..fbfffbb77d5fbb 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 9b760bd4bebcc0..48a7dc50de1710 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 94eaeb55f72428..a1f41e80fae28c 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 3f532cf4c384ff..f6e20104779fae 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 f1a4791821c126..31fff7612faf3e 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 5e9087947b95e7..bb4cbd8c08ae28 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 628c2d74dc438f..68daa7bb82df7b 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 4a32466d808da1..c8b8399f0f7864 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 ba5042dfc210c5..8e0111391ec0fa 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 d6f80b3eb231d3..859d0daf07a020 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 42c4650419c6b1..6ecef858619b58 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 4ffc458bfd4015..cd1d1d71aaa762 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 5addae51dd0116..4f30d4f8b3cc45 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 95a9d0d41481b9..cfe38442a1548d 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 00000000000000..9a0a3418d72dbb --- /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 5e144dabd25e20..6b6d7c3361ecfe 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 3b132ae9be12c7..f4ac79e12bbe23 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 cee6901b611ae7..e7905ccaf1c295 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 a5fb435da4550b..ae200892cec579 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 5091c29c287525..0cb6d7d5940fd7 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 79e4ed96cadec9..30bdab93cdfa8b 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 bdabded67a74a1..c0d89f2f669585 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 206900959a35bb..05b8949901e79c 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 fa463bea6f27f6..e03abf5d90cbe9 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 e594122871fe78..5e6074b12ce475 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 f3f320b3658a05..3ea3a4b1e4a06c 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 e7200a9ff30aae..bb4f570c6a2d86 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 70f0372025e3e8..37aa79a0b1aeea 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 2a063e4d8a7f4c..232e0494a9ebf0 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 d91bb5d0384b69..0f33c393e0643d 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 4f6eb7e5365092..45794776bc998f 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 4291b5c05fc397..0df7bf1365beae 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 8776a6bc2d18a9..dd5d2689af74d8 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 cdc02aacafa3b1..24ba7741cab910 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 00e3ed0791e5dc..d111007598b8b9 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 d4e4d4fcdd1dd1..70a1f938a8266b 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 1e33c589ff1fc5..c1de94ba0f5f98 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 c7e351ccc0429a..d34989917e7079 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 3178c23ee8fa0d..6202df3f650941 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 05a887b5513a33..90c181f8ac74ef 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 d5432a12624fbf..5196f0e33f404c 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 73d110e4d8d750..7bae32d031b46b 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 2e954b9a5b710b..04c4c3cedc9d22 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 2a987b3691f5ea..0658ed1b7c4b11 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 c9b978b3a2cee3..e3948807005e6f 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 9ce5a5339c04f6..56f9025a6bd0bb 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 f4ca3eb5c40aeb..5752a0ac09e8fb 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 61051eadf6b933..0912adaf9f5486 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 04ab8db1cda8fa..ecd741bc4d5d00 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 cde0f4b43d1cbb..67a9d79363e738 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 de91053b6dc4df..43fdb3c1984747 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 da10edf9591fbf..e5b11fcc0339cd 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 a5897519901a16..9256276b1e9c79 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 187b569f288676..c334a83f3dd6ac 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 710857e08ccdee..e4ebb1fa479299 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 1f27d2af1942d8..1fecf09f773803 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 815d0e10aafb2c..bf7ff40904130a 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 cb0ebe563f54be..251888aa194984 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 4dfa5035275fb2..4d39147587169e 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 2ff4040e3a8aa2..d6e6531866d4ba 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 62be39ffb8a732..ec9f0169a48fcb 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 1be6271382b10b..a2b747f4d5d9c6 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 aa05eb57f354a6..f4e2e4b977b8f2 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 65f7df6459bfe2..ad278847b0780b 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 a25d4087692733..bef6c939f864aa 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 00000000000000..8246b3f30646b6 --- /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 e4900ef4a35c8f..57b041b575e3f0 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 1294302d0becd6..1ecf6613558686 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 1510ec1bcb89a6..fbf398b886ffab 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 2dd7d7e0a91f9f..92b47edccfd922 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 1485131da83bcf..666a913e48402d 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 71d33cc20d057f..4750724ca3d42e 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 0c687aa918056b..13c9a6c275f8ed 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 7053f7de0d3288..71f7a639379e04 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 5cafbdd0a569cd..bd9882a15c1245 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 63df3f7eead437..2088878f963ae7 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 5ba35717e46f38..ee5cc950ff66b3 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 34ee33781f269d..04013969fb4fa3 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 2d3e819e960245..21528499835139 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 5454df3a165cde..9b4e1c61a201f5 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 bcf4beaa789459..ef48d8b6d78802 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 5497c46c1dd344..41bbfec7ee939f 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 75dfe8627d73ea..355b04f07d00d8 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 eed224cf2a514a..cbc970c7ed7d8b 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 d35a5a2374ca34..41d5f7c2c97942 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 3adfe3277c969d..69fbbcf80e28b4 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 f2d689126166f3..ceb655fa47107e 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 d39bbf5bfa5329..751c61f3b15317 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 e5ed34d03099da..da7005210865dc 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 e81f0fff96f49e..ce546339a9912e 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 271c5445a95807..105cd667990416 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 69f6a08946fce6..0bf5344ac7f266 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 1fd9b043e87f5b..da7bdfb0d79861 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 00429c6702eeb2..347354ac9d4f2b 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 30215d8feb8a30..08958915da4a4a 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 934278d13cff02..e733aebaa627c8 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 3fd62e33e257fe..174ed4c057974c 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 8c01e375039850..a4f5cf98fb9683 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 3d9f609292c003..3b673394463f0e 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 510ec9bc605d23..a92d35dc9fefdc 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 fadf3d80a6e81a..ddf14ead20a250 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 6d2b860066b075..ccad0c520f8eab 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 488e6fd84b4dac..57736444f49fe6 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 63bc55b288ae3a..7f1f7e8728151d 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 4437986eff5f74..cbe25bc1fef6f5 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 0b1eb5262d71ac..5fc130a08ed276 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 71ef78b19e076d..ff9dbd9ca76644 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 0687bd2af2cd13..81eeca55108ca3 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 849a646cca814e..311714ed3587da 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 d074263e5bb25b..61d175fa8ff7d8 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 4920885f51a071..0356e921a9d5cb 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 48527ec9333edd..fa8dd74e3942a4 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 c9b956f7cd3b56..cdb8f816d7e4f7 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 c2377b42bb1c2c..e015521f7436e2 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 4805d89068e86b..1b5a16a8894aa1 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 c125d8dd075ed9..98ace7dd57a390 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 23dabef662d559..47b103003b3ed5 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 d186617fef2ae5..f8ca1d059ae4f1 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 346f6cc74a1ac4..141174194f1bce 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 df3bee9b3f446e..093671307d5383 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 4d886c0dcb8842..b377fd54753da9 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 9a0a3b43329fd6..2d22b7566175c1 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 5238258fcf0808..8916f3f94f6ffe 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 239eae83057d4a..af75c38d627df5 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 00000000000000..f1f65b6218e829 --- /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/alerting/server/saved_objects/is_rule_exportable.test.ts b/x-pack/plugins/alerting/server/saved_objects/is_rule_exportable.test.ts index 8a22ded2886ff1..8322e42b0743c4 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/apm/common/utils/formatters/duration.test.ts b/x-pack/plugins/apm/common/utils/formatters/duration.test.ts index 42ae4d54bced3e..a45582f42b5b21 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 917521117af4ef..bc4d58831ff353 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 230912045077de..f876b639c923dc 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 4da73a6d2c29a7..67a259caa25341 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 00000000000000..f541c16e655abe --- /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 49d28fec1a1361..2506ac69f7aa24 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 3e8a8cc260a56b..c511a708058d3f 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 && ( = ({ - + {isCompact ? strings.getMaximizeButtonLabel() : strings.getMinimizeButtonLabel()} 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 bf7eeda7e0e2eb..aec188037f0953 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 199b541d49f988..045142ea13e11d 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/lens/public/embeddable/embeddable_factory.ts b/x-pack/plugins/lens/public/embeddable/embeddable_factory.ts index dcb72455e0ee95..ca9d830816dbc8 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 72aa3550e30dd1..d832848db06f68 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 5ce44db1c4db59..80808a4055f26d 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'; 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 6531b8a2f25012..1fdae3b596e00e 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 ed0946e526c80d..322c0540528d71 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, 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 c8e7285d8a34df..dacdb5e5d5d10c 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) { diff --git a/x-pack/plugins/observability/common/typings.ts b/x-pack/plugins/observability/common/typings.ts index 305a18903fe7e8..71337075e1617a 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 bbbd81b4e49eae..174650fc57c6bf 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 b3ff3f94dc4db5..0d6b4ab9b4cfb6 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 26169717d29673..00000000000000 --- 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 851e0cb6c3ddde..e06b5d333a9a67 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 72e07ebb8cadfd..817ca7706df9fa 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 00000000000000..475ba17a9d2f59 --- /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 f97e3fb996441d..00e487da7f9b76 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/reporting/common/constants.ts b/x-pack/plugins/reporting/common/constants.ts index 4ba406a14bafcb..842d7d1eb4b8d5 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 745bc11a8c8559..c324cf363faa13 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 8cfea1b010dfeb..50103c8806fe0b 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 998e4edf26a38c..129c474fd134ae 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 7a7a16c7bc7ea2..a43b4494fe9138 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 150154fa996c5f..12e89f19e6248e 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 00000000000000..ca1677c2379fc1 --- /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 9fc0141ab742e4..99d4b7d9345790 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 f07da188f3e62e..e5801b30caff64 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 226704b255ab3b..72824f6aeeb38b 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 8528543b09e076..2060fdcb1f01e0 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 58def60a24ccbd..aae8c0ff42710b 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/rule_registry/server/utils/create_lifecycle_executor.test.ts b/x-pack/plugins/rule_registry/server/utils/create_lifecycle_executor.test.ts index 236f3b41d689d2..2d0ca3e328a134 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_executor.ts b/x-pack/plugins/rule_registry/server/utils/create_lifecycle_executor.ts index e6db167d8c6b65..abdffd2aa03cc8 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 962a37a2991b07..7d798effcb9e57 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'; @@ -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/common/components/events_viewer/index.tsx b/x-pack/plugins/security_solution/public/common/components/events_viewer/index.tsx index d85c4464af986b..a20055d05afaba 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, }) ) : ( = ({ 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 780cb65ed13d31..3568972aef2e9a 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/security_solution/public/hosts/pages/navigation/events_query_tab_body.tsx b/x-pack/plugins/security_solution/public/hosts/pages/navigation/events_query_tab_body.tsx index b19c680fb9197d..fb3e22260bd840 100644 --- a/x-pack/plugins/security_solution/public/hosts/pages/navigation/events_query_tab_body.tsx +++ b/x-pack/plugins/security_solution/public/hosts/pages/navigation/events_query_tab_body.tsx @@ -46,6 +46,7 @@ export const eventsStackByOptions: MatrixHistogramOption[] = [ ]; const DEFAULT_STACK_BY = 'event.action'; +const unit = (n: number) => 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 b48a6d2193a30b..5563dc285ad5a8 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/security_solution/public/timelines/store/timeline/helpers.ts b/x-pack/plugins/security_solution/public/timelines/store/timeline/helpers.ts index 610c394614c32e..7c07410a2789a1 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 7a16b62cd45e6c..a2d7e2300d1716 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/security_solution/server/lib/telemetry/constants.ts b/x-pack/plugins/security_solution/server/lib/telemetry/constants.ts new file mode 100644 index 00000000000000..3ef45a554e7a5e --- /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 13b4ebf0b3efb9..668696f0dce1d3 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 bee673fc8725f7..a4d11b71f2a8ec 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 6af258a4cbe642..bb2cc4f42ca903 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 642be5fc737f7a..a38042e214ceb9 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 5cd67a9c9c2156..20d89c9721b274 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 00000000000000..1c4dc28f1c5a5e --- /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 5724c61bfcee78..c7bb58dd2251bf 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 f91f3e8428d04a..00000000000000 --- 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 355393145fa0b3..d1d7740071e1f6 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[]; +} 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 bbe0ad8014ae76..54a5f22839bfde 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": { @@ -5921,16 +5827,10 @@ }, "ui_open": { "properties": { - "cluster": { - "type": "long", - "_meta": { - "description": "Number of times a user viewed the list of Elasticsearch cluster deprecations." - } - }, - "indices": { + "elasticsearch": { "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/timelines/common/types/timeline/actions/index.ts b/x-pack/plugins/timelines/common/types/timeline/actions/index.ts index 4d426272d86214..bd864b9d97487a 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/timelines/public/components/t_grid/body/index.tsx b/x-pack/plugins/timelines/public/components/t_grid/body/index.tsx index 8dbc7f34b530ef..236ff6b4f8e6fe 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 4eb47afdc1923e..b8989bca65330d 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 b84eff4d2142c7..b2e6b592c0f456 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 9867cd834802ef..19c5bd84a551b6 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 4158a02ba3d723..0c4bb5b1eb6a51 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', { 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 0c492ad8f8a597..121e5bda78ed8e 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 c7c015a283b752..730d127d16d98a 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 2c39e3739b6916..0972189b38b304 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< diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 4b892d3d2562d4..87d10ff1ff13bf 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": "デバッグ", @@ -18135,10 +18122,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": "実験的", @@ -24637,24 +24620,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": "キャンセル", @@ -24682,7 +24654,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": "インデックスが閉じました", @@ -24694,13 +24665,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": "クイック解決", @@ -24718,13 +24682,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", @@ -24732,7 +24689,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サーバーログを確認してください。", @@ -24756,10 +24712,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 8434ed6ee3c72a..0d546e6b9455a4 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -18544,10 +18544,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": "实验性", @@ -25187,25 +25183,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": "取消", @@ -25233,7 +25217,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": "索引已关闭", @@ -25245,13 +25228,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": "快速解决", @@ -25269,13 +25245,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", @@ -25283,7 +25252,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 服务器日志中查看错误。", @@ -25307,10 +25275,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 533a74842216a4..00000000000000 --- 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 00000000000000..917fac8ef666a6 --- /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 00000000000000..ceebc528f0bc49 --- /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 00000000000000..8d3616a1b9d6b8 --- /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 00000000000000..efeb78a5071604 --- /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 00000000000000..909976355cd312 --- /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 00000000000000..ddf477195063c0 --- /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 00000000000000..c93cdcb1f4d972 --- /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 2aedface1e32ba..00000000000000 --- 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 00000000000000..86737d4925927b --- /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 74fcf14fdf597c..d0c93d74f31f42 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 8e256680253beb..b19c8b3d0f0821 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 5189ddc420b08f..00000000000000 --- 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 53b4b5d75931b8..c5de02bebd512c 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 89f648c98437ec..00000000000000 --- 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 b14ec26e5c8af1..5de290e325fe44 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 ba8f9f8b67d0cd..0bf9f9932b8a18 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 254242ab338a01..2afffe989ed1ba 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 35c514a0a95bb0..a390dd26a0747e 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 b1571b9e454616..864be6e5d996dd 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 7b4bee75bc7574..c7f974fab6a897 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 531bc229b39eaf..00000000000000 --- 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 d64400a8abdcf4..4865e977f52611 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 8be407371f0385..00000000000000 --- 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 1f4f0352e79398..c3e842941a250a 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 00000000000000..439062e0276509 --- /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/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/index.tsx rename to x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/default/index.ts index 6fbb38b04bbd68..ea537b642d8e4c 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/default/index.ts @@ -5,4 +5,4 @@ * 2.0. */ -export { ReindexButton } from './button'; +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 00000000000000..7f4b2e3be3479a --- /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 a4152e52a35b72..eb0221a722a301 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 00000000000000..1567562db53eed --- /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/index_settings/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/index_settings/index.ts rename to x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index_settings/index.ts index e8a83790ee2a69..282b8308f403fc 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/index_settings/index.ts @@ -5,4 +5,4 @@ * 2.0. */ -export { FixIndexSettingsButton } 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 00000000000000..a5a586927c811f --- /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 00000000000000..3a1706b08c0ee2 --- /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 00000000000000..972d640d18c5ae --- /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 7dafab011a69a3..ba72faf2f8c3f8 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/ml_snapshots/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/ml_snapshots/index.ts rename to x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/ml_snapshots/index.ts index d537c94cf67aed..d523184454533e 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/ml_snapshots/index.ts @@ -5,4 +5,4 @@ * 2.0. */ -export { FixMlSnapshotsButton } 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 00000000000000..7963701b5c5435 --- /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 00000000000000..73921b235d88cc --- /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 2dd4638c772b3a..a724922563e059 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 014edc96b05652..4cd55614ab4e6d 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 00000000000000..2d34253d2c4267 --- /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 f8d72addc2d188..a3a0f15188fca2 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 e852171a696b4b..856e2a57649df3 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 00000000000000..f10e7b4cc687e7 --- /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 00000000000000..6b9eee80acb574 --- /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 24a00af7a9fee3..b49d8163022130 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 088266f3a48406..65a790fe96691a 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/flyout/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/flyout/index.tsx rename to x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/index.tsx index facc830234667c..bbb1493f15bcc5 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/reindex/index.tsx @@ -5,4 +5,4 @@ * 2.0. */ -export { ReindexFlyout } from './container'; +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 00000000000000..6ea9a0277059a3 --- /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 00000000000000..95d65f1e777718 --- /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 00000000000000..b87a509d25a55f --- /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 e53fd9b254cf00..00000000000000 --- 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 4324379f456eaf..00000000000000 --- 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 66e2a5d25998be..00000000000000 --- 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 e63e26f3ecc610..00000000000000 --- 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 1fd0c79dbbef37..00000000000000 --- 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 f4ac573d86b111..00000000000000 --- 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 6b0f94ea24bc7b..00000000000000 --- 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 2bfa8119e41bcd..00000000000000 --- 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 7b543a7e94b33f..00000000000000 --- 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 13b7dacc3b598d..00000000000000 --- 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 f12149f9e88cbd..00000000000000 --- 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 646f2539316640..00000000000000 --- 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 97031dd08ee2ab..00000000000000 --- 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 13818e864783e6..00000000000000 --- 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 239bd56bd2fa53..00000000000000 --- 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 239433808c5aff..5e3c7a5fe6cef9 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 4fc4d691c40383..38367bd3cfaffd 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 00000000000000..5f742a3c63ae6c --- /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 00000000000000..dd187f19d5e96f --- /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 0e69259adc6096..17837458430704 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 31b5c80d5b3773..56d6e23d9d4f31 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 b7cac67ca5a961..f900416873b830 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 97306dac287ba4..ef0b3f438da03d 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 5db5b80cc42ebb..c717a8a2e12e85 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 3626151b63bbfc..7763450c6cfcf3 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 b4fd78252b2ffb..b46bb583244f07 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 1b22d26ea72183..78070c57174965 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 00359988d5e2a8..f36dc2096ddc73 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 4220f0eef8d42b..85cfd2a3fd16c4 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 c3ffd44662ec25..64b52065f63e6f 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 ef724e3bf892e2..617bb02ff9dfcd 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 3e847eef18f07d..be9ea11a4886e0 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 f87a8916e1a52f..e1a348f8ed8ee1 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 b87d63ae36ec11..cd719cc0f32b55 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 a911c5810dd0a6..caff78390b9d18 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 ab876828a343ca..3d463fe4b03ed0 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 2227139c53cda4..50c5b358aa5cb2 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 a6253ab1091dae..ee997f5da7ab75 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 9603eae18d9c11..bea74f116e0e24 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 395fa04af9173a..eb0ade26de7660 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 05ad542ec9c000..578cceb702751a 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 4e9b4b9a472a98..d083b38c7c240b 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 f76c07da678da1..42d5d339dd050f 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, }, 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 c6a75eccfa4c83..ffb1a14a184697 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'); 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 e1bd5a8d05b48c..5400c3af64b559 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", ], 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 c8a0e171d5a79d..e7b7ba18d62fbf 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/apps/security/users.js b/x-pack/test/functional/apps/security/users.ts similarity index 96% rename from x-pack/test/functional/apps/security/users.js rename to x-pack/test/functional/apps/security/users.ts index 757aa6393262ea..2c64e9ab5bb707 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(); diff --git a/x-pack/test/functional/page_objects/lens_page.ts b/x-pack/test/functional/page_objects/lens_page.ts index 1acddd4641ff41..2e1151602f3110 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(); 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 2d62725e23989a..6ff8946d48c5bc 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",