From 1735cecbba761f6cffde3a65ee367b4698f68967 Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Tue, 4 Oct 2022 09:22:51 +0300 Subject: [PATCH 01/18] Rename to textBased instead of textBasedLanguages --- x-pack/plugins/lens/public/app_plugin/lens_top_nav.tsx | 2 +- x-pack/plugins/lens/public/async_services.ts | 4 ++-- .../editor_frame_service/editor_frame/suggestion_helpers.ts | 2 +- x-pack/plugins/lens/public/plugin.ts | 2 +- .../public/state_management/init_middleware/load_initial.ts | 2 +- .../datapanel.test.tsx | 0 .../datapanel.tsx | 0 .../fetch_data_from_aggregate_query.ts | 0 .../field_select.test.tsx | 0 .../field_select.tsx | 0 .../index.ts | 0 .../layerpanel.test.tsx | 0 .../layerpanel.tsx | 0 .../mocks.ts | 0 .../text_based_languages.test.ts | 0 .../text_based_languages.tsx | 4 ++-- .../to_expression.ts | 0 .../types.ts | 0 .../utils.test.ts | 0 .../utils.ts | 0 20 files changed, 8 insertions(+), 8 deletions(-) rename x-pack/plugins/lens/public/{text_based_languages_datasource => text_based_datasource}/datapanel.test.tsx (100%) rename x-pack/plugins/lens/public/{text_based_languages_datasource => text_based_datasource}/datapanel.tsx (100%) rename x-pack/plugins/lens/public/{text_based_languages_datasource => text_based_datasource}/fetch_data_from_aggregate_query.ts (100%) rename x-pack/plugins/lens/public/{text_based_languages_datasource => text_based_datasource}/field_select.test.tsx (100%) rename x-pack/plugins/lens/public/{text_based_languages_datasource => text_based_datasource}/field_select.tsx (100%) rename x-pack/plugins/lens/public/{text_based_languages_datasource => text_based_datasource}/index.ts (100%) rename x-pack/plugins/lens/public/{text_based_languages_datasource => text_based_datasource}/layerpanel.test.tsx (100%) rename x-pack/plugins/lens/public/{text_based_languages_datasource => text_based_datasource}/layerpanel.tsx (100%) rename x-pack/plugins/lens/public/{text_based_languages_datasource => text_based_datasource}/mocks.ts (100%) rename x-pack/plugins/lens/public/{text_based_languages_datasource => text_based_datasource}/text_based_languages.test.ts (100%) rename x-pack/plugins/lens/public/{text_based_languages_datasource => text_based_datasource}/text_based_languages.tsx (99%) rename x-pack/plugins/lens/public/{text_based_languages_datasource => text_based_datasource}/to_expression.ts (100%) rename x-pack/plugins/lens/public/{text_based_languages_datasource => text_based_datasource}/types.ts (100%) rename x-pack/plugins/lens/public/{text_based_languages_datasource => text_based_datasource}/utils.test.ts (100%) rename x-pack/plugins/lens/public/{text_based_languages_datasource => text_based_datasource}/utils.ts (100%) diff --git a/x-pack/plugins/lens/public/app_plugin/lens_top_nav.tsx b/x-pack/plugins/lens/public/app_plugin/lens_top_nav.tsx index c381d519f3665..e595deb97c5dc 100644 --- a/x-pack/plugins/lens/public/app_plugin/lens_top_nav.tsx +++ b/x-pack/plugins/lens/public/app_plugin/lens_top_nav.tsx @@ -652,7 +652,7 @@ export const LensTopNavMenu = ({ setIsOnTextBasedMode(true); dispatch( switchAndCleanDatasource({ - newDatasourceId: 'textBasedLanguages', + newDatasourceId: 'textBased', visualizationId: visualization?.activeId, currentIndexPatternId: currentIndexPattern?.id, }) diff --git a/x-pack/plugins/lens/public/async_services.ts b/x-pack/plugins/lens/public/async_services.ts index c0ccd2a71ce2b..0ae3870fef7af 100644 --- a/x-pack/plugins/lens/public/async_services.ts +++ b/x-pack/plugins/lens/public/async_services.ts @@ -30,10 +30,10 @@ export * from './visualizations/gauge/gauge_visualization'; export * from './visualizations/gauge'; export * from './indexpattern_datasource/indexpattern'; -export { getTextBasedLanguagesDatasource } from './text_based_languages_datasource/text_based_languages'; +export { getTextBasedLanguagesDatasource } from './text_based_datasource/text_based_languages'; export { createFormulaPublicApi } from './indexpattern_datasource/operations/definitions/formula/formula_public_api'; -export * from './text_based_languages_datasource'; +export * from './text_based_datasource'; export * from './indexpattern_datasource'; export * from './lens_ui_telemetry'; export * from './lens_ui_errors'; diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/suggestion_helpers.ts b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/suggestion_helpers.ts index 21cab91889999..b4afa1c1190f6 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/suggestion_helpers.ts +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/suggestion_helpers.ts @@ -208,7 +208,7 @@ export function getVisualizeFieldSuggestions({ // suggestions for visualizing textbased languages if (visualizeTriggerFieldContext && 'query' in visualizeTriggerFieldContext) { if (visualizeTriggerFieldContext.query) { - return suggestions.find((s) => s.datasourceId === 'textBasedLanguages'); + return suggestions.find((s) => s.datasourceId === 'textBased'); } } diff --git a/x-pack/plugins/lens/public/plugin.ts b/x-pack/plugins/lens/public/plugin.ts index 6019f566e0ba6..8ed4d9abbaeeb 100644 --- a/x-pack/plugins/lens/public/plugin.ts +++ b/x-pack/plugins/lens/public/plugin.ts @@ -56,7 +56,7 @@ import type { IndexPatternDatasourceSetupPlugins, FormulaPublicApi, } from './indexpattern_datasource'; -import type { TextBasedLanguagesDatasource as TextBasedLanguagesDatasourceType } from './text_based_languages_datasource'; +import type { TextBasedLanguagesDatasource as TextBasedLanguagesDatasourceType } from './text_based_datasource'; import type { XyVisualization as XyVisualizationType, diff --git a/x-pack/plugins/lens/public/state_management/init_middleware/load_initial.ts b/x-pack/plugins/lens/public/state_management/init_middleware/load_initial.ts index 5b942eff4a683..69e93f7a763a3 100644 --- a/x-pack/plugins/lens/public/state_management/init_middleware/load_initial.ts +++ b/x-pack/plugins/lens/public/state_management/init_middleware/load_initial.ts @@ -117,7 +117,7 @@ export function loadInitial( let activeDatasourceId: string | undefined; if (initialContext && 'query' in initialContext) { - activeDatasourceId = 'textBasedLanguages'; + activeDatasourceId = 'textBased'; } if ( diff --git a/x-pack/plugins/lens/public/text_based_languages_datasource/datapanel.test.tsx b/x-pack/plugins/lens/public/text_based_datasource/datapanel.test.tsx similarity index 100% rename from x-pack/plugins/lens/public/text_based_languages_datasource/datapanel.test.tsx rename to x-pack/plugins/lens/public/text_based_datasource/datapanel.test.tsx diff --git a/x-pack/plugins/lens/public/text_based_languages_datasource/datapanel.tsx b/x-pack/plugins/lens/public/text_based_datasource/datapanel.tsx similarity index 100% rename from x-pack/plugins/lens/public/text_based_languages_datasource/datapanel.tsx rename to x-pack/plugins/lens/public/text_based_datasource/datapanel.tsx diff --git a/x-pack/plugins/lens/public/text_based_languages_datasource/fetch_data_from_aggregate_query.ts b/x-pack/plugins/lens/public/text_based_datasource/fetch_data_from_aggregate_query.ts similarity index 100% rename from x-pack/plugins/lens/public/text_based_languages_datasource/fetch_data_from_aggregate_query.ts rename to x-pack/plugins/lens/public/text_based_datasource/fetch_data_from_aggregate_query.ts diff --git a/x-pack/plugins/lens/public/text_based_languages_datasource/field_select.test.tsx b/x-pack/plugins/lens/public/text_based_datasource/field_select.test.tsx similarity index 100% rename from x-pack/plugins/lens/public/text_based_languages_datasource/field_select.test.tsx rename to x-pack/plugins/lens/public/text_based_datasource/field_select.test.tsx diff --git a/x-pack/plugins/lens/public/text_based_languages_datasource/field_select.tsx b/x-pack/plugins/lens/public/text_based_datasource/field_select.tsx similarity index 100% rename from x-pack/plugins/lens/public/text_based_languages_datasource/field_select.tsx rename to x-pack/plugins/lens/public/text_based_datasource/field_select.tsx diff --git a/x-pack/plugins/lens/public/text_based_languages_datasource/index.ts b/x-pack/plugins/lens/public/text_based_datasource/index.ts similarity index 100% rename from x-pack/plugins/lens/public/text_based_languages_datasource/index.ts rename to x-pack/plugins/lens/public/text_based_datasource/index.ts diff --git a/x-pack/plugins/lens/public/text_based_languages_datasource/layerpanel.test.tsx b/x-pack/plugins/lens/public/text_based_datasource/layerpanel.test.tsx similarity index 100% rename from x-pack/plugins/lens/public/text_based_languages_datasource/layerpanel.test.tsx rename to x-pack/plugins/lens/public/text_based_datasource/layerpanel.test.tsx diff --git a/x-pack/plugins/lens/public/text_based_languages_datasource/layerpanel.tsx b/x-pack/plugins/lens/public/text_based_datasource/layerpanel.tsx similarity index 100% rename from x-pack/plugins/lens/public/text_based_languages_datasource/layerpanel.tsx rename to x-pack/plugins/lens/public/text_based_datasource/layerpanel.tsx diff --git a/x-pack/plugins/lens/public/text_based_languages_datasource/mocks.ts b/x-pack/plugins/lens/public/text_based_datasource/mocks.ts similarity index 100% rename from x-pack/plugins/lens/public/text_based_languages_datasource/mocks.ts rename to x-pack/plugins/lens/public/text_based_datasource/mocks.ts diff --git a/x-pack/plugins/lens/public/text_based_languages_datasource/text_based_languages.test.ts b/x-pack/plugins/lens/public/text_based_datasource/text_based_languages.test.ts similarity index 100% rename from x-pack/plugins/lens/public/text_based_languages_datasource/text_based_languages.test.ts rename to x-pack/plugins/lens/public/text_based_datasource/text_based_languages.test.ts diff --git a/x-pack/plugins/lens/public/text_based_languages_datasource/text_based_languages.tsx b/x-pack/plugins/lens/public/text_based_datasource/text_based_languages.tsx similarity index 99% rename from x-pack/plugins/lens/public/text_based_languages_datasource/text_based_languages.tsx rename to x-pack/plugins/lens/public/text_based_datasource/text_based_languages.tsx index e9ab24b8392c6..09a1051ce84c8 100644 --- a/x-pack/plugins/lens/public/text_based_languages_datasource/text_based_languages.tsx +++ b/x-pack/plugins/lens/public/text_based_datasource/text_based_languages.tsx @@ -157,7 +157,7 @@ export function getTextBasedLanguagesDatasource({ TextBasedLanguagesPrivateState, TextBasedLanguagesPersistedState > = { - id: 'textBasedLanguages', + id: 'textBased', checkIntegrity: () => { return []; @@ -538,7 +538,7 @@ export function getTextBasedLanguagesDatasource({ getPublicAPI({ state, layerId }: PublicAPIProps) { return { - datasourceId: 'textBasedLanguages', + datasourceId: 'textBased', getTableSpec: () => { return ( diff --git a/x-pack/plugins/lens/public/text_based_languages_datasource/to_expression.ts b/x-pack/plugins/lens/public/text_based_datasource/to_expression.ts similarity index 100% rename from x-pack/plugins/lens/public/text_based_languages_datasource/to_expression.ts rename to x-pack/plugins/lens/public/text_based_datasource/to_expression.ts diff --git a/x-pack/plugins/lens/public/text_based_languages_datasource/types.ts b/x-pack/plugins/lens/public/text_based_datasource/types.ts similarity index 100% rename from x-pack/plugins/lens/public/text_based_languages_datasource/types.ts rename to x-pack/plugins/lens/public/text_based_datasource/types.ts diff --git a/x-pack/plugins/lens/public/text_based_languages_datasource/utils.test.ts b/x-pack/plugins/lens/public/text_based_datasource/utils.test.ts similarity index 100% rename from x-pack/plugins/lens/public/text_based_languages_datasource/utils.test.ts rename to x-pack/plugins/lens/public/text_based_datasource/utils.test.ts diff --git a/x-pack/plugins/lens/public/text_based_languages_datasource/utils.ts b/x-pack/plugins/lens/public/text_based_datasource/utils.ts similarity index 100% rename from x-pack/plugins/lens/public/text_based_languages_datasource/utils.ts rename to x-pack/plugins/lens/public/text_based_datasource/utils.ts From 03f43b731592ab5de5881517a9f241ae39a17f64 Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Tue, 4 Oct 2022 10:00:21 +0300 Subject: [PATCH 02/18] [Lens] Rename datasources to textBased and formBased --- .../lens/public/app_plugin/lens_top_nav.tsx | 6 +- .../app_plugin/show_underlying_data.test.ts | 4 +- .../public/app_plugin/show_underlying_data.ts | 2 +- x-pack/plugins/lens/public/async_services.ts | 8 +- .../public/data_views_service/loader.test.ts | 2 +- .../lens/public/data_views_service/loader.ts | 2 +- .../lens/public/data_views_service/mocks.ts | 4 +- .../embeddable/embeddable_component.tsx | 4 +- .../__mocks__/loader.ts | 4 +- .../__snapshots__/utils.test.tsx.snap | 0 .../datapanel.scss | 16 +- .../datapanel.test.tsx | 46 ++-- .../datapanel.tsx | 20 +- .../dedupe_aggs.test.ts | 0 .../dedupe_aggs.ts | 0 .../dimension_panel/advanced_options.tsx | 0 .../bucket_nesting_editor.test.tsx | 2 +- .../dimension_panel/bucket_nesting_editor.tsx | 4 +- .../dimension_panel/dimension_editor.scss | 0 .../dimension_panel/dimension_editor.tsx | 32 ++- .../dimension_panel/dimension_panel.test.tsx | 216 ++++++++------- .../dimension_panel/dimension_panel.tsx | 24 +- .../dimensions_editor_helpers.tsx | 0 .../droppable/get_drop_props.test.ts | 2 +- .../droppable/get_drop_props.ts | 6 +- .../dimension_panel/droppable/index.ts | 0 .../dimension_panel/droppable/mocks.ts | 4 +- .../droppable/on_drop_handler.test.ts | 24 +- .../droppable/on_drop_handler.ts | 8 +- .../dimension_panel/field_input.test.tsx | 8 +- .../dimension_panel/field_input.tsx | 0 .../dimension_panel/field_select.scss | 0 .../dimension_panel/field_select.tsx | 2 +- .../dimension_panel/filtering.tsx | 8 +- .../dimension_panel/format_selector.test.tsx | 0 .../dimension_panel/format_selector.tsx | 2 +- .../dimension_panel/index.ts | 0 .../dimension_panel/operation_support.ts | 8 +- .../dimension_panel/reduced_time_range.tsx | 8 +- .../dimension_panel/reference_editor.test.tsx | 20 +- .../dimension_panel/reference_editor.tsx | 14 +- .../dimension_panel/time_scaling.tsx | 8 +- .../dimension_panel/time_shift.tsx | 12 +- .../document_field.ts | 0 .../field_item.scss | 0 .../field_item.test.tsx | 0 .../field_item.tsx | 0 .../field_list.scss | 0 .../field_list.tsx | 0 .../fields_accordion.test.tsx | 0 .../fields_accordion.tsx | 4 +- .../form_based.test.ts} | 250 +++++++----------- .../form_based.tsx} | 70 +++-- .../form_based_suggestions.test.tsx} | 66 ++--- .../form_based_suggestions.ts} | 54 ++-- .../help_popover.scss | 0 .../help_popover.tsx | 0 .../index.ts | 16 +- .../layerpanel.test.tsx | 8 +- .../layerpanel.tsx | 10 +- .../loader.test.ts | 16 +- .../loader.ts | 28 +- .../mocks.ts | 0 .../no_fields_callout.test.tsx | 0 .../no_fields_callout.tsx | 0 .../operations/__mocks__/index.ts | 0 .../operations/definitions.test.ts | 6 +- .../definitions/calculations/counter_rate.tsx | 4 +- .../calculations/cumulative_sum.tsx | 4 +- .../definitions/calculations/differences.tsx | 4 +- .../definitions/calculations/index.ts | 0 .../calculations/moving_average.tsx | 4 +- .../calculations/overall_metric.test.ts | 4 +- .../calculations/overall_metric.tsx | 0 .../definitions/calculations/time_scale.tsx | 4 +- .../definitions/calculations/utils.test.ts | 0 .../definitions/calculations/utils.ts | 14 +- .../definitions/cardinality.test.ts | 0 .../operations/definitions/cardinality.tsx | 0 .../operations/definitions/column_types.ts | 0 .../operations/definitions/count.test.ts | 0 .../operations/definitions/count.tsx | 0 .../definitions/date_histogram.test.tsx | 20 +- .../operations/definitions/date_histogram.tsx | 4 +- .../definitions/filters/filter_popover.scss | 0 .../filters/filter_popover.test.tsx | 0 .../definitions/filters/filter_popover.tsx | 0 .../definitions/filters/filters.scss | 0 .../definitions/filters/filters.test.tsx | 4 +- .../definitions/filters/filters.tsx | 0 .../operations/definitions/filters/index.tsx | 0 .../definitions/formula/editor/formula.scss | 0 .../formula/editor/formula_editor.tsx | 0 .../formula/editor/formula_help.tsx | 0 .../definitions/formula/editor/index.ts | 0 .../formula/editor/math_completion.test.ts | 0 .../formula/editor/math_completion.ts | 0 .../formula/editor/math_tokenization.tsx | 0 .../definitions/formula/formula.test.tsx | 6 +- .../definitions/formula/formula.tsx | 0 .../formula/formula_public_api.test.ts | 4 +- .../definitions/formula/formula_public_api.ts | 6 +- .../definitions/formula/generate.ts | 4 +- .../operations/definitions/formula/index.ts | 0 .../definitions/formula/math.test.ts | 4 +- .../operations/definitions/formula/math.tsx | 0 .../definitions/formula/math_examples.md | 0 .../operations/definitions/formula/parse.ts | 10 +- .../operations/definitions/formula/types.ts | 0 .../operations/definitions/formula/util.ts | 0 .../definitions/formula/validation.ts | 8 +- .../definitions/get_group_by_key.ts | 0 .../operations/definitions/helpers.test.ts | 0 .../operations/definitions/helpers.tsx | 6 +- .../operations/definitions/index.ts | 44 +-- .../definitions/last_value.test.tsx | 8 +- .../operations/definitions/last_value.tsx | 0 .../operations/definitions/metrics.test.ts | 0 .../operations/definitions/metrics.tsx | 0 .../definitions/percentile.test.tsx | 4 +- .../operations/definitions/percentile.tsx | 0 .../definitions/percentile_ranks.test.tsx | 4 +- .../definitions/percentile_ranks.tsx | 0 .../definitions/ranges/advanced_editor.scss | 0 .../definitions/ranges/advanced_editor.tsx | 0 .../definitions/ranges/constants.ts | 0 .../operations/definitions/ranges/index.ts | 0 .../definitions/ranges/range_editor.tsx | 0 .../definitions/ranges/ranges.test.tsx | 6 +- .../operations/definitions/ranges/ranges.tsx | 0 .../shared_components/form_row.scss | 0 .../shared_components/form_row.tsx | 0 .../definitions/shared_components/index.tsx | 0 .../shared_components/label_input.tsx | 0 .../definitions/static_value.test.tsx | 8 +- .../operations/definitions/static_value.tsx | 0 .../operations/definitions/terms/constants.ts | 0 .../definitions/terms/field_inputs.tsx | 0 .../definitions/terms/helpers.test.ts | 2 +- .../operations/definitions/terms/helpers.ts | 8 +- .../terms/include_exclude_options.test.tsx | 0 .../terms/include_exclude_options.tsx | 0 .../operations/definitions/terms/index.tsx | 0 .../definitions/terms/terms.test.tsx | 6 +- .../operations/definitions/terms/types.ts | 0 .../definitions/terms/values_input.test.tsx | 0 .../definitions/terms/values_input.tsx | 0 .../operations/index.ts | 0 .../operations/layer_helpers.test.ts | 98 +++---- .../operations/layer_helpers.ts | 96 +++---- .../operations/mocks.ts | 0 .../operations/operations.test.ts | 0 .../operations/operations.ts | 0 .../operations/time_scale_utils.test.ts | 0 .../operations/time_scale_utils.ts | 0 .../pure_helpers.ts | 0 .../pure_utils.ts | 4 +- .../reduced_time_range_utils.tsx | 4 +- .../state_helpers.ts | 10 +- .../time_shift_utils.test.tsx | 4 +- .../time_shift_utils.tsx | 10 +- .../to_expression.ts | 8 +- .../types.ts | 12 +- .../utils.test.tsx | 10 +- .../utils.tsx | 24 +- .../visualize_geo_field_button.tsx | 0 x-pack/plugins/lens/public/index.ts | 8 +- x-pack/plugins/lens/public/plugin.ts | 26 +- .../field_picker/lens_field_icon.tsx | 2 +- .../text_based_datasource/datapanel.test.tsx | 14 +- .../text_based_datasource/datapanel.tsx | 17 +- .../text_based_datasource/field_select.tsx | 4 +- .../public/text_based_datasource/index.ts | 15 +- .../text_based_datasource/layerpanel.test.tsx | 8 +- .../text_based_datasource/layerpanel.tsx | 9 +- .../text_based_languages.test.ts | 62 ++--- .../text_based_languages.tsx | 70 ++--- .../text_based_datasource/to_expression.ts | 6 +- .../public/text_based_datasource/types.ts | 16 +- .../public/text_based_datasource/utils.ts | 8 +- x-pack/plugins/lens/public/types.ts | 2 +- .../datatable/visualization.tsx | 4 +- .../visualizations/metric/visualization.tsx | 6 +- .../partition/visualization.tsx | 4 +- .../visualizations/xy/visualization.test.ts | 2 +- .../annotations_config_panel/index.test.tsx | 2 +- 186 files changed, 863 insertions(+), 964 deletions(-) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/__mocks__/loader.ts (91%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/__snapshots__/utils.test.tsx.snap (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/datapanel.scss (72%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/datapanel.test.tsx (94%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/datapanel.tsx (97%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dedupe_aggs.test.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dedupe_aggs.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dimension_panel/advanced_options.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dimension_panel/bucket_nesting_editor.test.tsx (99%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dimension_panel/bucket_nesting_editor.tsx (97%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dimension_panel/dimension_editor.scss (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dimension_panel/dimension_editor.tsx (97%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dimension_panel/dimension_panel.test.tsx (89%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dimension_panel/dimension_panel.tsx (81%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dimension_panel/dimensions_editor_helpers.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dimension_panel/droppable/get_drop_props.test.ts (99%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dimension_panel/droppable/get_drop_props.ts (97%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dimension_panel/droppable/index.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dimension_panel/droppable/mocks.ts (98%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dimension_panel/droppable/on_drop_handler.test.ts (98%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dimension_panel/droppable/on_drop_handler.ts (98%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dimension_panel/field_input.test.tsx (98%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dimension_panel/field_input.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dimension_panel/field_select.scss (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dimension_panel/field_select.tsx (99%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dimension_panel/filtering.tsx (87%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dimension_panel/format_selector.test.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dimension_panel/format_selector.tsx (98%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dimension_panel/index.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dimension_panel/operation_support.ts (92%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dimension_panel/reduced_time_range.tsx (97%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dimension_panel/reference_editor.test.tsx (98%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dimension_panel/reference_editor.tsx (97%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dimension_panel/time_scaling.tsx (95%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/dimension_panel/time_shift.tsx (95%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/document_field.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/field_item.scss (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/field_item.test.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/field_item.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/field_list.scss (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/field_list.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/fields_accordion.test.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/fields_accordion.tsx (97%) rename x-pack/plugins/lens/public/{indexpattern_datasource/indexpattern.test.ts => form_based_datasource/form_based.test.ts} (93%) rename x-pack/plugins/lens/public/{indexpattern_datasource/indexpattern.tsx => form_based_datasource/form_based.tsx} (92%) rename x-pack/plugins/lens/public/{indexpattern_datasource/indexpattern_suggestions.test.tsx => form_based_datasource/form_based_suggestions.test.tsx} (98%) rename x-pack/plugins/lens/public/{indexpattern_datasource/indexpattern_suggestions.ts => form_based_datasource/form_based_suggestions.ts} (95%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/help_popover.scss (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/help_popover.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/index.ts (84%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/layerpanel.test.tsx (96%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/layerpanel.tsx (86%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/loader.test.ts (96%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/loader.ts (91%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/mocks.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/no_fields_callout.test.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/no_fields_callout.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/__mocks__/index.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions.test.ts (98%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/calculations/counter_rate.tsx (97%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/calculations/cumulative_sum.tsx (97%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/calculations/differences.tsx (97%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/calculations/index.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/calculations/moving_average.tsx (98%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/calculations/overall_metric.test.ts (93%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/calculations/overall_metric.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/calculations/time_scale.tsx (97%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/calculations/utils.test.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/calculations/utils.ts (94%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/cardinality.test.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/cardinality.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/column_types.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/count.test.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/count.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/date_histogram.test.tsx (98%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/date_histogram.tsx (99%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/filters/filter_popover.scss (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/filters/filter_popover.test.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/filters/filter_popover.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/filters/filters.scss (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/filters/filters.test.tsx (99%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/filters/filters.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/filters/index.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/formula/editor/formula.scss (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/formula/editor/formula_editor.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/formula/editor/formula_help.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/formula/editor/index.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/formula/editor/math_completion.test.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/formula/editor/math_completion.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/formula/editor/math_tokenization.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/formula/formula.test.tsx (99%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/formula/formula.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/formula/formula_public_api.test.ts (94%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/formula/formula_public_api.ts (94%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/formula/generate.ts (98%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/formula/index.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/formula/math.test.ts (99%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/formula/math.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/formula/math_examples.md (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/formula/parse.ts (98%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/formula/types.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/formula/util.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/formula/validation.ts (99%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/get_group_by_key.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/helpers.test.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/helpers.tsx (97%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/index.ts (95%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/last_value.test.tsx (99%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/last_value.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/metrics.test.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/metrics.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/percentile.test.tsx (99%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/percentile.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/percentile_ranks.test.tsx (99%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/percentile_ranks.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/ranges/advanced_editor.scss (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/ranges/advanced_editor.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/ranges/constants.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/ranges/index.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/ranges/range_editor.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/ranges/ranges.test.tsx (99%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/ranges/ranges.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/shared_components/form_row.scss (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/shared_components/form_row.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/shared_components/index.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/shared_components/label_input.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/static_value.test.tsx (98%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/static_value.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/terms/constants.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/terms/field_inputs.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/terms/helpers.test.ts (99%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/terms/helpers.ts (98%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/terms/include_exclude_options.test.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/terms/include_exclude_options.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/terms/index.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/terms/terms.test.tsx (99%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/terms/types.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/terms/values_input.test.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/definitions/terms/values_input.tsx (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/index.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/layer_helpers.test.ts (97%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/layer_helpers.ts (95%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/mocks.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/operations.test.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/operations.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/time_scale_utils.test.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/operations/time_scale_utils.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/pure_helpers.ts (100%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/pure_utils.ts (95%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/reduced_time_range_utils.tsx (97%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/state_helpers.ts (73%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/time_shift_utils.test.tsx (96%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/time_shift_utils.tsx (98%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/to_expression.ts (98%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/types.ts (86%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/utils.test.tsx (96%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/utils.tsx (97%) rename x-pack/plugins/lens/public/{indexpattern_datasource => form_based_datasource}/visualize_geo_field_button.tsx (100%) diff --git a/x-pack/plugins/lens/public/app_plugin/lens_top_nav.tsx b/x-pack/plugins/lens/public/app_plugin/lens_top_nav.tsx index e595deb97c5dc..d1bd72d27b723 100644 --- a/x-pack/plugins/lens/public/app_plugin/lens_top_nav.tsx +++ b/x-pack/plugins/lens/public/app_plugin/lens_top_nav.tsx @@ -775,7 +775,7 @@ export const LensTopNavMenu = ({ if (isOnTextBasedMode) { dispatch( switchAndCleanDatasource({ - newDatasourceId: 'indexpattern', + newDatasourceId: 'formBased', visualizationId: visualization?.activeId, currentIndexPatternId: dataView?.id, }) @@ -810,7 +810,7 @@ export const LensTopNavMenu = ({ if (isOnTextBasedMode) { dispatch( switchAndCleanDatasource({ - newDatasourceId: 'indexpattern', + newDatasourceId: 'formBased', visualizationId: visualization?.activeId, currentIndexPatternId: dataView?.id, }) @@ -855,7 +855,7 @@ export const LensTopNavMenu = ({ if (isOnTextBasedMode) { dispatch( switchAndCleanDatasource({ - newDatasourceId: 'indexpattern', + newDatasourceId: 'formBased', visualizationId: visualization?.activeId, currentIndexPatternId: newIndexPatternId, }) diff --git a/x-pack/plugins/lens/public/app_plugin/show_underlying_data.test.ts b/x-pack/plugins/lens/public/app_plugin/show_underlying_data.test.ts index 7030e58982ee5..1335d73d173aa 100644 --- a/x-pack/plugins/lens/public/app_plugin/show_underlying_data.test.ts +++ b/x-pack/plugins/lens/public/app_plugin/show_underlying_data.test.ts @@ -93,7 +93,7 @@ describe('getLayerMetaInfo', () => { it('should return error in case of getFilters returning errors', () => { const mockDatasource = createMockDatasource('testDatasource'); const updatedPublicAPI: DatasourcePublicAPI = { - datasourceId: 'indexpattern', + datasourceId: 'formBased', getOperationForColumnId: jest.fn(), getTableSpec: jest.fn(() => [{ columnId: 'col1', fields: ['bytes'] }]), getVisualDefaults: jest.fn(), @@ -154,7 +154,7 @@ describe('getLayerMetaInfo', () => { it('should basically work collecting fields and filters in the visualization', () => { const mockDatasource = createMockDatasource('testDatasource'); const updatedPublicAPI: DatasourcePublicAPI = { - datasourceId: 'indexpattern', + datasourceId: 'formBased', getOperationForColumnId: jest.fn(), getTableSpec: jest.fn(() => [{ columnId: 'col1', fields: ['bytes'] }]), getVisualDefaults: jest.fn(), diff --git a/x-pack/plugins/lens/public/app_plugin/show_underlying_data.ts b/x-pack/plugins/lens/public/app_plugin/show_underlying_data.ts index d5c264c5ade0c..550d23127d67d 100644 --- a/x-pack/plugins/lens/public/app_plugin/show_underlying_data.ts +++ b/x-pack/plugins/lens/public/app_plugin/show_underlying_data.ts @@ -111,7 +111,7 @@ export function getLayerMetaInfo( }; } // maybe add also datasourceId validation here? - if (datasourceAPI.datasourceId !== 'indexpattern') { + if (datasourceAPI.datasourceId !== 'formBased') { return { meta: undefined, error: i18n.translate('xpack.lens.app.showUnderlyingDataUnsupportedDatasource', { diff --git a/x-pack/plugins/lens/public/async_services.ts b/x-pack/plugins/lens/public/async_services.ts index 0ae3870fef7af..9927aa4b3a212 100644 --- a/x-pack/plugins/lens/public/async_services.ts +++ b/x-pack/plugins/lens/public/async_services.ts @@ -29,12 +29,12 @@ export * from './visualizations/heatmap'; export * from './visualizations/gauge/gauge_visualization'; export * from './visualizations/gauge'; -export * from './indexpattern_datasource/indexpattern'; -export { getTextBasedLanguagesDatasource } from './text_based_datasource/text_based_languages'; -export { createFormulaPublicApi } from './indexpattern_datasource/operations/definitions/formula/formula_public_api'; +export * from './form_based_datasource/form_based'; +export { getTextBasedDatasource } from './text_based_datasource/text_based_languages'; +export { createFormulaPublicApi } from './form_based_datasource/operations/definitions/formula/formula_public_api'; export * from './text_based_datasource'; -export * from './indexpattern_datasource'; +export * from './form_based_datasource'; export * from './lens_ui_telemetry'; export * from './lens_ui_errors'; export * from './editor_frame_service/editor_frame'; diff --git a/x-pack/plugins/lens/public/data_views_service/loader.test.ts b/x-pack/plugins/lens/public/data_views_service/loader.test.ts index 340bc675bf3e7..24ef8feb1b614 100644 --- a/x-pack/plugins/lens/public/data_views_service/loader.test.ts +++ b/x-pack/plugins/lens/public/data_views_service/loader.test.ts @@ -14,7 +14,7 @@ import { syncExistingFields, } from './loader'; import { sampleIndexPatterns, mockDataViewsService } from './mocks'; -import { documentField } from '../indexpattern_datasource/document_field'; +import { documentField } from '../form_based_datasource/document_field'; import { coreMock } from '@kbn/core/public/mocks'; import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; import type { DataView } from '@kbn/data-views-plugin/public'; diff --git a/x-pack/plugins/lens/public/data_views_service/loader.ts b/x-pack/plugins/lens/public/data_views_service/loader.ts index 9ffb99a54f403..bd97bb3b8b69d 100644 --- a/x-pack/plugins/lens/public/data_views_service/loader.ts +++ b/x-pack/plugins/lens/public/data_views_service/loader.ts @@ -12,7 +12,7 @@ import { CoreStart } from '@kbn/core/public'; import { DataPublicPluginStart } from '@kbn/data-plugin/public'; import { loadFieldExisting } from '@kbn/unified-field-list-plugin/public'; import { IndexPattern, IndexPatternField, IndexPatternMap, IndexPatternRef } from '../types'; -import { documentField } from '../indexpattern_datasource/document_field'; +import { documentField } from '../form_based_datasource/document_field'; import { DateRange } from '../../common'; import { DataViewsState } from '../state_management'; diff --git a/x-pack/plugins/lens/public/data_views_service/mocks.ts b/x-pack/plugins/lens/public/data_views_service/mocks.ts index 9b7f5cbc2a91a..b388bb8e24019 100644 --- a/x-pack/plugins/lens/public/data_views_service/mocks.ts +++ b/x-pack/plugins/lens/public/data_views_service/mocks.ts @@ -6,11 +6,11 @@ */ import { DataViewsContract } from '@kbn/data-views-plugin/common'; -import { documentField } from '../indexpattern_datasource/document_field'; +import { documentField } from '../form_based_datasource/document_field'; import { createMockedIndexPattern, createMockedRestrictedIndexPattern, -} from '../indexpattern_datasource/mocks'; +} from '../form_based_datasource/mocks'; import { DataViewsState } from '../state_management'; import { ExistingFieldsMap, IndexPattern } from '../types'; import { getFieldByNameFactory } from './loader'; diff --git a/x-pack/plugins/lens/public/embeddable/embeddable_component.tsx b/x-pack/plugins/lens/public/embeddable/embeddable_component.tsx index 98c8d363a45b7..7e1c4ee25c928 100644 --- a/x-pack/plugins/lens/public/embeddable/embeddable_component.tsx +++ b/x-pack/plugins/lens/public/embeddable/embeddable_component.tsx @@ -22,7 +22,7 @@ import { } from '@kbn/embeddable-plugin/public'; import type { LensByReferenceInput, LensByValueInput } from './embeddable'; import type { Document } from '../persistence'; -import type { IndexPatternPersistedState } from '../indexpattern_datasource/types'; +import type { FormBasedPersistedState } from '../form_based_datasource/types'; import type { XYState } from '../visualizations/xy/types'; import type { PieVisualizationState, LegacyMetricState } from '../../common'; import type { DatatableVisualizationState } from '../visualizations/datatable/visualization'; @@ -37,7 +37,7 @@ type LensAttributes = Omit< visualizationType: TVisType; state: Omit & { datasourceStates: { - indexpattern: IndexPatternPersistedState; + indexpattern: FormBasedPersistedState; }; visualization: TVisState; }; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/__mocks__/loader.ts b/x-pack/plugins/lens/public/form_based_datasource/__mocks__/loader.ts similarity index 91% rename from x-pack/plugins/lens/public/indexpattern_datasource/__mocks__/loader.ts rename to x-pack/plugins/lens/public/form_based_datasource/__mocks__/loader.ts index 1273d596576c4..47af8d816b73f 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/__mocks__/loader.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/__mocks__/loader.ts @@ -6,11 +6,11 @@ */ import { createMockedIndexPattern, createMockedRestrictedIndexPattern } from '../mocks'; -import { IndexPatternPrivateState } from '../types'; +import { FormBasedPrivateState } from '../types'; export function loadInitialState() { const indexPattern = createMockedIndexPattern(); - const result: IndexPatternPrivateState = { + const result: FormBasedPrivateState = { currentIndexPatternId: indexPattern.id, layers: {}, }; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/__snapshots__/utils.test.tsx.snap b/x-pack/plugins/lens/public/form_based_datasource/__snapshots__/utils.test.tsx.snap similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/__snapshots__/utils.test.tsx.snap rename to x-pack/plugins/lens/public/form_based_datasource/__snapshots__/utils.test.tsx.snap diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.scss b/x-pack/plugins/lens/public/form_based_datasource/datapanel.scss similarity index 72% rename from x-pack/plugins/lens/public/indexpattern_datasource/datapanel.scss rename to x-pack/plugins/lens/public/form_based_datasource/datapanel.scss index ef68c784100e4..ede6252711e65 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.scss +++ b/x-pack/plugins/lens/public/form_based_datasource/datapanel.scss @@ -1,41 +1,41 @@ -.lnsInnerIndexPatternDataPanel { +.lnsInnerFormBasedDataPanel { width: 100%; height: 100%; padding: $euiSize $euiSize 0; } -.lnsInnerIndexPatternDataPanel__switcher { +.lnsInnerFormBasedDataPanel__switcher { min-width: 0; } -.lnsInnerIndexPatternDataPanel__header { +.lnsInnerFormBasedDataPanel__header { display: flex; align-items: center; margin-bottom: $euiSizeS; } -.lnsInnerIndexPatternDataPanel__titleTooltip { +.lnsInnerFormBasedDataPanel__titleTooltip { margin-right: $euiSizeXS; } -.lnsInnerIndexPatternDataPanel__fieldItems { +.lnsInnerFormBasedDataPanel__fieldItems { // Quick fix for making sure the shadow and focus rings are visible outside the accordion bounds padding: $euiSizeXS; } -.lnsInnerIndexPatternDataPanel__textField { +.lnsInnerFormBasedDataPanel__textField { @include euiFormControlLayoutPadding(1, 'right'); @include euiFormControlLayoutPadding(1, 'left'); box-shadow: none; } -.lnsInnerIndexPatternDataPanel__filterType { +.lnsInnerFormBasedDataPanel__filterType { font-size: $euiFontSizeS; padding: $euiSizeS; border-bottom: 1px solid $euiColorLightestShade; } -.lnsInnerIndexPatternDataPanel__filterTypeInner { +.lnsInnerFormBasedDataPanel__filterTypeInner { display: flex; align-items: center; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.test.tsx b/x-pack/plugins/lens/public/form_based_datasource/datapanel.test.tsx similarity index 94% rename from x-pack/plugins/lens/public/indexpattern_datasource/datapanel.test.tsx rename to x-pack/plugins/lens/public/form_based_datasource/datapanel.test.tsx index 7ee461aa63369..d83191ba0c670 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.test.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/datapanel.test.tsx @@ -13,13 +13,13 @@ import { dataViewPluginMocks, Start as DataViewPublicStart, } from '@kbn/data-views-plugin/public/mocks'; -import { InnerIndexPatternDataPanel, IndexPatternDataPanel, Props } from './datapanel'; +import { InnerFormBasedDataPanel, FormBasedDataPanel, Props } from './datapanel'; import { FieldList } from './field_list'; import { FieldItem } from './field_item'; import { NoFieldsCallout } from './no_fields_callout'; import { act } from 'react-dom/test-utils'; import { coreMock } from '@kbn/core/public/mocks'; -import { IndexPatternPrivateState } from './types'; +import { FormBasedPrivateState } from './types'; import { mountWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import { EuiProgress, EuiLoadingSpinner } from '@elastic/eui'; import { documentField } from './document_field'; @@ -174,7 +174,7 @@ function getExistingFields(indexPatterns: Record) { return existingFields; } -const initialState: IndexPatternPrivateState = { +const initialState: FormBasedPrivateState = { currentIndexPatternId: '1', layers: { first: { @@ -304,7 +304,7 @@ describe('IndexPattern Data Panel', () => { hasRestrictions: false, }, }; - let defaultProps: Parameters[0] & { + let defaultProps: Parameters[0] & { showNoDataPopover: () => void; }; let core: ReturnType; @@ -340,7 +340,7 @@ describe('IndexPattern Data Panel', () => { it('should render a warning if there are no index patterns', () => { const wrapper = shallowWithIntl( - { columns: {}, }, }, - } as IndexPatternPrivateState, + } as FormBasedPrivateState, }; } async function testExistenceLoading( props: Props, - stateChanges?: Partial, + stateChanges?: Partial, propChanges?: Partial ) { - const inst = mountWithIntl(); + const inst = mountWithIntl(); await act(async () => { inst.update(); @@ -601,7 +601,7 @@ describe('IndexPattern Data Panel', () => { it('shows a loading indicator when loading', async () => { const updateIndexPatterns = jest.fn(); const load = async () => {}; - const inst = mountWithIntl(); + const inst = mountWithIntl(); expect(inst.find(EuiProgress).length).toEqual(1); await act(load); inst.update(); @@ -629,7 +629,7 @@ describe('IndexPattern Data Panel', () => { return result; }); - const inst = mountWithIntl(); + const inst = mountWithIntl(); inst.update(); @@ -676,7 +676,7 @@ describe('IndexPattern Data Panel', () => { }); describe('displaying field list', () => { - let props: Parameters[0]; + let props: Parameters[0]; beforeEach(() => { props = { ...defaultProps, @@ -691,7 +691,7 @@ describe('IndexPattern Data Panel', () => { }; }); it('should list all supported fields in the pattern sorted alphabetically in groups', async () => { - const wrapper = mountWithIntl(); + const wrapper = mountWithIntl(); expect(wrapper.find(FieldItem).first().prop('field').displayName).toEqual('Records'); expect( wrapper @@ -715,7 +715,7 @@ describe('IndexPattern Data Panel', () => { it('should show meta fields accordion', async () => { const wrapper = mountWithIntl( - { it('should display NoFieldsCallout when all fields are empty', async () => { const wrapper = mountWithIntl( - @@ -780,7 +780,7 @@ describe('IndexPattern Data Panel', () => { it('should display spinner for available fields accordion if existing fields are not loaded yet', async () => { const wrapper = mountWithIntl( - @@ -795,7 +795,7 @@ describe('IndexPattern Data Panel', () => { it('should not allow field details when error', () => { const wrapper = mountWithIntl( - @@ -810,7 +810,7 @@ describe('IndexPattern Data Panel', () => { it('should allow field details when timeout', () => { const wrapper = mountWithIntl( - @@ -824,7 +824,7 @@ describe('IndexPattern Data Panel', () => { }); it('should filter down by name', () => { - const wrapper = mountWithIntl(); + const wrapper = mountWithIntl(); act(() => { wrapper.find('[data-test-subj="lnsIndexPatternFieldSearch"]').simulate('change', { target: { value: 'me' }, @@ -843,7 +843,7 @@ describe('IndexPattern Data Panel', () => { }); it('should announce filter in live region', () => { - const wrapper = mountWithIntl(); + const wrapper = mountWithIntl(); act(() => { wrapper.find('[data-test-subj="lnsIndexPatternFieldSearch"]').simulate('change', { target: { value: 'me' }, @@ -862,7 +862,7 @@ describe('IndexPattern Data Panel', () => { }); it('should filter down by type', () => { - const wrapper = mountWithIntl(); + const wrapper = mountWithIntl(); wrapper.find('[data-test-subj="lnsIndexPatternFiltersToggle"]').first().simulate('click'); @@ -874,7 +874,7 @@ describe('IndexPattern Data Panel', () => { }); it('should display no fields in groups when filtered by type Record', () => { - const wrapper = mountWithIntl(); + const wrapper = mountWithIntl(); wrapper.find('[data-test-subj="lnsIndexPatternFiltersToggle"]').first().simulate('click'); @@ -887,7 +887,7 @@ describe('IndexPattern Data Panel', () => { }); it('should toggle type if clicked again', () => { - const wrapper = mountWithIntl(); + const wrapper = mountWithIntl(); wrapper.find('[data-test-subj="lnsIndexPatternFiltersToggle"]').first().simulate('click'); wrapper.find('[data-test-subj="typeFilter-number"]').first().simulate('click'); @@ -903,7 +903,7 @@ describe('IndexPattern Data Panel', () => { }); it('should filter down by type and by name', () => { - const wrapper = mountWithIntl(); + const wrapper = mountWithIntl(); act(() => { wrapper.find('[data-test-subj="lnsIndexPatternFieldSearch"]').simulate('change', { target: { value: 'me' }, diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.tsx b/x-pack/plugins/lens/public/form_based_datasource/datapanel.tsx similarity index 97% rename from x-pack/plugins/lens/public/indexpattern_datasource/datapanel.tsx rename to x-pack/plugins/lens/public/form_based_datasource/datapanel.tsx index 1ce184e623e7a..c811d03838015 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/datapanel.tsx @@ -41,7 +41,7 @@ import type { IndexPatternField, } from '../types'; import { ChildDragDropProvider, DragContextState } from '../drag_drop'; -import type { IndexPatternPrivateState } from './types'; +import type { FormBasedPrivateState } from './types'; import { Loader } from '../loader'; import { LensFieldIcon } from '../shared_components/field_picker/lens_field_icon'; import { getFieldType } from './pure_utils'; @@ -50,7 +50,7 @@ import { fieldContainsData, fieldExists } from '../shared_components'; import { IndexPatternServiceAPI } from '../data_views_service/service'; export type Props = Omit< - DatasourceDataPanelProps, + DatasourceDataPanelProps, 'core' | 'onChangeIndexPattern' > & { data: DataPublicPluginStart; @@ -124,7 +124,7 @@ function buildSafeEsQuery( } } -export function IndexPatternDataPanel({ +export function FormBasedDataPanel({ state, dragDropContext, core, @@ -193,7 +193,7 @@ export function IndexPatternDataPanel({ {Object.keys(indexPatterns).length === 0 && indexPatternRefs.length === 0 ? ( @@ -264,7 +264,7 @@ const defaultFieldGroups: { const htmlId = htmlIdGenerator('datapanel'); const fieldSearchDescriptionId = htmlId(); -export const InnerIndexPatternDataPanel = function InnerIndexPatternDataPanel({ +export const InnerFormBasedDataPanel = function InnerFormBasedDataPanel({ currentIndexPatternId, query, dateRange, @@ -615,7 +615,7 @@ export const InnerIndexPatternDataPanel = function InnerIndexPatternDataPanel({ @@ -672,7 +672,7 @@ export const InnerIndexPatternDataPanel = function InnerIndexPatternDataPanel({ data-test-subj="lnsIndexPatternTypeFilterOptions" items={(availableFieldTypes as DataType[]).map((type) => ( - + {fieldTypeNames[type]} @@ -695,7 +695,7 @@ export const InnerIndexPatternDataPanel = function InnerIndexPatternDataPanel({ } > = { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/bucket_nesting_editor.tsx b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/bucket_nesting_editor.tsx similarity index 97% rename from x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/bucket_nesting_editor.tsx rename to x-pack/plugins/lens/public/form_based_datasource/dimension_panel/bucket_nesting_editor.tsx index 31a4b91706dfa..357884d5961d7 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/bucket_nesting_editor.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/bucket_nesting_editor.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; import { EuiFormRow, EuiSwitch, EuiSelect } from '@elastic/eui'; -import { IndexPatternLayer } from '../types'; +import { FormBasedLayer } from '../types'; import { hasField } from '../pure_utils'; import { GenericIndexPatternColumn } from '../operations'; import { IndexPatternField } from '../../types'; @@ -38,7 +38,7 @@ export function BucketNestingEditor({ getFieldByName, }: { columnId: string; - layer: IndexPatternLayer; + layer: FormBasedLayer; setColumns: (columns: string[]) => void; getFieldByName: (name: string) => IndexPatternField | undefined; }) { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_editor.scss b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/dimension_editor.scss similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_editor.scss rename to x-pack/plugins/lens/public/form_based_datasource/dimension_panel/dimension_editor.scss diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_editor.tsx b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/dimension_editor.tsx similarity index 97% rename from x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_editor.tsx rename to x-pack/plugins/lens/public/form_based_datasource/dimension_panel/dimension_editor.tsx index 5a975482e6250..818d93897ef1d 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_editor.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/dimension_editor.tsx @@ -27,9 +27,9 @@ import { EuiButtonIcon, } from '@elastic/eui'; import ReactDOM from 'react-dom'; -import type { IndexPatternDimensionEditorProps } from './dimension_panel'; +import type { FormBasedDimensionEditorProps } from './dimension_panel'; import type { OperationSupportMatrix } from './operation_support'; -import { deleteColumn, GenericIndexPatternColumn } from '../indexpattern'; +import { deleteColumn, GenericIndexPatternColumn } from '../form_based'; import { operationDefinitionMap, getOperationDisplay, @@ -46,7 +46,7 @@ import { mergeLayer } from '../state_helpers'; import { getReferencedField, hasField } from '../pure_utils'; import { fieldIsInvalid } from '../utils'; import { BucketNestingEditor } from './bucket_nesting_editor'; -import type { IndexPatternLayer } from '../types'; +import type { FormBasedLayer } from '../types'; import { FormatSelector } from './format_selector'; import { ReferenceEditor } from './reference_editor'; import { TimeScaling } from './time_scaling'; @@ -76,7 +76,7 @@ import type { FieldChoiceWithOperationType } from './field_select'; import type { IndexPattern, IndexPatternField } from '../../types'; import { documentField } from '../document_field'; -export interface DimensionEditorProps extends IndexPatternDimensionEditorProps { +export interface DimensionEditorProps extends FormBasedDimensionEditorProps { selectedColumn?: GenericIndexPatternColumn; layerType: LayerType; operationSupportMatrix: OperationSupportMatrix; @@ -137,13 +137,13 @@ export function DimensionEditor(props: DimensionEditorProps) { const setStateWrapper = ( setter: - | IndexPatternLayer - | ((prevLayer: IndexPatternLayer) => IndexPatternLayer) + | FormBasedLayer + | ((prevLayer: FormBasedLayer) => FormBasedLayer) | GenericIndexPatternColumn, options: { forceRender?: boolean } = {} ) => { const layer = state.layers[layerId]; - let hypotethicalLayer: IndexPatternLayer; + let hypotethicalLayer: FormBasedLayer; if (isColumn(setter)) { hypotethicalLayer = { ...layer, @@ -159,7 +159,7 @@ export function DimensionEditor(props: DimensionEditorProps) { setState( (prevState) => { - let outputLayer: IndexPatternLayer; + let outputLayer: FormBasedLayer; const prevLayer = prevState.layers[layerId]; if (isColumn(setter)) { outputLayer = { @@ -243,8 +243,8 @@ export function DimensionEditor(props: DimensionEditorProps) { // TODO: revisit this once we get rid of updateDatasourceAsync upstream const moveDefinetelyToStaticValueAndUpdate = ( setter: - | IndexPatternLayer - | ((prevLayer: IndexPatternLayer) => IndexPatternLayer) + | FormBasedLayer + | ((prevLayer: FormBasedLayer) => FormBasedLayer) | GenericIndexPatternColumn ) => { if (temporaryStaticValue) { @@ -494,7 +494,7 @@ export function DimensionEditor(props: DimensionEditorProps) { } else if (!selectedColumn || !compatibleWithCurrentField) { const possibleFields = fieldByOperation[operationType] || new Set(); - let newLayer: IndexPatternLayer; + let newLayer: FormBasedLayer; if (possibleFields.size === 1) { newLayer = insertOrReplaceColumn({ layer: props.state.layers[props.layerId], @@ -578,9 +578,7 @@ export function DimensionEditor(props: DimensionEditorProps) { const paramEditorProps: ParamEditorProps< GenericIndexPatternColumn, - | IndexPatternLayer - | ((prevLayer: IndexPatternLayer) => IndexPatternLayer) - | GenericIndexPatternColumn + FormBasedLayer | ((prevLayer: FormBasedLayer) => FormBasedLayer) | GenericIndexPatternColumn > = { layer: state.layers[layerId], layerId, @@ -754,11 +752,11 @@ export function DimensionEditor(props: DimensionEditorProps) { }} paramEditorUpdater={( setter: - | IndexPatternLayer - | ((prevLayer: IndexPatternLayer) => IndexPatternLayer) + | FormBasedLayer + | ((prevLayer: FormBasedLayer) => FormBasedLayer) | GenericIndexPatternColumn ) => { - let newLayer: IndexPatternLayer; + let newLayer: FormBasedLayer; if (typeof setter === 'function') { newLayer = setter(layer); } else if (isColumn(setter)) { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/dimension_panel.test.tsx similarity index 89% rename from x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx rename to x-pack/plugins/lens/public/form_based_datasource/dimension_panel/dimension_panel.test.tsx index c7c0ff5d205cb..13dc9df220ee3 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/dimension_panel.test.tsx @@ -21,8 +21,8 @@ import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; import { DataPublicPluginStart } from '@kbn/data-plugin/public'; import { fieldFormatsServiceMock } from '@kbn/field-formats-plugin/public/mocks'; import { - IndexPatternDimensionEditorComponent, - IndexPatternDimensionEditorProps, + FormBasedDimensionEditorComponent, + FormBasedDimensionEditorProps, } from './dimension_panel'; import { mountWithIntl as mount, shallowWithIntl as shallow } from '@kbn/test-jest-helpers'; import { @@ -33,7 +33,7 @@ import { } from '@kbn/core/public'; import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; import { generateId } from '../../id_generator'; -import { IndexPatternPrivateState } from '../types'; +import { FormBasedPrivateState } from '../types'; import { FiltersIndexPatternColumn, GenericIndexPatternColumn, @@ -148,10 +148,10 @@ const bytesColumn: GenericIndexPatternColumn = { * - Dimension trigger: Not tested here * - Dimension editor component: First half of the tests */ -describe('IndexPatternDimensionEditorPanel', () => { - let state: IndexPatternPrivateState; +describe('FormBasedDimensionEditor', () => { + let state: FormBasedPrivateState; let setState: jest.Mock; - let defaultProps: IndexPatternDimensionEditorProps; + let defaultProps: FormBasedDimensionEditorProps; function getStateWithColumns(columns: Record) { return { @@ -265,14 +265,14 @@ describe('IndexPatternDimensionEditorPanel', () => { const filterOperations = jest.fn().mockReturnValue(true); wrapper = shallow( - + ); expect(filterOperations).toBeCalled(); }); it('should show field select', () => { - wrapper = mount(); + wrapper = mount(); expect( wrapper.find(EuiComboBox).filter('[data-test-subj="indexPattern-dimension-field"]') @@ -281,7 +281,7 @@ describe('IndexPatternDimensionEditorPanel', () => { it('should not show field select on fieldless operation', () => { wrapper = mount( - { it('should not show any choices if the filter returns false', () => { wrapper = mount( - false} @@ -320,7 +320,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }); it('should list all field names and document as a whole in prioritized order', () => { - wrapper = mount(); + wrapper = mount(); const options = wrapper .find(EuiComboBox) @@ -348,7 +348,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }, }, }; - wrapper = mount(); + wrapper = mount(); const options = wrapper .find(EuiComboBox) @@ -360,7 +360,7 @@ describe('IndexPatternDimensionEditorPanel', () => { it('should indicate fields which are incompatible for the operation of the current column', () => { wrapper = mount( - @@ -383,7 +383,7 @@ describe('IndexPatternDimensionEditorPanel', () => { it('should indicate operations which are incompatible for the field of the current column', () => { wrapper = mount( - @@ -407,7 +407,7 @@ describe('IndexPatternDimensionEditorPanel', () => { it('should indicate when a transition is invalid due to filterOperations', () => { wrapper = mount( - { }); it('should not display hidden operation types', () => { - wrapper = mount(); + wrapper = mount(); const items: EuiListGroupItemProps[] = wrapper.find(EuiListGroup).prop('listItems') || []; @@ -442,7 +442,7 @@ describe('IndexPatternDimensionEditorPanel', () => { it('should indicate that reference-based operations are not compatible when they are incomplete', () => { wrapper = mount( - { it('should indicate that reference-based operations are compatible sometimes', () => { wrapper = mount( - { }); it('should keep the operation when switching to another field compatible with this operation', () => { - const initialState: IndexPatternPrivateState = getStateWithColumns({ col1: bytesColumn }); + const initialState: FormBasedPrivateState = getStateWithColumns({ col1: bytesColumn }); - wrapper = mount( - - ); + wrapper = mount(); const comboBox = wrapper .find(EuiComboBox) @@ -562,7 +560,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }); it('should switch operations when selecting a field that requires another operation', () => { - wrapper = mount(); + wrapper = mount(); const comboBox = wrapper .find(EuiComboBox) @@ -597,7 +595,7 @@ describe('IndexPatternDimensionEditorPanel', () => { it('should keep the field when switching to another operation compatible for this field', () => { wrapper = mount( - @@ -628,7 +626,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }); it('should not set the state if selecting the currently active operation', () => { - wrapper = mount(); + wrapper = mount(); act(() => { wrapper @@ -640,7 +638,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }); it('should update label and custom label flag on label input changes', () => { - wrapper = mount(); + wrapper = mount(); act(() => { wrapper @@ -669,7 +667,7 @@ describe('IndexPatternDimensionEditorPanel', () => { it('should not keep the label as long as it is the default label', () => { wrapper = mount( - @@ -698,7 +696,7 @@ describe('IndexPatternDimensionEditorPanel', () => { it('should keep the label on operation change if it is custom', () => { wrapper = mount( - { it('should remove customLabel flag if label is set to default', () => { wrapper = mount( - { describe('transient invalid state', () => { it('should set the state if selecting an operation incompatible with the current field', () => { - wrapper = mount(); + wrapper = mount(); act(() => { wrapper @@ -799,7 +797,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }); it('should show error message in invalid state', () => { - wrapper = mount(); + wrapper = mount(); wrapper .find('button[data-test-subj="lns-indexPatternDimension-terms incompatible"]') @@ -811,7 +809,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }); it('should leave error state if a compatible operation is selected', () => { - wrapper = mount(); + wrapper = mount(); wrapper .find('button[data-test-subj="lns-indexPatternDimension-terms incompatible"]') @@ -825,7 +823,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }); it('should leave error state if the original operation is re-selected', () => { - wrapper = mount(); + wrapper = mount(); wrapper .find('button[data-test-subj="lns-indexPatternDimension-terms incompatible"]') @@ -841,7 +839,7 @@ describe('IndexPatternDimensionEditorPanel', () => { it('should leave error state when switching from incomplete state to fieldless operation', () => { // @ts-expect-error window['__react-beautiful-dnd-disable-dev-warnings'] = true; // issue with enzyme & react-beautiful-dnd throwing errors: https://github.com/atlassian/react-beautiful-dnd/issues/1593 - wrapper = mount(); + wrapper = mount(); wrapper .find('button[data-test-subj="lns-indexPatternDimension-terms incompatible"]') @@ -854,7 +852,7 @@ describe('IndexPatternDimensionEditorPanel', () => { it('should leave error state when re-selecting the original fieldless function', () => { wrapper = mount( - { }); it('should indicate fields compatible with selected operation', () => { - wrapper = mount(); + wrapper = mount(); wrapper .find('button[data-test-subj="lns-indexPatternDimension-terms incompatible"]') @@ -901,7 +899,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }); it('should select compatible operation if field not compatible with selected operation', () => { - wrapper = mount(); + wrapper = mount(); wrapper.find('button[data-test-subj="lns-indexPatternDimension-average"]').simulate('click'); @@ -962,11 +960,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }, }); wrapper = mount( - + ); // Transition to a field operation (incompatible) @@ -991,7 +985,7 @@ describe('IndexPatternDimensionEditorPanel', () => { it('should select the Records field when count is selected on non-existing column', () => { wrapper = mount( - { it('should indicate document and field compatibility with selected document operation', () => { wrapper = mount( - { }); it('should set datasource state if compatible field is selected for operation', () => { - wrapper = mount(); + wrapper = mount(); wrapper .find('button[data-test-subj="lns-indexPatternDimension-terms incompatible"]') @@ -1110,7 +1104,7 @@ describe('IndexPatternDimensionEditorPanel', () => { } it('should default to None if time scaling is not set', () => { - wrapper = mount(); + wrapper = mount(); findTestSubject(wrapper, 'indexPattern-advanced-accordion').simulate('click'); expect(wrapper.find('[data-test-subj="indexPattern-time-scaling-enable"]')).toHaveLength(1); expect( @@ -1122,7 +1116,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }); it('should show current time scaling if set', () => { - wrapper = mount(); + wrapper = mount(); findTestSubject(wrapper, 'indexPattern-advanced-accordion').simulate('click'); expect( wrapper @@ -1134,7 +1128,7 @@ describe('IndexPatternDimensionEditorPanel', () => { it('should allow to set time scaling initially', () => { const props = getProps({}); - wrapper = mount(); + wrapper = mount(); findTestSubject(wrapper, 'indexPattern-advanced-accordion').simulate('click'); wrapper .find('[data-test-subj="indexPattern-time-scaling-unit"]') @@ -1167,7 +1161,7 @@ describe('IndexPatternDimensionEditorPanel', () => { operationType: 'sum', label: 'Sum of bytes per hour', }); - wrapper = mount(); + wrapper = mount(); wrapper.find('button[data-test-subj="lns-indexPatternDimension-count"]').simulate('click'); expect(setState.mock.calls[0]).toEqual([expect.any(Function), { isDimensionComplete: true }]); expect(setState.mock.calls[0][0](props.state)).toEqual({ @@ -1194,7 +1188,7 @@ describe('IndexPatternDimensionEditorPanel', () => { operationType: 'sum', label: 'Sum of bytes per hour', }); - wrapper = mount(); + wrapper = mount(); wrapper.find('button[data-test-subj="lns-indexPatternDimension-average"]').simulate('click'); expect(setState.mock.calls[0]).toEqual([expect.any(Function), { isDimensionComplete: true }]); expect(setState.mock.calls[0][0](props.state)).toEqual({ @@ -1216,7 +1210,7 @@ describe('IndexPatternDimensionEditorPanel', () => { it('should allow to change time scaling', () => { const props = getProps({ timeScale: 's', label: 'Count of records per second' }); - wrapper = mount(); + wrapper = mount(); findTestSubject(wrapper, 'indexPattern-advanced-accordion').simulate('click'); wrapper.find('[data-test-subj="indexPattern-time-scaling-unit"] select').simulate('change', { @@ -1243,7 +1237,7 @@ describe('IndexPatternDimensionEditorPanel', () => { it('should not adjust label if it is custom', () => { const props = getProps({ timeScale: 's', customLabel: true, label: 'My label' }); - wrapper = mount(); + wrapper = mount(); wrapper.find('[data-test-subj="indexPattern-time-scaling-unit"] select').simulate('change', { target: { value: 'h' }, }); @@ -1309,7 +1303,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }), columnId: 'col2', }; - wrapper = mount(); + wrapper = mount(); findTestSubject(wrapper, 'indexPattern-advanced-accordion').simulate('click'); expect( wrapper.find('[data-test-subj="indexPattern-dimension-reducedTimeRange-row"]') @@ -1318,7 +1312,7 @@ describe('IndexPatternDimensionEditorPanel', () => { it('should show current reduced time range if set', () => { wrapper = mount( - + ); expect( wrapper.find(ReducedTimeRange).find(EuiComboBox).prop('selectedOptions')[0].value @@ -1327,7 +1321,7 @@ describe('IndexPatternDimensionEditorPanel', () => { it('should allow to set reduced time range initially', () => { const props = getProps({}); - wrapper = mount(); + wrapper = mount(); findTestSubject(wrapper, 'indexPattern-advanced-accordion').simulate('click'); wrapper.find(ReducedTimeRange).find(EuiComboBox).prop('onChange')!([ { value: '1h', label: '' }, @@ -1355,7 +1349,7 @@ describe('IndexPatternDimensionEditorPanel', () => { operationType: 'sum', label: 'Sum of bytes per hour', }); - wrapper = mount(); + wrapper = mount(); wrapper.find('button[data-test-subj="lns-indexPatternDimension-count"]').simulate('click'); expect((props.setState as jest.Mock).mock.calls[0][0](props.state)).toEqual({ ...props.state, @@ -1377,7 +1371,7 @@ describe('IndexPatternDimensionEditorPanel', () => { const props = getProps({ timeShift: '1d', }); - wrapper = mount(); + wrapper = mount(); wrapper.find(ReducedTimeRange).find(EuiComboBox).prop('onCreateOption')!('7m', []); expect((props.setState as jest.Mock).mock.calls[0][0](props.state)).toEqual({ ...props.state, @@ -1399,7 +1393,7 @@ describe('IndexPatternDimensionEditorPanel', () => { const props = getProps({ reducedTimeRange: '5 months', }); - wrapper = mount(); + wrapper = mount(); expect(wrapper.find(ReducedTimeRange).find(EuiComboBox).prop('isInvalid')).toBeTruthy(); @@ -1457,7 +1451,7 @@ describe('IndexPatternDimensionEditorPanel', () => { columnId: 'col2', }; wrapper = mount( - { }); it('should show custom options if time shift is available', () => { - wrapper = shallow(); + wrapper = shallow(); expect( wrapper .find(DimensionEditor) @@ -1485,7 +1479,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }); it('should show current time shift if set', () => { - wrapper = mount(); + wrapper = mount(); expect(wrapper.find(TimeShift).find(EuiComboBox).prop('selectedOptions')[0].value).toEqual( '1d' ); @@ -1493,7 +1487,7 @@ describe('IndexPatternDimensionEditorPanel', () => { it('should allow to set time shift initially', () => { const props = getProps({}); - wrapper = mount(); + wrapper = mount(); findTestSubject(wrapper, 'indexPattern-advanced-accordion').simulate('click'); wrapper.find(TimeShift).find(EuiComboBox).prop('onChange')!([{ value: '1h', label: '' }]); expect((props.setState as jest.Mock).mock.calls[0][0](props.state)).toEqual({ @@ -1519,7 +1513,7 @@ describe('IndexPatternDimensionEditorPanel', () => { operationType: 'sum', label: 'Sum of bytes per hour', }); - wrapper = mount(); + wrapper = mount(); wrapper.find('button[data-test-subj="lns-indexPatternDimension-count"]').simulate('click'); expect((props.setState as jest.Mock).mock.calls[0][0](props.state)).toEqual({ ...props.state, @@ -1541,7 +1535,7 @@ describe('IndexPatternDimensionEditorPanel', () => { const props = getProps({ timeShift: '1d', }); - wrapper = mount(); + wrapper = mount(); wrapper.find(TimeShift).find(EuiComboBox).prop('onCreateOption')!('1h', []); expect((props.setState as jest.Mock).mock.calls[0][0](props.state)).toEqual({ ...props.state, @@ -1563,7 +1557,7 @@ describe('IndexPatternDimensionEditorPanel', () => { const props = getProps({ timeShift: '5 months', }); - wrapper = mount(); + wrapper = mount(); expect(wrapper.find(TimeShift).find(EuiComboBox).prop('isInvalid')).toBeTruthy(); @@ -1608,7 +1602,7 @@ describe('IndexPatternDimensionEditorPanel', () => { it('should not show custom options if time scaling is not available', () => { wrapper = mount( - { }); it('should show custom options if filtering is available', () => { - wrapper = mount(); + wrapper = mount(); findTestSubject(wrapper, 'indexPattern-advanced-accordion').simulate('click'); expect( wrapper.find('[data-test-subj="indexPattern-filter-by-enable"]').hostNodes() @@ -1635,7 +1629,7 @@ describe('IndexPatternDimensionEditorPanel', () => { it('should show current filter if set', () => { wrapper = mount( - ); @@ -1655,7 +1649,7 @@ describe('IndexPatternDimensionEditorPanel', () => { operationType: 'sum', label: 'Sum of bytes per hour', }); - wrapper = mount(); + wrapper = mount(); wrapper.find('button[data-test-subj="lns-indexPatternDimension-count"]').simulate('click'); expect(setState.mock.calls[0]).toEqual([expect.any(Function), { isDimensionComplete: true }]); expect(setState.mock.calls[0][0](props.state)).toEqual({ @@ -1679,7 +1673,7 @@ describe('IndexPatternDimensionEditorPanel', () => { filter: { language: 'kuery', query: 'a: b' }, }); - wrapper = mount(); + wrapper = mount(); act(() => { const { updateLayer, columnId, layer } = wrapper.find(Filtering).props(); @@ -1707,7 +1701,7 @@ describe('IndexPatternDimensionEditorPanel', () => { it('should render invalid field if field reference is broken', () => { wrapper = mount( - { }); it('should support selecting the operation before the field', () => { - wrapper = mount(); + wrapper = mount(); wrapper.find('button[data-test-subj="lns-indexPatternDimension-average"]').simulate('click'); @@ -1784,7 +1778,7 @@ describe('IndexPatternDimensionEditorPanel', () => { it('should select operation directly if only one field is possible', () => { wrapper = mount( - { }); it('should select operation directly if only document is possible', () => { - wrapper = mount(); + wrapper = mount(); wrapper.find('button[data-test-subj="lns-indexPatternDimension-count"]').simulate('click'); @@ -1845,7 +1839,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }); it('should indicate compatible fields when selecting the operation first', () => { - wrapper = mount(); + wrapper = mount(); act(() => { wrapper.find('button[data-test-subj="lns-indexPatternDimension-average"]').simulate('click'); @@ -1871,7 +1865,7 @@ describe('IndexPatternDimensionEditorPanel', () => { it('should indicate document compatibility when document operation is selected', () => { wrapper = mount( - { }); it('should not update when selecting the current field again', () => { - wrapper = mount(); + wrapper = mount(); const comboBox = wrapper .find(EuiComboBox) @@ -1914,7 +1908,7 @@ describe('IndexPatternDimensionEditorPanel', () => { it('should show all operations that are not filtered out', () => { wrapper = mount( - !op.isBucketed && op.dataType === 'number'} /> @@ -1946,7 +1940,7 @@ describe('IndexPatternDimensionEditorPanel', () => { // Prevents field format from being loaded setState.mockImplementation(() => {}); - wrapper = mount(); + wrapper = mount(); const comboBox = wrapper .find(EuiComboBox) @@ -1981,12 +1975,10 @@ describe('IndexPatternDimensionEditorPanel', () => { }); it('should use helper function when changing the function', () => { - const initialState: IndexPatternPrivateState = getStateWithColumns({ + const initialState: FormBasedPrivateState = getStateWithColumns({ col1: bytesColumn, }); - wrapper = mount( - - ); + wrapper = mount(); act(() => { wrapper .find('button[data-test-subj="lns-indexPatternDimension-min"]') @@ -2004,7 +1996,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }); it('should keep the latest valid dimension when removing the selection in field combobox', () => { - wrapper = mount(); + wrapper = mount(); act(() => { wrapper @@ -2017,7 +2009,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }); it('allows custom format', () => { - const stateWithNumberCol: IndexPatternPrivateState = getStateWithColumns({ + const stateWithNumberCol: FormBasedPrivateState = getStateWithColumns({ col1: { label: 'Average of memory', dataType: 'number', @@ -2029,7 +2021,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }); wrapper = mount( - + ); act(() => { @@ -2059,7 +2051,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }); it('keeps decimal places while switching', () => { - const stateWithNumberCol: IndexPatternPrivateState = getStateWithColumns({ + const stateWithNumberCol: FormBasedPrivateState = getStateWithColumns({ col1: { label: 'Average of memory', dataType: 'number', @@ -2073,7 +2065,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }, }); wrapper = mount( - + ); act(() => { @@ -2099,7 +2091,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }); it('allows custom format with number of decimal places', () => { - const stateWithNumberCol: IndexPatternPrivateState = getStateWithColumns({ + const stateWithNumberCol: FormBasedPrivateState = getStateWithColumns({ col1: { label: 'Average of memory', dataType: 'number', @@ -2114,7 +2106,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }); wrapper = mount( - + ); act(() => { @@ -2145,7 +2137,7 @@ describe('IndexPatternDimensionEditorPanel', () => { it('should hide the top level field selector when switching from non-reference to reference', () => { (generateId as jest.Mock).mockReturnValue(`second`); - wrapper = mount(); + wrapper = mount(); expect(wrapper.find('ReferenceEditor')).toHaveLength(0); @@ -2157,7 +2149,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }); it('should hide the reference editors when switching from reference to non-reference', () => { - const stateWithReferences: IndexPatternPrivateState = getStateWithColumns({ + const stateWithReferences: FormBasedPrivateState = getStateWithColumns({ col1: { label: 'Differences of (incomplete)', dataType: 'number', @@ -2169,7 +2161,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }); wrapper = mount( - + ); expect(wrapper.find('ReferenceEditor')).toHaveLength(1); @@ -2182,7 +2174,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }); it('should show a warning when the current dimension is no longer configurable', () => { - const stateWithInvalidCol: IndexPatternPrivateState = getStateWithColumns({ + const stateWithInvalidCol: FormBasedPrivateState = getStateWithColumns({ col1: { label: 'Invalid differences', dataType: 'number', @@ -2193,7 +2185,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }); wrapper = mount( - + ); expect( @@ -2205,7 +2197,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }); it('should remove options to select references when there are no time fields', () => { - const stateWithoutTime: IndexPatternPrivateState = { + const stateWithoutTime: FormBasedPrivateState = { ...getStateWithColumns({ col1: { label: 'Avg', @@ -2218,7 +2210,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }; wrapper = mount( - { }); it('should not show tabs when formula and static_value operations are not available', () => { - const stateWithInvalidCol: IndexPatternPrivateState = getStateWithColumns({ + const stateWithInvalidCol: FormBasedPrivateState = getStateWithColumns({ col1: { label: 'Average of memory', dataType: 'number', @@ -2279,15 +2271,13 @@ describe('IndexPatternDimensionEditorPanel', () => { }), }; - wrapper = mount( - - ); + wrapper = mount(); expect(wrapper.find('[data-test-subj="lens-dimensionTabs"]').exists()).toBeFalsy(); }); it('should show the formula tab when supported', () => { - const stateWithFormulaColumn: IndexPatternPrivateState = getStateWithColumns({ + const stateWithFormulaColumn: FormBasedPrivateState = getStateWithColumns({ col1: { label: 'Formula', dataType: 'number', @@ -2299,7 +2289,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }); wrapper = mount( - + ); expect( @@ -2308,7 +2298,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }); it('should not show the static_value tab when not supported', () => { - const stateWithFormulaColumn: IndexPatternPrivateState = getStateWithColumns({ + const stateWithFormulaColumn: FormBasedPrivateState = getStateWithColumns({ col1: { label: 'Formula', dataType: 'number', @@ -2320,14 +2310,14 @@ describe('IndexPatternDimensionEditorPanel', () => { }); wrapper = mount( - + ); expect(wrapper.find('[data-test-subj="lens-dimensionTabs-static_value"]').exists()).toBeFalsy(); }); it('should show the static value tab when supported', () => { - const staticWithFormulaColumn: IndexPatternPrivateState = getStateWithColumns({ + const staticWithFormulaColumn: FormBasedPrivateState = getStateWithColumns({ col1: { label: 'Formula', dataType: 'number', @@ -2339,7 +2329,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }); wrapper = mount( - { }); it('should select the quick function tab by default', () => { - const stateWithNoColumn: IndexPatternPrivateState = getStateWithColumns({}); + const stateWithNoColumn: FormBasedPrivateState = getStateWithColumns({}); wrapper = mount( - + ); expect( @@ -2367,10 +2357,10 @@ describe('IndexPatternDimensionEditorPanel', () => { }); it('should select the static value tab when supported by default', () => { - const stateWithNoColumn: IndexPatternPrivateState = getStateWithColumns({}); + const stateWithNoColumn: FormBasedPrivateState = getStateWithColumns({}); wrapper = mount( - { }); it('should not show any tab when formula is in full screen mode', () => { - const stateWithFormulaColumn: IndexPatternPrivateState = getStateWithColumns({ + const stateWithFormulaColumn: FormBasedPrivateState = getStateWithColumns({ col1: { label: 'Formula', dataType: 'number', @@ -2395,7 +2385,7 @@ describe('IndexPatternDimensionEditorPanel', () => { }); wrapper = mount( - & { +export type FormBasedDimensionTriggerProps = + DatasourceDimensionTriggerProps & { uniqueLabel: string; }; -export type IndexPatternDimensionEditorProps = - DatasourceDimensionEditorProps & { +export type FormBasedDimensionEditorProps = + DatasourceDimensionEditorProps & { uiSettings: IUiSettingsClient; storage: IStorageWrapper; savedObjectsClient: SavedObjectsClientContract; @@ -48,8 +48,8 @@ function wrapOnDot(str?: string) { return str ? str.replace(/\./g, '.\u200B') : ''; } -export const IndexPatternDimensionTriggerComponent = function IndexPatternDimensionTrigger( - props: IndexPatternDimensionTriggerProps +export const FormBasedDimensionTriggerComponent = function FormBasedDimensionTrigger( + props: FormBasedDimensionTriggerProps ) { const layerId = props.layerId; const layer = props.state.layers[layerId]; @@ -79,8 +79,8 @@ export const IndexPatternDimensionTriggerComponent = function IndexPatternDimens ); }; -export const IndexPatternDimensionEditorComponent = function IndexPatternDimensionPanel( - props: IndexPatternDimensionEditorProps +export const FormBasedDimensionEditorComponent = function FormBasedDimensionPanel( + props: FormBasedDimensionEditorProps ) { const layerId = props.layerId; const currentIndexPattern = props.indexPatterns[props.state.layers[layerId]?.indexPatternId]; @@ -102,5 +102,5 @@ export const IndexPatternDimensionEditorComponent = function IndexPatternDimensi ); }; -export const IndexPatternDimensionTrigger = memo(IndexPatternDimensionTriggerComponent); -export const IndexPatternDimensionEditor = memo(IndexPatternDimensionEditorComponent); +export const FormBasedDimensionTrigger = memo(FormBasedDimensionTriggerComponent); +export const FormBasedDimensionEditor = memo(FormBasedDimensionEditorComponent); diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimensions_editor_helpers.tsx b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/dimensions_editor_helpers.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimensions_editor_helpers.tsx rename to x-pack/plugins/lens/public/form_based_datasource/dimension_panel/dimensions_editor_helpers.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/get_drop_props.test.ts b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/get_drop_props.test.ts similarity index 99% rename from x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/get_drop_props.test.ts rename to x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/get_drop_props.test.ts index 2f4d8a0121aa1..4fa6dda7a6cec 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/get_drop_props.test.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/get_drop_props.test.ts @@ -27,7 +27,7 @@ const getDefaultProps = () => ({ source: mockedDndOperations.bucket, }); -describe('IndexPatternDimensionEditorPanel#getDropProps', () => { +describe('FormBasedDimensionEditorPanel#getDropProps', () => { describe('not dragging', () => { it('returns undefined if no drag is happening', () => { expect(getDropProps({ ...getDefaultProps(), source: undefined })).toBe(undefined); diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/get_drop_props.ts b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/get_drop_props.ts similarity index 97% rename from x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/get_drop_props.ts rename to x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/get_drop_props.ts index a1f16006fd803..77e9f37512ed2 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/get_drop_props.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/get_drop_props.ts @@ -23,11 +23,11 @@ import { hasField } from '../../pure_utils'; import { DragContextState } from '../../../drag_drop/providers'; import { OperationMetadata, DraggedField } from '../../../types'; import { getOperationTypesForField } from '../../operations'; -import { GenericIndexPatternColumn } from '../../indexpattern'; -import { IndexPatternPrivateState, DataViewDragDropOperation } from '../../types'; +import { GenericIndexPatternColumn } from '../../form_based'; +import { FormBasedPrivateState, DataViewDragDropOperation } from '../../types'; interface GetDropPropsArgs { - state: IndexPatternPrivateState; + state: FormBasedPrivateState; source?: DragContextState['dragging']; target: DragDropOperation; indexPatterns: IndexPatternMap; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/index.ts b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/index.ts similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/index.ts rename to x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/index.ts diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/mocks.ts b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/mocks.ts similarity index 98% rename from x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/mocks.ts rename to x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/mocks.ts index 93b63071d6642..4551bd15edef9 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/mocks.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/mocks.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { IndexPatternLayer } from '../../types'; +import { FormBasedLayer } from '../../types'; import { documentField } from '../../document_field'; import { IndexPatternMap, OperationMetadata } from '../../../types'; import { @@ -191,7 +191,7 @@ export const mockedColumns: Record = { } as GenericIndexPatternColumn, }; -export const mockedLayers: Record IndexPatternLayer> = { +export const mockedLayers: Record FormBasedLayer> = { singleColumnLayer: (id = 'col1') => ({ indexPatternId: 'first', columnOrder: [id], diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/on_drop_handler.test.ts b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/on_drop_handler.test.ts similarity index 98% rename from x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/on_drop_handler.test.ts rename to x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/on_drop_handler.test.ts index 3b468181db6df..d34113fede748 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/on_drop_handler.test.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/on_drop_handler.test.ts @@ -6,7 +6,7 @@ */ import { onDrop } from './on_drop_handler'; -import { IndexPatternPrivateState } from '../../types'; +import { FormBasedPrivateState } from '../../types'; import { OperationMetadata, DropType, DatasourceDimensionDropHandlerProps } from '../../../types'; import { FormulaIndexPatternColumn, MedianIndexPatternColumn } from '../../operations'; import { generateId } from '../../../id_generator'; @@ -47,7 +47,7 @@ const dimensionGroups = [ }, ]; -function getStateWithMultiFieldColumn(state: IndexPatternPrivateState) { +function getStateWithMultiFieldColumn(state: FormBasedPrivateState) { return { ...state, layers: { @@ -62,10 +62,10 @@ function getStateWithMultiFieldColumn(state: IndexPatternPrivateState) { }; } -describe('IndexPatternDimensionEditorPanel: onDrop', () => { - let state: IndexPatternPrivateState; +describe('FormBasedDimensionEditorPanel: onDrop', () => { + let state: FormBasedPrivateState; let setState: jest.Mock; - let defaultProps: DatasourceDimensionDropHandlerProps; + let defaultProps: DatasourceDimensionDropHandlerProps; beforeEach(() => { state = { @@ -347,7 +347,7 @@ describe('IndexPatternDimensionEditorPanel: onDrop', () => { describe('dropping a dimension', () => { it('sets correct order in group for metric and bucket columns when duplicating a column in group', () => { - const testState: IndexPatternPrivateState = { + const testState: FormBasedPrivateState = { ...state, layers: { ...state.layers, @@ -439,7 +439,7 @@ describe('IndexPatternDimensionEditorPanel: onDrop', () => { it('when duplicating fullReference column, the referenced columns get duplicated too', () => { (generateId as jest.Mock).mockReturnValue(`ref1Copy`); - const testState: IndexPatternPrivateState = { + const testState: FormBasedPrivateState = { ...state, layers: { ...state.layers, @@ -501,7 +501,7 @@ describe('IndexPatternDimensionEditorPanel: onDrop', () => { it('when duplicating fullReference column, the multiple referenced columns get duplicated too', () => { (generateId as jest.Mock).mockReturnValueOnce(`ref1Copy`); (generateId as jest.Mock).mockReturnValueOnce(`ref2Copy`); - const testState: IndexPatternPrivateState = { + const testState: FormBasedPrivateState = { ...state, layers: { ...state.layers, @@ -566,7 +566,7 @@ describe('IndexPatternDimensionEditorPanel: onDrop', () => { it('when duplicating fullReference column, the referenced columns get duplicated', () => { (generateId as jest.Mock).mockReturnValueOnce(`ref1Copy`); (generateId as jest.Mock).mockReturnValueOnce(`ref2Copy`); - const testState: IndexPatternPrivateState = { + const testState: FormBasedPrivateState = { ...state, layers: { ...state.layers, @@ -854,7 +854,7 @@ describe('IndexPatternDimensionEditorPanel: onDrop', () => { }); describe('dimension group aware ordering and copying', () => { - let testState: IndexPatternPrivateState; + let testState: FormBasedPrivateState; beforeEach(() => { testState = { ...state }; testState.layers.first = { ...mockedLayers.multipleColumnsLayer() }; @@ -1541,7 +1541,7 @@ describe('IndexPatternDimensionEditorPanel: onDrop', () => { }, ]; describe('simple operations', () => { - let props: DatasourceDimensionDropHandlerProps; + let props: DatasourceDimensionDropHandlerProps; beforeEach(() => { setState = jest.fn(); @@ -2087,7 +2087,7 @@ describe('IndexPatternDimensionEditorPanel: onDrop', () => { }); }); describe('references', () => { - let props: DatasourceDimensionDropHandlerProps; + let props: DatasourceDimensionDropHandlerProps; beforeEach(() => { props = { dimensionGroups: defaultDimensionGroups, diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/on_drop_handler.ts b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/on_drop_handler.ts similarity index 98% rename from x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/on_drop_handler.ts rename to x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/on_drop_handler.ts index 232c96610f04c..4f727af283f6b 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/on_drop_handler.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/on_drop_handler.ts @@ -28,12 +28,12 @@ import { } from '../../operations'; import { mergeLayer, mergeLayers } from '../../state_helpers'; import { getNewOperation, getField } from './get_drop_props'; -import { IndexPatternPrivateState, DataViewDragDropOperation } from '../../types'; +import { FormBasedPrivateState, DataViewDragDropOperation } from '../../types'; interface DropHandlerProps { - state: IndexPatternPrivateState; + state: FormBasedPrivateState; setState: StateSetter< - IndexPatternPrivateState, + FormBasedPrivateState, { isDimensionComplete?: boolean; forceRender?: boolean; @@ -46,7 +46,7 @@ interface DropHandlerProps { indexPatterns: IndexPatternMap; } -export function onDrop(props: DatasourceDimensionDropHandlerProps) { +export function onDrop(props: DatasourceDimensionDropHandlerProps) { const { target, source, dropType, state, indexPatterns } = props; if (isDraggedDataViewField(source) && isFieldDropType(dropType)) { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/field_input.test.tsx b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/field_input.test.tsx similarity index 98% rename from x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/field_input.test.tsx rename to x-pack/plugins/lens/public/form_based_datasource/dimension_panel/field_input.test.tsx index b7ab501f34d16..877dc18156cdf 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/field_input.test.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/field_input.test.tsx @@ -21,7 +21,7 @@ import { import { FieldInput, getErrorMessage } from './field_input'; import { createMockedIndexPattern } from '../mocks'; import { getOperationSupportMatrix } from '.'; -import { GenericIndexPatternColumn, IndexPatternLayer, IndexPatternPrivateState } from '../types'; +import { GenericIndexPatternColumn, FormBasedLayer, FormBasedPrivateState } from '../types'; import { ReferenceBasedIndexPatternColumn } from '../operations/definitions/column_types'; jest.mock('../operations/layer_helpers', () => { @@ -30,7 +30,7 @@ jest.mock('../operations/layer_helpers', () => { return { ...original, insertOrReplaceColumn: () => { - return {} as IndexPatternLayer; + return {} as FormBasedLayer; }, }; }); @@ -113,14 +113,14 @@ function getLayer(col1: GenericIndexPatternColumn = getStringBasedOperationColum }; } function getDefaultOperationSupportMatrix( - layer: IndexPatternLayer, + layer: FormBasedLayer, columnId: string, existingFields: Record> ) { return getOperationSupportMatrix({ state: { layers: { layer1: layer }, - } as unknown as IndexPatternPrivateState, + } as unknown as FormBasedPrivateState, layerId: 'layer1', filterOperations: () => true, columnId, diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/field_input.tsx b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/field_input.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/field_input.tsx rename to x-pack/plugins/lens/public/form_based_datasource/dimension_panel/field_input.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/field_select.scss b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/field_select.scss similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/field_select.scss rename to x-pack/plugins/lens/public/form_based_datasource/dimension_panel/field_select.scss diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/field_select.tsx b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/field_select.tsx similarity index 99% rename from x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/field_select.tsx rename to x-pack/plugins/lens/public/form_based_datasource/dimension_panel/field_select.tsx index af5dc76143b17..934728993d321 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/field_select.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/field_select.tsx @@ -10,7 +10,7 @@ import { partition } from 'lodash'; import React, { useMemo } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiComboBoxOptionOption, EuiComboBoxProps } from '@elastic/eui'; -import type { OperationType } from '../indexpattern'; +import type { OperationType } from '../form_based'; import type { OperationSupportMatrix } from './operation_support'; import { FieldOption, FieldOptionValue, FieldPicker } from '../../shared_components/field_picker'; import { fieldContainsData } from '../../shared_components'; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/filtering.tsx b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/filtering.tsx similarity index 87% rename from x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/filtering.tsx rename to x-pack/plugins/lens/public/form_based_datasource/dimension_panel/filtering.tsx index 059170d9702d8..e948711f572c0 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/filtering.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/filtering.tsx @@ -8,11 +8,11 @@ import React, { useCallback } from 'react'; import { isEqual } from 'lodash'; import type { Query } from '@kbn/es-query'; import { GenericIndexPatternColumn, operationDefinitionMap } from '../operations'; -import type { IndexPatternLayer } from '../types'; +import type { FormBasedLayer } from '../types'; import { validateQuery, FilterQueryInput } from '../../shared_components'; import type { IndexPattern } from '../../types'; -export function setFilter(columnId: string, layer: IndexPatternLayer, query: Query | undefined) { +export function setFilter(columnId: string, layer: FormBasedLayer, query: Query | undefined) { return { ...layer, columns: { @@ -36,8 +36,8 @@ export function Filtering({ selectedColumn: GenericIndexPatternColumn; indexPattern: IndexPattern; columnId: string; - layer: IndexPatternLayer; - updateLayer: (newLayer: IndexPatternLayer) => void; + layer: FormBasedLayer; + updateLayer: (newLayer: FormBasedLayer) => void; helpMessage: string | null; }) { const inputFilter = selectedColumn.filter; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/format_selector.test.tsx b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/format_selector.test.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/format_selector.test.tsx rename to x-pack/plugins/lens/public/form_based_datasource/dimension_panel/format_selector.test.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/format_selector.tsx b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/format_selector.tsx similarity index 98% rename from x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/format_selector.tsx rename to x-pack/plugins/lens/public/form_based_datasource/dimension_panel/format_selector.tsx index 280829c8c1573..07a96f5d6dc38 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/format_selector.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/format_selector.tsx @@ -8,7 +8,7 @@ import React, { useCallback, useMemo, useState } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiFormRow, EuiComboBox, EuiSpacer, EuiRange, EuiFieldText } from '@elastic/eui'; -import { GenericIndexPatternColumn } from '../indexpattern'; +import { GenericIndexPatternColumn } from '../form_based'; import { isColumnFormatted } from '../operations/definitions/helpers'; import { useDebouncedValue } from '../../shared_components'; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/index.ts b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/index.ts similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/index.ts rename to x-pack/plugins/lens/public/form_based_datasource/dimension_panel/index.ts diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/operation_support.ts b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/operation_support.ts similarity index 92% rename from x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/operation_support.ts rename to x-pack/plugins/lens/public/form_based_datasource/dimension_panel/operation_support.ts index 43d9770deb228..eb043807b3e6c 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/operation_support.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/operation_support.ts @@ -7,9 +7,9 @@ import memoizeOne from 'memoize-one'; import { DatasourceDimensionDropProps, IndexPatternMap, OperationMetadata } from '../../types'; -import { OperationType } from '../indexpattern'; +import { OperationType } from '../form_based'; import { memoizedGetAvailableOperationsByMetadata, OperationFieldTuple } from '../operations'; -import { IndexPatternPrivateState } from '../types'; +import { FormBasedPrivateState } from '../types'; export interface OperationSupportMatrix { operationByField: Partial>>; @@ -18,9 +18,9 @@ export interface OperationSupportMatrix { } type Props = Pick< - DatasourceDimensionDropProps['target'], + DatasourceDimensionDropProps['target'], 'layerId' | 'columnId' | 'filterOperations' -> & { state: IndexPatternPrivateState; indexPatterns: IndexPatternMap }; +> & { state: FormBasedPrivateState; indexPatterns: IndexPatternMap }; function computeOperationMatrix( operationsByMetadata: Array<{ diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/reduced_time_range.tsx b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/reduced_time_range.tsx similarity index 97% rename from x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/reduced_time_range.tsx rename to x-pack/plugins/lens/public/form_based_datasource/dimension_panel/reduced_time_range.tsx index e00bc670a9d6b..6638f24e5ea84 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/reduced_time_range.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/reduced_time_range.tsx @@ -17,13 +17,13 @@ import { GenericIndexPatternColumn, operationDefinitionMap, } from '../operations'; -import type { IndexPatternLayer } from '../types'; +import type { FormBasedLayer } from '../types'; import type { IndexPattern } from '../../types'; import { reducedTimeRangeOptions } from '../reduced_time_range_utils'; export function setReducedTimeRange( columnId: string, - layer: IndexPatternLayer, + layer: FormBasedLayer, reducedTimeRange: string | undefined ) { const trimmedReducedTimeRange = reducedTimeRange?.trim(); @@ -65,8 +65,8 @@ export function ReducedTimeRange({ }: { selectedColumn: GenericIndexPatternColumn; columnId: string; - layer: IndexPatternLayer; - updateLayer: (newLayer: IndexPatternLayer) => void; + layer: FormBasedLayer; + updateLayer: (newLayer: FormBasedLayer) => void; indexPattern: IndexPattern; }) { const [localValue, setLocalValue] = useState(selectedColumn.reducedTimeRange); diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/reference_editor.test.tsx b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/reference_editor.test.tsx similarity index 98% rename from x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/reference_editor.test.tsx rename to x-pack/plugins/lens/public/form_based_datasource/dimension_panel/reference_editor.test.tsx index 6e5c157e5b9e8..51d8cf20ada2f 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/reference_editor.test.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/reference_editor.test.tsx @@ -26,7 +26,7 @@ import { TermsIndexPatternColumn, } from '../operations'; import { FieldSelect } from './field_select'; -import { IndexPatternLayer } from '../types'; +import { FormBasedLayer } from '../types'; jest.mock('../operations'); @@ -148,7 +148,7 @@ describe('reference editor', () => { sourceField: 'bytes', }, }, - } as IndexPatternLayer; + } as FormBasedLayer; wrapper = mount( { sourceField: 'dest', }, }, - } as IndexPatternLayer; + } as FormBasedLayer; wrapper = mount( { sourceField: 'bytes', }, }, - } as IndexPatternLayer; + } as FormBasedLayer; wrapper = mount( { sourceField: 'bytes', }, }, - } as IndexPatternLayer; + } as FormBasedLayer; wrapper = mount( { sourceField: 'dest', }, }, - } as IndexPatternLayer; + } as FormBasedLayer; const onChooseFunction = jest.fn(); wrapper = mount( { sourceField: 'bytes', }, }, - } as IndexPatternLayer; + } as FormBasedLayer; wrapper = mount( { incompleteColumns: { ref: { operationType: 'max' }, }, - } as IndexPatternLayer; + } as FormBasedLayer; wrapper = mount( { incompleteColumns: { ref: { sourceField: 'timestamp' }, }, - } as IndexPatternLayer; + } as FormBasedLayer; wrapper = mount( { sourceField: 'missing', }, }, - } as IndexPatternLayer; + } as FormBasedLayer; wrapper = mount( IndexPatternLayer) + | FormBasedLayer + | ((prevLayer: FormBasedLayer) => FormBasedLayer) | GenericIndexPatternColumn ) => void; onChooseField: (choice: FieldChoiceWithOperationType) => void; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/time_scaling.tsx b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/time_scaling.tsx similarity index 95% rename from x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/time_scaling.tsx rename to x-pack/plugins/lens/public/form_based_datasource/dimension_panel/time_scaling.tsx index 536123956ce8d..2861f9c8df600 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/time_scaling.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/time_scaling.tsx @@ -23,11 +23,11 @@ import { } from '../operations'; import type { TimeScaleUnit } from '../../../common/expressions'; import { unitSuffixesLong } from '../../../common/suffix_formatter'; -import type { IndexPatternLayer } from '../types'; +import type { FormBasedLayer } from '../types'; export function setTimeScaling( columnId: string, - layer: IndexPatternLayer, + layer: FormBasedLayer, timeScale: TimeScaleUnit | undefined ) { const currentColumn = layer.columns[columnId]; @@ -63,8 +63,8 @@ export function TimeScaling({ }: { selectedColumn: GenericIndexPatternColumn; columnId: string; - layer: IndexPatternLayer; - updateLayer: (newLayer: IndexPatternLayer) => void; + layer: FormBasedLayer; + updateLayer: (newLayer: FormBasedLayer) => void; }) { const selectedOperation = operationDefinitionMap[selectedColumn.operationType]; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/time_shift.tsx b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/time_shift.tsx similarity index 95% rename from x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/time_shift.tsx rename to x-pack/plugins/lens/public/form_based_datasource/dimension_panel/time_shift.tsx index 63696a3a2196c..a5dfd8df9f006 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/time_shift.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/time_shift.tsx @@ -15,8 +15,8 @@ import { GenericIndexPatternColumn, operationDefinitionMap, } from '../operations'; -import type { IndexPatternLayer } from '../types'; -import type { IndexPatternDimensionEditorProps } from './dimension_panel'; +import type { FormBasedLayer } from '../types'; +import type { FormBasedDimensionEditorProps } from './dimension_panel'; import { getDateHistogramInterval, getLayerTimeShiftChecks, @@ -26,7 +26,7 @@ import type { IndexPattern } from '../../types'; export function setTimeShift( columnId: string, - layer: IndexPatternLayer, + layer: FormBasedLayer, timeShift: string | undefined ) { const trimmedTimeShift = timeShift?.trim(); @@ -69,9 +69,9 @@ export function TimeShift({ selectedColumn: GenericIndexPatternColumn; indexPattern: IndexPattern; columnId: string; - layer: IndexPatternLayer; - updateLayer: (newLayer: IndexPatternLayer) => void; - activeData: IndexPatternDimensionEditorProps['activeData']; + layer: FormBasedLayer; + updateLayer: (newLayer: FormBasedLayer) => void; + activeData: FormBasedDimensionEditorProps['activeData']; layerId: string; }) { const [localValue, setLocalValue] = useState(selectedColumn.timeShift); diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/document_field.ts b/x-pack/plugins/lens/public/form_based_datasource/document_field.ts similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/document_field.ts rename to x-pack/plugins/lens/public/form_based_datasource/document_field.ts diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/field_item.scss b/x-pack/plugins/lens/public/form_based_datasource/field_item.scss similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/field_item.scss rename to x-pack/plugins/lens/public/form_based_datasource/field_item.scss diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/field_item.test.tsx b/x-pack/plugins/lens/public/form_based_datasource/field_item.test.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/field_item.test.tsx rename to x-pack/plugins/lens/public/form_based_datasource/field_item.test.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/field_item.tsx b/x-pack/plugins/lens/public/form_based_datasource/field_item.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/field_item.tsx rename to x-pack/plugins/lens/public/form_based_datasource/field_item.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/field_list.scss b/x-pack/plugins/lens/public/form_based_datasource/field_list.scss similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/field_list.scss rename to x-pack/plugins/lens/public/form_based_datasource/field_list.scss diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/field_list.tsx b/x-pack/plugins/lens/public/form_based_datasource/field_list.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/field_list.tsx rename to x-pack/plugins/lens/public/form_based_datasource/field_list.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/fields_accordion.test.tsx b/x-pack/plugins/lens/public/form_based_datasource/fields_accordion.test.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/fields_accordion.test.tsx rename to x-pack/plugins/lens/public/form_based_datasource/fields_accordion.test.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/fields_accordion.tsx b/x-pack/plugins/lens/public/form_based_datasource/fields_accordion.tsx similarity index 97% rename from x-pack/plugins/lens/public/indexpattern_datasource/fields_accordion.tsx rename to x-pack/plugins/lens/public/form_based_datasource/fields_accordion.tsx index 5db910e6d3eff..c0904c320781a 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/fields_accordion.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/fields_accordion.tsx @@ -116,7 +116,7 @@ export const FieldsAccordion = memo(function InnerFieldsAccordion({ const renderButton = useMemo(() => { const titleClassname = classNames({ // eslint-disable-next-line @typescript-eslint/naming-convention - lnsInnerIndexPatternDataPanel__titleTooltip: !!helpTooltip, + lnsInnerFormBasedDataPanel__titleTooltip: !!helpTooltip, }); return ( @@ -190,7 +190,7 @@ export const FieldsAccordion = memo(function InnerFieldsAccordion({ {hasLoaded && (!!fieldsCount ? ( -
    +
      {paginatedFields && paginatedFields.map(renderField)}
    ) : ( diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.test.ts b/x-pack/plugins/lens/public/form_based_datasource/form_based.test.ts similarity index 93% rename from x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.test.ts rename to x-pack/plugins/lens/public/form_based_datasource/form_based.test.ts index aefb4c7327463..369c6db90eb97 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.test.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/form_based.test.ts @@ -10,7 +10,7 @@ import { SavedObjectReference } from '@kbn/core/public'; import { isFragment } from 'react-is'; import { coreMock } from '@kbn/core/public/mocks'; import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; -import { IndexPatternPersistedState, IndexPatternPrivateState } from './types'; +import { FormBasedPersistedState, FormBasedPrivateState } from './types'; import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks'; import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; @@ -20,7 +20,7 @@ import { indexPatternFieldEditorPluginMock } from '@kbn/data-view-field-editor-p import { uiActionsPluginMock } from '@kbn/ui-actions-plugin/public/mocks'; import { fieldFormatsServiceMock } from '@kbn/field-formats-plugin/public/mocks'; import { TinymathAST } from '@kbn/tinymath'; -import { getIndexPatternDatasource, GenericIndexPatternColumn } from './indexpattern'; +import { getFormBasedDatasource, GenericIndexPatternColumn } from './form_based'; import { DatasourcePublicAPI, Datasource, FramePublicAPI, OperationDescriptor } from '../types'; import { getFieldByNameFactory } from './pure_helpers'; import { @@ -178,11 +178,11 @@ const expectedIndexPatterns = { const indexPatterns = expectedIndexPatterns; describe('IndexPattern Data Source', () => { - let baseState: IndexPatternPrivateState; - let indexPatternDatasource: Datasource; + let baseState: FormBasedPrivateState; + let FormBasedDatasource: Datasource; beforeEach(() => { - indexPatternDatasource = getIndexPatternDatasource({ + FormBasedDatasource = getFormBasedDatasource({ unifiedSearch: unifiedSearchPluginMock.createStartContract(), storage: {} as IStorageWrapper, core: coreMock.createStart(), @@ -230,7 +230,7 @@ describe('IndexPattern Data Source', () => { operationType: 'count', sourceField: '___records___', }; - const map = indexPatternDatasource.uniqueLabels({ + const map = FormBasedDatasource.uniqueLabels({ layers: { a: { columnOrder: ['a', 'b'], @@ -252,7 +252,7 @@ describe('IndexPattern Data Source', () => { indexPatternId: 'foo', }, }, - } as unknown as IndexPatternPrivateState); + } as unknown as FormBasedPrivateState); expect(map).toMatchInlineSnapshot(` Object { @@ -267,7 +267,7 @@ describe('IndexPattern Data Source', () => { describe('#getPersistedState', () => { it('should persist from saved state', async () => { - expect(indexPatternDatasource.getPersistableState(baseState)).toEqual({ + expect(FormBasedDatasource.getPersistableState(baseState)).toEqual({ state: { layers: { first: { @@ -300,12 +300,12 @@ describe('IndexPattern Data Source', () => { describe('#toExpression', () => { it('should generate an empty expression when no columns are selected', async () => { - const state = indexPatternDatasource.initialize(); - expect(indexPatternDatasource.toExpression(state, 'first', indexPatterns)).toEqual(null); + const state = FormBasedDatasource.initialize(); + expect(FormBasedDatasource.toExpression(state, 'first', indexPatterns)).toEqual(null); }); it('should create a table when there is a formula without aggs', async () => { - const queryBaseState: IndexPatternPrivateState = { + const queryBaseState: FormBasedPrivateState = { currentIndexPatternId: '1', layers: { first: { @@ -324,7 +324,7 @@ describe('IndexPattern Data Source', () => { }, }, }; - expect(indexPatternDatasource.toExpression(queryBaseState, 'first', indexPatterns)).toEqual({ + expect(FormBasedDatasource.toExpression(queryBaseState, 'first', indexPatterns)).toEqual({ chain: [ { function: 'createTable', @@ -342,7 +342,7 @@ describe('IndexPattern Data Source', () => { }); it('should generate an expression for an aggregated query', async () => { - const queryBaseState: IndexPatternPrivateState = { + const queryBaseState: FormBasedPrivateState = { currentIndexPatternId: '1', layers: { first: { @@ -371,7 +371,7 @@ describe('IndexPattern Data Source', () => { }, }; - expect(indexPatternDatasource.toExpression(queryBaseState, 'first', indexPatterns)) + expect(FormBasedDatasource.toExpression(queryBaseState, 'first', indexPatterns)) .toMatchInlineSnapshot(` Object { "chain": Array [ @@ -496,7 +496,7 @@ describe('IndexPattern Data Source', () => { }); it('should put all time fields used in date_histograms to the esaggs timeFields parameter if not ignoring global time range', async () => { - const queryBaseState: IndexPatternPrivateState = { + const queryBaseState: FormBasedPrivateState = { currentIndexPatternId: '1', layers: { first: { @@ -546,16 +546,12 @@ describe('IndexPattern Data Source', () => { }, }; - const ast = indexPatternDatasource.toExpression( - queryBaseState, - 'first', - indexPatterns - ) as Ast; + const ast = FormBasedDatasource.toExpression(queryBaseState, 'first', indexPatterns) as Ast; expect(ast.chain[1].arguments.timeFields).toEqual(['timestamp', 'another_datefield']); }); it('should pass time shift parameter to metric agg functions', async () => { - const queryBaseState: IndexPatternPrivateState = { + const queryBaseState: FormBasedPrivateState = { currentIndexPatternId: '1', layers: { first: { @@ -585,11 +581,7 @@ describe('IndexPattern Data Source', () => { }, }; - const ast = indexPatternDatasource.toExpression( - queryBaseState, - 'first', - indexPatterns - ) as Ast; + const ast = FormBasedDatasource.toExpression(queryBaseState, 'first', indexPatterns) as Ast; expect((ast.chain[1].arguments.aggs[1] as Ast).chain[0].arguments.timeShift).toEqual(['1d']); }); @@ -609,7 +601,7 @@ describe('IndexPattern Data Source', () => { * The sum has its own shift and does not respected the shift from the moving average * The differences has a filter which is inherited to the median, but not the average as it has its own filter */ - const queryBaseState: IndexPatternPrivateState = { + const queryBaseState: FormBasedPrivateState = { currentIndexPatternId: '1', layers: { first: { @@ -796,11 +788,7 @@ describe('IndexPattern Data Source', () => { }, }; - const ast = indexPatternDatasource.toExpression( - queryBaseState, - 'first', - indexPatterns - ) as Ast; + const ast = FormBasedDatasource.toExpression(queryBaseState, 'first', indexPatterns) as Ast; const count = (ast.chain[1].arguments.aggs[1] as Ast).chain[0]; const sum = (ast.chain[1].arguments.aggs[2] as Ast).chain[0]; const average = (ast.chain[1].arguments.aggs[3] as Ast).chain[0]; @@ -822,7 +810,7 @@ describe('IndexPattern Data Source', () => { }); it('should wrap filtered metrics in filtered metric aggregation', async () => { - const queryBaseState: IndexPatternPrivateState = { + const queryBaseState: FormBasedPrivateState = { currentIndexPatternId: '1', layers: { first: { @@ -864,11 +852,7 @@ describe('IndexPattern Data Source', () => { }, }; - const ast = indexPatternDatasource.toExpression( - queryBaseState, - 'first', - indexPatterns - ) as Ast; + const ast = FormBasedDatasource.toExpression(queryBaseState, 'first', indexPatterns) as Ast; expect(ast.chain[1].arguments.aggs[0]).toMatchInlineSnapshot(` Object { "chain": Array [ @@ -954,7 +938,7 @@ describe('IndexPattern Data Source', () => { }); it('should add time_scale and format function if time scale is set and supported', async () => { - const queryBaseState: IndexPatternPrivateState = { + const queryBaseState: FormBasedPrivateState = { currentIndexPatternId: '1', layers: { first: { @@ -992,11 +976,7 @@ describe('IndexPattern Data Source', () => { }, }; - const ast = indexPatternDatasource.toExpression( - queryBaseState, - 'first', - indexPatterns - ) as Ast; + const ast = FormBasedDatasource.toExpression(queryBaseState, 'first', indexPatterns) as Ast; const timeScaleCalls = ast.chain.filter((fn) => fn.function === 'lens_time_scale'); const formatCalls = ast.chain.filter((fn) => fn.function === 'lens_format_column'); expect(timeScaleCalls).toHaveLength(1); @@ -1040,7 +1020,7 @@ describe('IndexPattern Data Source', () => { }); it('should not add time shift to nested count metric', async () => { - const queryBaseState: IndexPatternPrivateState = { + const queryBaseState: FormBasedPrivateState = { currentIndexPatternId: '1', layers: { first: { @@ -1061,11 +1041,7 @@ describe('IndexPattern Data Source', () => { }, }; - const ast = indexPatternDatasource.toExpression( - queryBaseState, - 'first', - indexPatterns - ) as Ast; + const ast = FormBasedDatasource.toExpression(queryBaseState, 'first', indexPatterns) as Ast; const filteredMetricAgg = (ast.chain[1].arguments.aggs[0] as Ast).chain[0].arguments; const metricAgg = (filteredMetricAgg.customMetric[0] as Ast).chain[0].arguments; const bucketAgg = (filteredMetricAgg.customBucket[0] as Ast).chain[0].arguments; @@ -1076,7 +1052,7 @@ describe('IndexPattern Data Source', () => { }); it('should put column formatters after calculated columns', async () => { - const queryBaseState: IndexPatternPrivateState = { + const queryBaseState: FormBasedPrivateState = { currentIndexPatternId: '1', layers: { first: { @@ -1116,18 +1092,14 @@ describe('IndexPattern Data Source', () => { }, }; - const ast = indexPatternDatasource.toExpression( - queryBaseState, - 'first', - indexPatterns - ) as Ast; + const ast = FormBasedDatasource.toExpression(queryBaseState, 'first', indexPatterns) as Ast; const formatIndex = ast.chain.findIndex((fn) => fn.function === 'lens_format_column'); const calculationIndex = ast.chain.findIndex((fn) => fn.function === 'moving_average'); expect(calculationIndex).toBeLessThan(formatIndex); }); it('should rename the output from esaggs when using flat query', () => { - const queryBaseState: IndexPatternPrivateState = { + const queryBaseState: FormBasedPrivateState = { currentIndexPatternId: '1', layers: { first: { @@ -1168,11 +1140,7 @@ describe('IndexPattern Data Source', () => { }, }; - const ast = indexPatternDatasource.toExpression( - queryBaseState, - 'first', - indexPatterns - ) as Ast; + const ast = FormBasedDatasource.toExpression(queryBaseState, 'first', indexPatterns) as Ast; expect(ast.chain[1].arguments.metricsAtAllLevels).toEqual([false]); expect(JSON.parse(ast.chain[2].arguments.idMap[0] as string)).toEqual({ 'col-0-0': [expect.objectContaining({ id: 'bucket1' })], @@ -1182,7 +1150,7 @@ describe('IndexPattern Data Source', () => { }); it('should not put date fields used outside date_histograms to the esaggs timeFields parameter', async () => { - const queryBaseState: IndexPatternPrivateState = { + const queryBaseState: FormBasedPrivateState = { currentIndexPatternId: '1', layers: { first: { @@ -1211,18 +1179,14 @@ describe('IndexPattern Data Source', () => { }, }; - const ast = indexPatternDatasource.toExpression( - queryBaseState, - 'first', - indexPatterns - ) as Ast; + const ast = FormBasedDatasource.toExpression(queryBaseState, 'first', indexPatterns) as Ast; expect(ast.chain[1].arguments.timeFields).toEqual(['timestamp']); expect(ast.chain[1].arguments.timeFields).not.toContain('timefield'); }); describe('optimizations', () => { it('should call optimizeEsAggs once per operation for which it is available', () => { - const queryBaseState: IndexPatternPrivateState = { + const queryBaseState: FormBasedPrivateState = { currentIndexPatternId: '1', layers: { first: { @@ -1272,7 +1236,7 @@ describe('IndexPattern Data Source', () => { const optimizeMock = jest.spyOn(operationDefinitionMap.percentile, 'optimizeEsAggs'); - indexPatternDatasource.toExpression(queryBaseState, 'first', indexPatterns); + FormBasedDatasource.toExpression(queryBaseState, 'first', indexPatterns); expect(operationDefinitionMap.percentile.optimizeEsAggs).toHaveBeenCalledTimes(1); @@ -1280,7 +1244,7 @@ describe('IndexPattern Data Source', () => { }); it('should update anticipated esAggs column IDs based on the order of the optimized agg expression builders', () => { - const queryBaseState: IndexPatternPrivateState = { + const queryBaseState: FormBasedPrivateState = { currentIndexPatternId: '1', layers: { first: { @@ -1340,11 +1304,7 @@ describe('IndexPattern Data Source', () => { return { aggs: aggs.reverse(), esAggsIdMap }; }); - const ast = indexPatternDatasource.toExpression( - queryBaseState, - 'first', - indexPatterns - ) as Ast; + const ast = FormBasedDatasource.toExpression(queryBaseState, 'first', indexPatterns) as Ast; expect(operationDefinitionMap.percentile.optimizeEsAggs).toHaveBeenCalledTimes(1); @@ -1356,7 +1316,7 @@ describe('IndexPattern Data Source', () => { }); it('should deduplicate aggs for supported operations', () => { - const queryBaseState: IndexPatternPrivateState = { + const queryBaseState: FormBasedPrivateState = { currentIndexPatternId: '1', layers: { first: { @@ -1408,11 +1368,7 @@ describe('IndexPattern Data Source', () => { }, }; - const ast = indexPatternDatasource.toExpression( - queryBaseState, - 'first', - indexPatterns - ) as Ast; + const ast = FormBasedDatasource.toExpression(queryBaseState, 'first', indexPatterns) as Ast; const idMap = JSON.parse(ast.chain[2].arguments.idMap as unknown as string); @@ -1491,7 +1447,7 @@ describe('IndexPattern Data Source', () => { }); it('should collect expression references and append them', async () => { - const queryBaseState: IndexPatternPrivateState = { + const queryBaseState: FormBasedPrivateState = { currentIndexPatternId: '1', layers: { first: { @@ -1517,18 +1473,14 @@ describe('IndexPattern Data Source', () => { }, }; - const ast = indexPatternDatasource.toExpression( - queryBaseState, - 'first', - indexPatterns - ) as Ast; + const ast = FormBasedDatasource.toExpression(queryBaseState, 'first', indexPatterns) as Ast; // @ts-expect-error we can't isolate just the reference type expect(operationDefinitionMap.testReference.toExpression).toHaveBeenCalled(); expect(ast.chain[3]).toEqual('mock'); }); it('should keep correct column mapping keys with reference columns present', async () => { - const queryBaseState: IndexPatternPrivateState = { + const queryBaseState: FormBasedPrivateState = { currentIndexPatternId: '1', layers: { first: { @@ -1554,11 +1506,7 @@ describe('IndexPattern Data Source', () => { }, }; - const ast = indexPatternDatasource.toExpression( - queryBaseState, - 'first', - indexPatterns - ) as Ast; + const ast = FormBasedDatasource.toExpression(queryBaseState, 'first', indexPatterns) as Ast; expect(JSON.parse(ast.chain[2].arguments.idMap[0] as string)).toEqual({ 'col-0-0': [ @@ -1571,7 +1519,7 @@ describe('IndexPattern Data Source', () => { it('should topologically sort references', () => { // This is a real example of count() + count() - const queryBaseState: IndexPatternPrivateState = { + const queryBaseState: FormBasedPrivateState = { currentIndexPatternId: '1', layers: { first: { @@ -1645,11 +1593,7 @@ describe('IndexPattern Data Source', () => { }, }; - const ast = indexPatternDatasource.toExpression( - queryBaseState, - 'first', - indexPatterns - ) as Ast; + const ast = FormBasedDatasource.toExpression(queryBaseState, 'first', indexPatterns) as Ast; const chainLength = ast.chain.length; expect(ast.chain[chainLength - 2].arguments.name).toEqual(['math']); expect(ast.chain[chainLength - 1].arguments.id).toEqual(['formula']); @@ -1674,7 +1618,7 @@ describe('IndexPattern Data Source', () => { }, currentIndexPatternId: '1', }; - expect(indexPatternDatasource.insertLayer(state, 'newLayer')).toEqual({ + expect(FormBasedDatasource.insertLayer(state, 'newLayer')).toEqual({ ...state, layers: { ...state.layers, @@ -1705,7 +1649,7 @@ describe('IndexPattern Data Source', () => { }, currentIndexPatternId: '1', }; - expect(indexPatternDatasource.removeLayer(state, 'first')).toEqual({ + expect(FormBasedDatasource.removeLayer(state, 'first')).toEqual({ ...state, layers: { second: { @@ -1720,7 +1664,7 @@ describe('IndexPattern Data Source', () => { describe('#createEmptyLayer', () => { it('creates state with empty layers', () => { - expect(indexPatternDatasource.createEmptyLayer('index-pattern-id')).toEqual({ + expect(FormBasedDatasource.createEmptyLayer('index-pattern-id')).toEqual({ currentIndexPatternId: 'index-pattern-id', layers: {}, }); @@ -1730,7 +1674,7 @@ describe('IndexPattern Data Source', () => { describe('#getLayers', () => { it('should list the current layers', () => { expect( - indexPatternDatasource.getLayers({ + FormBasedDatasource.getLayers({ layers: { first: { indexPatternId: '1', @@ -1753,7 +1697,7 @@ describe('IndexPattern Data Source', () => { let publicAPI: DatasourcePublicAPI; beforeEach(async () => { - publicAPI = indexPatternDatasource.getPublicAPI({ + publicAPI = FormBasedDatasource.getPublicAPI({ state: baseState, layerId: 'first', indexPatterns, @@ -1770,7 +1714,7 @@ describe('IndexPattern Data Source', () => { }); it('should skip columns that are being referenced', () => { - publicAPI = indexPatternDatasource.getPublicAPI({ + publicAPI = FormBasedDatasource.getPublicAPI({ state: { ...baseState, layers: { @@ -1808,7 +1752,7 @@ describe('IndexPattern Data Source', () => { }); it('should collect all fields (also from referenced columns)', () => { - publicAPI = indexPatternDatasource.getPublicAPI({ + publicAPI = FormBasedDatasource.getPublicAPI({ state: { ...baseState, layers: { @@ -1847,7 +1791,7 @@ describe('IndexPattern Data Source', () => { }); it('should collect and organize fields per visible column', () => { - publicAPI = indexPatternDatasource.getPublicAPI({ + publicAPI = FormBasedDatasource.getPublicAPI({ state: { ...baseState, layers: { @@ -1917,7 +1861,7 @@ describe('IndexPattern Data Source', () => { }); it('should return null for referenced columns', () => { - publicAPI = indexPatternDatasource.getPublicAPI({ + publicAPI = FormBasedDatasource.getPublicAPI({ state: { ...baseState, layers: { @@ -1962,7 +1906,7 @@ describe('IndexPattern Data Source', () => { describe('getFilters', () => { it('should return all filters in metrics, grouped by language', () => { - publicAPI = indexPatternDatasource.getPublicAPI({ + publicAPI = FormBasedDatasource.getPublicAPI({ state: { ...baseState, layers: { @@ -2004,7 +1948,7 @@ describe('IndexPattern Data Source', () => { }); }); it('should ignore empty filtered metrics', () => { - publicAPI = indexPatternDatasource.getPublicAPI({ + publicAPI = FormBasedDatasource.getPublicAPI({ state: { ...baseState, layers: { @@ -2034,7 +1978,7 @@ describe('IndexPattern Data Source', () => { }); }); it('shuold collect top values fields as kuery existence filters if no data is provided', () => { - publicAPI = indexPatternDatasource.getPublicAPI({ + publicAPI = FormBasedDatasource.getPublicAPI({ state: { ...baseState, layers: { @@ -2089,7 +2033,7 @@ describe('IndexPattern Data Source', () => { }); }); it('shuold collect top values fields and terms as kuery filters if data is provided', () => { - publicAPI = indexPatternDatasource.getPublicAPI({ + publicAPI = FormBasedDatasource.getPublicAPI({ state: { ...baseState, layers: { @@ -2160,7 +2104,7 @@ describe('IndexPattern Data Source', () => { }); }); it('shuold collect top values fields and terms and carefully handle empty string values', () => { - publicAPI = indexPatternDatasource.getPublicAPI({ + publicAPI = FormBasedDatasource.getPublicAPI({ state: { ...baseState, layers: { @@ -2231,7 +2175,7 @@ describe('IndexPattern Data Source', () => { }); }); it('should ignore top values fields if other/missing option is enabled', () => { - publicAPI = indexPatternDatasource.getPublicAPI({ + publicAPI = FormBasedDatasource.getPublicAPI({ state: { ...baseState, layers: { @@ -2278,7 +2222,7 @@ describe('IndexPattern Data Source', () => { }); }); it('should collect custom ranges as kuery filters', () => { - publicAPI = indexPatternDatasource.getPublicAPI({ + publicAPI = FormBasedDatasource.getPublicAPI({ state: { ...baseState, layers: { @@ -2333,7 +2277,7 @@ describe('IndexPattern Data Source', () => { }); }); it('should collect custom ranges as kuery filters as partial', () => { - publicAPI = indexPatternDatasource.getPublicAPI({ + publicAPI = FormBasedDatasource.getPublicAPI({ state: { ...baseState, layers: { @@ -2393,7 +2337,7 @@ describe('IndexPattern Data Source', () => { }); }); it('should collect filters within filters operation grouped by language', () => { - publicAPI = indexPatternDatasource.getPublicAPI({ + publicAPI = FormBasedDatasource.getPublicAPI({ state: { ...baseState, layers: { @@ -2464,7 +2408,7 @@ describe('IndexPattern Data Source', () => { }); }); it('should ignore filtered metrics if at least one metric is unfiltered', () => { - publicAPI = indexPatternDatasource.getPublicAPI({ + publicAPI = FormBasedDatasource.getPublicAPI({ state: { ...baseState, layers: { @@ -2502,7 +2446,7 @@ describe('IndexPattern Data Source', () => { }); }); it('should ignore filtered metrics if at least one metric is unfiltered in formula', () => { - publicAPI = indexPatternDatasource.getPublicAPI({ + publicAPI = FormBasedDatasource.getPublicAPI({ state: { ...baseState, layers: { @@ -2575,7 +2519,7 @@ describe('IndexPattern Data Source', () => { }); }); it('should support complete scenarios', () => { - publicAPI = indexPatternDatasource.getPublicAPI({ + publicAPI = FormBasedDatasource.getPublicAPI({ state: { ...baseState, layers: { @@ -2662,7 +2606,7 @@ describe('IndexPattern Data Source', () => { }); it('should avoid duplicate filters when formula has a global filter', () => { - publicAPI = indexPatternDatasource.getPublicAPI({ + publicAPI = FormBasedDatasource.getPublicAPI({ state: { ...baseState, layers: { @@ -2770,7 +2714,7 @@ describe('IndexPattern Data Source', () => { it('should use the results of getErrorMessages directly when single layer', () => { (getErrorMessages as jest.Mock).mockClear(); (getErrorMessages as jest.Mock).mockReturnValueOnce(['error 1', 'error 2']); - const state: IndexPatternPrivateState = { + const state: FormBasedPrivateState = { layers: { first: { indexPatternId: '1', @@ -2780,7 +2724,7 @@ describe('IndexPattern Data Source', () => { }, currentIndexPatternId: '1', }; - expect(indexPatternDatasource.getErrorMessages(state, indexPatterns)).toEqual([ + expect(FormBasedDatasource.getErrorMessages(state, indexPatterns)).toEqual([ { longMessage: 'error 1', shortMessage: '' }, { longMessage: 'error 2', shortMessage: '' }, ]); @@ -2790,7 +2734,7 @@ describe('IndexPattern Data Source', () => { it('should prepend each error with its layer number on multi-layer chart', () => { (getErrorMessages as jest.Mock).mockClear(); (getErrorMessages as jest.Mock).mockReturnValueOnce(['error 1', 'error 2']); - const state: IndexPatternPrivateState = { + const state: FormBasedPrivateState = { layers: { first: { indexPatternId: '1', @@ -2805,7 +2749,7 @@ describe('IndexPattern Data Source', () => { }, currentIndexPatternId: '1', }; - expect(indexPatternDatasource.getErrorMessages(state, indexPatterns)).toEqual([ + expect(FormBasedDatasource.getErrorMessages(state, indexPatterns)).toEqual([ { longMessage: 'Layer 1 error: error 1', shortMessage: '' }, { longMessage: 'Layer 1 error: error 2', shortMessage: '' }, ]); @@ -2814,7 +2758,7 @@ describe('IndexPattern Data Source', () => { }); describe('#getWarningMessages', () => { - let state: IndexPatternPrivateState; + let state: FormBasedPrivateState; let framePublicAPI: FramePublicAPI; beforeEach(() => { @@ -2948,12 +2892,7 @@ describe('IndexPattern Data Source', () => { ); it('should return mismatched time shifts', () => { - const warnings = indexPatternDatasource.getWarningMessages!( - state, - framePublicAPI, - {}, - () => {} - ); + const warnings = FormBasedDatasource.getWarningMessages!(state, framePublicAPI, {}, () => {}); expect(extractTranslationIdsFromWarnings(warnings)).toMatchInlineSnapshot(` Array [ @@ -2966,12 +2905,7 @@ describe('IndexPattern Data Source', () => { it('should show different types of warning messages', () => { framePublicAPI.activeData!.first.columns[1].meta.sourceParams!.hasPrecisionError = true; - const warnings = indexPatternDatasource.getWarningMessages!( - state, - framePublicAPI, - {}, - () => {} - ); + const warnings = FormBasedDatasource.getWarningMessages!(state, framePublicAPI, {}, () => {}); expect(extractTranslationIdsFromWarnings(warnings)).toMatchInlineSnapshot(` Array [ @@ -3002,7 +2936,7 @@ describe('IndexPattern Data Source', () => { currentIndexPatternId: '1', }; - expect(indexPatternDatasource.getErrorMessages(state, indexPatterns)).toEqual([ + expect(FormBasedDatasource.getErrorMessages(state, indexPatterns)).toEqual([ { longMessage: 'Layer 1 error: error 1', shortMessage: '' }, { longMessage: 'Layer 1 error: error 2', shortMessage: '' }, ]); @@ -3013,7 +2947,7 @@ describe('IndexPattern Data Source', () => { describe('#updateStateOnCloseDimension', () => { it('should not update when there are no incomplete columns', () => { expect( - indexPatternDatasource.updateStateOnCloseDimension!({ + FormBasedDatasource.updateStateOnCloseDimension!({ state: { layers: { first: { @@ -3055,7 +2989,7 @@ describe('IndexPattern Data Source', () => { currentIndexPatternId: '1', }; expect( - indexPatternDatasource.updateStateOnCloseDimension!({ + FormBasedDatasource.updateStateOnCloseDimension!({ state, layerId: 'first', columnId: 'col1', @@ -3127,9 +3061,9 @@ describe('IndexPattern Data Source', () => { }, }, }, - } as IndexPatternPrivateState; + } as FormBasedPrivateState; expect( - indexPatternDatasource.isTimeBased(state, { + FormBasedDatasource.isTimeBased(state, { ...indexPatterns, '1': { ...indexPatterns['1'], timeFieldName: undefined }, }) @@ -3189,9 +3123,9 @@ describe('IndexPattern Data Source', () => { }, }, }, - } as IndexPatternPrivateState; + } as FormBasedPrivateState; expect( - indexPatternDatasource.isTimeBased(state, { + FormBasedDatasource.isTimeBased(state, { ...indexPatterns, '1': { ...indexPatterns['1'], timeFieldName: undefined }, }) @@ -3215,9 +3149,9 @@ describe('IndexPattern Data Source', () => { }, }, }, - } as IndexPatternPrivateState; + } as FormBasedPrivateState; expect( - indexPatternDatasource.isTimeBased(state, { + FormBasedDatasource.isTimeBased(state, { ...indexPatterns, '1': { ...indexPatterns['1'], timeFieldName: undefined }, }) @@ -3241,8 +3175,8 @@ describe('IndexPattern Data Source', () => { }, }, }, - } as IndexPatternPrivateState; - expect(indexPatternDatasource.isTimeBased(state, indexPatterns)).toEqual(true); + } as FormBasedPrivateState; + expect(FormBasedDatasource.isTimeBased(state, indexPatterns)).toEqual(true); }); }); @@ -3265,9 +3199,9 @@ describe('IndexPattern Data Source', () => { }, }, }, - } as IndexPatternPrivateState; + } as FormBasedPrivateState; expect( - indexPatternDatasource.initializeDimension!(state, 'first', indexPatterns, { + FormBasedDatasource.initializeDimension!(state, 'first', indexPatterns, { columnId: 'newStatic', groupId: 'a', }) @@ -3292,9 +3226,9 @@ describe('IndexPattern Data Source', () => { }, }, }, - } as IndexPatternPrivateState; + } as FormBasedPrivateState; expect( - indexPatternDatasource.initializeDimension!(state, 'first', indexPatterns, { + FormBasedDatasource.initializeDimension!(state, 'first', indexPatterns, { columnId: 'newStatic', groupId: 'a', staticValue: 0, // use a falsy value to check also this corner case @@ -3329,7 +3263,7 @@ describe('IndexPattern Data Source', () => { describe('#isEqual', () => { const layerId = '8bd66b66-aba3-49fb-9ff2-4bf83f2be08e'; - const persistableState: IndexPatternPersistedState = { + const persistableState: FormBasedPersistedState = { layers: { [layerId]: { columns: { @@ -3366,7 +3300,7 @@ describe('IndexPattern Data Source', () => { it('should be false if datasource states are using different data views', () => { expect( - indexPatternDatasource.isEqual(persistableState, references1, persistableState, references2) + FormBasedDatasource.isEqual(persistableState, references1, persistableState, references2) ).toBe(false); }); @@ -3375,7 +3309,7 @@ describe('IndexPattern Data Source', () => { differentPersistableState.layers[layerId].columnOrder = ['something else']; expect( - indexPatternDatasource.isEqual( + FormBasedDatasource.isEqual( persistableState, references1, differentPersistableState, @@ -3386,7 +3320,7 @@ describe('IndexPattern Data Source', () => { it('should be true if datasource states are identical and they refer to the same data view', () => { expect( - indexPatternDatasource.isEqual(persistableState, references1, persistableState, references1) + FormBasedDatasource.isEqual(persistableState, references1, persistableState, references1) ).toBe(true); }); }); diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.tsx b/x-pack/plugins/lens/public/form_based_datasource/form_based.tsx similarity index 92% rename from x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.tsx rename to x-pack/plugins/lens/public/form_based_datasource/form_based.tsx index fb31c3c1a9a71..c49c9951d5228 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/form_based.tsx @@ -49,18 +49,18 @@ import { } from './loader'; import { toExpression } from './to_expression'; import { - IndexPatternDimensionTrigger, - IndexPatternDimensionEditor, + FormBasedDimensionTrigger, + FormBasedDimensionEditor, getDropProps, onDrop, } from './dimension_panel'; -import { IndexPatternDataPanel } from './datapanel'; +import { FormBasedDataPanel } from './datapanel'; import { getDatasourceSuggestionsForField, getDatasourceSuggestionsFromCurrentState, getDatasourceSuggestionsForVisualizeField, getDatasourceSuggestionsForVisualizeCharts, -} from './indexpattern_suggestions'; +} from './form_based_suggestions'; import { getFiltersInLayer, @@ -81,7 +81,7 @@ import { TermsIndexPatternColumn, } from './operations'; import { getReferenceRoot } from './operations/layer_helpers'; -import { IndexPatternPrivateState, IndexPatternPersistedState } from './types'; +import { FormBasedPrivateState, FormBasedPersistedState } from './types'; import { mergeLayer } from './state_helpers'; import { Datasource, VisualizeEditorContext } from '../types'; import { deleteColumn, isReferenced } from './operations'; @@ -127,7 +127,7 @@ export { suffixFormatterId, } from '../../common/suffix_formatter'; -export function getIndexPatternDatasource({ +export function getFormBasedDatasource({ core, storage, data, @@ -152,14 +152,14 @@ export function getIndexPatternDatasource({ }) { const uiSettings = core.uiSettings; - const DATASOURCE_ID = 'indexpattern'; + const DATASOURCE_ID = 'formBased'; // Not stateful. State is persisted to the frame - const indexPatternDatasource: Datasource = { + const formBasedDatasource: Datasource = { id: DATASOURCE_ID, initialize( - persistedState?: IndexPatternPersistedState, + persistedState?: FormBasedPersistedState, references?: SavedObjectReference[], initialContext?: VisualizeFieldContext | VisualizeEditorContext, indexPatternRefs?: IndexPatternRef[], @@ -176,11 +176,11 @@ export function getIndexPatternDatasource({ }); }, - getPersistableState(state: IndexPatternPrivateState) { + getPersistableState(state: FormBasedPrivateState) { return extractReferences(state); }, - insertLayer(state: IndexPatternPrivateState, newLayerId: string) { + insertLayer(state: FormBasedPrivateState, newLayerId: string) { return { ...state, layers: { @@ -204,7 +204,7 @@ export function getIndexPatternDatasource({ }; }, - removeLayer(state: IndexPatternPrivateState, layerId: string) { + removeLayer(state: FormBasedPrivateState, layerId: string) { const newLayers = { ...state.layers }; delete newLayers[layerId]; @@ -214,7 +214,7 @@ export function getIndexPatternDatasource({ }; }, - clearLayer(state: IndexPatternPrivateState, layerId: string) { + clearLayer(state: FormBasedPrivateState, layerId: string) { return { ...state, layers: { @@ -224,7 +224,7 @@ export function getIndexPatternDatasource({ }; }, - getLayers(state: IndexPatternPrivateState) { + getLayers(state: FormBasedPrivateState) { return Object.keys(state?.layers); }, @@ -266,10 +266,7 @@ export function getIndexPatternDatasource({ toExpression: (state, layerId, indexPatterns) => toExpression(state, layerId, indexPatterns, uiSettings), - renderDataPanel( - domElement: Element, - props: DatasourceDataPanelProps - ) { + renderDataPanel(domElement: Element, props: DatasourceDataPanelProps) { const { onChangeIndexPattern, ...otherProps } = props; render( @@ -285,7 +282,7 @@ export function getIndexPatternDatasource({ discover, }} > - ; const counts = {} as Record; @@ -342,9 +339,9 @@ export function getIndexPatternDatasource({ renderDimensionTrigger: ( domElement: Element, - props: DatasourceDimensionTriggerProps + props: DatasourceDimensionTriggerProps ) => { - const columnLabelMap = indexPatternDatasource.uniqueLabels(props.state); + const columnLabelMap = formBasedDatasource.uniqueLabels(props.state); render( @@ -361,10 +358,7 @@ export function getIndexPatternDatasource({ unifiedSearch, }} > - + , @@ -374,9 +368,9 @@ export function getIndexPatternDatasource({ renderDimensionEditor: ( domElement: Element, - props: DatasourceDimensionEditorProps + props: DatasourceDimensionEditorProps ) => { - const columnLabelMap = indexPatternDatasource.uniqueLabels(props.state); + const columnLabelMap = formBasedDatasource.uniqueLabels(props.state); render( @@ -394,7 +388,7 @@ export function getIndexPatternDatasource({ unifiedSearch, }} > - + props: DatasourceLayerPanelProps ) => { const { onChangeIndexPattern, ...otherProps } = props; render( @@ -445,7 +439,7 @@ export function getIndexPatternDatasource({ onDrop, getCustomWorkspaceRenderer: ( - state: IndexPatternPrivateState, + state: FormBasedPrivateState, dragging: DraggingIdentifier, indexPatterns: Record ) => { @@ -501,7 +495,7 @@ export function getIndexPatternDatasource({ onIndexPatternRename: (state, oldIndexPatternId, newIndexPatternId) => { return renameIndexPattern({ state, oldIndexPatternId, newIndexPatternId }); }, - getRenderEventCounters(state: IndexPatternPrivateState): string[] { + getRenderEventCounters(state: FormBasedPrivateState): string[] { const additionalEvents = { time_shift: false, filter: false, @@ -545,8 +539,8 @@ export function getIndexPatternDatasource({ }); }, - getPublicAPI({ state, layerId, indexPatterns }: PublicAPIProps) { - const columnLabelMap = indexPatternDatasource.uniqueLabels(state); + getPublicAPI({ state, layerId, indexPatterns }: PublicAPIProps) { + const columnLabelMap = formBasedDatasource.uniqueLabels(state); const layer = state.layers[layerId]; const visibleColumnIds = layer.columnOrder.filter((colId) => !isReferenced(layer, colId)); @@ -766,16 +760,16 @@ export function getIndexPatternDatasource({ ); }, isEqual: ( - persistableState1: IndexPatternPersistedState, + persistableState1: FormBasedPersistedState, references1: SavedObjectReference[], - persistableState2: IndexPatternPersistedState, + persistableState2: FormBasedPersistedState, references2: SavedObjectReference[] ) => isEqual( injectReferences(persistableState1, references1), injectReferences(persistableState2, references2) ), - getUsedDataView: (state: IndexPatternPrivateState, layerId?: string) => { + getUsedDataView: (state: FormBasedPrivateState, layerId?: string) => { if (!layerId) { return state.currentIndexPatternId; } @@ -786,7 +780,7 @@ export function getIndexPatternDatasource({ }, }; - return indexPatternDatasource; + return formBasedDatasource; } function blankLayer(indexPatternId: string) { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern_suggestions.test.tsx b/x-pack/plugins/lens/public/form_based_datasource/form_based_suggestions.test.tsx similarity index 98% rename from x-pack/plugins/lens/public/indexpattern_datasource/indexpattern_suggestions.test.tsx rename to x-pack/plugins/lens/public/form_based_datasource/form_based_suggestions.test.tsx index 382c11bda545a..e38a3005d4eba 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern_suggestions.test.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/form_based_suggestions.test.tsx @@ -14,14 +14,14 @@ import type { } from '@kbn/visualizations-plugin/common/convert_to_lens'; import { DatasourceSuggestion } from '../types'; import { generateId } from '../id_generator'; -import type { IndexPatternPrivateState } from './types'; +import type { FormBasedPrivateState } from './types'; import { getDatasourceSuggestionsForField, getDatasourceSuggestionsFromCurrentState, getDatasourceSuggestionsForVisualizeField, getDatasourceSuggestionsForVisualizeCharts, IndexPatternSuggestion, -} from './indexpattern_suggestions'; +} from './form_based_suggestions'; import { documentField } from './document_field'; import { getFieldByNameFactory } from './pure_helpers'; import { isEqual } from 'lodash'; @@ -171,7 +171,7 @@ const expectedIndexPatterns = { }, }; -function testInitialState(): IndexPatternPrivateState { +function testInitialState(): FormBasedPrivateState { return { currentIndexPatternId: '1', layers: { @@ -206,7 +206,7 @@ function getSuggestionSubset( ): Array> { return suggestions.map((s) => { const newSuggestion = { ...s } as Omit & { - state?: IndexPatternPrivateState; + state?: FormBasedPrivateState; }; delete newSuggestion.state; return newSuggestion; @@ -385,7 +385,7 @@ describe('IndexPattern Data Source suggestions', () => { }); it('should make a metric suggestion for a number field if there is no time field', async () => { - const state: IndexPatternPrivateState = { + const state: FormBasedPrivateState = { currentIndexPatternId: '1', layers: { first: { @@ -628,7 +628,7 @@ describe('IndexPattern Data Source suggestions', () => { }); it('should make a metric suggestion for a number field if there is no time field', async () => { - const state: IndexPatternPrivateState = { + const state: FormBasedPrivateState = { currentIndexPatternId: '1', layers: { previousLayer: { @@ -764,7 +764,7 @@ describe('IndexPattern Data Source suggestions', () => { }); describe('suggesting extensions to non-empty tables', () => { - function stateWithNonEmptyTables(): IndexPatternPrivateState { + function stateWithNonEmptyTables(): FormBasedPrivateState { const state = testInitialState(); return { @@ -1036,7 +1036,7 @@ describe('IndexPattern Data Source suggestions', () => { it('adds a metric column on a number field if no other metrics set', () => { (generateId as jest.Mock).mockReturnValue('newid'); const initialState = stateWithNonEmptyTables(); - const modifiedState: IndexPatternPrivateState = { + const modifiedState: FormBasedPrivateState = { ...initialState, layers: { ...initialState.layers, @@ -1138,7 +1138,7 @@ describe('IndexPattern Data Source suggestions', () => { it('skips duplicates when the document-specific field is already in use', () => { const initialState = stateWithNonEmptyTables(); - const modifiedState: IndexPatternPrivateState = { + const modifiedState: FormBasedPrivateState = { ...initialState, layers: { ...initialState.layers, @@ -1170,7 +1170,7 @@ describe('IndexPattern Data Source suggestions', () => { it('hides any referenced metrics when adding new metrics', () => { (generateId as jest.Mock).mockReturnValue('newid'); const initialState = stateWithNonEmptyTables(); - const modifiedState: IndexPatternPrivateState = { + const modifiedState: FormBasedPrivateState = { ...initialState, layers: { currentLayer: { @@ -1239,7 +1239,7 @@ describe('IndexPattern Data Source suggestions', () => { it('makes a suggestion to extending from an invalid state with a new metric', () => { (generateId as jest.Mock).mockReturnValue('newid'); const initialState = stateWithNonEmptyTables(); - const modifiedState: IndexPatternPrivateState = { + const modifiedState: FormBasedPrivateState = { ...initialState, layers: { currentLayer: { @@ -1306,7 +1306,7 @@ describe('IndexPattern Data Source suggestions', () => { (generateId as jest.Mock).mockReturnValue('newid'); const initialState = stateWithNonEmptyTables(); - const modifiedState: IndexPatternPrivateState = { + const modifiedState: FormBasedPrivateState = { ...initialState, layers: { referenceLineLayer: { @@ -1394,7 +1394,7 @@ describe('IndexPattern Data Source suggestions', () => { }); describe('finding the layer that is using the current index pattern', () => { - function stateWithCurrentIndexPattern(): IndexPatternPrivateState { + function stateWithCurrentIndexPattern(): FormBasedPrivateState { const state = testInitialState(); return { @@ -2140,7 +2140,7 @@ describe('IndexPattern Data Source suggestions', () => { it('returns a single suggestion containing the current columns for each layer', async () => { const initialState = testInitialState(); - const state: IndexPatternPrivateState = { + const state: FormBasedPrivateState = { ...initialState, layers: { ...initialState.layers, @@ -2233,7 +2233,7 @@ describe('IndexPattern Data Source suggestions', () => { it('returns a metric over time for single metric tables', async () => { const initialState = testInitialState(); - const state: IndexPatternPrivateState = { + const state: FormBasedPrivateState = { ...initialState, layers: { first: { @@ -2296,7 +2296,7 @@ describe('IndexPattern Data Source suggestions', () => { it('adds date histogram over default time field for tables without time dimension', async () => { const initialState = testInitialState(); - const state: IndexPatternPrivateState = { + const state: FormBasedPrivateState = { ...initialState, layers: { first: { @@ -2385,7 +2385,7 @@ describe('IndexPattern Data Source suggestions', () => { it('adds date histogram over default time field for tables without time dimension and a referenceLine', async () => { const initialState = testInitialState(); - const state: IndexPatternPrivateState = { + const state: FormBasedPrivateState = { ...initialState, layers: { first: { @@ -2495,7 +2495,7 @@ describe('IndexPattern Data Source suggestions', () => { it('does not create an over time suggestion if tables with numeric buckets with time dimension', async () => { const initialState = testInitialState(); - const state: IndexPatternPrivateState = { + const state: FormBasedPrivateState = { ...initialState, layers: { first: { @@ -2543,7 +2543,7 @@ describe('IndexPattern Data Source suggestions', () => { it('adds date histogram over default time field for custom range intervals', async () => { const initialState = testInitialState(); - const state: IndexPatternPrivateState = { + const state: FormBasedPrivateState = { ...initialState, layers: { first: { @@ -2630,7 +2630,7 @@ describe('IndexPattern Data Source suggestions', () => { it('does not create an over time suggestion if there is no default time field', async () => { const initialState = testInitialState(); - const state: IndexPatternPrivateState = { + const state: FormBasedPrivateState = { ...initialState, layers: { first: { @@ -2667,7 +2667,7 @@ describe('IndexPattern Data Source suggestions', () => { it('should not propose an over time suggestion if there are multiple bucket dimensions', () => { const initialState = testInitialState(); - const state: IndexPatternPrivateState = { + const state: FormBasedPrivateState = { ...initialState, layers: { first: { @@ -2751,7 +2751,7 @@ describe('IndexPattern Data Source suggestions', () => { searchable: true, }, ]; - const state: IndexPatternPrivateState = { + const state: FormBasedPrivateState = { currentIndexPatternId: '1', layers: { first: { @@ -2858,7 +2858,7 @@ describe('IndexPattern Data Source suggestions', () => { it('returns an only metric version of a given table, but does not include current state as reduced', () => { const initialState = testInitialState(); - const state: IndexPatternPrivateState = { + const state: FormBasedPrivateState = { currentIndexPatternId: '1', layers: { first: { @@ -2966,7 +2966,7 @@ describe('IndexPattern Data Source suggestions', () => { it('returns an alternative metric for an only-metric table', () => { const initialState = testInitialState(); - const state: IndexPatternPrivateState = { + const state: FormBasedPrivateState = { currentIndexPatternId: '1', layers: { first: { @@ -3032,7 +3032,7 @@ describe('IndexPattern Data Source suggestions', () => { it('contains a reordering suggestion when there are exactly 2 buckets', () => { const initialState = testInitialState(); - const state: IndexPatternPrivateState = { + const state: FormBasedPrivateState = { currentIndexPatternId: '1', layers: { first: { @@ -3084,7 +3084,7 @@ describe('IndexPattern Data Source suggestions', () => { it('will generate suggestions even if there are errors from missing fields', () => { const initialState = testInitialState(); - const state: IndexPatternPrivateState = { + const state: FormBasedPrivateState = { currentIndexPatternId: '1', layers: { first: { @@ -3148,7 +3148,7 @@ describe('IndexPattern Data Source suggestions', () => { describe('references', () => { it('will extend the table with a date when starting in an invalid state', () => { const initialState = testInitialState(); - const state: IndexPatternPrivateState = { + const state: FormBasedPrivateState = { ...initialState, layers: { ...initialState.layers, @@ -3237,7 +3237,7 @@ describe('IndexPattern Data Source suggestions', () => { it('will make an unchanged suggestion including incomplete references', () => { const initialState = testInitialState(); - const state: IndexPatternPrivateState = { + const state: FormBasedPrivateState = { ...initialState, layers: { ...initialState.layers, @@ -3327,7 +3327,7 @@ describe('IndexPattern Data Source suggestions', () => { it('will create reduced suggestions with all referenced children when handling references', () => { const initialState = testInitialState(); - const state: IndexPatternPrivateState = { + const state: FormBasedPrivateState = { ...initialState, layers: { ...initialState.layers, @@ -3473,7 +3473,7 @@ describe('IndexPattern Data Source suggestions', () => { it('will leave dangling references in place', () => { const initialState = testInitialState(); - const state: IndexPatternPrivateState = { + const state: FormBasedPrivateState = { ...initialState, layers: { ...initialState.layers, @@ -3521,7 +3521,7 @@ describe('IndexPattern Data Source suggestions', () => { it('will not suggest reduced tables if there is just a referenced top level metric', () => { const initialState = testInitialState(); - const state: IndexPatternPrivateState = { + const state: FormBasedPrivateState = { ...initialState, layers: { ...initialState.layers, @@ -3566,7 +3566,7 @@ describe('IndexPattern Data Source suggestions', () => { }); function isTableWithBucketColumns( - suggestion: DatasourceSuggestion, + suggestion: DatasourceSuggestion, columnIds: string[], numBuckets: number ) { @@ -3577,7 +3577,7 @@ function isTableWithBucketColumns( } function isTableWithMetricColumns( - suggestion: DatasourceSuggestion, + suggestion: DatasourceSuggestion, columnIds: string[] ) { expect(suggestion.table.isMultiRow).toEqual(false); diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern_suggestions.ts b/x-pack/plugins/lens/public/form_based_datasource/form_based_suggestions.ts similarity index 95% rename from x-pack/plugins/lens/public/indexpattern_datasource/indexpattern_suggestions.ts rename to x-pack/plugins/lens/public/form_based_datasource/form_based_suggestions.ts index 8503c369f4ec2..eec6b88329122 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern_suggestions.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/form_based_suggestions.ts @@ -23,7 +23,7 @@ import type { TableChangeType, VisualizationDimensionGroupConfig, } from '../types'; -import { columnToOperation } from './indexpattern'; +import { columnToOperation } from './form_based'; import { insertNewColumn, replaceColumn, @@ -41,12 +41,12 @@ import { ColumnAdvancedParams, } from './operations'; import { hasField } from './pure_utils'; -import type { IndexPatternPrivateState, IndexPatternLayer } from './types'; +import type { FormBasedPrivateState, FormBasedLayer } from './types'; import { documentField } from './document_field'; import { OperationDefinition } from './operations/definitions'; import { insertOrReplaceFormulaColumn } from './operations/definitions/formula'; -export type IndexPatternSuggestion = DatasourceSuggestion; +export type IndexPatternSuggestion = DatasourceSuggestion; interface ColumnChange { op: OperationType; @@ -67,12 +67,12 @@ function buildSuggestion({ label, changeType, }: { - state: IndexPatternPrivateState; + state: FormBasedPrivateState; layerId: string; changeType: TableChangeType; - updatedLayer?: IndexPatternLayer; + updatedLayer?: FormBasedLayer; label?: string; -}): DatasourceSuggestion { +}): DatasourceSuggestion { const updatedState = updatedLayer ? { ...state, @@ -120,7 +120,7 @@ function buildSuggestion({ } export function getDatasourceSuggestionsForField( - state: IndexPatternPrivateState, + state: FormBasedPrivateState, indexPatternId: string, field: IndexPatternField, indexPatterns: IndexPatternMap, @@ -176,7 +176,7 @@ export function getDatasourceSuggestionsForField( // Called when the user navigates from Visualize editor to Lens export function getDatasourceSuggestionsForVisualizeCharts( - state: IndexPatternPrivateState, + state: FormBasedPrivateState, contextLayers: Layer[], indexPatterns: IndexPatternMap ): IndexPatternSuggestion[] { @@ -184,7 +184,7 @@ export function getDatasourceSuggestionsForVisualizeCharts( } function getEmptyLayersSuggestionsForVisualizeCharts( - state: IndexPatternPrivateState, + state: FormBasedPrivateState, contextLayers: Layer[], indexPatterns: IndexPatternMap ): IndexPatternSuggestion[] { @@ -280,7 +280,7 @@ function convertToColumnChange(columns: Layer['columns'], indexPattern: IndexPat ) { const orderColumn = column.params.orderAgg; const operationDefinition = operationDefinitionMap[orderColumn.operationType]; - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: indexPattern.id, columns: {}, columnOrder: [], @@ -311,7 +311,7 @@ function createNewLayerWithMetricAggregationFromVizEditor( layer: Layer ) { const columns = convertToColumnChange(layer.columns, indexPattern); - let newLayer: IndexPatternLayer = { + let newLayer: FormBasedLayer = { indexPatternId: indexPattern.id, columns: {}, columnOrder: [], @@ -360,7 +360,7 @@ function createNewLayerWithMetricAggregationFromVizEditor( // Called when the user navigates from Discover to Lens (Visualize button) export function getDatasourceSuggestionsForVisualizeField( - state: IndexPatternPrivateState, + state: FormBasedPrivateState, indexPatternId: string, fieldName: string, indexPatterns: IndexPatternMap @@ -400,7 +400,7 @@ function getBucketOperation(field: IndexPatternField) { } function getExistingLayerSuggestionsForField( - state: IndexPatternPrivateState, + state: FormBasedPrivateState, layerId: string, field: IndexPatternField, indexPatterns: IndexPatternMap @@ -514,14 +514,14 @@ function getExistingLayerSuggestionsForField( } function getEmptyLayerSuggestionsForField( - state: IndexPatternPrivateState, + state: FormBasedPrivateState, layerId: string, indexPatternId: string, field: IndexPatternField, indexPatterns: IndexPatternMap ): IndexPatternSuggestion[] { const indexPattern = indexPatterns[indexPatternId]; - let newLayer: IndexPatternLayer | undefined; + let newLayer: FormBasedLayer | undefined; const bucketOperation = getBucketOperation(field); if (bucketOperation) { newLayer = createNewLayerWithBucketAggregation(indexPattern, field, bucketOperation); @@ -549,7 +549,7 @@ function createNewLayerWithBucketAggregation( indexPattern: IndexPattern, field: IndexPatternField, operation: OperationType -): IndexPatternLayer { +): FormBasedLayer { return insertNewColumn({ op: operation, layer: insertNewColumn({ @@ -570,7 +570,7 @@ function createNewLayerWithBucketAggregation( function createNewLayerWithMetricAggregation( indexPattern: IndexPattern, field: IndexPatternField -): IndexPatternLayer | undefined { +): FormBasedLayer | undefined { const dateField = indexPattern.getFieldByName(indexPattern.timeFieldName!); const [metricOperation] = getMetricOperationTypes(field); if (!metricOperation) { @@ -595,10 +595,10 @@ function createNewLayerWithMetricAggregation( } export function getDatasourceSuggestionsFromCurrentState( - state: IndexPatternPrivateState, + state: FormBasedPrivateState, indexPatterns: IndexPatternMap, filterLayers: (layerId: string) => boolean = () => true -): Array> { +): Array> { const layers = Object.entries(state.layers || {}).filter(([layerId]) => filterLayers(layerId)); if (layers.length > 1) { @@ -658,7 +658,7 @@ export function getDatasourceSuggestionsFromCurrentState( buckets.length === 1 && buckets.some((columnId) => layer.columns[columnId].dataType === 'number'); - const suggestions: Array> = []; + const suggestions: Array> = []; // Always suggest an unchanged table, including during invalid states suggestions.push( @@ -708,7 +708,7 @@ export function getDatasourceSuggestionsFromCurrentState( } function createChangedNestingSuggestion( - state: IndexPatternPrivateState, + state: FormBasedPrivateState, layerId: string, indexPatterns: IndexPatternMap ) { @@ -739,7 +739,7 @@ function createChangedNestingSuggestion( function createMetricSuggestion( indexPattern: IndexPattern, layerId: string, - state: IndexPatternPrivateState, + state: FormBasedPrivateState, field: IndexPatternField ) { const [operation] = getMetricOperationTypes(field); @@ -781,10 +781,10 @@ function getNestedTitle([outerBucketLabel, innerBucketLabel]: string[]) { function createAlternativeMetricSuggestions( indexPattern: IndexPattern, layerId: string, - state: IndexPatternPrivateState + state: FormBasedPrivateState ) { const layer = state.layers[layerId]; - const suggestions: Array> = []; + const suggestions: Array> = []; const topLevelMetricColumns = layer.columnOrder.filter( (columnId) => !isReferenced(layer, columnId) ); @@ -826,7 +826,7 @@ function createAlternativeMetricSuggestions( } function createSuggestionWithDefaultDateHistogram( - state: IndexPatternPrivateState, + state: FormBasedPrivateState, layerId: string, timeField: IndexPatternField, indexPatterns: IndexPatternMap @@ -852,7 +852,7 @@ function createSuggestionWithDefaultDateHistogram( }); } -function createSimplifiedTableSuggestions(state: IndexPatternPrivateState, layerId: string) { +function createSimplifiedTableSuggestions(state: FormBasedPrivateState, layerId: string) { const layer = state.layers[layerId]; const [availableBucketedColumns, availableMetricColumns] = partition( @@ -916,7 +916,7 @@ function createSimplifiedTableSuggestions(state: IndexPatternPrivateState, layer }); } -function getMetricSuggestionTitle(layer: IndexPatternLayer, onlySimpleMetric: boolean) { +function getMetricSuggestionTitle(layer: FormBasedLayer, onlySimpleMetric: boolean) { const { operationType, label } = layer.columns[layer.columnOrder[0]]; return i18n.translate('xpack.lens.indexpattern.suggestions.overallLabel', { defaultMessage: '{operation} overall', diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/help_popover.scss b/x-pack/plugins/lens/public/form_based_datasource/help_popover.scss similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/help_popover.scss rename to x-pack/plugins/lens/public/form_based_datasource/help_popover.scss diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/help_popover.tsx b/x-pack/plugins/lens/public/form_based_datasource/help_popover.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/help_popover.tsx rename to x-pack/plugins/lens/public/form_based_datasource/help_popover.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/index.ts b/x-pack/plugins/lens/public/form_based_datasource/index.ts similarity index 84% rename from x-pack/plugins/lens/public/indexpattern_datasource/index.ts rename to x-pack/plugins/lens/public/form_based_datasource/index.ts index 6b1b052c90b14..4f1b8c7f6a240 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/index.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/index.ts @@ -18,9 +18,9 @@ import type { UiActionsStart } from '@kbn/ui-actions-plugin/public'; import type { FieldFormatsStart, FieldFormatsSetup } from '@kbn/field-formats-plugin/public'; import type { EditorFrameSetup } from '../types'; -export type { PersistedIndexPatternLayer, FormulaPublicApi } from './types'; +export type { PersistedFormBasedLayer, FormulaPublicApi } from './types'; -export interface IndexPatternDatasourceSetupPlugins { +export interface FormBasedDatasourceSetupPlugins { expressions: ExpressionsSetup; fieldFormats: FieldFormatsSetup; data: DataPublicPluginSetup; @@ -28,7 +28,7 @@ export interface IndexPatternDatasourceSetupPlugins { charts: ChartsPluginSetup; } -export interface IndexPatternDatasourceStartPlugins { +export interface FormBasedDatasourceStartPlugins { data: DataPublicPluginStart; unifiedSearch: UnifiedSearchPublicPluginStart; discover?: DiscoverStart; @@ -38,18 +38,18 @@ export interface IndexPatternDatasourceStartPlugins { uiActions: UiActionsStart; } -export class IndexPatternDatasource { +export class FormBasedDatasource { setup( - core: CoreSetup, + core: CoreSetup, { fieldFormats: fieldFormatsSetup, expressions, editorFrame, charts, - }: IndexPatternDatasourceSetupPlugins + }: FormBasedDatasourceSetupPlugins ) { editorFrame.registerDatasource(async () => { - const { getIndexPatternDatasource, getSuffixFormatter, suffixFormatterId } = await import( + const { getFormBasedDatasource, getSuffixFormatter, suffixFormatterId } = await import( '../async_services' ); @@ -67,7 +67,7 @@ export class IndexPatternDatasource { { dataViewFieldEditor, uiActions, data, fieldFormats, dataViews, unifiedSearch, discover }, ] = await core.getStartServices(); - return getIndexPatternDatasource({ + return getFormBasedDatasource({ core: coreStart, fieldFormats, storage: new Storage(localStorage), diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/layerpanel.test.tsx b/x-pack/plugins/lens/public/form_based_datasource/layerpanel.test.tsx similarity index 96% rename from x-pack/plugins/lens/public/indexpattern_datasource/layerpanel.test.tsx rename to x-pack/plugins/lens/public/form_based_datasource/layerpanel.test.tsx index 7dde02c6c2b61..d9912da5ff43a 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/layerpanel.test.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/layerpanel.test.tsx @@ -6,8 +6,8 @@ */ import React, { MouseEvent } from 'react'; -import { IndexPatternPrivateState } from './types'; -import { IndexPatternLayerPanelProps, LayerPanel } from './layerpanel'; +import { FormBasedPrivateState } from './types'; +import { FormBasedLayerPanelProps, LayerPanel } from './layerpanel'; import { shallowWithIntl as shallow } from '@kbn/test-jest-helpers'; import { ShallowWrapper } from 'enzyme'; import { EuiSelectable } from '@elastic/eui'; @@ -135,7 +135,7 @@ const fieldsThree = [ }, ]; -const initialState: IndexPatternPrivateState = { +const initialState: FormBasedPrivateState = { currentIndexPatternId: '1', layers: { first: { @@ -168,7 +168,7 @@ const initialState: IndexPatternPrivateState = { }, }; describe('Layer Data Panel', () => { - let defaultProps: IndexPatternLayerPanelProps; + let defaultProps: FormBasedLayerPanelProps; beforeEach(() => { defaultProps = { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/layerpanel.tsx b/x-pack/plugins/lens/public/form_based_datasource/layerpanel.tsx similarity index 86% rename from x-pack/plugins/lens/public/indexpattern_datasource/layerpanel.tsx rename to x-pack/plugins/lens/public/form_based_datasource/layerpanel.tsx index 9824f70eeddfc..54787d092ccb8 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/layerpanel.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/layerpanel.tsx @@ -9,12 +9,12 @@ import React from 'react'; import { I18nProvider } from '@kbn/i18n-react'; import { i18n } from '@kbn/i18n'; import { DatasourceLayerPanelProps } from '../types'; -import { IndexPatternPrivateState } from './types'; +import { FormBasedPrivateState } from './types'; import { ChangeIndexPattern } from '../shared_components/dataview_picker/dataview_picker'; -export interface IndexPatternLayerPanelProps - extends DatasourceLayerPanelProps { - state: IndexPatternPrivateState; +export interface FormBasedLayerPanelProps + extends DatasourceLayerPanelProps { + state: FormBasedPrivateState; onChangeIndexPattern: (newId: string) => void; } @@ -23,7 +23,7 @@ export function LayerPanel({ layerId, onChangeIndexPattern, dataViews, -}: IndexPatternLayerPanelProps) { +}: FormBasedLayerPanelProps) { const layer = state.layers[layerId]; const indexPattern = dataViews.indexPatterns[layer.indexPatternId]; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/loader.test.ts b/x-pack/plugins/lens/public/form_based_datasource/loader.test.ts similarity index 96% rename from x-pack/plugins/lens/public/indexpattern_datasource/loader.test.ts rename to x-pack/plugins/lens/public/form_based_datasource/loader.test.ts index a3bc7a21143c4..f7f721c38691a 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/loader.test.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/loader.test.ts @@ -12,7 +12,7 @@ import { extractReferences, injectReferences, } from './loader'; -import { IndexPatternPersistedState, IndexPatternPrivateState } from './types'; +import { FormBasedPersistedState, FormBasedPrivateState } from './types'; import { DateHistogramIndexPatternColumn, TermsIndexPatternColumn } from './operations'; import { sampleIndexPatterns } from '../data_views_service/mocks'; @@ -141,7 +141,7 @@ describe('loader', () => { }); it('should initialize all the embeddable references without local storage', () => { - const savedState: IndexPatternPersistedState = { + const savedState: FormBasedPersistedState = { layers: { layerb: { columnOrder: ['col1', 'col2'], @@ -189,7 +189,7 @@ describe('loader', () => { }); it('should initialize from saved state', () => { - const savedState: IndexPatternPersistedState = { + const savedState: FormBasedPersistedState = { layers: { layerb: { columnOrder: ['col1', 'col2'], @@ -242,7 +242,7 @@ describe('loader', () => { }); describe('saved object references', () => { - const state: IndexPatternPrivateState = { + const state: FormBasedPrivateState = { currentIndexPatternId: 'b', layers: { a: { @@ -300,7 +300,7 @@ describe('loader', () => { describe('changeIndexPattern', () => { it('sets the given indexpattern as current', () => { - const state: IndexPatternPrivateState = { + const state: FormBasedPrivateState = { currentIndexPatternId: '2', layers: {}, }; @@ -324,7 +324,7 @@ describe('loader', () => { }); it('should update an empty layer on indexpattern change', () => { - const state: IndexPatternPrivateState = { + const state: FormBasedPrivateState = { currentIndexPatternId: '2', layers: { layerId: { columnOrder: [], columns: {}, indexPatternId: '2' } }, }; @@ -345,7 +345,7 @@ describe('loader', () => { }); it('should keep layer indexpattern on change if not empty', () => { - const state: IndexPatternPrivateState = { + const state: FormBasedPrivateState = { currentIndexPatternId: '2', layers: { layerId: { @@ -402,7 +402,7 @@ describe('loader', () => { describe('changeLayerIndexPattern', () => { it('loads the index pattern and then changes the specified layer', async () => { - const state: IndexPatternPrivateState = { + const state: FormBasedPrivateState = { currentIndexPatternId: '1', layers: { l0: { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/loader.ts b/x-pack/plugins/lens/public/form_based_datasource/loader.ts similarity index 91% rename from x-pack/plugins/lens/public/indexpattern_datasource/loader.ts rename to x-pack/plugins/lens/public/form_based_datasource/loader.ts index e26231995578e..e9baf8c46a4bd 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/loader.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/loader.ts @@ -18,7 +18,7 @@ import { VisualizeFieldContext, } from '@kbn/ui-actions-plugin/public'; import type { VisualizeEditorContext } from '../types'; -import { IndexPatternPersistedState, IndexPatternPrivateState, IndexPatternLayer } from './types'; +import { FormBasedPersistedState, FormBasedPrivateState, FormBasedLayer } from './types'; import { memoizedGetAvailableOperationsByMetadata, updateLayerIndexPattern } from './operations'; import { readFromStorage, writeToStorage } from '../settings_storage'; @@ -47,9 +47,9 @@ function getLayerReferenceName(layerId: string) { return `indexpattern-datasource-layer-${layerId}`; } -export function extractReferences({ layers }: IndexPatternPrivateState) { +export function extractReferences({ layers }: FormBasedPrivateState) { const savedObjectReferences: SavedObjectReference[] = []; - const persistableState: IndexPatternPersistedState = { + const persistableState: FormBasedPersistedState = { layers: {}, }; Object.entries(layers).forEach(([layerId, { indexPatternId, ...persistableLayer }]) => { @@ -64,10 +64,10 @@ export function extractReferences({ layers }: IndexPatternPrivateState) { } export function injectReferences( - state: IndexPatternPersistedState, + state: FormBasedPersistedState, references: SavedObjectReference[] ) { - const layers: Record = {}; + const layers: Record = {}; Object.entries(state.layers).forEach(([layerId, persistedLayer]) => { layers[layerId] = { ...persistedLayer, @@ -83,7 +83,7 @@ function createStateFromPersisted({ persistedState, references, }: { - persistedState?: IndexPatternPersistedState; + persistedState?: FormBasedPersistedState; references?: SavedObjectReference[]; }) { return persistedState && references ? injectReferences(persistedState, references) : undefined; @@ -97,7 +97,7 @@ function getUsedIndexPatterns({ defaultIndexPatternId, }: { state?: { - layers: Record; + layers: Record; }; defaultIndexPatternId?: string; storage: IStorageWrapper; @@ -139,14 +139,14 @@ export function loadInitialState({ indexPatternRefs = [], indexPatterns = {}, }: { - persistedState?: IndexPatternPersistedState; + persistedState?: FormBasedPersistedState; references?: SavedObjectReference[]; defaultIndexPatternId?: string; storage: IStorageWrapper; initialContext?: VisualizeFieldContext | VisualizeEditorContext; indexPatternRefs?: IndexPatternRef[]; indexPatterns?: Record; -}): IndexPatternPrivateState { +}): FormBasedPrivateState { const state = createStateFromPersisted({ persistedState, references }); const { usedPatterns, allIndexPatternIds: indexPatternIds } = getUsedIndexPatterns({ state, @@ -186,7 +186,7 @@ export function changeIndexPattern({ indexPatterns, }: { indexPatternId: string; - state: IndexPatternPrivateState; + state: FormBasedPrivateState; storage: IStorageWrapper; indexPatterns: Record; }) { @@ -209,7 +209,7 @@ export function renameIndexPattern({ }: { oldIndexPatternId: string; newIndexPatternId: string; - state: IndexPatternPrivateState; + state: FormBasedPrivateState; }) { return { ...state, @@ -231,7 +231,7 @@ export function triggerActionOnIndexPatternChange({ }: { indexPatternId: string; layerId: string; - state: IndexPatternPrivateState; + state: FormBasedPrivateState; uiActions: UiActionsStart; }) { const fromDataView = state.layers[layerId]?.indexPatternId; @@ -260,7 +260,7 @@ export function changeLayerIndexPattern({ }: { indexPatternId: string; layerId: string; - state: IndexPatternPrivateState; + state: FormBasedPrivateState; replaceIfPossible?: boolean; storage: IStorageWrapper; indexPatterns: Record; @@ -276,7 +276,7 @@ export function changeLayerIndexPattern({ }; } -function isSingleEmptyLayer(layerMap: IndexPatternPrivateState['layers']) { +function isSingleEmptyLayer(layerMap: FormBasedPrivateState['layers']) { const layers = Object.values(layerMap); return layers.length === 1 && layers[0].columnOrder.length === 0; } diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/mocks.ts b/x-pack/plugins/lens/public/form_based_datasource/mocks.ts similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/mocks.ts rename to x-pack/plugins/lens/public/form_based_datasource/mocks.ts diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/no_fields_callout.test.tsx b/x-pack/plugins/lens/public/form_based_datasource/no_fields_callout.test.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/no_fields_callout.test.tsx rename to x-pack/plugins/lens/public/form_based_datasource/no_fields_callout.test.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/no_fields_callout.tsx b/x-pack/plugins/lens/public/form_based_datasource/no_fields_callout.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/no_fields_callout.tsx rename to x-pack/plugins/lens/public/form_based_datasource/no_fields_callout.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/__mocks__/index.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/__mocks__/index.ts similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/__mocks__/index.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/__mocks__/index.ts diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions.test.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions.test.ts similarity index 98% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions.test.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions.test.ts index c9b3ae608ec76..f298de18fe6a4 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions.test.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions.test.ts @@ -18,7 +18,7 @@ import { } from './definitions'; import { getFieldByNameFactory } from '../pure_helpers'; import { documentField } from '../document_field'; -import { IndexPatternLayer } from '../types'; +import { FormBasedLayer } from '../types'; import { IndexPattern, IndexPatternField } from '../../types'; import { GenericIndexPatternColumn } from '.'; import { DateHistogramIndexPatternColumn } from './definitions/date_histogram'; @@ -83,7 +83,7 @@ const indexPattern = { const baseColumnArgs: { previousColumn: GenericIndexPatternColumn; indexPattern: IndexPattern; - layer: IndexPatternLayer; + layer: FormBasedLayer; field: IndexPatternField; } = { previousColumn: { @@ -105,7 +105,7 @@ const baseColumnArgs: { field: indexPattern.fields[2], }; -const layer: IndexPatternLayer = { +const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['date', 'metric', 'ref'], columns: { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/counter_rate.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/counter_rate.tsx similarity index 97% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/counter_rate.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/counter_rate.tsx index f2c421946bafb..3b89de8e94c51 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/counter_rate.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/counter_rate.tsx @@ -7,7 +7,7 @@ import { i18n } from '@kbn/i18n'; import { FormattedIndexPatternColumn, ReferenceBasedIndexPatternColumn } from '../column_types'; -import { IndexPatternLayer } from '../../../types'; +import { FormBasedLayer } from '../../../types'; import { buildLabelFunction, getErrorsForDateReference, @@ -106,7 +106,7 @@ export const counterRateOperation: OperationDefinition< isTransferable: (column, newIndexPattern) => { return hasDateField(newIndexPattern); }, - getErrorMessage: (layer: IndexPatternLayer, columnId: string) => { + getErrorMessage: (layer: FormBasedLayer, columnId: string) => { return combineErrorMessages([ getErrorsForDateReference( layer, diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/cumulative_sum.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/cumulative_sum.tsx similarity index 97% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/cumulative_sum.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/cumulative_sum.tsx index 67260672fa66d..c8c0d0b5f3897 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/cumulative_sum.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/cumulative_sum.tsx @@ -7,7 +7,7 @@ import { i18n } from '@kbn/i18n'; import { FormattedIndexPatternColumn, ReferenceBasedIndexPatternColumn } from '../column_types'; -import { IndexPatternLayer } from '../../../types'; +import { FormBasedLayer } from '../../../types'; import { checkForDateHistogram, getErrorsForDateReference, @@ -106,7 +106,7 @@ export const cumulativeSumOperation: OperationDefinition< isTransferable: () => { return true; }, - getErrorMessage: (layer: IndexPatternLayer, columnId: string) => { + getErrorMessage: (layer: FormBasedLayer, columnId: string) => { return combineErrorMessages([ getErrorsForDateReference( layer, diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/differences.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/differences.tsx similarity index 97% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/differences.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/differences.tsx index 1d76667654cb3..f2c379b5af5c1 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/differences.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/differences.tsx @@ -7,7 +7,7 @@ import { i18n } from '@kbn/i18n'; import { FormattedIndexPatternColumn, ReferenceBasedIndexPatternColumn } from '../column_types'; -import { IndexPatternLayer } from '../../../types'; +import { FormBasedLayer } from '../../../types'; import { buildLabelFunction, checkForDateHistogram, @@ -92,7 +92,7 @@ export const derivativeOperation: OperationDefinition< isTransferable: (column, newIndexPattern) => { return hasDateField(newIndexPattern); }, - getErrorMessage: (layer: IndexPatternLayer, columnId: string) => { + getErrorMessage: (layer: FormBasedLayer, columnId: string) => { return combineErrorMessages([ getErrorsForDateReference( layer, diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/index.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/index.ts similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/index.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/index.ts diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/moving_average.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/moving_average.tsx similarity index 98% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/moving_average.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/moving_average.tsx index 0fbdd96153a0f..8d9d673f37a22 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/moving_average.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/moving_average.tsx @@ -11,7 +11,7 @@ import React, { useState } from 'react'; import { EuiFieldNumber, EuiFormRow } from '@elastic/eui'; import { useDebounceWithOptions } from '../../../../shared_components'; import { FormattedIndexPatternColumn, ReferenceBasedIndexPatternColumn } from '../column_types'; -import { IndexPatternLayer } from '../../../types'; +import { FormBasedLayer } from '../../../types'; import { buildLabelFunction, checkForDateHistogram, @@ -114,7 +114,7 @@ export const movingAverageOperation: OperationDefinition< isTransferable: (column, newIndexPattern) => { return hasDateField(newIndexPattern); }, - getErrorMessage: (layer: IndexPatternLayer, columnId: string) => { + getErrorMessage: (layer: FormBasedLayer, columnId: string) => { return combineErrorMessages([ getErrorsForDateReference( layer, diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/overall_metric.test.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/overall_metric.test.ts similarity index 93% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/overall_metric.test.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/overall_metric.test.ts index 178a98074ad8a..901600e90f034 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/overall_metric.test.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/overall_metric.test.ts @@ -6,7 +6,7 @@ */ import { createMockedIndexPattern } from '../../../mocks'; -import type { IndexPatternLayer } from '../../../types'; +import type { FormBasedLayer } from '../../../types'; import { overallAverageOperation, overallMaxOperation, @@ -16,7 +16,7 @@ import { describe('overall_metric', () => { const indexPattern = createMockedIndexPattern(); - let layer: IndexPatternLayer; + let layer: FormBasedLayer; beforeEach(() => { layer = { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/overall_metric.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/overall_metric.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/overall_metric.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/overall_metric.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/time_scale.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/time_scale.tsx similarity index 97% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/time_scale.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/time_scale.tsx index 68df34650794d..59eb7fea46233 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/time_scale.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/time_scale.tsx @@ -13,7 +13,7 @@ import type { import { getErrorsForDateReference } from './utils'; import type { OperationDefinition } from '..'; import { combineErrorMessages, getFormatFromPreviousColumn } from '../helpers'; -import { IndexPatternLayer } from '../../../types'; +import { FormBasedLayer } from '../../../types'; import { getDisallowedPreviousShiftMessage } from '../../../time_shift_utils'; type OverallMetricIndexPatternColumn = FormattedIndexPatternColumn & @@ -101,7 +101,7 @@ export const timeScaleOperation: OperationDefinition { return true; }, - getErrorMessage: (layer: IndexPatternLayer, columnId: string) => { + getErrorMessage: (layer: FormBasedLayer, columnId: string) => { return combineErrorMessages([ getErrorsForDateReference( layer, diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/utils.test.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/utils.test.ts similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/utils.test.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/utils.test.ts diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/utils.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/utils.ts similarity index 94% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/utils.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/utils.ts index 04a8f554be7df..fec97e0597a25 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/utils.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/utils.ts @@ -11,7 +11,7 @@ import memoizeOne from 'memoize-one'; import type { IndexPattern } from '../../../../types'; import { LayerType, layerTypes } from '../../../../../common'; import type { TimeScaleUnit } from '../../../../../common/expressions'; -import type { IndexPatternLayer } from '../../../types'; +import type { FormBasedLayer } from '../../../types'; import { adjustTimeScaleLabelSuffix } from '../../time_scale_utils'; import type { ReferenceBasedIndexPatternColumn } from '../column_types'; import { getManagedColumnsFrom, isColumnValidAsReference } from '../../layer_helpers'; @@ -48,7 +48,7 @@ export function checkForDataLayerType(layerType: LayerType, name: string) { /** * Checks whether the current layer includes a date histogram and returns an error otherwise */ -export function checkForDateHistogram(layer: IndexPatternLayer, name: string) { +export function checkForDateHistogram(layer: FormBasedLayer, name: string) { const buckets = layer.columnOrder.filter((colId) => layer.columns[colId].isBucketed); const hasDateHistogram = buckets.some( (colId) => layer.columns[colId].operationType === 'date_histogram' @@ -67,7 +67,7 @@ export function checkForDateHistogram(layer: IndexPatternLayer, name: string) { ]; } -const getFullyManagedColumnIds = memoizeOne((layer: IndexPatternLayer) => { +const getFullyManagedColumnIds = memoizeOne((layer: FormBasedLayer) => { const managedColumnIds = new Set(); Object.entries(layer.columns).forEach(([id, column]) => { if ( @@ -84,7 +84,7 @@ const getFullyManagedColumnIds = memoizeOne((layer: IndexPatternLayer) => { return managedColumnIds; }); -export function checkReferences(layer: IndexPatternLayer, columnId: string) { +export function checkReferences(layer: FormBasedLayer, columnId: string) { const column = layer.columns[columnId] as ReferenceBasedIndexPatternColumn; const errors: string[] = []; @@ -128,7 +128,7 @@ export function checkReferences(layer: IndexPatternLayer, columnId: string) { } export function getErrorsForDateReference( - layer: IndexPatternLayer, + layer: FormBasedLayer, columnId: string, name: string ) { @@ -148,7 +148,7 @@ export function hasDateField(indexPattern: IndexPattern) { * Creates an expression ast for a date based operation (cumulative sum, derivative, moving average, counter rate) */ export function dateBasedOperationToExpression( - layer: IndexPatternLayer, + layer: FormBasedLayer, columnId: string, functionName: string, additionalArgs: Record = {} @@ -179,7 +179,7 @@ export function dateBasedOperationToExpression( * Creates an expression ast for a date based operation (cumulative sum, derivative, moving average, counter rate) */ export function optionallHistogramBasedOperationToExpression( - layer: IndexPatternLayer, + layer: FormBasedLayer, columnId: string, functionName: string, additionalArgs: Record = {} diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/cardinality.test.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/cardinality.test.ts similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/cardinality.test.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/cardinality.test.ts diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/cardinality.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/cardinality.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/cardinality.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/cardinality.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/column_types.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/column_types.ts similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/column_types.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/column_types.ts diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/count.test.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/count.test.ts similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/count.test.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/count.test.ts diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/count.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/count.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/count.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/count.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/date_histogram.test.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/date_histogram.test.tsx similarity index 98% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/date_histogram.test.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/date_histogram.test.tsx index a437cf63fd873..cc8ba1030b1d0 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/date_histogram.test.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/date_histogram.test.tsx @@ -18,7 +18,7 @@ import type { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; import { UI_SETTINGS } from '@kbn/data-plugin/public'; import { dataPluginMock, getCalculateAutoTimeExpression } from '@kbn/data-plugin/public/mocks'; import { createMockedIndexPattern } from '../../mocks'; -import type { IndexPatternLayer } from '../../types'; +import type { FormBasedLayer } from '../../types'; import type { IndexPattern } from '../../../types'; import { getFieldByNameFactory } from '../../pure_helpers'; import { act } from 'react-dom/test-utils'; @@ -124,7 +124,7 @@ const defaultOptions = { }; describe('date_histogram', () => { - let layer: IndexPatternLayer; + let layer: FormBasedLayer; const InlineOptions = dateHistogramOperation.paramEditor!; beforeEach(() => { @@ -160,7 +160,7 @@ describe('date_histogram', () => { }, }, }, - } as unknown as IndexPatternLayer; + } as unknown as FormBasedLayer; } describe('buildColumn', () => { @@ -339,7 +339,7 @@ describe('date_histogram', () => { it('should render current value for other index pattern', () => { const updateLayerSpy = jest.fn(); - const secondLayer: IndexPatternLayer = { + const secondLayer: FormBasedLayer = { indexPatternId: '2', columnOrder: ['col2'], columns: { @@ -374,7 +374,7 @@ describe('date_histogram', () => { }); it('should render time interval control set to auto for auto interval', () => { - const thirdLayer: IndexPatternLayer = { + const thirdLayer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['col1'], columns: { @@ -409,7 +409,7 @@ describe('date_histogram', () => { }); it('should allow switching to manual interval', () => { - const thirdLayer: IndexPatternLayer = { + const thirdLayer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['col1'], columns: { @@ -451,7 +451,7 @@ describe('date_histogram', () => { }); it('should allow turning off time range sync', () => { - const thirdLayer: IndexPatternLayer = { + const thirdLayer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['col1'], columns: { @@ -493,7 +493,7 @@ describe('date_histogram', () => { }); it('turns off time range ignore on switching to auto interval', () => { - const thirdLayer: IndexPatternLayer = { + const thirdLayer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['col1'], columns: { @@ -535,7 +535,7 @@ describe('date_histogram', () => { }); it('turns off drop partial bucket on tuning off time range ignore', () => { - const thirdLayer: IndexPatternLayer = { + const thirdLayer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['col1'], columns: { @@ -735,7 +735,7 @@ describe('date_histogram', () => { }); it('should allow the drop of partial buckets', () => { - const thirdLayer: IndexPatternLayer = { + const thirdLayer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['col1'], columns: { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/date_histogram.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/date_histogram.tsx similarity index 99% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/date_histogram.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/date_histogram.tsx index 8d6b201b2cc19..d0b53c837f4fd 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/date_histogram.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/date_histogram.tsx @@ -33,7 +33,7 @@ import { updateColumnParam } from '../layer_helpers'; import { OperationDefinition, ParamEditorProps } from '.'; import { FieldBasedIndexPatternColumn } from './column_types'; import { getInvalidFieldMessage, getSafeName } from './helpers'; -import { IndexPatternLayer } from '../../types'; +import { FormBasedLayer } from '../../types'; import { TooltipWrapper } from '../../../shared_components'; const { isValidInterval } = search.aggs; @@ -50,7 +50,7 @@ export interface DateHistogramIndexPatternColumn extends FieldBasedIndexPatternC }; } -function getMultipleDateHistogramsErrorMessage(layer: IndexPatternLayer, columnId: string) { +function getMultipleDateHistogramsErrorMessage(layer: FormBasedLayer, columnId: string) { const usesTimeShift = Object.values(layer.columns).some( (col) => col.timeShift && col.timeShift !== '' ); diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filter_popover.scss b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/filter_popover.scss similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filter_popover.scss rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/filter_popover.scss diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filter_popover.test.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/filter_popover.test.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filter_popover.test.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/filter_popover.test.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filter_popover.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/filter_popover.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filter_popover.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/filter_popover.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filters.scss b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/filters.scss similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filters.scss rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/filters.scss diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filters.test.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/filters.test.tsx similarity index 99% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filters.test.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/filters.test.tsx index 2b227674c26e9..2264fa8f185fb 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filters.test.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/filters.test.tsx @@ -16,7 +16,7 @@ import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; import type { FiltersIndexPatternColumn } from '.'; import { filtersOperation } from '..'; -import type { IndexPatternLayer } from '../../../types'; +import type { FormBasedLayer } from '../../../types'; import { createMockedIndexPattern } from '../../../mocks'; import { FilterPopover } from './filter_popover'; @@ -62,7 +62,7 @@ jest.mock('@elastic/eui', () => { }); describe('filters', () => { - let layer: IndexPatternLayer; + let layer: FormBasedLayer; const InlineOptions = filtersOperation.paramEditor!; beforeEach(() => { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filters.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/filters.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filters.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/filters.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/index.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/index.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/index.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/index.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/editor/formula.scss b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/formula.scss similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/editor/formula.scss rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/formula.scss diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/editor/formula_editor.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/formula_editor.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/editor/formula_editor.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/formula_editor.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/editor/formula_help.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/formula_help.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/editor/formula_help.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/formula_help.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/editor/index.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/index.ts similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/editor/index.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/index.ts diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/editor/math_completion.test.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/math_completion.test.ts similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/editor/math_completion.test.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/math_completion.test.ts diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/editor/math_completion.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/math_completion.ts similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/editor/math_completion.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/math_completion.ts diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/editor/math_tokenization.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/math_tokenization.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/editor/math_tokenization.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/math_tokenization.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/formula.test.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/formula.test.tsx similarity index 99% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/formula.test.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/formula.test.tsx index e68bb0d3142ef..19f47a05f3f8f 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/formula.test.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/formula.test.tsx @@ -9,7 +9,7 @@ import { createMockedIndexPattern } from '../../../mocks'; import { formulaOperation, GenericOperationDefinition, GenericIndexPatternColumn } from '..'; import { FormulaIndexPatternColumn } from './formula'; import { insertOrReplaceFormulaColumn } from './parse'; -import type { IndexPatternLayer } from '../../../types'; +import type { FormBasedLayer } from '../../../types'; import { IndexPattern, IndexPatternField } from '../../../../types'; import { tinymathFunctions } from './util'; import { TermsIndexPatternColumn } from '../terms'; @@ -112,7 +112,7 @@ const operationDefinitionMap: Record = { }; describe('formula', () => { - let layer: IndexPatternLayer; + let layer: FormBasedLayer; beforeEach(() => { layer = { @@ -844,7 +844,7 @@ describe('formula', () => { formula: string, isBroken = true, columnParams: Partial> = {} - ): IndexPatternLayer { + ): FormBasedLayer { return { columns: { col1: { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/formula.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/formula.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/formula.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/formula.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/formula_public_api.test.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/formula_public_api.test.ts similarity index 94% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/formula_public_api.test.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/formula_public_api.test.ts index c854595757a0c..deb6cdd86d7cc 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/formula_public_api.test.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/formula_public_api.test.ts @@ -9,7 +9,7 @@ import { insertOrReplaceFormulaColumn } from './parse'; import { createFormulaPublicApi, FormulaPublicApi } from './formula_public_api'; import type { DataView } from '@kbn/data-views-plugin/public'; -import type { DateHistogramIndexPatternColumn, PersistedIndexPatternLayer } from '../../../types'; +import type { DateHistogramIndexPatternColumn, PersistedFormBasedLayer } from '../../../types'; import { convertDataViewIntoLensIndexPattern } from '../../../../data_views_service/loader'; jest.mock('./parse', () => ({ @@ -20,7 +20,7 @@ jest.mock('../../../../data_views_service/loader', () => ({ convertDataViewIntoLensIndexPattern: jest.fn((v) => v), })); -const getBaseLayer = (): PersistedIndexPatternLayer => ({ +const getBaseLayer = (): PersistedFormBasedLayer => ({ columnOrder: ['col1'], columns: { col1: { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/formula_public_api.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/formula_public_api.ts similarity index 94% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/formula_public_api.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/formula_public_api.ts index 4085ec931d3a6..d073db2b3d651 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/formula_public_api.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/formula_public_api.ts @@ -8,7 +8,7 @@ import type { DataView } from '@kbn/data-views-plugin/public'; import { convertDataViewIntoLensIndexPattern } from '../../../../data_views_service/loader'; import type { IndexPattern } from '../../../../types'; -import type { PersistedIndexPatternLayer } from '../../../types'; +import type { PersistedFormBasedLayer } from '../../../types'; import { insertOrReplaceFormulaColumn } from './parse'; @@ -38,9 +38,9 @@ export interface FormulaPublicApi { }; }; }, - layer: PersistedIndexPatternLayer, + layer: PersistedFormBasedLayer, dataView: DataView - ) => PersistedIndexPatternLayer | undefined; + ) => PersistedFormBasedLayer | undefined; } /** @public **/ diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/generate.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/generate.ts similarity index 98% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/generate.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/generate.ts index 189a8d342b903..01dc204d54021 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/generate.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/generate.ts @@ -13,7 +13,7 @@ import { GenericIndexPatternColumn, } from '..'; import { BaseIndexPatternColumn, ReferenceBasedIndexPatternColumn } from '../column_types'; -import { IndexPatternLayer } from '../../../types'; +import { FormBasedLayer } from '../../../types'; import { unquotedStringRegex } from './util'; import { isColumnOfType } from '../helpers'; import { StaticValueIndexPatternColumn } from '../static_value'; @@ -37,7 +37,7 @@ export function getSafeFieldName({ export function generateFormula( previousColumn: ReferenceBasedIndexPatternColumn | GenericIndexPatternColumn, - layer: IndexPatternLayer, + layer: FormBasedLayer, previousFormula: string, operationDefinitionMap: Record | undefined ) { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/index.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/index.ts similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/index.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/index.ts diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/math.test.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/math.test.ts similarity index 99% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/math.test.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/math.test.ts index fdf4cc98c59d7..0d3051ea0a82e 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/math.test.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/math.test.ts @@ -7,10 +7,10 @@ import { TinymathAST } from '@kbn/tinymath'; import { IndexPattern } from '../../../../types'; -import { IndexPatternLayer } from '../../../types'; +import { FormBasedLayer } from '../../../types'; import { MathIndexPatternColumn, mathOperation } from './math'; -function createLayerWithMathColumn(tinymathAst: string | TinymathAST): IndexPatternLayer { +function createLayerWithMathColumn(tinymathAst: string | TinymathAST): FormBasedLayer { return { columnOrder: ['myColumnId'], columns: { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/math.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/math.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/math.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/math.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/math_examples.md b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/math_examples.md similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/math_examples.md rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/math_examples.md diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/parse.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/parse.ts similarity index 98% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/parse.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/parse.ts index 5c9a277070936..839db399d2993 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/parse.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/parse.ts @@ -15,7 +15,7 @@ import { GenericIndexPatternColumn, operationDefinitionMap, } from '..'; -import type { IndexPatternLayer } from '../../../types'; +import type { FormBasedLayer } from '../../../types'; import { mathOperation } from './math'; import { documentField } from '../../../document_field'; import { runASTValidation, shouldHaveFieldArgument, tryToParse } from './validation'; @@ -36,7 +36,7 @@ export function getManagedId(mainId: string, index: number) { function parseAndExtract( text: string, - layer: IndexPatternLayer, + layer: FormBasedLayer, columnId: string, indexPattern: IndexPattern, operations: Record, @@ -72,7 +72,7 @@ function extractColumns( idPrefix: string, operations: Record, ast: TinymathAST, - layer: IndexPatternLayer, + layer: FormBasedLayer, indexPattern: IndexPattern, label: string ): Array<{ column: GenericIndexPatternColumn; location?: TinymathLocation }> { @@ -223,7 +223,7 @@ const getEmptyColumnsWithFormulaMeta = (): { function generateFormulaColumns( id: string, column: FormulaIndexPatternColumn, - layer: IndexPatternLayer, + layer: FormBasedLayer, { indexPattern, operations = operationDefinitionMap }: ExpandColumnProperties ) { const { columns, meta } = getEmptyColumnsWithFormulaMeta(); @@ -270,7 +270,7 @@ function generateFormulaColumns( export function insertOrReplaceFormulaColumn( id: string, column: FormulaIndexPatternColumn, - baseLayer: IndexPatternLayer, + baseLayer: FormBasedLayer, params: ExpandColumnProperties ) { const layer = { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/types.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/types.ts similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/types.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/types.ts diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/util.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/util.ts similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/util.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/util.ts diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/validation.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/validation.ts similarity index 99% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/validation.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/validation.ts index a7ffc57a2361e..5c4e75e7543e9 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/formula/validation.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/validation.ts @@ -27,7 +27,7 @@ import type { GenericIndexPatternColumn, GenericOperationDefinition, } from '..'; -import type { IndexPatternLayer } from '../../../types'; +import type { FormBasedLayer } from '../../../types'; import type { IndexPattern } from '../../../../types'; import type { TinymathNodeTypes } from './types'; @@ -397,7 +397,7 @@ export function tryToParse( export function runASTValidation( ast: TinymathAST, - layer: IndexPatternLayer, + layer: FormBasedLayer, indexPattern: IndexPattern, operations: Record, currentColumn: GenericIndexPatternColumn @@ -426,7 +426,7 @@ function checkVariableEdgeCases(ast: TinymathAST, missingVariables: Set) function checkMissingVariableOrFunctions( ast: TinymathAST, - layer: IndexPatternLayer, + layer: FormBasedLayer, indexPattern: IndexPattern, operations: Record ): ErrorWrapper[] { @@ -623,7 +623,7 @@ function validateNameArguments( function runFullASTValidation( ast: TinymathAST, - layer: IndexPatternLayer, + layer: FormBasedLayer, indexPattern: IndexPattern, operations: Record, currentColumn?: GenericIndexPatternColumn diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/get_group_by_key.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/get_group_by_key.ts similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/get_group_by_key.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/get_group_by_key.ts diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/helpers.test.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/helpers.test.ts similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/helpers.test.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/helpers.test.ts diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/helpers.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/helpers.tsx similarity index 97% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/helpers.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/helpers.tsx index 868d5e2557e49..604cfe41b9128 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/helpers.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/helpers.tsx @@ -13,7 +13,7 @@ import { FormattedIndexPatternColumn, ReferenceBasedIndexPatternColumn, } from './column_types'; -import type { IndexPatternLayer } from '../../types'; +import type { FormBasedLayer } from '../../types'; import { hasField } from '../../pure_utils'; export function getInvalidFieldMessage( @@ -132,8 +132,8 @@ export function isColumnOfType( export const isColumn = ( setter: | GenericIndexPatternColumn - | IndexPatternLayer - | ((prevLayer: IndexPatternLayer) => IndexPatternLayer) + | FormBasedLayer + | ((prevLayer: FormBasedLayer) => FormBasedLayer) ): setter is GenericIndexPatternColumn => { return 'operationType' in setter; }; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/index.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/index.ts similarity index 95% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/index.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/index.ts index 6c79d314d10fa..9671807df9622 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/index.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/index.ts @@ -62,10 +62,10 @@ import type { GenericIndexPatternColumn, ReferenceBasedIndexPatternColumn, } from './column_types'; -import { DataViewDragDropOperation, IndexPatternLayer } from '../../types'; +import { DataViewDragDropOperation, FormBasedLayer } from '../../types'; import { DateRange, LayerType } from '../../../../common'; import { rangeOperation } from './ranges'; -import { IndexPatternDimensionEditorProps, OperationSupportMatrix } from '../../dimension_panel'; +import { FormBasedDimensionEditorProps, OperationSupportMatrix } from '../../dimension_panel'; import type { OriginalColumn } from '../../to_expression'; import { ReferenceEditorProps } from '../../dimension_panel/reference_editor'; @@ -174,10 +174,10 @@ export { staticValueOperation } from './static_value'; */ export interface ParamEditorProps< C, - U = IndexPatternLayer | ((prevLayer: IndexPatternLayer) => IndexPatternLayer) + U = FormBasedLayer | ((prevLayer: FormBasedLayer) => FormBasedLayer) > { currentColumn: C; - layer: IndexPatternLayer; + layer: FormBasedLayer; paramEditorUpdater: (setter: U) => void; ReferenceEditor?: (props: ReferenceEditorProps) => JSX.Element | null; toggleFullscreen: () => void; @@ -195,7 +195,7 @@ export interface ParamEditorProps< fieldFormats: FieldFormatsStart; unifiedSearch: UnifiedSearchPublicPluginStart; dataViews: DataViewsPublicPluginStart; - activeData?: IndexPatternDimensionEditorProps['activeData']; + activeData?: FormBasedDimensionEditorProps['activeData']; operationDefinitionMap: Record; paramEditorCustomProps?: ParamEditorCustomProps; existingFields: Record>; @@ -203,20 +203,20 @@ export interface ParamEditorProps< } export interface FieldInputProps { - layer: IndexPatternLayer; + layer: FormBasedLayer; selectedColumn?: C; columnId: string; indexPattern: IndexPattern; updateLayer: ( - setter: IndexPatternLayer | ((prevLayer: IndexPatternLayer) => IndexPatternLayer) + setter: FormBasedLayer | ((prevLayer: FormBasedLayer) => FormBasedLayer) ) => void; onDeleteColumn?: () => void; currentFieldIsInvalid: boolean; incompleteField: IncompleteColumn['sourceField'] | null; incompleteOperation: IncompleteColumn['operationType']; incompleteParams: Omit; - dimensionGroups: IndexPatternDimensionEditorProps['dimensionGroups']; - groupId: IndexPatternDimensionEditorProps['groupId']; + dimensionGroups: FormBasedDimensionEditorProps['dimensionGroups']; + groupId: FormBasedDimensionEditorProps['groupId']; /** * indexPatternId -> fieldName -> boolean */ @@ -271,7 +271,7 @@ interface BaseOperationDefinitionProps< * Based on the current column and the other updated columns, this function has to * return an updated column. If not implemented, the `id` function is used instead. */ - onOtherColumnChanged?: (layer: IndexPatternLayer, thisColumnId: string) => C; + onOtherColumnChanged?: (layer: FormBasedLayer, thisColumnId: string) => C; /** * React component for operation specific settings shown in the flyout editor */ @@ -303,7 +303,7 @@ interface BaseOperationDefinitionProps< */ getDisabledStatus?: ( indexPattern: IndexPattern, - layer: IndexPatternLayer, + layer: FormBasedLayer, layerType?: LayerType ) => string | undefined; /** @@ -313,7 +313,7 @@ interface BaseOperationDefinitionProps< * - Missing references */ getErrorMessage?: ( - layer: IndexPatternLayer, + layer: FormBasedLayer, columnId: string, indexPattern: IndexPattern, operationDefinitionMap?: Record @@ -329,7 +329,7 @@ interface BaseOperationDefinitionProps< core: CoreStart, frame: FrameDatasourceAPI, layerId: string - ) => Promise; + ) => Promise; }; } > @@ -453,7 +453,7 @@ interface BaseOperationDefinitionProps< } interface BaseBuildColumnArgs { - layer: IndexPatternLayer; + layer: FormBasedLayer; indexPattern: IndexPattern; } @@ -499,7 +499,7 @@ interface FieldlessOperationDefinition column: C, columnId: string, indexPattern: IndexPattern, - layer: IndexPatternLayer, + layer: FormBasedLayer, uiSettings: IUiSettingsClient ) => ExpressionAstFunction; } @@ -556,7 +556,7 @@ interface FieldBasedOperationDefinition @@ -568,7 +568,7 @@ interface FieldBasedOperationDefinition @@ -584,7 +584,7 @@ interface FieldBasedOperationDefinition Promise; + ) => Promise; }; } > @@ -652,7 +652,7 @@ interface FullReferenceOperationDefinition { * A chain of expression functions which will transform the table */ toExpression: ( - layer: IndexPatternLayer, + layer: FormBasedLayer, columnId: string, indexPattern: IndexPattern ) => ExpressionAstFunction[]; @@ -679,7 +679,7 @@ interface ManagedReferenceOperationDefinition * A chain of expression functions which will transform the table */ toExpression: ( - layer: IndexPatternLayer, + layer: FormBasedLayer, columnId: string, indexPattern: IndexPattern ) => ExpressionAstFunction[]; @@ -688,11 +688,11 @@ interface ManagedReferenceOperationDefinition * root level */ createCopy: ( - layers: Record, + layers: Record, source: DataViewDragDropOperation, target: DataViewDragDropOperation, operationDefinitionMap: Record - ) => Record; + ) => Record; } interface OperationDefinitionMap { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/last_value.test.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/last_value.test.tsx similarity index 99% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/last_value.test.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/last_value.test.tsx index 05386492544f4..eac2cbad86c73 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/last_value.test.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/last_value.test.tsx @@ -17,7 +17,7 @@ import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; import { createMockedIndexPattern } from '../../mocks'; import { LastValueIndexPatternColumn } from './last_value'; import { lastValueOperation } from '.'; -import type { IndexPatternLayer } from '../../types'; +import type { FormBasedLayer } from '../../types'; import type { IndexPattern } from '../../../types'; import { TermsIndexPatternColumn } from './terms'; import { EuiSwitch, EuiSwitchEvent } from '@elastic/eui'; @@ -55,7 +55,7 @@ const defaultProps = { }; describe('last_value', () => { - let layer: IndexPatternLayer; + let layer: FormBasedLayer; const InlineOptions = lastValueOperation.paramEditor!; beforeEach(() => { @@ -506,7 +506,7 @@ describe('last_value', () => { }, columnOrder: [], indexPatternId: '', - } as IndexPatternLayer; + } as FormBasedLayer; expect( lastValueOperation.buildColumn({ @@ -829,7 +829,7 @@ describe('last_value', () => { describe('getErrorMessage', () => { let indexPattern: IndexPattern; - let errorLayer: IndexPatternLayer; + let errorLayer: FormBasedLayer; beforeEach(() => { indexPattern = createMockedIndexPattern(); errorLayer = { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/last_value.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/last_value.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/last_value.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/last_value.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/metrics.test.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/metrics.test.ts similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/metrics.test.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/metrics.test.ts diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/metrics.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/metrics.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/metrics.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/metrics.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/percentile.test.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/percentile.test.tsx similarity index 99% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/percentile.test.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/percentile.test.tsx index 77434d7ecc7ad..bcb840f81d45c 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/percentile.test.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/percentile.test.tsx @@ -18,7 +18,7 @@ import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; import { createMockedIndexPattern } from '../../mocks'; import { percentileOperation } from '.'; -import { IndexPatternLayer } from '../../types'; +import { FormBasedLayer } from '../../types'; import { PercentileIndexPatternColumn } from './percentile'; import { TermsIndexPatternColumn } from './terms'; import { @@ -71,7 +71,7 @@ const defaultProps = { }; describe('percentile', () => { - let layer: IndexPatternLayer; + let layer: FormBasedLayer; const InlineOptions = percentileOperation.paramEditor!; beforeEach(() => { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/percentile.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/percentile.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/percentile.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/percentile.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/percentile_ranks.test.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/percentile_ranks.test.tsx similarity index 99% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/percentile_ranks.test.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/percentile_ranks.test.tsx index a0c69a7354849..bcf535dc1fc55 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/percentile_ranks.test.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/percentile_ranks.test.tsx @@ -18,7 +18,7 @@ import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; import { createMockedIndexPattern } from '../../mocks'; import { percentileRanksOperation } from '.'; -import { IndexPatternLayer } from '../../types'; +import { FormBasedLayer } from '../../types'; import type { PercentileRanksIndexPatternColumn } from './percentile_ranks'; import { TermsIndexPatternColumn } from './terms'; import { IndexPattern } from '../../../types'; @@ -64,7 +64,7 @@ const defaultProps = { }; describe('percentile ranks', () => { - let layer: IndexPatternLayer; + let layer: FormBasedLayer; const InlineOptions = percentileRanksOperation.paramEditor!; beforeEach(() => { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/percentile_ranks.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/percentile_ranks.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/percentile_ranks.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/percentile_ranks.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/advanced_editor.scss b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/advanced_editor.scss similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/advanced_editor.scss rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/advanced_editor.scss diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/advanced_editor.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/advanced_editor.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/advanced_editor.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/advanced_editor.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/constants.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/constants.ts similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/constants.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/constants.ts diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/index.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/index.ts similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/index.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/index.ts diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/range_editor.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/range_editor.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/range_editor.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/range_editor.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/ranges.test.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/ranges.test.tsx similarity index 99% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/ranges.test.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/ranges.test.tsx index 874559ae66c19..3c6f8f95d0fe8 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/ranges.test.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/ranges.test.tsx @@ -15,7 +15,7 @@ import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; import { fieldFormatsServiceMock } from '@kbn/field-formats-plugin/public/mocks'; import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks'; -import type { IndexPatternLayer } from '../../../types'; +import type { FormBasedLayer } from '../../../types'; import { rangeOperation } from '..'; import { RangeIndexPatternColumn } from './ranges'; import { @@ -136,7 +136,7 @@ const defaultOptions = { }; describe('ranges', () => { - let layer: IndexPatternLayer; + let layer: FormBasedLayer; const InlineOptions = rangeOperation.paramEditor!; const MAX_HISTOGRAM_VALUE = 100; const GRANULARITY_DEFAULT_VALUE = (MAX_HISTOGRAM_VALUE - MIN_HISTOGRAM_BARS) / 2; @@ -156,7 +156,7 @@ describe('ranges', () => { column.params.type = MODES.Range; } - function getDefaultLayer(): IndexPatternLayer { + function getDefaultLayer(): FormBasedLayer { return { indexPatternId: '1', columnOrder: ['col1', 'col2'], diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/ranges.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/ranges.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/ranges.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/ranges.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/shared_components/form_row.scss b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/shared_components/form_row.scss similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/shared_components/form_row.scss rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/shared_components/form_row.scss diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/shared_components/form_row.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/shared_components/form_row.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/shared_components/form_row.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/shared_components/form_row.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/shared_components/index.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/shared_components/index.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/shared_components/index.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/shared_components/index.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/shared_components/label_input.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/shared_components/label_input.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/shared_components/label_input.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/shared_components/label_input.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/static_value.test.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/static_value.test.tsx similarity index 98% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/static_value.test.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/static_value.test.tsx index a93b1ece5e13f..fd124ff93d92a 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/static_value.test.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/static_value.test.tsx @@ -17,7 +17,7 @@ import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; import { createMockedIndexPattern } from '../../mocks'; import { staticValueOperation } from '.'; -import { IndexPatternLayer } from '../../types'; +import { FormBasedLayer } from '../../types'; import { IndexPattern } from '../../../types'; import { StaticValueIndexPatternColumn } from './static_value'; import { TermsIndexPatternColumn } from './terms'; @@ -63,7 +63,7 @@ const defaultProps = { }; describe('static_value', () => { - let layer: IndexPatternLayer; + let layer: FormBasedLayer; beforeEach(() => { layer = { @@ -97,7 +97,7 @@ describe('static_value', () => { }; }); - function getLayerWithStaticValue(newValue: string | null | undefined): IndexPatternLayer { + function getLayerWithStaticValue(newValue: string | null | undefined): FormBasedLayer { return { ...layer, columns: { @@ -377,7 +377,7 @@ describe('static_value', () => { }, } as StaticValueIndexPatternColumn, }, - } as IndexPatternLayer; + } as FormBasedLayer; const instance = shallow( { - let layer: IndexPatternLayer; + let layer: FormBasedLayer; const InlineOptions = termsOperation.paramEditor!; const InlineFieldInput = termsOperation.renderFieldInput!; @@ -1187,7 +1187,7 @@ describe('terms', () => { return getOperationSupportMatrix({ state: { layers: { layer1: layer }, - } as unknown as IndexPatternPrivateState, + } as unknown as FormBasedPrivateState, layerId: 'layer1', filterOperations: () => true, columnId, diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/terms/types.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/types.ts similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/terms/types.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/types.ts diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/terms/values_input.test.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/values_input.test.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/terms/values_input.test.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/values_input.test.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/terms/values_input.tsx b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/values_input.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/terms/values_input.tsx rename to x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/values_input.tsx diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/index.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/index.ts similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/index.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/index.ts diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/layer_helpers.test.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/layer_helpers.test.ts similarity index 97% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/layer_helpers.test.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/layer_helpers.test.ts index 1a77cd253424f..c07ae9fa688cd 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/layer_helpers.test.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/layer_helpers.test.ts @@ -23,7 +23,7 @@ import { operationDefinitionMap, OperationType } from '.'; import { TermsIndexPatternColumn } from './definitions/terms'; import { DateHistogramIndexPatternColumn } from './definitions/date_histogram'; import { AvgIndexPatternColumn } from './definitions/metrics'; -import type { IndexPatternLayer, IndexPatternPrivateState } from '../types'; +import type { FormBasedLayer, FormBasedPrivateState } from '../types'; import { documentField } from '../document_field'; import { getFieldByNameFactory } from '../pure_helpers'; import { generateId } from '../../id_generator'; @@ -257,7 +257,7 @@ describe('state_helpers', () => { }); it('should update order on inserting a bucketed fieldless operation', () => { - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['col1'], columns: { @@ -284,7 +284,7 @@ describe('state_helpers', () => { }); it('should update order on inserting a bucketed field-based operation', () => { - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['col1'], columns: { @@ -312,7 +312,7 @@ describe('state_helpers', () => { }); it('should insert a metric after buckets', () => { - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['col1'], columns: { @@ -343,7 +343,7 @@ describe('state_helpers', () => { }); it('should insert a metric after references', () => { - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['col1'], columns: { @@ -382,7 +382,7 @@ describe('state_helpers', () => { }); it('should insert new buckets at the end of previous buckets', () => { - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['col1', 'col3'], columns: { @@ -421,7 +421,7 @@ describe('state_helpers', () => { }); it('should not change order of metrics and references on inserting new buckets', () => { - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['col1', 'col2'], columns: { @@ -665,7 +665,7 @@ describe('state_helpers', () => { specificOperations: [], }, ]; - const layer: IndexPatternLayer = { indexPatternId: '1', columnOrder: [], columns: {} }; + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: [], columns: {} }; expect(() => { insertNewColumn({ layer, @@ -678,7 +678,7 @@ describe('state_helpers', () => { }); it('should leave the references empty if too ambiguous', () => { - const layer: IndexPatternLayer = { indexPatternId: '1', columnOrder: [], columns: {} }; + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: [], columns: {} }; const result = insertNewColumn({ layer, indexPattern, @@ -710,7 +710,7 @@ describe('state_helpers', () => { validateMetadata: () => true, }, ]; - const layer: IndexPatternLayer = { indexPatternId: '1', columnOrder: [], columns: {} }; + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: [], columns: {} }; const result = insertNewColumn({ layer, indexPattern, @@ -728,7 +728,7 @@ describe('state_helpers', () => { }); it('should create a referenced column if the ID is being used as a reference', () => { - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['col1'], columns: { @@ -825,7 +825,7 @@ describe('state_helpers', () => { }); it('should update order on changing the column', () => { - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['col1', 'col2'], columns: { @@ -1498,7 +1498,7 @@ describe('state_helpers', () => { operationType: 'count' as const, }; - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['col1'], columns: { col1: expectedColumn }, @@ -1526,7 +1526,7 @@ describe('state_helpers', () => { }); it('should not wrap around the previous operation as a reference if excluded by validateMetadata (case new1)', () => { - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['col1'], columns: { @@ -1573,7 +1573,7 @@ describe('state_helpers', () => { const testFilter = { language: 'kuery', query: '' }; - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['col1'], columns: { col1: { ...expectedColumn, filter: testFilter } }, @@ -1612,7 +1612,7 @@ describe('state_helpers', () => { validateMetadata: () => true, }, ]; - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['col1'], columns: { @@ -1653,7 +1653,7 @@ describe('state_helpers', () => { specificOperations: ['unique_count', 'sum', 'average'], // this order is ignored }, ]; - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['col1'], columns: { @@ -1694,7 +1694,7 @@ describe('state_helpers', () => { specificOperations: ['unique_count'], }, ]; - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['col1'], columns: { @@ -1734,7 +1734,7 @@ describe('state_helpers', () => { specificOperations: [], }, ]; - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['col1'], columns: { @@ -1804,7 +1804,7 @@ describe('state_helpers', () => { }); it('should use existing references, delete invalid, when switching from one reference to another (case ref1)', () => { - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['ref1', 'invalid', 'output'], columns: { @@ -1856,7 +1856,7 @@ describe('state_helpers', () => { }); it('should modify a copied object, not the original layer', () => { - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['ref1', 'invalid', 'output'], columns: { @@ -1907,7 +1907,7 @@ describe('state_helpers', () => { label: 'math', operationType: 'math' as const, }; - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '', columnOrder: [], columns: { @@ -1977,7 +1977,7 @@ describe('state_helpers', () => { }); it('should transition by using the field from the previous reference if nothing else works (case new5)', () => { - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['fieldReused', 'output'], columns: { @@ -2045,7 +2045,7 @@ describe('state_helpers', () => { ], }, }; - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['col1', 'col2'], columns: { @@ -2089,7 +2089,7 @@ describe('state_helpers', () => { filter: { language: 'kuery', query: 'bytes > 4000' }, timeShift: '3h', }; - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['col1', 'col2'], columns: { @@ -2135,7 +2135,7 @@ describe('state_helpers', () => { timeShift: '3h', }; - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['metric', 'ref'], columns: { @@ -2168,7 +2168,7 @@ describe('state_helpers', () => { }); it('should keep state and set incomplete column on incompatible switch', () => { - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['metric', 'ref'], columns: { @@ -2272,7 +2272,7 @@ describe('state_helpers', () => { }, ]; - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['col1', 'col2'], columns: { @@ -2439,7 +2439,7 @@ describe('state_helpers', () => { }); it('should delete the column and all of its references', () => { - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['col1', 'col2'], columns: { @@ -2467,7 +2467,7 @@ describe('state_helpers', () => { }); it('should update the labels when deleting columns', () => { - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['col1', 'col2'], columns: { @@ -2512,7 +2512,7 @@ describe('state_helpers', () => { }); it('should recursively delete references', () => { - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: ['col1', 'col2', 'col3'], columns: { @@ -2837,7 +2837,7 @@ describe('state_helpers', () => { }); it('should remove operations referencing unavailable fields', () => { - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { columnOrder: ['col1', 'col2'], columns: { col1: { @@ -2870,7 +2870,7 @@ describe('state_helpers', () => { }); it('should remove operations indirectly referencing unavailable fields', () => { - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { columnOrder: ['col1', 'col2'], columns: { col1: { @@ -2902,7 +2902,7 @@ describe('state_helpers', () => { }); it('should remove operations referencing fields with insufficient capabilities', () => { - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { columnOrder: ['col1', 'col2'], columns: { col1: { @@ -2941,7 +2941,7 @@ describe('state_helpers', () => { interval: 'w', }, })) as OperationDefinition['transfer']; - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { columnOrder: ['col1', 'col2'], columns: { col1: { @@ -2971,7 +2971,7 @@ describe('state_helpers', () => { }); it('should remove operations referencing fields with wrong field types', () => { - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { columnOrder: ['col1', 'col2'], columns: { col1: { @@ -3004,7 +3004,7 @@ describe('state_helpers', () => { }); it('should remove operations referencing fields with incompatible restrictions', () => { - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { columnOrder: ['col1', 'col2'], columns: { col1: { @@ -3078,7 +3078,7 @@ describe('state_helpers', () => { }, }, indexPattern, - {} as IndexPatternPrivateState, + {} as FormBasedPrivateState, '1', {} as CoreStart, dataMock @@ -3114,7 +3114,7 @@ describe('state_helpers', () => { }, }, indexPattern, - {} as IndexPatternPrivateState, + {} as FormBasedPrivateState, '1', {} as CoreStart, dataMock @@ -3151,7 +3151,7 @@ describe('state_helpers', () => { }, }, indexPattern, - {} as IndexPatternPrivateState, + {} as FormBasedPrivateState, '1', {} as CoreStart, dataMock @@ -3181,7 +3181,7 @@ describe('state_helpers', () => { }, }, indexPattern, - {} as IndexPatternPrivateState, + {} as FormBasedPrivateState, '1', {} as CoreStart, dataMock @@ -3209,7 +3209,7 @@ describe('state_helpers', () => { describe('hasTermsWithManyBuckets', () => { it('should return false for a bucketed non terms operation', () => { - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { columnOrder: ['col1'], columns: { col1: { @@ -3230,7 +3230,7 @@ describe('state_helpers', () => { }); it('should return false if all terms operation have a lower size', () => { - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { columnOrder: ['col1'], columns: { col1: { @@ -3256,7 +3256,7 @@ describe('state_helpers', () => { }); it('should return true if the size is high', () => { - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { columnOrder: ['col1'], columns: { col1: { @@ -3284,7 +3284,7 @@ describe('state_helpers', () => { describe('isReferenced', () => { it('should return false for top column which has references', () => { - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: [], columns: { @@ -3308,7 +3308,7 @@ describe('state_helpers', () => { }); it('should return true for referenced column', () => { - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: [], columns: { @@ -3334,7 +3334,7 @@ describe('state_helpers', () => { describe('getReferenceRoot', () => { it("should just return the column id itself if it's not a referenced column", () => { - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: [], columns: { @@ -3358,7 +3358,7 @@ describe('state_helpers', () => { }); it('should return the top column if a referenced column is passed', () => { - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '1', columnOrder: [], columns: { @@ -3389,7 +3389,7 @@ describe('state_helpers', () => { label: 'math', operationType: 'math' as const, }; - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '', columnOrder: [], columns: { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/layer_helpers.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/layer_helpers.ts similarity index 95% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/layer_helpers.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/layer_helpers.ts index b3f1b3bc7d5f3..ade932cf24c7b 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/layer_helpers.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/layer_helpers.ts @@ -29,8 +29,8 @@ import { } from './definitions'; import type { DataViewDragDropOperation, - IndexPatternLayer, - IndexPatternPrivateState, + FormBasedLayer, + FormBasedPrivateState, } from '../types'; import { getSortScoreByPriorityForField } from './operations'; import { generateId } from '../../id_generator'; @@ -54,7 +54,7 @@ export interface ColumnAdvancedParams { interface ColumnChange { op: OperationType; - layer: IndexPatternLayer; + layer: FormBasedLayer; columnId: string; indexPattern: IndexPattern; field?: IndexPatternField; @@ -72,7 +72,7 @@ interface ColumnChange { } interface ColumnCopy { - layers: Record; + layers: Record; target: DataViewDragDropOperation; source: DataViewDragDropOperation; shouldDeleteSource?: boolean; @@ -82,7 +82,7 @@ export const deleteColumnInLayers = ({ layers, source, }: { - layers: Record; + layers: Record; source: DataViewDragDropOperation; }) => ({ ...layers, @@ -98,7 +98,7 @@ export function copyColumn({ source, target, shouldDeleteSource, -}: ColumnCopy): Record { +}: ColumnCopy): Record { const outputLayers = createCopiedColumn(layers, target, source); return shouldDeleteSource ? deleteColumnInLayers({ @@ -109,10 +109,10 @@ export function copyColumn({ } function createCopiedColumn( - layers: Record, + layers: Record, target: DataViewDragDropOperation, source: DataViewDragDropOperation -): Record { +): Record { const sourceLayer = layers[source.layerId]; const sourceColumn = sourceLayer.columns[source.columnId]; const targetLayer = layers[target.layerId]; @@ -152,7 +152,7 @@ function createCopiedColumn( }; } -export function insertOrReplaceColumn(args: ColumnChange): IndexPatternLayer { +export function insertOrReplaceColumn(args: ColumnChange): FormBasedLayer { if (args.layer.columns[args.columnId]) { return replaceColumn(args); } @@ -185,7 +185,7 @@ const insertReferences = ({ visualizationGroups, targetGroup, }: { - layer: IndexPatternLayer; + layer: FormBasedLayer; references: Exclude; requiredReferences: RequiredReference[]; indexPattern: IndexPattern; @@ -269,7 +269,7 @@ const generateNewReferences = ({ incompleteFieldName?: string; incompleteFieldOperation?: OperationType; columnParams?: Record; - layer: IndexPatternLayer; + layer: FormBasedLayer; requiredReferences: RequiredReference[]; indexPattern: IndexPattern; visualizationGroups: VisualizationDimensionGroupConfig[]; @@ -364,7 +364,7 @@ export function insertNewColumn({ initialParams, references, respectOrder, -}: ColumnChange): IndexPatternLayer { +}: ColumnChange): FormBasedLayer { const operationDefinition = operationDefinitionMap[op]; if (!operationDefinition) { @@ -540,7 +540,7 @@ export function replaceColumn({ initialParams, shouldResetLabel, shouldCombineField, -}: ColumnChange): IndexPatternLayer { +}: ColumnChange): FormBasedLayer { const previousColumn = layer.columns[columnId]; if (!previousColumn) { throw new Error(`Can't replace column because there is no prior column`); @@ -850,10 +850,10 @@ function removeOrphanedColumns( | OperationDefinition | OperationDefinition, previousColumn: GenericIndexPatternColumn, - tempLayer: IndexPatternLayer, + tempLayer: FormBasedLayer, indexPattern: IndexPattern ) { - let newLayer: IndexPatternLayer = tempLayer; + let newLayer: FormBasedLayer = tempLayer; if (previousDefinition.input === 'managedReference') { const [columnId] = Object.entries(tempLayer.columns).find(([_, currColumn]) => currColumn === previousColumn) || @@ -943,13 +943,13 @@ function applyReferenceTransition({ indexPattern, visualizationGroups, }: { - layer: IndexPatternLayer; + layer: FormBasedLayer; columnId: string; previousColumn: GenericIndexPatternColumn; op: OperationType; indexPattern: IndexPattern; visualizationGroups: VisualizationDimensionGroupConfig[]; -}): IndexPatternLayer { +}): FormBasedLayer { const operationDefinition = operationDefinitionMap[op]; if (operationDefinition.input !== 'fullReference') { @@ -1167,13 +1167,13 @@ function copyCustomLabel( } function addBucket( - layer: IndexPatternLayer, + layer: FormBasedLayer, column: BaseIndexPatternColumn, addedColumnId: string, visualizationGroups: VisualizationDimensionGroupConfig[], targetGroup?: string, respectOrder?: boolean -): IndexPatternLayer { +): FormBasedLayer { const [buckets, metrics] = partition( layer.columnOrder, (colId) => layer.columns[colId].isBucketed @@ -1263,10 +1263,10 @@ export function reorderByGroups( } function addMetric( - layer: IndexPatternLayer, + layer: FormBasedLayer, column: BaseIndexPatternColumn, addedColumnId: string -): IndexPatternLayer { +): FormBasedLayer { const tempLayer = { ...resetIncomplete(layer, addedColumnId), columns: { @@ -1296,10 +1296,10 @@ export function updateColumnLabel({ columnId, customLabel, }: { - layer: IndexPatternLayer; + layer: FormBasedLayer; columnId: string; customLabel?: string; -}): IndexPatternLayer { +}): FormBasedLayer { const oldColumn = layer.columns[columnId]; return { ...layer, @@ -1320,11 +1320,11 @@ export function updateColumnParam({ paramName, value, }: { - layer: IndexPatternLayer; + layer: FormBasedLayer; columnId: string; paramName: string; value: unknown; -}): IndexPatternLayer { +}): FormBasedLayer { const currentColumn = layer.columns[columnId]; return { ...layer, @@ -1341,7 +1341,7 @@ export function updateColumnParam({ }; } -export function adjustColumnReferences(layer: IndexPatternLayer) { +export function adjustColumnReferences(layer: FormBasedLayer) { const newColumns = { ...layer.columns }; Object.keys(newColumns).forEach((currentColumnId) => { const currentColumn = newColumns[currentColumnId]; @@ -1362,7 +1362,7 @@ export function adjustColumnReferences(layer: IndexPatternLayer) { } export function adjustColumnReferencesForChangedColumn( - layer: IndexPatternLayer, + layer: FormBasedLayer, changedColumnId: string ) { const newColumns = { ...layer.columns }; @@ -1389,10 +1389,10 @@ export function deleteColumn({ columnId, indexPattern, }: { - layer: IndexPatternLayer; + layer: FormBasedLayer; columnId: string; indexPattern: IndexPattern; -}): IndexPatternLayer { +}): FormBasedLayer { const column = layer.columns[columnId]; if (!column) { const newIncomplete = { ...(layer.incompleteColumns || {}) }; @@ -1440,7 +1440,7 @@ export function deleteColumn({ // // This does NOT topologically sort references, as this would cause the order in the UI // to change. Reference order is determined before creating the pipeline in to_expression -export function getColumnOrder(layer: IndexPatternLayer): string[] { +export function getColumnOrder(layer: FormBasedLayer): string[] { const entries = Object.entries(layer.columns); entries.sort(([idA], [idB]) => { const indexA = layer.columnOrder.indexOf(idA); @@ -1460,7 +1460,7 @@ export function getColumnOrder(layer: IndexPatternLayer): string[] { } // Splits existing columnOrder into the three categories -export function getExistingColumnGroups(layer: IndexPatternLayer): [string[], string[], string[]] { +export function getExistingColumnGroups(layer: FormBasedLayer): [string[], string[], string[]] { const [direct, referenced] = partition( layer.columnOrder, (columnId) => layer.columns[columnId] && !('references' in layer.columns[columnId]) @@ -1474,7 +1474,7 @@ export function getExistingColumnGroups(layer: IndexPatternLayer): [string[], st export function isColumnTransferable( column: GenericIndexPatternColumn, newIndexPattern: IndexPattern, - layer: IndexPatternLayer + layer: FormBasedLayer ): boolean { return ( operationDefinitionMap[column.operationType].isTransferable( @@ -1490,13 +1490,13 @@ export function isColumnTransferable( } export function updateLayerIndexPattern( - layer: IndexPatternLayer, + layer: FormBasedLayer, newIndexPattern: IndexPattern -): IndexPatternLayer { - const keptColumns: IndexPatternLayer['columns'] = pickBy(layer.columns, (column) => { +): FormBasedLayer { + const keptColumns: FormBasedLayer['columns'] = pickBy(layer.columns, (column) => { return isColumnTransferable(column, newIndexPattern, layer); }); - const newColumns: IndexPatternLayer['columns'] = mapValues(keptColumns, (column) => { + const newColumns: FormBasedLayer['columns'] = mapValues(keptColumns, (column) => { const operationDefinition = operationDefinitionMap[column.operationType]; return operationDefinition.transfer ? operationDefinition.transfer(column, newIndexPattern) @@ -1522,9 +1522,9 @@ export function updateLayerIndexPattern( * - If timeshift is used, only a single date histogram can be used */ export function getErrorMessages( - layer: IndexPatternLayer, + layer: FormBasedLayer, indexPattern: IndexPattern, - state: IndexPatternPrivateState, + state: FormBasedPrivateState, layerId: string, core: CoreStart, data: DataPublicPluginStart @@ -1533,7 +1533,7 @@ export function getErrorMessages( | string | { message: string; - fixAction?: DatasourceFixAction; + fixAction?: DatasourceFixAction; } > | undefined { @@ -1581,21 +1581,21 @@ export function getErrorMessages( | string | { message: string; - fixAction?: DatasourceFixAction; + fixAction?: DatasourceFixAction; } >; return errors.length ? errors : undefined; } -export function isReferenced(layer: IndexPatternLayer, columnId: string): boolean { +export function isReferenced(layer: FormBasedLayer, columnId: string): boolean { const allReferences = Object.values(layer.columns).flatMap((col) => 'references' in col ? col.references : [] ); return allReferences.includes(columnId); } -const computeReferenceLookup = memoizeOne((layer: IndexPatternLayer): Record => { +const computeReferenceLookup = memoizeOne((layer: FormBasedLayer): Record => { // speed up things for deep chains as in formula const refLookup: Record = {}; for (const [parentId, col] of Object.entries(layer.columns)) { @@ -1615,7 +1615,7 @@ const computeReferenceLookup = memoizeOne((layer: IndexPatternLayer): Record { const column = layer.columns[columnId]; if (column) { @@ -1689,9 +1689,9 @@ export function isOperationAllowedAsReference({ // Labels need to be updated when columns are added because reference-based column labels // are sometimes copied into the parents export function updateDefaultLabels( - layer: IndexPatternLayer, + layer: FormBasedLayer, indexPattern: IndexPattern -): IndexPatternLayer { +): FormBasedLayer { const copiedColumns = { ...layer.columns }; layer.columnOrder.forEach((id) => { const col = copiedColumns[id]; @@ -1709,7 +1709,7 @@ export function updateDefaultLabels( return { ...layer, columns: copiedColumns }; } -export function resetIncomplete(layer: IndexPatternLayer, columnId: string): IndexPatternLayer { +export function resetIncomplete(layer: FormBasedLayer, columnId: string): FormBasedLayer { const incompleteColumns = { ...(layer.incompleteColumns ?? {}) }; delete incompleteColumns[columnId]; return { ...layer, incompleteColumns }; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/mocks.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/mocks.ts similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/mocks.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/mocks.ts diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/operations.test.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/operations.test.ts similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/operations.test.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/operations.test.ts diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/operations.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/operations.ts similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/operations.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/operations.ts diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/time_scale_utils.test.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/time_scale_utils.test.ts similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/time_scale_utils.test.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/time_scale_utils.test.ts diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/time_scale_utils.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/time_scale_utils.ts similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/operations/time_scale_utils.ts rename to x-pack/plugins/lens/public/form_based_datasource/operations/time_scale_utils.ts diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/pure_helpers.ts b/x-pack/plugins/lens/public/form_based_datasource/pure_helpers.ts similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/pure_helpers.ts rename to x-pack/plugins/lens/public/form_based_datasource/pure_helpers.ts diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/pure_utils.ts b/x-pack/plugins/lens/public/form_based_datasource/pure_utils.ts similarity index 95% rename from x-pack/plugins/lens/public/indexpattern_datasource/pure_utils.ts rename to x-pack/plugins/lens/public/form_based_datasource/pure_utils.ts index 39b4bcdf49229..f19965f969cb7 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/pure_utils.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/pure_utils.ts @@ -6,7 +6,7 @@ */ import type { DataType, IndexPattern, IndexPatternField } from '../types'; -import type { IndexPatternLayer } from './types'; +import type { FormBasedLayer } from './types'; import type { BaseIndexPatternColumn, FieldBasedIndexPatternColumn, @@ -36,7 +36,7 @@ export function getFieldType(field: IndexPatternField) { export function getReferencedField( column: GenericIndexPatternColumn | undefined, indexPattern: IndexPattern, - layer: IndexPatternLayer + layer: FormBasedLayer ) { if (!column) return; if (!('references' in column)) return; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/reduced_time_range_utils.tsx b/x-pack/plugins/lens/public/form_based_datasource/reduced_time_range_utils.tsx similarity index 97% rename from x-pack/plugins/lens/public/indexpattern_datasource/reduced_time_range_utils.tsx rename to x-pack/plugins/lens/public/form_based_datasource/reduced_time_range_utils.tsx index 04984a1c782bf..5669f0cf21938 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/reduced_time_range_utils.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/reduced_time_range_utils.tsx @@ -6,7 +6,7 @@ */ import { i18n } from '@kbn/i18n'; -import type { IndexPatternLayer } from './types'; +import type { FormBasedLayer } from './types'; import type { IndexPattern } from '../types'; export const reducedTimeRangeOptions = [ @@ -53,7 +53,7 @@ export const reducedTimeRangeOptionOrder = reducedTimeRangeOptions.reduce<{ ); export function getColumnReducedTimeRangeError( - layer: IndexPatternLayer, + layer: FormBasedLayer, columnId: string, indexPattern: IndexPattern ): string[] | undefined { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/state_helpers.ts b/x-pack/plugins/lens/public/form_based_datasource/state_helpers.ts similarity index 73% rename from x-pack/plugins/lens/public/indexpattern_datasource/state_helpers.ts rename to x-pack/plugins/lens/public/form_based_datasource/state_helpers.ts index 6e16ebe5e8d53..0120c29713a83 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/state_helpers.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/state_helpers.ts @@ -5,16 +5,16 @@ * 2.0. */ -import { IndexPatternPrivateState, IndexPatternLayer } from './types'; +import { FormBasedPrivateState, FormBasedLayer } from './types'; export function mergeLayer({ state, layerId, newLayer, }: { - state: IndexPatternPrivateState; + state: FormBasedPrivateState; layerId: string; - newLayer: Partial; + newLayer: Partial; }) { return { ...state, @@ -29,8 +29,8 @@ export function mergeLayers({ state, newLayers, }: { - state: IndexPatternPrivateState; - newLayers: Record; + state: FormBasedPrivateState; + newLayers: Record; }) { return { ...state, diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/time_shift_utils.test.tsx b/x-pack/plugins/lens/public/form_based_datasource/time_shift_utils.test.tsx similarity index 96% rename from x-pack/plugins/lens/public/indexpattern_datasource/time_shift_utils.test.tsx rename to x-pack/plugins/lens/public/form_based_datasource/time_shift_utils.test.tsx index 4cb251e3820be..a0ff29a684150 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/time_shift_utils.test.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/time_shift_utils.test.tsx @@ -6,11 +6,11 @@ */ import { getDisallowedPreviousShiftMessage } from './time_shift_utils'; -import { IndexPatternLayer } from './types'; +import { FormBasedLayer } from './types'; describe('time_shift_utils', () => { describe('getDisallowedPreviousShiftMessage', () => { - const layer: IndexPatternLayer = { + const layer: FormBasedLayer = { indexPatternId: '', columnOrder: [], columns: { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/time_shift_utils.tsx b/x-pack/plugins/lens/public/form_based_datasource/time_shift_utils.tsx similarity index 98% rename from x-pack/plugins/lens/public/indexpattern_datasource/time_shift_utils.tsx rename to x-pack/plugins/lens/public/form_based_datasource/time_shift_utils.tsx index 51f389e69a4f0..f4c4a30917535 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/time_shift_utils.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/time_shift_utils.tsx @@ -15,8 +15,8 @@ import { search } from '@kbn/data-plugin/public'; import { parseTimeShift } from '@kbn/data-plugin/common'; import type { GenericIndexPatternColumn, - IndexPatternLayer, - IndexPatternPrivateState, + FormBasedLayer, + FormBasedPrivateState, } from './types'; import type { FramePublicAPI, IndexPattern } from '../types'; @@ -105,7 +105,7 @@ export const timeShiftOptionOrder = timeShiftOptions.reduce<{ [key: string]: num export function getDateHistogramInterval( datatableUtilities: DatatableUtilitiesService, - layer: IndexPatternLayer, + layer: FormBasedLayer, indexPattern: IndexPattern, activeData: Record | undefined, layerId: string @@ -163,7 +163,7 @@ export function getLayerTimeShiftChecks({ } export function getDisallowedPreviousShiftMessage( - layer: IndexPatternLayer, + layer: FormBasedLayer, columnId: string ): string[] | undefined { const currentColumn = layer.columns[columnId]; @@ -191,7 +191,7 @@ export function getDisallowedPreviousShiftMessage( export function getStateTimeShiftWarningMessages( datatableUtilities: DatatableUtilitiesService, - state: IndexPatternPrivateState, + state: FormBasedPrivateState, { activeData, dataViews }: FramePublicAPI ) { if (!state) return; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/to_expression.ts b/x-pack/plugins/lens/public/form_based_datasource/to_expression.ts similarity index 98% rename from x-pack/plugins/lens/public/indexpattern_datasource/to_expression.ts rename to x-pack/plugins/lens/public/form_based_datasource/to_expression.ts index 72cb2a2ab729e..1a287275b1951 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/to_expression.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/to_expression.ts @@ -20,9 +20,9 @@ import { ExpressionAstExpressionBuilder, ExpressionAstFunction, } from '@kbn/expressions-plugin/public'; -import { GenericIndexPatternColumn } from './indexpattern'; +import { GenericIndexPatternColumn } from './form_based'; import { operationDefinitionMap } from './operations'; -import { IndexPatternPrivateState, IndexPatternLayer } from './types'; +import { FormBasedPrivateState, FormBasedLayer } from './types'; import { DateHistogramIndexPatternColumn, RangeIndexPatternColumn } from './operations/definitions'; import { FormattedIndexPatternColumn } from './operations/definitions/column_types'; import { isColumnFormatted, isColumnOfType } from './operations/definitions/helpers'; @@ -50,7 +50,7 @@ const updatePositionIndex = (currentId: string, newIndex: number) => { }; function getExpressionForLayer( - layer: IndexPatternLayer, + layer: FormBasedLayer, indexPattern: IndexPattern, uiSettings: IUiSettingsClient ): ExpressionAstExpression | null { @@ -438,7 +438,7 @@ function sortedReferences(columns: Array; // Each layer is tied to the index pattern that created it @@ -56,15 +56,15 @@ export interface IndexPatternLayer { incompleteColumns?: Record; } -export interface IndexPatternPersistedState { - layers: Record>; +export interface FormBasedPersistedState { + layers: Record>; } -export type PersistedIndexPatternLayer = Omit; +export type PersistedFormBasedLayer = Omit; -export interface IndexPatternPrivateState { +export interface FormBasedPrivateState { currentIndexPatternId: string; - layers: Record; + layers: Record; isDimensionClosePrevented?: boolean; } diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/utils.test.tsx b/x-pack/plugins/lens/public/form_based_datasource/utils.test.tsx similarity index 96% rename from x-pack/plugins/lens/public/indexpattern_datasource/utils.test.tsx rename to x-pack/plugins/lens/public/form_based_datasource/utils.test.tsx index 2d7a6334adaf6..7997170f2f4f3 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/utils.test.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/utils.test.tsx @@ -9,19 +9,19 @@ import React from 'react'; import { shallow } from 'enzyme'; import { createDatatableUtilitiesMock } from '@kbn/data-plugin/common/mocks'; import { getPrecisionErrorWarningMessages, cloneLayer } from './utils'; -import type { IndexPatternPrivateState, GenericIndexPatternColumn } from './types'; +import type { FormBasedPrivateState, GenericIndexPatternColumn } from './types'; import type { FramePublicAPI } from '../types'; import type { DocLinksStart } from '@kbn/core/public'; import { EuiButton } from '@elastic/eui'; import { TermsIndexPatternColumn } from './operations'; import { mountWithIntl } from '@kbn/test-jest-helpers'; import { FormattedMessage } from '@kbn/i18n-react'; -import { IndexPatternLayer } from './types'; +import { FormBasedLayer } from './types'; describe('indexpattern_datasource utils', () => { describe('getPrecisionErrorWarningMessages', () => { const datatableUtilitites = createDatatableUtilitiesMock(); - let state: IndexPatternPrivateState; + let state: FormBasedPrivateState; let framePublicAPI: FramePublicAPI; let docLinks: DocLinksStart; @@ -42,7 +42,7 @@ describe('indexpattern_datasource utils', () => { }, }, }, - } as unknown as IndexPatternPrivateState; + } as unknown as FormBasedPrivateState; framePublicAPI = { activeData: { id: { @@ -227,7 +227,7 @@ describe('indexpattern_datasource utils', () => { incompleteColumns: {}, indexPatternId: 'ff959d40-b880-11e8-a6d9-e546fe2bba5f', }, - } as unknown as Record, + } as unknown as Record, 'a', 'b', (id) => id + 'C' diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/utils.tsx b/x-pack/plugins/lens/public/form_based_datasource/utils.tsx similarity index 97% rename from x-pack/plugins/lens/public/indexpattern_datasource/utils.tsx rename to x-pack/plugins/lens/public/form_based_datasource/utils.tsx index 77a359729a5e0..bf6195912005b 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/utils.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/utils.tsx @@ -20,9 +20,9 @@ import { SearchResponseWarning } from '@kbn/data-plugin/public/search/types'; import type { FramePublicAPI, IndexPattern, StateSetter } from '../types'; import { renewIDs } from '../utils'; import type { - IndexPatternLayer, - IndexPatternPersistedState, - IndexPatternPrivateState, + FormBasedLayer, + FormBasedPersistedState, + FormBasedPrivateState, } from './types'; import type { ReferenceBasedIndexPatternColumn } from './operations/definitions/column_types'; @@ -48,7 +48,7 @@ import { getOriginalId } from '../../common/expressions'; import { isQueryValid } from '../shared_components'; export function isColumnInvalid( - layer: IndexPatternLayer, + layer: FormBasedLayer, columnId: string, indexPattern: IndexPattern ) { @@ -76,7 +76,7 @@ export function isColumnInvalid( } function getReferencesErrors( - layer: IndexPatternLayer, + layer: FormBasedLayer, column: ReferenceBasedIndexPatternColumn, indexPattern: IndexPattern ) { @@ -167,7 +167,7 @@ const accuracyModeEnabledWarning = (columnName: string, docLink: string) => ( ); export function getTSDBRollupWarningMessages( - state: IndexPatternPersistedState, + state: FormBasedPersistedState, warning: SearchResponseWarning ) { if (state) { @@ -208,10 +208,10 @@ export function getTSDBRollupWarningMessages( export function getPrecisionErrorWarningMessages( datatableUtilities: DatatableUtilitiesService, - state: IndexPatternPrivateState, + state: FormBasedPrivateState, { activeData, dataViews }: FramePublicAPI, docLinks: DocLinksStart, - setState: StateSetter + setState: StateSetter ) { const warningMessages: React.ReactNode[] = []; @@ -338,7 +338,7 @@ export function getPrecisionErrorWarningMessages( return warningMessages; } -export function getVisualDefaultsForLayer(layer: IndexPatternLayer) { +export function getVisualDefaultsForLayer(layer: FormBasedLayer) { return Object.keys(layer.columns).reduce>>( (memo, columnId) => { const column = layer.columns[columnId]; @@ -461,7 +461,7 @@ function shouldUseTermsFallback( * * if there's at least one unfiltered metric, then just return an empty list of filters * * otherwise get all the filters, with the only exception of those from formula (referenced columns will have it anyway) */ -function collectFiltersFromMetrics(layer: IndexPatternLayer, columnIds: string[]) { +function collectFiltersFromMetrics(layer: FormBasedLayer, columnIds: string[]) { // Isolate filtered metrics first // mind to ignore non-filterable columns and formula columns const metricColumns = Object.keys(layer.columns).filter((colId) => { @@ -506,7 +506,7 @@ function collectOnlyValidQueries( } export function getFiltersInLayer( - layer: IndexPatternLayer, + layer: FormBasedLayer, columnIds: string[], layerData: NonNullable[string] | undefined, indexPattern: IndexPattern, @@ -617,7 +617,7 @@ export function getFiltersInLayer( } export const cloneLayer = ( - layers: Record, + layers: Record, layerId: string, newLayerId: string, getNewId: (id: string) => string diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/visualize_geo_field_button.tsx b/x-pack/plugins/lens/public/form_based_datasource/visualize_geo_field_button.tsx similarity index 100% rename from x-pack/plugins/lens/public/indexpattern_datasource/visualize_geo_field_button.tsx rename to x-pack/plugins/lens/public/form_based_datasource/visualize_geo_field_button.tsx diff --git a/x-pack/plugins/lens/public/index.ts b/x-pack/plugins/lens/public/index.ts index 776d8731d7eae..bd106f6eed359 100644 --- a/x-pack/plugins/lens/public/index.ts +++ b/x-pack/plugins/lens/public/index.ts @@ -43,8 +43,8 @@ export type { DatatableVisualizationState } from './visualizations/datatable/vis export type { HeatmapVisualizationState } from './visualizations/heatmap/types'; export type { GaugeVisualizationState } from './visualizations/gauge/constants'; export type { - IndexPatternPersistedState, - PersistedIndexPatternLayer, + FormBasedPersistedState, + PersistedFormBasedLayer, OperationType, IncompleteColumn, GenericIndexPatternColumn, @@ -74,8 +74,8 @@ export type { FormulaPublicApi, StaticValueIndexPatternColumn, TimeScaleIndexPatternColumn, - IndexPatternLayer, -} from './indexpattern_datasource/types'; + FormBasedLayer, +} from './form_based_datasource/types'; export type { XYArgs, XYRender, diff --git a/x-pack/plugins/lens/public/plugin.ts b/x-pack/plugins/lens/public/plugin.ts index 8ed4d9abbaeeb..3ae774c159422 100644 --- a/x-pack/plugins/lens/public/plugin.ts +++ b/x-pack/plugins/lens/public/plugin.ts @@ -52,11 +52,11 @@ import { AdvancedUiActionsSetup } from '@kbn/ui-actions-enhanced-plugin/public'; import type { DocLinksStart } from '@kbn/core-doc-links-browser'; import type { EditorFrameService as EditorFrameServiceType } from './editor_frame_service'; import type { - IndexPatternDatasource as IndexPatternDatasourceType, - IndexPatternDatasourceSetupPlugins, + FormBasedDatasource as FormBasedDatasourceType, + FormBasedDatasourceSetupPlugins, FormulaPublicApi, -} from './indexpattern_datasource'; -import type { TextBasedLanguagesDatasource as TextBasedLanguagesDatasourceType } from './text_based_datasource'; +} from './form_based_datasource'; +import type { TextBasedDatasource as TextBasedDatasourceType } from './text_based_datasource'; import type { XyVisualization as XyVisualizationType, @@ -231,8 +231,8 @@ export class LensPlugin { private editorFrameService: EditorFrameServiceType | undefined; private editorFrameSetup: EditorFrameSetup | undefined; private queuedVisualizations: Array Promise)> = []; - private indexpatternDatasource: IndexPatternDatasourceType | undefined; - private textBasedLanguagesDatasource: TextBasedLanguagesDatasourceType | undefined; + private FormBasedDatasource: FormBasedDatasourceType | undefined; + private TextBasedDatasource: TextBasedDatasourceType | undefined; private xyVisualization: XyVisualizationType | undefined; private legacyMetricVisualization: LegacyMetricVisualizationType | undefined; private metricVisualization: MetricVisualizationType | undefined; @@ -422,19 +422,19 @@ export class LensPlugin { const { DatatableVisualization, EditorFrameService, - IndexPatternDatasource, + FormBasedDatasource, XyVisualization, LegacyMetricVisualization, MetricVisualization, PieVisualization, HeatmapVisualization, GaugeVisualization, - TextBasedLanguagesDatasource, + TextBasedDatasource, } = await import('./async_services'); this.datatableVisualization = new DatatableVisualization(); this.editorFrameService = new EditorFrameService(); - this.indexpatternDatasource = new IndexPatternDatasource(); - this.textBasedLanguagesDatasource = new TextBasedLanguagesDatasource(); + this.FormBasedDatasource = new FormBasedDatasource(); + this.TextBasedDatasource = new TextBasedDatasource(); this.xyVisualization = new XyVisualization(); this.legacyMetricVisualization = new LegacyMetricVisualization(); this.metricVisualization = new MetricVisualization(); @@ -444,7 +444,7 @@ export class LensPlugin { const editorFrameSetupInterface = this.editorFrameService.setup(); - const dependencies: IndexPatternDatasourceSetupPlugins & + const dependencies: FormBasedDatasourceSetupPlugins & XyVisualizationPluginSetupPlugins & DatatableVisualizationPluginSetupPlugins & LegacyMetricVisualizationPluginSetupPlugins & @@ -457,8 +457,8 @@ export class LensPlugin { formatFactory, eventAnnotation, }; - this.indexpatternDatasource.setup(core, dependencies); - this.textBasedLanguagesDatasource.setup(core, dependencies); + this.FormBasedDatasource.setup(core, dependencies); + this.TextBasedDatasource.setup(core, dependencies); this.xyVisualization.setup(core, dependencies); this.datatableVisualization.setup(core, dependencies); this.legacyMetricVisualization.setup(core, dependencies); diff --git a/x-pack/plugins/lens/public/shared_components/field_picker/lens_field_icon.tsx b/x-pack/plugins/lens/public/shared_components/field_picker/lens_field_icon.tsx index fabb8cab6fd0e..024c8290e79c4 100644 --- a/x-pack/plugins/lens/public/shared_components/field_picker/lens_field_icon.tsx +++ b/x-pack/plugins/lens/public/shared_components/field_picker/lens_field_icon.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { FieldIcon, FieldIconProps } from '@kbn/react-field'; import { DataType } from '../../types'; -import { normalizeOperationDataType } from '../../indexpattern_datasource/pure_utils'; +import { normalizeOperationDataType } from '../../form_based_datasource/pure_utils'; export function LensFieldIcon({ type, ...rest }: FieldIconProps & { type: DataType }) { return ( diff --git a/x-pack/plugins/lens/public/text_based_datasource/datapanel.test.tsx b/x-pack/plugins/lens/public/text_based_datasource/datapanel.test.tsx index 51ba02c1cdc6f..5f6c1b2702349 100644 --- a/x-pack/plugins/lens/public/text_based_datasource/datapanel.test.tsx +++ b/x-pack/plugins/lens/public/text_based_datasource/datapanel.test.tsx @@ -19,10 +19,10 @@ import { import type { DatatableColumn } from '@kbn/expressions-plugin/public'; import { FieldButton } from '@kbn/react-field'; -import { type TextBasedLanguagesDataPanelProps, TextBasedLanguagesDataPanel } from './datapanel'; +import { type TextBasedDataPanelProps, TextBasedDataPanel } from './datapanel'; import { coreMock } from '@kbn/core/public/mocks'; -import type { TextBasedLanguagesPrivateState } from './types'; +import type { TextBasedPrivateState } from './types'; import { mountWithIntl } from '@kbn/test-jest-helpers'; import { uiActionsPluginMock } from '@kbn/ui-actions-plugin/public/mocks'; @@ -113,7 +113,7 @@ function getExistingFields(indexPatterns: Record) { return existingFields; } -const initialState: TextBasedLanguagesPrivateState = { +const initialState: TextBasedPrivateState = { layers: { first: { index: '1', @@ -163,7 +163,7 @@ describe('TextBased Query Languages Data Panel', () => { let core: ReturnType; let dataViews: DataViewPublicStart; - let defaultProps: TextBasedLanguagesDataPanelProps; + let defaultProps: TextBasedDataPanelProps; const dataViewsMock = dataViewPluginMocks.createStartContract(); beforeEach(() => { core = coreMock.createStart(); @@ -202,12 +202,12 @@ describe('TextBased Query Languages Data Panel', () => { }); it('should render a search box', async () => { - const wrapper = mountWithIntl(); + const wrapper = mountWithIntl(); expect(wrapper.find('[data-test-subj="lnsTextBasedLangugesFieldSearch"]').length).toEqual(1); }); it('should list all supported fields in the pattern', async () => { - const wrapper = mountWithIntl(); + const wrapper = mountWithIntl(); expect( wrapper .find('[data-test-subj="lnsTextBasedLanguagesPanelFields"]') @@ -217,7 +217,7 @@ describe('TextBased Query Languages Data Panel', () => { }); it('should list all supported fields in the pattern that match the search input', async () => { - const wrapper = mountWithIntl(); + const wrapper = mountWithIntl(); const searchBox = wrapper.find('[data-test-subj="lnsTextBasedLangugesFieldSearch"]'); act(() => { diff --git a/x-pack/plugins/lens/public/text_based_datasource/datapanel.tsx b/x-pack/plugins/lens/public/text_based_datasource/datapanel.tsx index 9e15db381549d..d5736bc40f006 100644 --- a/x-pack/plugins/lens/public/text_based_datasource/datapanel.tsx +++ b/x-pack/plugins/lens/public/text_based_datasource/datapanel.tsx @@ -18,22 +18,21 @@ import { ExpressionsStart } from '@kbn/expressions-plugin/public'; import { FieldButton } from '@kbn/react-field'; import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; import { DatasourceDataPanelProps, DataType } from '../types'; -import type { TextBasedLanguagesPrivateState } from './types'; +import type { TextBasedPrivateState } from './types'; import { getStateFromAggregateQuery } from './utils'; import { DragDrop } from '../drag_drop'; import { LensFieldIcon } from '../shared_components'; import { ChildDragDropProvider } from '../drag_drop'; -export type TextBasedLanguagesDataPanelProps = - DatasourceDataPanelProps & { - data: DataPublicPluginStart; - expressions: ExpressionsStart; - dataViews: DataViewsPublicPluginStart; - }; +export type TextBasedDataPanelProps = DatasourceDataPanelProps & { + data: DataPublicPluginStart; + expressions: ExpressionsStart; + dataViews: DataViewsPublicPluginStart; +}; const htmlId = htmlIdGenerator('datapanel-text-based-languages'); const fieldSearchDescriptionId = htmlId(); -export function TextBasedLanguagesDataPanel({ +export function TextBasedDataPanel({ setState, state, dragDropContext, @@ -44,7 +43,7 @@ export function TextBasedLanguagesDataPanel({ dateRange, expressions, dataViews, -}: TextBasedLanguagesDataPanelProps) { +}: TextBasedDataPanelProps) { const prevQuery = usePrevious(query); const [localState, setLocalState] = useState({ nameFilter: '' }); const clearLocalState = () => setLocalState((s) => ({ ...s, nameFilter: '' })); diff --git a/x-pack/plugins/lens/public/text_based_datasource/field_select.tsx b/x-pack/plugins/lens/public/text_based_datasource/field_select.tsx index 63153bc87d59e..893f3d337a6e5 100644 --- a/x-pack/plugins/lens/public/text_based_datasource/field_select.tsx +++ b/x-pack/plugins/lens/public/text_based_datasource/field_select.tsx @@ -10,11 +10,11 @@ import { EuiComboBoxOptionOption, EuiComboBoxProps } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import type { DatatableColumn } from '@kbn/expressions-plugin/public'; import { FieldPicker, FieldOptionValue, FieldOption } from '../shared_components/field_picker'; -import type { TextBasedLanguagesLayerColumn } from './types'; +import type { TextBasedLayerColumn } from './types'; import type { DataType } from '../types'; export interface FieldSelectProps extends EuiComboBoxProps { - selectedField?: TextBasedLanguagesLayerColumn; + selectedField?: TextBasedLayerColumn; onChoose: (choice: FieldOptionValue) => void; existingFields: DatatableColumn[]; } diff --git a/x-pack/plugins/lens/public/text_based_datasource/index.ts b/x-pack/plugins/lens/public/text_based_datasource/index.ts index b2cffc5659dbf..4fc1eb821a596 100644 --- a/x-pack/plugins/lens/public/text_based_datasource/index.ts +++ b/x-pack/plugins/lens/public/text_based_datasource/index.ts @@ -12,29 +12,26 @@ import { DataPublicPluginSetup, DataPublicPluginStart } from '@kbn/data-plugin/p import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; import { EditorFrameSetup } from '../types'; -export interface TextBasedLanguageSetupPlugins { +export interface TextBasedSetupPlugins { data: DataPublicPluginSetup; editorFrame: EditorFrameSetup; } -export interface TextBasedLanguageStartPlugins { +export interface TextBasedStartPlugins { data: DataPublicPluginStart; dataViews: DataViewsPublicPluginStart; expressions: ExpressionsStart; } -export class TextBasedLanguagesDatasource { +export class TextBasedDatasource { constructor() {} - setup( - core: CoreSetup, - { editorFrame }: TextBasedLanguageSetupPlugins - ) { + setup(core: CoreSetup, { editorFrame }: TextBasedSetupPlugins) { editorFrame.registerDatasource(async () => { - const { getTextBasedLanguagesDatasource } = await import('../async_services'); + const { getTextBasedDatasource } = await import('../async_services'); const [coreStart, { data, dataViews, expressions }] = await core.getStartServices(); - return getTextBasedLanguagesDatasource({ + return getTextBasedDatasource({ core: coreStart, storage: new Storage(localStorage), data, diff --git a/x-pack/plugins/lens/public/text_based_datasource/layerpanel.test.tsx b/x-pack/plugins/lens/public/text_based_datasource/layerpanel.test.tsx index 7a3bf25b5e9e6..de53f8122137d 100644 --- a/x-pack/plugins/lens/public/text_based_datasource/layerpanel.test.tsx +++ b/x-pack/plugins/lens/public/text_based_datasource/layerpanel.test.tsx @@ -7,10 +7,10 @@ import React from 'react'; import type { DatatableColumn } from '@kbn/expressions-plugin/public'; -import { TextBasedLanguagesPrivateState } from './types'; +import { TextBasedPrivateState } from './types'; import type { DataViewsState } from '../state_management/types'; -import { TextBasedLanguageLayerPanelProps, LayerPanel } from './layerpanel'; +import { TextBasedLayerPanelProps, LayerPanel } from './layerpanel'; import { shallowWithIntl as shallow } from '@kbn/test-jest-helpers'; import { ChangeIndexPattern } from '../shared_components/dataview_picker/dataview_picker'; @@ -38,7 +38,7 @@ const fields = [ }, ] as DatatableColumn[]; -const initialState: TextBasedLanguagesPrivateState = { +const initialState: TextBasedPrivateState = { layers: { first: { index: '1', @@ -55,7 +55,7 @@ const initialState: TextBasedLanguagesPrivateState = { fieldList: fields, }; describe('Layer Data Panel', () => { - let defaultProps: TextBasedLanguageLayerPanelProps; + let defaultProps: TextBasedLayerPanelProps; beforeEach(() => { defaultProps = { diff --git a/x-pack/plugins/lens/public/text_based_datasource/layerpanel.tsx b/x-pack/plugins/lens/public/text_based_datasource/layerpanel.tsx index 8f8e4a91242b1..a01adb7ff9730 100644 --- a/x-pack/plugins/lens/public/text_based_datasource/layerpanel.tsx +++ b/x-pack/plugins/lens/public/text_based_datasource/layerpanel.tsx @@ -9,15 +9,14 @@ import React from 'react'; import { I18nProvider } from '@kbn/i18n-react'; import { i18n } from '@kbn/i18n'; import { DatasourceLayerPanelProps } from '../types'; -import { TextBasedLanguagesPrivateState } from './types'; +import { TextBasedPrivateState } from './types'; import { ChangeIndexPattern } from '../shared_components/dataview_picker/dataview_picker'; -export interface TextBasedLanguageLayerPanelProps - extends DatasourceLayerPanelProps { - state: TextBasedLanguagesPrivateState; +export interface TextBasedLayerPanelProps extends DatasourceLayerPanelProps { + state: TextBasedPrivateState; } -export function LayerPanel({ state, layerId, dataViews }: TextBasedLanguageLayerPanelProps) { +export function LayerPanel({ state, layerId, dataViews }: TextBasedLayerPanelProps) { const layer = state.layers[layerId]; const dataView = dataViews.indexPatternRefs.find((ref) => ref.id === layer.index); const notFoundTitleLabel = i18n.translate('xpack.lens.layerPanel.missingDataView', { diff --git a/x-pack/plugins/lens/public/text_based_datasource/text_based_languages.test.ts b/x-pack/plugins/lens/public/text_based_datasource/text_based_languages.test.ts index 92a3ef01fdb7d..93bc195a4968b 100644 --- a/x-pack/plugins/lens/public/text_based_datasource/text_based_languages.test.ts +++ b/x-pack/plugins/lens/public/text_based_datasource/text_based_languages.test.ts @@ -8,10 +8,10 @@ import { coreMock } from '@kbn/core/public/mocks'; import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; import { expressionsPluginMock } from '@kbn/expressions-plugin/public/mocks'; -import { TextBasedLanguagesPersistedState, TextBasedLanguagesPrivateState } from './types'; +import { TextBasedPersistedState, TextBasedPrivateState } from './types'; import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; -import { getTextBasedLanguagesDatasource } from './text_based_languages'; +import { getTextBasedDatasource } from './text_based_languages'; import { generateId } from '../id_generator'; import { DatasourcePublicAPI, Datasource } from '../types'; @@ -78,14 +78,14 @@ const expectedIndexPatterns = { const indexPatterns = expectedIndexPatterns; describe('IndexPattern Data Source', () => { - let baseState: TextBasedLanguagesPrivateState; - let textBasedLanguagesDatasource: Datasource< - TextBasedLanguagesPrivateState, - TextBasedLanguagesPersistedState + let baseState: TextBasedPrivateState; + let TextBasedDatasource: Datasource< + TextBasedPrivateState, + TextBasedPersistedState >; beforeEach(() => { - textBasedLanguagesDatasource = getTextBasedLanguagesDatasource({ + TextBasedDatasource = getTextBasedDatasource({ storage: {} as IStorageWrapper, core: coreMock.createStart(), data: dataPluginMock.createStartContract(), @@ -118,12 +118,12 @@ describe('IndexPattern Data Source', () => { query: { sql: 'SELECT * FROM foo' }, }, }, - } as unknown as TextBasedLanguagesPrivateState; + } as unknown as TextBasedPrivateState; }); describe('uniqueLabels', () => { it('appends a suffix to duplicates', () => { - const map = textBasedLanguagesDatasource.uniqueLabels({ + const map = TextBasedDatasource.uniqueLabels({ layers: { a: { columns: [ @@ -145,7 +145,7 @@ describe('IndexPattern Data Source', () => { index: 'foo', }, }, - } as unknown as TextBasedLanguagesPrivateState); + } as unknown as TextBasedPrivateState); expect(map).toMatchInlineSnapshot(` Object { @@ -158,7 +158,7 @@ describe('IndexPattern Data Source', () => { describe('#getPersistedState', () => { it('should persist from saved state', async () => { - expect(textBasedLanguagesDatasource.getPersistableState(baseState)).toEqual({ + expect(TextBasedDatasource.getPersistableState(baseState)).toEqual({ state: baseState, savedObjectReferences: [ { name: 'textBasedLanguages-datasource-layer-a', type: 'index-pattern', id: 'foo' }, @@ -169,7 +169,7 @@ describe('IndexPattern Data Source', () => { describe('#insertLayer', () => { it('should insert an empty layer into the previous state', () => { - expect(textBasedLanguagesDatasource.insertLayer(baseState, 'newLayer')).toEqual({ + expect(TextBasedDatasource.insertLayer(baseState, 'newLayer')).toEqual({ ...baseState, layers: { ...baseState.layers, @@ -194,7 +194,7 @@ describe('IndexPattern Data Source', () => { describe('#removeLayer', () => { it('should remove a layer', () => { - expect(textBasedLanguagesDatasource.removeLayer(baseState, 'a')).toEqual({ + expect(TextBasedDatasource.removeLayer(baseState, 'a')).toEqual({ ...baseState, layers: { a: { @@ -218,7 +218,7 @@ describe('IndexPattern Data Source', () => { describe('#createEmptyLayer', () => { it('creates state with empty layers', () => { - expect(textBasedLanguagesDatasource.createEmptyLayer('index-pattern-id')).toEqual({ + expect(TextBasedDatasource.createEmptyLayer('index-pattern-id')).toEqual({ fieldList: [], layers: {}, indexPatternRefs: [], @@ -229,7 +229,7 @@ describe('IndexPattern Data Source', () => { describe('#getLayers', () => { it('should list the current layers', () => { expect( - textBasedLanguagesDatasource.getLayers({ + TextBasedDatasource.getLayers({ layers: { a: { columns: [ @@ -268,7 +268,7 @@ describe('IndexPattern Data Source', () => { index: 'foo', }, }, - } as unknown as TextBasedLanguagesPrivateState) + } as unknown as TextBasedPrivateState) ).toEqual(['a']); }); }); @@ -287,8 +287,8 @@ describe('IndexPattern Data Source', () => { name: 'Foo', }, }, - } as unknown as TextBasedLanguagesPrivateState; - const suggestions = textBasedLanguagesDatasource.getDatasourceSuggestionsForVisualizeField( + } as unknown as TextBasedPrivateState; + const suggestions = TextBasedDatasource.getDatasourceSuggestionsForVisualizeField( state, '1', '', @@ -406,8 +406,8 @@ describe('IndexPattern Data Source', () => { index: 'foo', }, }, - } as unknown as TextBasedLanguagesPrivateState; - expect(textBasedLanguagesDatasource.getErrorMessages(state, indexPatterns)).toEqual([ + } as unknown as TextBasedPrivateState; + expect(TextBasedDatasource.getErrorMessages(state, indexPatterns)).toEqual([ { longMessage: 'error 1', shortMessage: 'error 1' }, { longMessage: 'error 2', shortMessage: 'error 2' }, ]); @@ -455,9 +455,9 @@ describe('IndexPattern Data Source', () => { index: '1', }, }, - } as unknown as TextBasedLanguagesPrivateState; + } as unknown as TextBasedPrivateState; expect( - textBasedLanguagesDatasource.isTimeBased(state, { + TextBasedDatasource.isTimeBased(state, { ...indexPatterns, }) ).toEqual(true); @@ -502,9 +502,9 @@ describe('IndexPattern Data Source', () => { index: '1', }, }, - } as unknown as TextBasedLanguagesPrivateState; + } as unknown as TextBasedPrivateState; expect( - textBasedLanguagesDatasource.isTimeBased(state, { + TextBasedDatasource.isTimeBased(state, { ...indexPatterns, '1': { ...indexPatterns['1'], timeFieldName: undefined }, }) @@ -514,8 +514,8 @@ describe('IndexPattern Data Source', () => { describe('#toExpression', () => { it('should generate an empty expression when no columns are selected', async () => { - const state = textBasedLanguagesDatasource.initialize(); - expect(textBasedLanguagesDatasource.toExpression(state, 'first', indexPatterns)).toEqual( + const state = TextBasedDatasource.initialize(); + expect(TextBasedDatasource.toExpression(state, 'first', indexPatterns)).toEqual( null ); }); @@ -565,9 +565,9 @@ describe('IndexPattern Data Source', () => { { id: '2', title: 'my-fake-restricted-pattern' }, { id: '3', title: 'my-compatible-pattern' }, ], - } as unknown as TextBasedLanguagesPrivateState; + } as unknown as TextBasedPrivateState; - expect(textBasedLanguagesDatasource.toExpression(queryBaseState, 'a', indexPatterns)) + expect(TextBasedDatasource.toExpression(queryBaseState, 'a', indexPatterns)) .toMatchInlineSnapshot(` Object { "chain": Array [ @@ -610,7 +610,7 @@ describe('IndexPattern Data Source', () => { let publicAPI: DatasourcePublicAPI; beforeEach(async () => { - publicAPI = textBasedLanguagesDatasource.getPublicAPI({ + publicAPI = TextBasedDatasource.getPublicAPI({ state: baseState, layerId: 'a', indexPatterns, @@ -649,9 +649,9 @@ describe('IndexPattern Data Source', () => { index: 'foo', }, }, - } as unknown as TextBasedLanguagesPrivateState; + } as unknown as TextBasedPrivateState; - publicAPI = textBasedLanguagesDatasource.getPublicAPI({ + publicAPI = TextBasedDatasource.getPublicAPI({ state, layerId: 'a', indexPatterns, diff --git a/x-pack/plugins/lens/public/text_based_datasource/text_based_languages.tsx b/x-pack/plugins/lens/public/text_based_datasource/text_based_languages.tsx index 09a1051ce84c8..dde2fc152674c 100644 --- a/x-pack/plugins/lens/public/text_based_datasource/text_based_languages.tsx +++ b/x-pack/plugins/lens/public/text_based_datasource/text_based_languages.tsx @@ -28,12 +28,12 @@ import { } from '../types'; import { generateId } from '../id_generator'; import { toExpression } from './to_expression'; -import { TextBasedLanguagesDataPanel } from './datapanel'; +import { TextBasedDataPanel } from './datapanel'; import type { - TextBasedLanguagesPrivateState, - TextBasedLanguagesPersistedState, - TextBasedLanguagesLayerColumn, - TextBasedLanguageField, + TextBasedPrivateState, + TextBasedPersistedState, + TextBasedLayerColumn, + TextBasedField, } from './types'; import { FieldSelect } from './field_select'; import type { Datasource, IndexPatternMap } from '../types'; @@ -43,7 +43,7 @@ function getLayerReferenceName(layerId: string) { return `textBasedLanguages-datasource-layer-${layerId}`; } -export function getTextBasedLanguagesDatasource({ +export function getTextBasedDatasource({ core, storage, data, @@ -56,7 +56,7 @@ export function getTextBasedLanguagesDatasource({ expressions: ExpressionsStart; dataViews: DataViewsPublicPluginStart; }) { - const getSuggestionsForState = (state: TextBasedLanguagesPrivateState) => { + const getSuggestionsForState = (state: TextBasedPrivateState) => { return Object.entries(state.layers)?.map(([id, layer]) => { return { state: { @@ -83,7 +83,7 @@ export function getTextBasedLanguagesDatasource({ }); }; const getSuggestionsForVisualizeField = ( - state: TextBasedLanguagesPrivateState, + state: TextBasedPrivateState, indexPatternId: string, fieldName: string, indexPatterns: IndexPatternMap @@ -153,10 +153,7 @@ export function getTextBasedLanguagesDatasource({ return []; }; - const TextBasedLanguagesDatasource: Datasource< - TextBasedLanguagesPrivateState, - TextBasedLanguagesPersistedState - > = { + const TextBasedDatasource: Datasource = { id: 'textBased', checkIntegrity: () => { @@ -188,7 +185,7 @@ export function getTextBasedLanguagesDatasource({ return errors; }, initialize( - state?: TextBasedLanguagesPersistedState, + state?: TextBasedPersistedState, savedObjectReferences?, context?, indexPatternRefs?, @@ -217,7 +214,7 @@ export function getTextBasedLanguagesDatasource({ return Object.values(state.layers).map(({ index }) => index); }, - getPersistableState({ layers }: TextBasedLanguagesPrivateState) { + getPersistableState({ layers }: TextBasedPrivateState) { const savedObjectReferences: SavedObjectReference[] = []; Object.entries(layers).forEach(([layerId, { index, ...persistableLayer }]) => { if (index) { @@ -237,7 +234,7 @@ export function getTextBasedLanguagesDatasource({ if (!column || !indexPattern) return false; return true; }, - insertLayer(state: TextBasedLanguagesPrivateState, newLayerId: string) { + insertLayer(state: TextBasedPrivateState, newLayerId: string) { const layer = Object.values(state?.layers)?.[0]; const query = layer?.query; const columns = layer?.allColumns ?? []; @@ -267,7 +264,7 @@ export function getTextBasedLanguagesDatasource({ }; }, - removeLayer(state: TextBasedLanguagesPrivateState, layerId: string) { + removeLayer(state: TextBasedPrivateState, layerId: string) { const newLayers = { ...state.layers, [layerId]: { @@ -283,7 +280,7 @@ export function getTextBasedLanguagesDatasource({ }; }, - clearLayer(state: TextBasedLanguagesPrivateState, layerId: string) { + clearLayer(state: TextBasedPrivateState, layerId: string) { return { ...state, layers: { @@ -293,7 +290,7 @@ export function getTextBasedLanguagesDatasource({ }; }, - getLayers(state: TextBasedLanguagesPrivateState) { + getLayers(state: TextBasedPrivateState) { return state && state.layers ? Object.keys(state?.layers) : []; }, isTimeBased: (state, indexPatterns) => { @@ -306,7 +303,7 @@ export function getTextBasedLanguagesDatasource({ }) ); }, - getUsedDataView: (state: TextBasedLanguagesPrivateState, layerId?: string) => { + getUsedDataView: (state: TextBasedPrivateState, layerId?: string) => { if (!layerId) { const layers = Object.values(state.layers); return layers?.[0]?.index; @@ -331,13 +328,10 @@ export function getTextBasedLanguagesDatasource({ return toExpression(state, layerId); }, - renderDataPanel( - domElement: Element, - props: DatasourceDataPanelProps - ) { + renderDataPanel(domElement: Element, props: DatasourceDataPanelProps) { render( - + props: DatasourceDimensionTriggerProps ) => { - const columnLabelMap = TextBasedLanguagesDatasource.uniqueLabels(props.state); + const columnLabelMap = TextBasedDatasource.uniqueLabels(props.state); const layer = props.state.layers[props.layerId]; const selectedField = layer?.allColumns?.find((column) => column.columnId === props.columnId); let customLabel: string | undefined = columnLabelMap[props.columnId]; @@ -377,13 +371,13 @@ export function getTextBasedLanguagesDatasource({ ); }, - getRenderEventCounters(state: TextBasedLanguagesPrivateState): string[] { + getRenderEventCounters(state: TextBasedPrivateState): string[] { return []; }, renderDimensionEditor: ( domElement: Element, - props: DatasourceDimensionEditorProps + props: DatasourceDimensionEditorProps ) => { const fields = props.state.fieldList; const selectedField = props.state.layers[props.layerId]?.allColumns?.find( @@ -450,7 +444,7 @@ export function getTextBasedLanguagesDatasource({ renderLayerPanel: ( domElement: Element, - props: DatasourceLayerPanelProps + props: DatasourceLayerPanelProps ) => { render( @@ -460,7 +454,7 @@ export function getTextBasedLanguagesDatasource({ ); }, - uniqueLabels(state: TextBasedLanguagesPrivateState) { + uniqueLabels(state: TextBasedPrivateState) { const layers = state.layers; const columnLabelMap = {} as Record; const counts = {} as Record; @@ -536,7 +530,7 @@ export function getTextBasedLanguagesDatasource({ return false; }, - getPublicAPI({ state, layerId }: PublicAPIProps) { + getPublicAPI({ state, layerId }: PublicAPIProps) { return { datasourceId: 'textBased', @@ -551,7 +545,7 @@ export function getTextBasedLanguagesDatasource({ getOperationForColumnId: (columnId: string) => { const layer = state.layers[layerId]; const column = layer?.allColumns?.find((c) => c.columnId === columnId); - const columnLabelMap = TextBasedLanguagesDatasource.uniqueLabels(state); + const columnLabelMap = TextBasedDatasource.uniqueLabels(state); if (column) { return { @@ -587,9 +581,7 @@ export function getTextBasedLanguagesDatasource({ }; }, getDatasourceSuggestionsForField(state, draggedField) { - const field = state.fieldList.find( - (f) => f.id === (draggedField as TextBasedLanguageField).id - ); + const field = state.fieldList.find((f) => f.id === (draggedField as TextBasedField).id); if (!field) return []; return Object.entries(state.layers)?.map(([id, layer]) => { const newId = generateId(); @@ -646,14 +638,10 @@ export function getTextBasedLanguagesDatasource({ isEqual: () => true, }; - return TextBasedLanguagesDatasource; + return TextBasedDatasource; } -function blankLayer( - index: string, - query?: AggregateQuery, - columns?: TextBasedLanguagesLayerColumn[] -) { +function blankLayer(index: string, query?: AggregateQuery, columns?: TextBasedLayerColumn[]) { return { index, query, diff --git a/x-pack/plugins/lens/public/text_based_datasource/to_expression.ts b/x-pack/plugins/lens/public/text_based_datasource/to_expression.ts index aa7a264673a3e..aa3b2f51637f9 100644 --- a/x-pack/plugins/lens/public/text_based_datasource/to_expression.ts +++ b/x-pack/plugins/lens/public/text_based_datasource/to_expression.ts @@ -8,10 +8,10 @@ import { Ast } from '@kbn/interpreter'; import { textBasedQueryStateToExpressionAst } from '@kbn/data-plugin/common'; import type { OriginalColumn } from '../../common/types'; -import { TextBasedLanguagesPrivateState, TextBasedLanguagesLayer, IndexPatternRef } from './types'; +import { TextBasedPrivateState, TextBasedLayer, IndexPatternRef } from './types'; function getExpressionForLayer( - layer: TextBasedLanguagesLayer, + layer: TextBasedLayer, refs: IndexPatternRef[] ): Ast | null { if (!layer.columns || layer.columns?.length === 0) { @@ -53,7 +53,7 @@ function getExpressionForLayer( return textBasedQueryToAst; } -export function toExpression(state: TextBasedLanguagesPrivateState, layerId: string) { +export function toExpression(state: TextBasedPrivateState, layerId: string) { if (state.layers[layerId]) { return getExpressionForLayer(state.layers[layerId], state.indexPatternRefs); } diff --git a/x-pack/plugins/lens/public/text_based_datasource/types.ts b/x-pack/plugins/lens/public/text_based_datasource/types.ts index 11b9612624efd..17fad0d8ffde0 100644 --- a/x-pack/plugins/lens/public/text_based_datasource/types.ts +++ b/x-pack/plugins/lens/public/text_based_datasource/types.ts @@ -9,31 +9,31 @@ import type { AggregateQuery } from '@kbn/es-query'; import type { VisualizeFieldContext } from '@kbn/ui-actions-plugin/public'; import type { VisualizeEditorContext } from '../types'; -export interface TextBasedLanguagesLayerColumn { +export interface TextBasedLayerColumn { columnId: string; fieldName: string; meta?: DatatableColumn['meta']; } -export interface TextBasedLanguageField { +export interface TextBasedField { id: string; field: string; } -export interface TextBasedLanguagesLayer { +export interface TextBasedLayer { index: string; query: AggregateQuery | undefined; - columns: TextBasedLanguagesLayerColumn[]; - allColumns: TextBasedLanguagesLayerColumn[]; + columns: TextBasedLayerColumn[]; + allColumns: TextBasedLayerColumn[]; timeField?: string; errors?: Error[]; } -export interface TextBasedLanguagesPersistedState { - layers: Record; +export interface TextBasedPersistedState { + layers: Record; } -export type TextBasedLanguagesPrivateState = TextBasedLanguagesPersistedState & { +export type TextBasedPrivateState = TextBasedPersistedState & { indexPatternRefs: IndexPatternRef[]; fieldList: DatatableColumn[]; initialContext?: VisualizeFieldContext | VisualizeEditorContext; diff --git a/x-pack/plugins/lens/public/text_based_datasource/utils.ts b/x-pack/plugins/lens/public/text_based_datasource/utils.ts index c4e41103f0fd1..c91b10831e4e5 100644 --- a/x-pack/plugins/lens/public/text_based_datasource/utils.ts +++ b/x-pack/plugins/lens/public/text_based_datasource/utils.ts @@ -15,8 +15,8 @@ import { fetchDataFromAggregateQuery } from './fetch_data_from_aggregate_query'; import type { IndexPatternRef, - TextBasedLanguagesPrivateState, - TextBasedLanguagesLayerColumn, + TextBasedPrivateState, + TextBasedLayerColumn, } from './types'; export async function loadIndexPatternRefs( @@ -36,7 +36,7 @@ export async function loadIndexPatternRefs( } export async function getStateFromAggregateQuery( - state: TextBasedLanguagesPrivateState, + state: TextBasedPrivateState, query: AggregateQuery, dataViews: DataViewsPublicPluginStart, data: DataPublicPluginStart, @@ -52,7 +52,7 @@ export async function getStateFromAggregateQuery( // get the id of the dataview const index = indexPatternRefs.find((r) => r.title === indexPattern)?.id ?? ''; let columnsFromQuery: DatatableColumn[] = []; - let allColumns: TextBasedLanguagesLayerColumn[] = []; + let allColumns: TextBasedLayerColumn[] = []; let timeFieldName; try { const table = await fetchDataFromAggregateQuery(query, dataViews, data, expressions); diff --git a/x-pack/plugins/lens/public/types.ts b/x-pack/plugins/lens/public/types.ts index 29aff3d428690..9251f5e8d7a54 100644 --- a/x-pack/plugins/lens/public/types.ts +++ b/x-pack/plugins/lens/public/types.ts @@ -47,7 +47,7 @@ import { LENS_EDIT_PAGESIZE_ACTION, } from './visualizations/datatable/components/constants'; import type { LensInspector } from './lens_inspector_service'; -import type { FormatSelectorOptions } from './indexpattern_datasource/dimension_panel/format_selector'; +import type { FormatSelectorOptions } from './form_based_datasource/dimension_panel/format_selector'; import type { DataViewsState } from './state_management/types'; import type { IndexPatternServiceAPI } from './data_views_service/service'; import type { Document } from './persistence/saved_object_store'; diff --git a/x-pack/plugins/lens/public/visualizations/datatable/visualization.tsx b/x-pack/plugins/lens/public/visualizations/datatable/visualization.tsx index ca6f6775f8934..20e62a28cc897 100644 --- a/x-pack/plugins/lens/public/visualizations/datatable/visualization.tsx +++ b/x-pack/plugins/lens/public/visualizations/datatable/visualization.tsx @@ -28,7 +28,7 @@ import { LayerType, layerTypes } from '../../../common'; import { getDefaultSummaryLabel, PagingState } from '../../../common/expressions'; import type { ColumnState, SortingState } from '../../../common/expressions'; import { DataTableToolbar } from './components/toolbar'; -import { IndexPatternLayer } from '../../indexpattern_datasource/types'; +import { FormBasedLayer } from '../../form_based_datasource/types'; export interface DatatableVisualizationState { columns: ColumnState[]; @@ -44,7 +44,7 @@ export interface DatatableVisualizationState { interface DatatableDatasourceState { [prop: string]: unknown; - layers: IndexPatternLayer[]; + layers: FormBasedLayer[]; } export interface DatatableSuggestion extends Suggestion { diff --git a/x-pack/plugins/lens/public/visualizations/metric/visualization.tsx b/x-pack/plugins/lens/public/visualizations/metric/visualization.tsx index 81f7f08fe3223..955d6167899b7 100644 --- a/x-pack/plugins/lens/public/visualizations/metric/visualization.tsx +++ b/x-pack/plugins/lens/public/visualizations/metric/visualization.tsx @@ -31,8 +31,8 @@ import { GROUP_ID, LENS_METRIC_ID } from './constants'; import { DimensionEditor } from './dimension_editor'; import { Toolbar } from './toolbar'; import { generateId } from '../../id_generator'; -import { FormatSelectorOptions } from '../../indexpattern_datasource/dimension_panel/format_selector'; -import { IndexPatternLayer } from '../../indexpattern_datasource/types'; +import { FormatSelectorOptions } from '../../form_based_datasource/dimension_panel/format_selector'; +import { FormBasedLayer } from '../../form_based_datasource/types'; export const DEFAULT_MAX_COLUMNS = 3; @@ -59,7 +59,7 @@ export interface MetricVisualizationState { interface MetricDatasourceState { [prop: string]: unknown; - layers: IndexPatternLayer[]; + layers: FormBasedLayer[]; } export interface MetricSuggestion extends Suggestion { diff --git a/x-pack/plugins/lens/public/visualizations/partition/visualization.tsx b/x-pack/plugins/lens/public/visualizations/partition/visualization.tsx index 2a8bdc2dd4ab0..9e697ea33e5d4 100644 --- a/x-pack/plugins/lens/public/visualizations/partition/visualization.tsx +++ b/x-pack/plugins/lens/public/visualizations/partition/visualization.tsx @@ -30,11 +30,11 @@ import { PartitionChartsMeta } from './partition_charts_meta'; import { DimensionEditor, PieToolbar } from './toolbar'; import { checkTableForContainsSmallValues } from './render_helpers'; import { PieChartTypes, PieLayerState, PieVisualizationState } from '../../../common'; -import { IndexPatternLayer } from '../..'; +import { FormBasedLayer } from '../..'; interface DatatableDatasourceState { [prop: string]: unknown; - layers: IndexPatternLayer[]; + layers: FormBasedLayer[]; } export interface PartitionSuggestion extends Suggestion { diff --git a/x-pack/plugins/lens/public/visualizations/xy/visualization.test.ts b/x-pack/plugins/lens/public/visualizations/xy/visualization.test.ts index e76633b349924..38247ef6d801e 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/visualization.test.ts +++ b/x-pack/plugins/lens/public/visualizations/xy/visualization.test.ts @@ -28,7 +28,7 @@ import { EventAnnotationConfig } from '@kbn/event-annotation-plugin/common'; import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; import { DataViewsState } from '../../state_management'; -import { createMockedIndexPattern } from '../../indexpattern_datasource/mocks'; +import { createMockedIndexPattern } from '../../form_based_datasource/mocks'; import { createMockDataViewsState } from '../../data_views_service/mocks'; import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks'; diff --git a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/index.test.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/index.test.tsx index c852759a97aa8..6577891fce6eb 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/index.test.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/index.test.tsx @@ -18,7 +18,7 @@ import { chartPluginMock } from '@kbn/charts-plugin/public/mocks'; import moment from 'moment'; import { EventAnnotationConfig } from '@kbn/event-annotation-plugin/common'; import { createMockDataViewsState } from '../../../../data_views_service/mocks'; -import { createMockedIndexPattern } from '../../../../indexpattern_datasource/mocks'; +import { createMockedIndexPattern } from '../../../../form_based_datasource/mocks'; import { act } from 'react-dom/test-utils'; import { EuiButtonGroup } from '@elastic/eui'; From 773e86dcec698df520f67c64ce81d5b13dccea60 Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Tue, 4 Oct 2022 10:04:37 +0300 Subject: [PATCH 03/18] Fix css --- .../plugins/lens/public/text_based_datasource/datapanel.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/lens/public/text_based_datasource/datapanel.tsx b/x-pack/plugins/lens/public/text_based_datasource/datapanel.tsx index d5736bc40f006..3c5492775d1f1 100644 --- a/x-pack/plugins/lens/public/text_based_datasource/datapanel.tsx +++ b/x-pack/plugins/lens/public/text_based_datasource/datapanel.tsx @@ -86,7 +86,7 @@ export function TextBasedDataPanel({ @@ -107,7 +107,7 @@ export function TextBasedDataPanel({ }} >
      {filteredFields.length > 0 && From 8b4be72ab73b745803005488317ade5202fe4091 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Tue, 4 Oct 2022 07:36:46 +0000 Subject: [PATCH 04/18] [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' --- .../lens/public/form_based_datasource/layerpanel.tsx | 3 +-- .../operations/definitions/calculations/utils.ts | 6 +----- .../operations/definitions/index.ts | 4 +--- .../form_based_datasource/operations/layer_helpers.ts | 6 +----- .../public/form_based_datasource/time_shift_utils.tsx | 6 +----- .../plugins/lens/public/form_based_datasource/utils.tsx | 6 +----- .../text_based_datasource/text_based_languages.test.ts | 9 ++------- .../lens/public/text_based_datasource/to_expression.ts | 5 +---- .../plugins/lens/public/text_based_datasource/utils.ts | 6 +----- 9 files changed, 10 insertions(+), 41 deletions(-) diff --git a/x-pack/plugins/lens/public/form_based_datasource/layerpanel.tsx b/x-pack/plugins/lens/public/form_based_datasource/layerpanel.tsx index 54787d092ccb8..f2b63ea586f71 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/layerpanel.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/layerpanel.tsx @@ -12,8 +12,7 @@ import { DatasourceLayerPanelProps } from '../types'; import { FormBasedPrivateState } from './types'; import { ChangeIndexPattern } from '../shared_components/dataview_picker/dataview_picker'; -export interface FormBasedLayerPanelProps - extends DatasourceLayerPanelProps { +export interface FormBasedLayerPanelProps extends DatasourceLayerPanelProps { state: FormBasedPrivateState; onChangeIndexPattern: (newId: string) => void; } diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/utils.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/utils.ts index fec97e0597a25..091361a39f91a 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/utils.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/utils.ts @@ -127,11 +127,7 @@ export function checkReferences(layer: FormBasedLayer, columnId: string) { return errors.length ? errors : undefined; } -export function getErrorsForDateReference( - layer: FormBasedLayer, - columnId: string, - name: string -) { +export function getErrorsForDateReference(layer: FormBasedLayer, columnId: string, name: string) { const dateErrors = checkForDateHistogram(layer, name) ?? []; const referenceErrors = checkReferences(layer, columnId) ?? []; if (dateErrors.length || referenceErrors.length) { diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/index.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/index.ts index 9671807df9622..3185eb0380601 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/index.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/index.ts @@ -207,9 +207,7 @@ export interface FieldInputProps { selectedColumn?: C; columnId: string; indexPattern: IndexPattern; - updateLayer: ( - setter: FormBasedLayer | ((prevLayer: FormBasedLayer) => FormBasedLayer) - ) => void; + updateLayer: (setter: FormBasedLayer | ((prevLayer: FormBasedLayer) => FormBasedLayer)) => void; onDeleteColumn?: () => void; currentFieldIsInvalid: boolean; incompleteField: IncompleteColumn['sourceField'] | null; diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/layer_helpers.ts b/x-pack/plugins/lens/public/form_based_datasource/operations/layer_helpers.ts index ade932cf24c7b..cfcfb156f9f0d 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/layer_helpers.ts +++ b/x-pack/plugins/lens/public/form_based_datasource/operations/layer_helpers.ts @@ -27,11 +27,7 @@ import { GenericOperationDefinition, TermsIndexPatternColumn, } from './definitions'; -import type { - DataViewDragDropOperation, - FormBasedLayer, - FormBasedPrivateState, -} from '../types'; +import type { DataViewDragDropOperation, FormBasedLayer, FormBasedPrivateState } from '../types'; import { getSortScoreByPriorityForField } from './operations'; import { generateId } from '../../id_generator'; import { diff --git a/x-pack/plugins/lens/public/form_based_datasource/time_shift_utils.tsx b/x-pack/plugins/lens/public/form_based_datasource/time_shift_utils.tsx index f4c4a30917535..a3d5a6218fcc0 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/time_shift_utils.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/time_shift_utils.tsx @@ -13,11 +13,7 @@ import type { DatatableUtilitiesService } from '@kbn/data-plugin/common'; import { Datatable } from '@kbn/expressions-plugin/common'; import { search } from '@kbn/data-plugin/public'; import { parseTimeShift } from '@kbn/data-plugin/common'; -import type { - GenericIndexPatternColumn, - FormBasedLayer, - FormBasedPrivateState, -} from './types'; +import type { GenericIndexPatternColumn, FormBasedLayer, FormBasedPrivateState } from './types'; import type { FramePublicAPI, IndexPattern } from '../types'; export const timeShiftOptions = [ diff --git a/x-pack/plugins/lens/public/form_based_datasource/utils.tsx b/x-pack/plugins/lens/public/form_based_datasource/utils.tsx index bf6195912005b..8b76d9820562f 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/utils.tsx +++ b/x-pack/plugins/lens/public/form_based_datasource/utils.tsx @@ -19,11 +19,7 @@ import type { Query } from '@kbn/data-plugin/common'; import { SearchResponseWarning } from '@kbn/data-plugin/public/search/types'; import type { FramePublicAPI, IndexPattern, StateSetter } from '../types'; import { renewIDs } from '../utils'; -import type { - FormBasedLayer, - FormBasedPersistedState, - FormBasedPrivateState, -} from './types'; +import type { FormBasedLayer, FormBasedPersistedState, FormBasedPrivateState } from './types'; import type { ReferenceBasedIndexPatternColumn } from './operations/definitions/column_types'; import { diff --git a/x-pack/plugins/lens/public/text_based_datasource/text_based_languages.test.ts b/x-pack/plugins/lens/public/text_based_datasource/text_based_languages.test.ts index 93bc195a4968b..e7b6d7b8aec3d 100644 --- a/x-pack/plugins/lens/public/text_based_datasource/text_based_languages.test.ts +++ b/x-pack/plugins/lens/public/text_based_datasource/text_based_languages.test.ts @@ -79,10 +79,7 @@ const indexPatterns = expectedIndexPatterns; describe('IndexPattern Data Source', () => { let baseState: TextBasedPrivateState; - let TextBasedDatasource: Datasource< - TextBasedPrivateState, - TextBasedPersistedState - >; + let TextBasedDatasource: Datasource; beforeEach(() => { TextBasedDatasource = getTextBasedDatasource({ @@ -515,9 +512,7 @@ describe('IndexPattern Data Source', () => { describe('#toExpression', () => { it('should generate an empty expression when no columns are selected', async () => { const state = TextBasedDatasource.initialize(); - expect(TextBasedDatasource.toExpression(state, 'first', indexPatterns)).toEqual( - null - ); + expect(TextBasedDatasource.toExpression(state, 'first', indexPatterns)).toEqual(null); }); it('should generate an expression for an SQL query', async () => { diff --git a/x-pack/plugins/lens/public/text_based_datasource/to_expression.ts b/x-pack/plugins/lens/public/text_based_datasource/to_expression.ts index aa3b2f51637f9..ba3bc28732678 100644 --- a/x-pack/plugins/lens/public/text_based_datasource/to_expression.ts +++ b/x-pack/plugins/lens/public/text_based_datasource/to_expression.ts @@ -10,10 +10,7 @@ import { textBasedQueryStateToExpressionAst } from '@kbn/data-plugin/common'; import type { OriginalColumn } from '../../common/types'; import { TextBasedPrivateState, TextBasedLayer, IndexPatternRef } from './types'; -function getExpressionForLayer( - layer: TextBasedLayer, - refs: IndexPatternRef[] -): Ast | null { +function getExpressionForLayer(layer: TextBasedLayer, refs: IndexPatternRef[]): Ast | null { if (!layer.columns || layer.columns?.length === 0) { return null; } diff --git a/x-pack/plugins/lens/public/text_based_datasource/utils.ts b/x-pack/plugins/lens/public/text_based_datasource/utils.ts index c91b10831e4e5..ab15a97406746 100644 --- a/x-pack/plugins/lens/public/text_based_datasource/utils.ts +++ b/x-pack/plugins/lens/public/text_based_datasource/utils.ts @@ -13,11 +13,7 @@ import type { DatatableColumn } from '@kbn/expressions-plugin/public'; import { generateId } from '../id_generator'; import { fetchDataFromAggregateQuery } from './fetch_data_from_aggregate_query'; -import type { - IndexPatternRef, - TextBasedPrivateState, - TextBasedLayerColumn, -} from './types'; +import type { IndexPatternRef, TextBasedPrivateState, TextBasedLayerColumn } from './types'; export async function loadIndexPatternRefs( indexPatternsService: DataViewsPublicPluginStart From 5a9853f9278f7acaccd7ac5b7fe9322a0d3eb81f Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Tue, 4 Oct 2022 10:47:19 +0300 Subject: [PATCH 05/18] Move datasources under a common foler --- x-pack/plugins/lens/public/async_services.ts | 10 +++++----- .../public/data_views_service/loader.test.ts | 2 +- .../lens/public/data_views_service/loader.ts | 2 +- .../lens/public/data_views_service/mocks.ts | 4 ++-- .../form_based}/__mocks__/loader.ts | 0 .../__snapshots__/utils.test.tsx.snap | 0 .../form_based}/datapanel.scss | 0 .../form_based}/datapanel.test.tsx | 14 +++++++------- .../form_based}/datapanel.tsx | 12 ++++++------ .../form_based}/dedupe_aggs.test.ts | 0 .../form_based}/dedupe_aggs.ts | 0 .../dimension_panel/advanced_options.tsx | 0 .../bucket_nesting_editor.test.tsx | 2 +- .../dimension_panel/bucket_nesting_editor.tsx | 2 +- .../dimension_panel/dimension_editor.scss | 0 .../dimension_panel/dimension_editor.tsx | 8 ++++---- .../dimension_panel/dimension_panel.test.tsx | 8 ++++---- .../dimension_panel/dimension_panel.tsx | 6 +++--- .../dimensions_editor_helpers.tsx | 0 .../droppable/get_drop_props.test.ts | 4 ++-- .../dimension_panel/droppable/get_drop_props.ts | 8 ++++---- .../dimension_panel/droppable/index.ts | 0 .../dimension_panel/droppable/mocks.ts | 4 ++-- .../droppable/on_drop_handler.test.ts | 10 +++++++--- .../dimension_panel/droppable/on_drop_handler.ts | 4 ++-- .../dimension_panel/field_input.test.tsx | 0 .../form_based}/dimension_panel/field_input.tsx | 0 .../dimension_panel/field_select.scss | 0 .../form_based}/dimension_panel/field_select.tsx | 10 +++++++--- .../form_based}/dimension_panel/filtering.tsx | 4 ++-- .../dimension_panel/format_selector.test.tsx | 2 +- .../dimension_panel/format_selector.tsx | 2 +- .../form_based}/dimension_panel/index.ts | 0 .../dimension_panel/operation_support.ts | 2 +- .../dimension_panel/reduced_time_range.tsx | 2 +- .../dimension_panel/reference_editor.test.tsx | 2 +- .../dimension_panel/reference_editor.tsx | 4 ++-- .../form_based}/dimension_panel/time_scaling.tsx | 4 ++-- .../form_based}/dimension_panel/time_shift.tsx | 2 +- .../form_based}/document_field.ts | 4 ++-- .../form_based}/field_item.scss | 2 +- .../form_based}/field_item.test.tsx | 6 +++--- .../form_based}/field_item.tsx | 16 ++++++++-------- .../form_based}/field_list.scss | 0 .../form_based}/field_list.tsx | 2 +- .../form_based}/fields_accordion.test.tsx | 2 +- .../form_based}/fields_accordion.tsx | 2 +- .../form_based}/form_based.test.ts | 6 +++--- .../form_based}/form_based.tsx | 16 ++++++++-------- .../form_based}/form_based_suggestions.test.tsx | 6 +++--- .../form_based}/form_based_suggestions.ts | 4 ++-- .../form_based}/help_popover.scss | 0 .../form_based}/help_popover.tsx | 0 .../form_based}/index.ts | 6 +++--- .../form_based}/layerpanel.test.tsx | 2 +- .../form_based}/layerpanel.tsx | 7 +++---- .../form_based}/loader.test.ts | 2 +- .../form_based}/loader.ts | 6 +++--- .../form_based}/mocks.ts | 4 ++-- .../form_based}/no_fields_callout.test.tsx | 0 .../form_based}/no_fields_callout.tsx | 0 .../form_based}/operations/__mocks__/index.ts | 0 .../form_based}/operations/definitions.test.ts | 2 +- .../definitions/calculations/counter_rate.tsx | 0 .../definitions/calculations/cumulative_sum.tsx | 2 +- .../definitions/calculations/differences.tsx | 0 .../operations/definitions/calculations/index.ts | 0 .../definitions/calculations/moving_average.tsx | 2 +- .../calculations/overall_metric.test.ts | 0 .../definitions/calculations/overall_metric.tsx | 0 .../definitions/calculations/time_scale.tsx | 0 .../definitions/calculations/utils.test.ts | 2 +- .../operations/definitions/calculations/utils.ts | 12 ++++-------- .../operations/definitions/cardinality.test.ts | 0 .../operations/definitions/cardinality.tsx | 0 .../operations/definitions/column_types.ts | 4 ++-- .../operations/definitions/count.test.ts | 0 .../form_based}/operations/definitions/count.tsx | 4 ++-- .../definitions/date_histogram.test.tsx | 2 +- .../operations/definitions/date_histogram.tsx | 2 +- .../definitions/filters/filter_popover.scss | 0 .../definitions/filters/filter_popover.test.tsx | 2 +- .../definitions/filters/filter_popover.tsx | 4 ++-- .../operations/definitions/filters/filters.scss | 0 .../definitions/filters/filters.test.tsx | 0 .../operations/definitions/filters/filters.tsx | 4 ++-- .../operations/definitions/filters/index.tsx | 0 .../definitions/formula/editor/formula.scss | 0 .../formula/editor/formula_editor.tsx | 2 +- .../definitions/formula/editor/formula_help.tsx | 2 +- .../definitions/formula/editor/index.ts | 0 .../formula/editor/math_completion.test.ts | 2 +- .../formula/editor/math_completion.ts | 2 +- .../formula/editor/math_tokenization.tsx | 0 .../definitions/formula/formula.test.tsx | 2 +- .../operations/definitions/formula/formula.tsx | 2 +- .../formula/formula_public_api.test.ts | 8 ++++---- .../definitions/formula/formula_public_api.ts | 10 +++++----- .../operations/definitions/formula/generate.ts | 2 +- .../operations/definitions/formula/index.ts | 0 .../operations/definitions/formula/math.test.ts | 2 +- .../operations/definitions/formula/math.tsx | 2 +- .../definitions/formula/math_examples.md | 0 .../operations/definitions/formula/parse.ts | 2 +- .../operations/definitions/formula/types.ts | 0 .../operations/definitions/formula/util.ts | 0 .../operations/definitions/formula/validation.ts | 2 +- .../operations/definitions/get_group_by_key.ts | 0 .../operations/definitions/helpers.test.ts | 0 .../operations/definitions/helpers.tsx | 2 +- .../form_based}/operations/definitions/index.ts | 8 +++----- .../operations/definitions/last_value.test.tsx | 2 +- .../operations/definitions/last_value.tsx | 4 ++-- .../operations/definitions/metrics.test.ts | 0 .../operations/definitions/metrics.tsx | 0 .../operations/definitions/percentile.test.tsx | 2 +- .../operations/definitions/percentile.tsx | 2 +- .../definitions/percentile_ranks.test.tsx | 2 +- .../operations/definitions/percentile_ranks.tsx | 2 +- .../definitions/ranges/advanced_editor.scss | 0 .../definitions/ranges/advanced_editor.tsx | 2 +- .../operations/definitions/ranges/constants.ts | 0 .../operations/definitions/ranges/index.ts | 0 .../definitions/ranges/range_editor.tsx | 2 +- .../definitions/ranges/ranges.test.tsx | 4 ++-- .../operations/definitions/ranges/ranges.tsx | 4 ++-- .../definitions/shared_components/form_row.scss | 0 .../definitions/shared_components/form_row.tsx | 0 .../definitions/shared_components/index.tsx | 0 .../shared_components/label_input.tsx | 2 +- .../operations/definitions/static_value.test.tsx | 2 +- .../operations/definitions/static_value.tsx | 4 ++-- .../operations/definitions/terms/constants.ts | 0 .../definitions/terms/field_inputs.tsx | 4 ++-- .../operations/definitions/terms/helpers.test.ts | 2 +- .../operations/definitions/terms/helpers.ts | 2 +- .../terms/include_exclude_options.test.tsx | 0 .../terms/include_exclude_options.tsx | 2 +- .../operations/definitions/terms/index.tsx | 6 +++--- .../operations/definitions/terms/terms.test.tsx | 4 ++-- .../operations/definitions/terms/types.ts | 0 .../definitions/terms/values_input.test.tsx | 0 .../definitions/terms/values_input.tsx | 2 +- .../form_based}/operations/index.ts | 0 .../form_based}/operations/layer_helpers.test.ts | 8 ++++---- .../form_based}/operations/layer_helpers.ts | 14 +++++--------- .../form_based}/operations/mocks.ts | 2 +- .../form_based}/operations/operations.test.ts | 0 .../form_based}/operations/operations.ts | 2 +- .../operations/time_scale_utils.test.ts | 2 +- .../form_based}/operations/time_scale_utils.ts | 4 ++-- .../form_based}/pure_helpers.ts | 2 +- .../form_based}/pure_utils.ts | 2 +- .../form_based}/reduced_time_range_utils.tsx | 2 +- .../form_based}/state_helpers.ts | 0 .../form_based}/time_shift_utils.test.tsx | 0 .../form_based}/time_shift_utils.tsx | 8 ++------ .../form_based}/to_expression.ts | 2 +- .../form_based}/types.ts | 7 +++---- .../form_based}/utils.test.tsx | 2 +- .../form_based}/utils.tsx | 14 +++++--------- .../form_based}/visualize_geo_field_button.tsx | 4 ++-- .../text_based}/datapanel.test.tsx | 8 ++++---- .../text_based}/datapanel.tsx | 8 ++++---- .../fetch_data_from_aggregate_query.ts | 0 .../text_based}/field_select.test.tsx | 2 +- .../text_based}/field_select.tsx | 4 ++-- .../text_based}/index.ts | 4 ++-- .../text_based}/layerpanel.test.tsx | 4 ++-- .../text_based}/layerpanel.tsx | 4 ++-- .../text_based}/mocks.ts | 2 +- .../text_based}/text_based_languages.test.ts | 15 +++++---------- .../text_based}/text_based_languages.tsx | 6 +++--- .../text_based}/to_expression.ts | 7 ++----- .../text_based}/types.ts | 2 +- .../text_based}/utils.test.ts | 2 +- .../text_based}/utils.ts | 8 ++------ .../public/embeddable/embeddable_component.tsx | 2 +- x-pack/plugins/lens/public/index.ts | 4 ++-- x-pack/plugins/lens/public/plugin.ts | 4 ++-- .../field_picker/lens_field_icon.tsx | 2 +- x-pack/plugins/lens/public/types.ts | 2 +- .../visualizations/datatable/visualization.tsx | 2 +- .../visualizations/metric/visualization.tsx | 4 ++-- .../visualizations/xy/visualization.test.ts | 2 +- .../annotations_config_panel/index.test.tsx | 2 +- 186 files changed, 263 insertions(+), 287 deletions(-) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/__mocks__/loader.ts (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/__snapshots__/utils.test.tsx.snap (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/datapanel.scss (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/datapanel.test.tsx (98%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/datapanel.tsx (98%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dedupe_aggs.test.ts (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dedupe_aggs.ts (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dimension_panel/advanced_options.tsx (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dimension_panel/bucket_nesting_editor.test.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dimension_panel/bucket_nesting_editor.tsx (98%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dimension_panel/dimension_editor.scss (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dimension_panel/dimension_editor.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dimension_panel/dimension_panel.test.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dimension_panel/dimension_panel.tsx (95%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dimension_panel/dimensions_editor_helpers.tsx (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dimension_panel/droppable/get_drop_props.test.ts (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dimension_panel/droppable/get_drop_props.ts (97%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dimension_panel/droppable/index.ts (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dimension_panel/droppable/mocks.ts (98%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dimension_panel/droppable/on_drop_handler.test.ts (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dimension_panel/droppable/on_drop_handler.ts (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dimension_panel/field_input.test.tsx (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dimension_panel/field_input.tsx (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dimension_panel/field_select.scss (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dimension_panel/field_select.tsx (96%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dimension_panel/filtering.tsx (93%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dimension_panel/format_selector.test.tsx (98%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dimension_panel/format_selector.tsx (98%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dimension_panel/index.ts (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dimension_panel/operation_support.ts (98%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dimension_panel/reduced_time_range.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dimension_panel/reference_editor.test.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dimension_panel/reference_editor.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dimension_panel/time_scaling.tsx (95%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/dimension_panel/time_shift.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/document_field.ts (85%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/field_item.scss (97%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/field_item.test.tsx (98%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/field_item.tsx (96%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/field_list.scss (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/field_list.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/fields_accordion.test.tsx (98%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/fields_accordion.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/form_based.test.ts (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/form_based.tsx (98%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/form_based_suggestions.test.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/form_based_suggestions.ts (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/help_popover.scss (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/help_popover.tsx (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/index.ts (94%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/layerpanel.test.tsx (98%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/layerpanel.tsx (85%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/loader.test.ts (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/loader.ts (97%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/mocks.ts (97%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/no_fields_callout.test.tsx (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/no_fields_callout.tsx (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/__mocks__/index.ts (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions.test.ts (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/calculations/counter_rate.tsx (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/calculations/cumulative_sum.tsx (98%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/calculations/differences.tsx (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/calculations/index.ts (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/calculations/moving_average.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/calculations/overall_metric.test.ts (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/calculations/overall_metric.tsx (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/calculations/time_scale.tsx (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/calculations/utils.test.ts (97%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/calculations/utils.ts (95%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/cardinality.test.ts (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/cardinality.tsx (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/column_types.ts (91%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/count.test.ts (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/count.tsx (98%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/date_histogram.test.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/date_histogram.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/filters/filter_popover.scss (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/filters/filter_popover.test.tsx (98%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/filters/filter_popover.tsx (94%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/filters/filters.scss (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/filters/filters.test.tsx (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/filters/filters.tsx (98%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/filters/index.tsx (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/formula/editor/formula.scss (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/formula/editor/formula_editor.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/formula/editor/formula_help.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/formula/editor/index.ts (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/formula/editor/math_completion.test.ts (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/formula/editor/math_completion.ts (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/formula/editor/math_tokenization.tsx (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/formula/formula.test.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/formula/formula.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/formula/formula_public_api.test.ts (91%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/formula/formula_public_api.ts (90%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/formula/generate.ts (98%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/formula/index.ts (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/formula/math.test.ts (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/formula/math.tsx (98%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/formula/math_examples.md (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/formula/parse.ts (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/formula/types.ts (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/formula/util.ts (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/formula/validation.ts (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/get_group_by_key.ts (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/helpers.test.ts (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/helpers.tsx (98%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/index.ts (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/last_value.test.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/last_value.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/metrics.test.ts (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/metrics.tsx (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/percentile.test.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/percentile.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/percentile_ranks.test.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/percentile_ranks.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/ranges/advanced_editor.scss (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/ranges/advanced_editor.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/ranges/constants.ts (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/ranges/index.ts (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/ranges/range_editor.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/ranges/ranges.test.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/ranges/ranges.tsx (98%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/shared_components/form_row.scss (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/shared_components/form_row.tsx (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/shared_components/index.tsx (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/shared_components/label_input.tsx (96%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/static_value.test.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/static_value.tsx (98%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/terms/constants.ts (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/terms/field_inputs.tsx (98%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/terms/helpers.test.ts (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/terms/helpers.ts (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/terms/include_exclude_options.test.tsx (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/terms/include_exclude_options.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/terms/index.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/terms/terms.test.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/terms/types.ts (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/terms/values_input.test.tsx (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/definitions/terms/values_input.tsx (97%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/index.ts (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/layer_helpers.test.ts (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/layer_helpers.ts (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/mocks.ts (97%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/operations.test.ts (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/operations.ts (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/time_scale_utils.test.ts (98%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/operations/time_scale_utils.ts (92%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/pure_helpers.ts (92%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/pure_utils.ts (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/reduced_time_range_utils.tsx (98%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/state_helpers.ts (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/time_shift_utils.test.tsx (100%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/time_shift_utils.tsx (98%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/to_expression.ts (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/types.ts (89%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/utils.test.tsx (99%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/utils.tsx (98%) rename x-pack/plugins/lens/public/{form_based_datasource => datasources/form_based}/visualize_geo_field_button.tsx (95%) rename x-pack/plugins/lens/public/{text_based_datasource => datasources/text_based}/datapanel.test.tsx (96%) rename x-pack/plugins/lens/public/{text_based_datasource => datasources/text_based}/datapanel.tsx (96%) rename x-pack/plugins/lens/public/{text_based_datasource => datasources/text_based}/fetch_data_from_aggregate_query.ts (100%) rename x-pack/plugins/lens/public/{text_based_datasource => datasources/text_based}/field_select.test.tsx (96%) rename x-pack/plugins/lens/public/{text_based_datasource => datasources/text_based}/field_select.tsx (94%) rename x-pack/plugins/lens/public/{text_based_datasource => datasources/text_based}/index.ts (91%) rename x-pack/plugins/lens/public/{text_based_datasource => datasources/text_based}/layerpanel.test.tsx (93%) rename x-pack/plugins/lens/public/{text_based_datasource => datasources/text_based}/layerpanel.tsx (90%) rename x-pack/plugins/lens/public/{text_based_datasource => datasources/text_based}/mocks.ts (92%) rename x-pack/plugins/lens/public/{text_based_datasource => datasources/text_based}/text_based_languages.test.ts (98%) rename x-pack/plugins/lens/public/{text_based_datasource => datasources/text_based}/text_based_languages.tsx (99%) rename x-pack/plugins/lens/public/{text_based_datasource => datasources/text_based}/to_expression.ts (91%) rename x-pack/plugins/lens/public/{text_based_datasource => datasources/text_based}/types.ts (95%) rename x-pack/plugins/lens/public/{text_based_datasource => datasources/text_based}/utils.test.ts (98%) rename x-pack/plugins/lens/public/{text_based_datasource => datasources/text_based}/utils.ts (95%) diff --git a/x-pack/plugins/lens/public/async_services.ts b/x-pack/plugins/lens/public/async_services.ts index 9927aa4b3a212..1aa40cda21445 100644 --- a/x-pack/plugins/lens/public/async_services.ts +++ b/x-pack/plugins/lens/public/async_services.ts @@ -29,12 +29,12 @@ export * from './visualizations/heatmap'; export * from './visualizations/gauge/gauge_visualization'; export * from './visualizations/gauge'; -export * from './form_based_datasource/form_based'; -export { getTextBasedDatasource } from './text_based_datasource/text_based_languages'; -export { createFormulaPublicApi } from './form_based_datasource/operations/definitions/formula/formula_public_api'; +export * from './datasources/form_based/form_based'; +export { getTextBasedDatasource } from './datasources/text_based/text_based_languages'; +export { createFormulaPublicApi } from './datasources/form_based/operations/definitions/formula/formula_public_api'; -export * from './text_based_datasource'; -export * from './form_based_datasource'; +export * from './datasources/text_based'; +export * from './datasources/form_based'; export * from './lens_ui_telemetry'; export * from './lens_ui_errors'; export * from './editor_frame_service/editor_frame'; diff --git a/x-pack/plugins/lens/public/data_views_service/loader.test.ts b/x-pack/plugins/lens/public/data_views_service/loader.test.ts index 24ef8feb1b614..97ded75233cda 100644 --- a/x-pack/plugins/lens/public/data_views_service/loader.test.ts +++ b/x-pack/plugins/lens/public/data_views_service/loader.test.ts @@ -14,7 +14,7 @@ import { syncExistingFields, } from './loader'; import { sampleIndexPatterns, mockDataViewsService } from './mocks'; -import { documentField } from '../form_based_datasource/document_field'; +import { documentField } from '../datasources/form_based/document_field'; import { coreMock } from '@kbn/core/public/mocks'; import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; import type { DataView } from '@kbn/data-views-plugin/public'; diff --git a/x-pack/plugins/lens/public/data_views_service/loader.ts b/x-pack/plugins/lens/public/data_views_service/loader.ts index bd97bb3b8b69d..3c4373914c1c7 100644 --- a/x-pack/plugins/lens/public/data_views_service/loader.ts +++ b/x-pack/plugins/lens/public/data_views_service/loader.ts @@ -12,7 +12,7 @@ import { CoreStart } from '@kbn/core/public'; import { DataPublicPluginStart } from '@kbn/data-plugin/public'; import { loadFieldExisting } from '@kbn/unified-field-list-plugin/public'; import { IndexPattern, IndexPatternField, IndexPatternMap, IndexPatternRef } from '../types'; -import { documentField } from '../form_based_datasource/document_field'; +import { documentField } from '../datasources/form_based/document_field'; import { DateRange } from '../../common'; import { DataViewsState } from '../state_management'; diff --git a/x-pack/plugins/lens/public/data_views_service/mocks.ts b/x-pack/plugins/lens/public/data_views_service/mocks.ts index b388bb8e24019..ed8d6e86e58a4 100644 --- a/x-pack/plugins/lens/public/data_views_service/mocks.ts +++ b/x-pack/plugins/lens/public/data_views_service/mocks.ts @@ -6,11 +6,11 @@ */ import { DataViewsContract } from '@kbn/data-views-plugin/common'; -import { documentField } from '../form_based_datasource/document_field'; +import { documentField } from '../datasources/form_based/document_field'; import { createMockedIndexPattern, createMockedRestrictedIndexPattern, -} from '../form_based_datasource/mocks'; +} from '../datasources/form_based/mocks'; import { DataViewsState } from '../state_management'; import { ExistingFieldsMap, IndexPattern } from '../types'; import { getFieldByNameFactory } from './loader'; diff --git a/x-pack/plugins/lens/public/form_based_datasource/__mocks__/loader.ts b/x-pack/plugins/lens/public/datasources/form_based/__mocks__/loader.ts similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/__mocks__/loader.ts rename to x-pack/plugins/lens/public/datasources/form_based/__mocks__/loader.ts diff --git a/x-pack/plugins/lens/public/form_based_datasource/__snapshots__/utils.test.tsx.snap b/x-pack/plugins/lens/public/datasources/form_based/__snapshots__/utils.test.tsx.snap similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/__snapshots__/utils.test.tsx.snap rename to x-pack/plugins/lens/public/datasources/form_based/__snapshots__/utils.test.tsx.snap diff --git a/x-pack/plugins/lens/public/form_based_datasource/datapanel.scss b/x-pack/plugins/lens/public/datasources/form_based/datapanel.scss similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/datapanel.scss rename to x-pack/plugins/lens/public/datasources/form_based/datapanel.scss diff --git a/x-pack/plugins/lens/public/form_based_datasource/datapanel.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/datapanel.test.tsx similarity index 98% rename from x-pack/plugins/lens/public/form_based_datasource/datapanel.test.tsx rename to x-pack/plugins/lens/public/datasources/form_based/datapanel.test.tsx index d83191ba0c670..deb9642e25dc3 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/datapanel.test.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/datapanel.test.tsx @@ -29,12 +29,12 @@ import { indexPatternFieldEditorPluginMock } from '@kbn/data-view-field-editor-p import { getFieldByNameFactory } from './pure_helpers'; import { uiActionsPluginMock } from '@kbn/ui-actions-plugin/public/mocks'; import { TermsIndexPatternColumn } from './operations'; -import { DOCUMENT_FIELD_NAME } from '../../common'; -import { createIndexPatternServiceMock } from '../mocks/data_views_service_mock'; -import { createMockFramePublicAPI } from '../mocks'; -import { DataViewsState } from '../state_management'; -import { ExistingFieldsMap, FramePublicAPI, IndexPattern } from '../types'; -import { IndexPatternServiceProps } from '../data_views_service/service'; +import { DOCUMENT_FIELD_NAME } from '../../../common'; +import { createIndexPatternServiceMock } from '../../mocks/data_views_service_mock'; +import { createMockFramePublicAPI } from '../../mocks'; +import { DataViewsState } from '../../state_management'; +import { ExistingFieldsMap, FramePublicAPI, IndexPattern } from '../../types'; +import { IndexPatternServiceProps } from '../../data_views_service/service'; import { FieldSpec, DataView } from '@kbn/data-views-plugin/public'; import { UI_SETTINGS } from '@kbn/data-plugin/public'; @@ -285,7 +285,7 @@ const dslQuery = { bool: { must: [], filter: [], should: [], must_not: [] } }; // @ts-expect-error Portal mocks are notoriously difficult to type ReactDOM.createPortal = jest.fn((element) => element); -describe('IndexPattern Data Panel', () => { +describe('FormBased Data Panel', () => { const indexPatterns = { a: { id: 'a', diff --git a/x-pack/plugins/lens/public/form_based_datasource/datapanel.tsx b/x-pack/plugins/lens/public/datasources/form_based/datapanel.tsx similarity index 98% rename from x-pack/plugins/lens/public/form_based_datasource/datapanel.tsx rename to x-pack/plugins/lens/public/datasources/form_based/datapanel.tsx index c811d03838015..8b4b9a4259146 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/datapanel.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/datapanel.tsx @@ -39,15 +39,15 @@ import type { FramePublicAPI, IndexPattern, IndexPatternField, -} from '../types'; -import { ChildDragDropProvider, DragContextState } from '../drag_drop'; +} from '../../types'; +import { ChildDragDropProvider, DragContextState } from '../../drag_drop'; import type { FormBasedPrivateState } from './types'; -import { Loader } from '../loader'; -import { LensFieldIcon } from '../shared_components/field_picker/lens_field_icon'; +import { Loader } from '../../loader'; +import { LensFieldIcon } from '../../shared_components/field_picker/lens_field_icon'; import { getFieldType } from './pure_utils'; import { FieldGroups, FieldList } from './field_list'; -import { fieldContainsData, fieldExists } from '../shared_components'; -import { IndexPatternServiceAPI } from '../data_views_service/service'; +import { fieldContainsData, fieldExists } from '../../shared_components'; +import { IndexPatternServiceAPI } from '../../data_views_service/service'; export type Props = Omit< DatasourceDataPanelProps, diff --git a/x-pack/plugins/lens/public/form_based_datasource/dedupe_aggs.test.ts b/x-pack/plugins/lens/public/datasources/form_based/dedupe_aggs.test.ts similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/dedupe_aggs.test.ts rename to x-pack/plugins/lens/public/datasources/form_based/dedupe_aggs.test.ts diff --git a/x-pack/plugins/lens/public/form_based_datasource/dedupe_aggs.ts b/x-pack/plugins/lens/public/datasources/form_based/dedupe_aggs.ts similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/dedupe_aggs.ts rename to x-pack/plugins/lens/public/datasources/form_based/dedupe_aggs.ts diff --git a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/advanced_options.tsx b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/advanced_options.tsx similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/dimension_panel/advanced_options.tsx rename to x-pack/plugins/lens/public/datasources/form_based/dimension_panel/advanced_options.tsx diff --git a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/bucket_nesting_editor.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/bucket_nesting_editor.test.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/dimension_panel/bucket_nesting_editor.test.tsx rename to x-pack/plugins/lens/public/datasources/form_based/dimension_panel/bucket_nesting_editor.test.tsx index 2d8840514e05a..6c09849df04ac 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/bucket_nesting_editor.test.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/bucket_nesting_editor.test.tsx @@ -9,7 +9,7 @@ import { mount } from 'enzyme'; import React from 'react'; import { BucketNestingEditor } from './bucket_nesting_editor'; import { GenericIndexPatternColumn } from '../form_based'; -import { IndexPatternField } from '../../types'; +import { IndexPatternField } from '../../../types'; const fieldMap: Record = { a: { displayName: 'a' } as IndexPatternField, diff --git a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/bucket_nesting_editor.tsx b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/bucket_nesting_editor.tsx similarity index 98% rename from x-pack/plugins/lens/public/form_based_datasource/dimension_panel/bucket_nesting_editor.tsx rename to x-pack/plugins/lens/public/datasources/form_based/dimension_panel/bucket_nesting_editor.tsx index 357884d5961d7..fb062e4231467 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/bucket_nesting_editor.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/bucket_nesting_editor.tsx @@ -11,7 +11,7 @@ import { EuiFormRow, EuiSwitch, EuiSelect } from '@elastic/eui'; import { FormBasedLayer } from '../types'; import { hasField } from '../pure_utils'; import { GenericIndexPatternColumn } from '../operations'; -import { IndexPatternField } from '../../types'; +import { IndexPatternField } from '../../../types'; function nestColumn(columnOrder: string[], outer: string, inner: string) { const result = columnOrder.filter((c) => c !== inner); diff --git a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/dimension_editor.scss b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/dimension_editor.scss similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/dimension_panel/dimension_editor.scss rename to x-pack/plugins/lens/public/datasources/form_based/dimension_panel/dimension_editor.scss diff --git a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/dimension_editor.tsx b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/dimension_editor.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/dimension_panel/dimension_editor.tsx rename to x-pack/plugins/lens/public/datasources/form_based/dimension_panel/dimension_editor.tsx index 818d93897ef1d..a63e3fe70fd56 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/dimension_editor.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/dimension_editor.tsx @@ -54,8 +54,8 @@ import { Filtering } from './filtering'; import { ReducedTimeRange } from './reduced_time_range'; import { AdvancedOptions } from './advanced_options'; import { TimeShift } from './time_shift'; -import type { LayerType } from '../../../common'; -import { DOCUMENT_FIELD_NAME } from '../../../common'; +import type { LayerType } from '../../../../common'; +import { DOCUMENT_FIELD_NAME } from '../../../../common'; import { quickFunctionsName, staticValueOperationName, @@ -68,12 +68,12 @@ import { } from './dimensions_editor_helpers'; import type { TemporaryState } from './dimensions_editor_helpers'; import { FieldInput } from './field_input'; -import { NameInput } from '../../shared_components'; +import { NameInput } from '../../../shared_components'; import { ParamEditorProps } from '../operations/definitions'; import { WrappingHelpPopover } from '../help_popover'; import { isColumn } from '../operations/definitions/helpers'; import type { FieldChoiceWithOperationType } from './field_select'; -import type { IndexPattern, IndexPatternField } from '../../types'; +import type { IndexPattern, IndexPatternField } from '../../../types'; import { documentField } from '../document_field'; export interface DimensionEditorProps extends FormBasedDimensionEditorProps { diff --git a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/dimension_panel.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/dimension_panel.test.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/dimension_panel/dimension_panel.test.tsx rename to x-pack/plugins/lens/public/datasources/form_based/dimension_panel/dimension_panel.test.tsx index 13dc9df220ee3..c97f852bd3211 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/dimension_panel.test.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/dimension_panel.test.tsx @@ -32,7 +32,7 @@ import { CoreStart, } from '@kbn/core/public'; import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; -import { generateId } from '../../id_generator'; +import { generateId } from '../../../id_generator'; import { FormBasedPrivateState } from '../types'; import { FiltersIndexPatternColumn, @@ -41,7 +41,7 @@ import { TermsIndexPatternColumn, } from '../operations'; import { documentField } from '../document_field'; -import { OperationMetadata } from '../../types'; +import { OperationMetadata } from '../../../types'; import { DateHistogramIndexPatternColumn } from '../operations/definitions/date_histogram'; import { getFieldByNameFactory } from '../pure_helpers'; import { Filtering, setFilter } from './filtering'; @@ -49,7 +49,7 @@ import { TimeShift } from './time_shift'; import { ReducedTimeRange } from './reduced_time_range'; import { DimensionEditor } from './dimension_editor'; import { AdvancedOptions } from './advanced_options'; -import { layerTypes } from '../../../common'; +import { layerTypes } from '../../../../common'; jest.mock('./reference_editor', () => ({ ReferenceEditor: () => null, @@ -69,7 +69,7 @@ jest.mock('lodash', () => { debounce: (fn: unknown) => fn, }; }); -jest.mock('../../id_generator'); +jest.mock('../../../id_generator'); // Mock the Monaco Editor component jest.mock('../operations/definitions/formula/editor/formula_editor', () => { return { diff --git a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/dimension_panel.tsx b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/dimension_panel.tsx similarity index 95% rename from x-pack/plugins/lens/public/form_based_datasource/dimension_panel/dimension_panel.tsx rename to x-pack/plugins/lens/public/datasources/form_based/dimension_panel/dimension_panel.tsx index 1d9cdbadade8f..71c81a5198656 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/dimension_panel.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/dimension_panel.tsx @@ -12,14 +12,14 @@ import { DataPublicPluginStart } from '@kbn/data-plugin/public'; import { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; import { FieldFormatsStart } from '@kbn/field-formats-plugin/public'; import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; -import { DatasourceDimensionTriggerProps, DatasourceDimensionEditorProps } from '../../types'; +import { DatasourceDimensionTriggerProps, DatasourceDimensionEditorProps } from '../../../types'; import { GenericIndexPatternColumn } from '../form_based'; import { isColumnInvalid } from '../utils'; import { FormBasedPrivateState } from '../types'; import { DimensionEditor } from './dimension_editor'; -import { DateRange, layerTypes } from '../../../common'; +import { DateRange, layerTypes } from '../../../../common'; import { getOperationSupportMatrix } from './operation_support'; -import { DimensionTrigger } from '../../shared_components/dimension_trigger'; +import { DimensionTrigger } from '../../../shared_components/dimension_trigger'; export type FormBasedDimensionTriggerProps = DatasourceDimensionTriggerProps & { diff --git a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/dimensions_editor_helpers.tsx b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/dimensions_editor_helpers.tsx similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/dimension_panel/dimensions_editor_helpers.tsx rename to x-pack/plugins/lens/public/datasources/form_based/dimension_panel/dimensions_editor_helpers.tsx diff --git a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/get_drop_props.test.ts b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/droppable/get_drop_props.test.ts similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/get_drop_props.test.ts rename to x-pack/plugins/lens/public/datasources/form_based/dimension_panel/droppable/get_drop_props.test.ts index 4fa6dda7a6cec..21650cffed54a 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/get_drop_props.test.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/droppable/get_drop_props.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { DragDropOperation, OperationMetadata } from '../../../types'; +import { DragDropOperation, OperationMetadata } from '../../../../types'; import { TermsIndexPatternColumn } from '../../operations'; import { getDropProps } from './get_drop_props'; import { @@ -15,7 +15,7 @@ import { mockedDndOperations, mockedColumns, } from './mocks'; -import { generateId } from '../../../id_generator'; +import { generateId } from '../../../../id_generator'; const getDefaultProps = () => ({ indexPatterns: mockDataViews(), diff --git a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/get_drop_props.ts b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/droppable/get_drop_props.ts similarity index 97% rename from x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/get_drop_props.ts rename to x-pack/plugins/lens/public/datasources/form_based/dimension_panel/droppable/get_drop_props.ts index 77e9f37512ed2..a9e81bd6df668 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/get_drop_props.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/droppable/get_drop_props.ts @@ -12,16 +12,16 @@ import { IndexPattern, IndexPatternMap, IndexPatternField, -} from '../../../types'; +} from '../../../../types'; import { getCurrentFieldsForOperation, getOperationDisplay, hasOperationSupportForMultipleFields, } from '../../operations'; -import { isDraggedDataViewField, isOperationFromTheSameGroup } from '../../../utils'; +import { isDraggedDataViewField, isOperationFromTheSameGroup } from '../../../../utils'; import { hasField } from '../../pure_utils'; -import { DragContextState } from '../../../drag_drop/providers'; -import { OperationMetadata, DraggedField } from '../../../types'; +import { DragContextState } from '../../../../drag_drop/providers'; +import { OperationMetadata, DraggedField } from '../../../../types'; import { getOperationTypesForField } from '../../operations'; import { GenericIndexPatternColumn } from '../../form_based'; import { FormBasedPrivateState, DataViewDragDropOperation } from '../../types'; diff --git a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/index.ts b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/droppable/index.ts similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/index.ts rename to x-pack/plugins/lens/public/datasources/form_based/dimension_panel/droppable/index.ts diff --git a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/mocks.ts b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/droppable/mocks.ts similarity index 98% rename from x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/mocks.ts rename to x-pack/plugins/lens/public/datasources/form_based/dimension_panel/droppable/mocks.ts index 4551bd15edef9..ceb16345f475c 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/mocks.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/droppable/mocks.ts @@ -7,7 +7,7 @@ import { FormBasedLayer } from '../../types'; import { documentField } from '../../document_field'; -import { IndexPatternMap, OperationMetadata } from '../../../types'; +import { IndexPatternMap, OperationMetadata } from '../../../../types'; import { DateHistogramIndexPatternColumn, GenericIndexPatternColumn, @@ -15,7 +15,7 @@ import { TermsIndexPatternColumn, } from '../../operations'; import { getFieldByNameFactory } from '../../pure_helpers'; -jest.mock('../../../id_generator'); +jest.mock('../../../../id_generator'); export const mockDataViews = (): IndexPatternMap => { const fields = [ diff --git a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/on_drop_handler.test.ts b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/droppable/on_drop_handler.test.ts similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/on_drop_handler.test.ts rename to x-pack/plugins/lens/public/datasources/form_based/dimension_panel/droppable/on_drop_handler.test.ts index d34113fede748..1bff858194a36 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/on_drop_handler.test.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/droppable/on_drop_handler.test.ts @@ -7,9 +7,13 @@ import { onDrop } from './on_drop_handler'; import { FormBasedPrivateState } from '../../types'; -import { OperationMetadata, DropType, DatasourceDimensionDropHandlerProps } from '../../../types'; +import { + OperationMetadata, + DropType, + DatasourceDimensionDropHandlerProps, +} from '../../../../types'; import { FormulaIndexPatternColumn, MedianIndexPatternColumn } from '../../operations'; -import { generateId } from '../../../id_generator'; +import { generateId } from '../../../../id_generator'; import { mockDataViews, mockedLayers, @@ -18,7 +22,7 @@ import { mockedColumns, } from './mocks'; -jest.mock('../../../id_generator'); +jest.mock('../../../../id_generator'); const dimensionGroups = [ { diff --git a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/on_drop_handler.ts b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/droppable/on_drop_handler.ts similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/on_drop_handler.ts rename to x-pack/plugins/lens/public/datasources/form_based/dimension_panel/droppable/on_drop_handler.ts index 4f727af283f6b..ad575d3c53947 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/droppable/on_drop_handler.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/droppable/on_drop_handler.ts @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { isDraggedDataViewField } from '../../../utils'; +import { isDraggedDataViewField } from '../../../../utils'; import { DatasourceDimensionDropHandlerProps, DragDropOperation, @@ -14,7 +14,7 @@ import { StateSetter, VisualizationDimensionGroupConfig, DraggedField, -} from '../../../types'; +} from '../../../../types'; import { insertOrReplaceColumn, deleteColumn, diff --git a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/field_input.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/field_input.test.tsx similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/dimension_panel/field_input.test.tsx rename to x-pack/plugins/lens/public/datasources/form_based/dimension_panel/field_input.test.tsx diff --git a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/field_input.tsx b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/field_input.tsx similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/dimension_panel/field_input.tsx rename to x-pack/plugins/lens/public/datasources/form_based/dimension_panel/field_input.tsx diff --git a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/field_select.scss b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/field_select.scss similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/dimension_panel/field_select.scss rename to x-pack/plugins/lens/public/datasources/form_based/dimension_panel/field_select.scss diff --git a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/field_select.tsx b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/field_select.tsx similarity index 96% rename from x-pack/plugins/lens/public/form_based_datasource/dimension_panel/field_select.tsx rename to x-pack/plugins/lens/public/datasources/form_based/dimension_panel/field_select.tsx index 934728993d321..52b2c128af595 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/field_select.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/field_select.tsx @@ -12,9 +12,13 @@ import { i18n } from '@kbn/i18n'; import { EuiComboBoxOptionOption, EuiComboBoxProps } from '@elastic/eui'; import type { OperationType } from '../form_based'; import type { OperationSupportMatrix } from './operation_support'; -import { FieldOption, FieldOptionValue, FieldPicker } from '../../shared_components/field_picker'; -import { fieldContainsData } from '../../shared_components'; -import type { ExistingFieldsMap, IndexPattern } from '../../types'; +import { + FieldOption, + FieldOptionValue, + FieldPicker, +} from '../../../shared_components/field_picker'; +import { fieldContainsData } from '../../../shared_components'; +import type { ExistingFieldsMap, IndexPattern } from '../../../types'; import { getFieldType } from '../pure_utils'; export type FieldChoiceWithOperationType = FieldOptionValue & { diff --git a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/filtering.tsx b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/filtering.tsx similarity index 93% rename from x-pack/plugins/lens/public/form_based_datasource/dimension_panel/filtering.tsx rename to x-pack/plugins/lens/public/datasources/form_based/dimension_panel/filtering.tsx index e948711f572c0..13db26af12108 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/filtering.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/filtering.tsx @@ -9,8 +9,8 @@ import { isEqual } from 'lodash'; import type { Query } from '@kbn/es-query'; import { GenericIndexPatternColumn, operationDefinitionMap } from '../operations'; import type { FormBasedLayer } from '../types'; -import { validateQuery, FilterQueryInput } from '../../shared_components'; -import type { IndexPattern } from '../../types'; +import { validateQuery, FilterQueryInput } from '../../../shared_components'; +import type { IndexPattern } from '../../../types'; export function setFilter(columnId: string, layer: FormBasedLayer, query: Query | undefined) { return { diff --git a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/format_selector.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/format_selector.test.tsx similarity index 98% rename from x-pack/plugins/lens/public/form_based_datasource/dimension_panel/format_selector.test.tsx rename to x-pack/plugins/lens/public/datasources/form_based/dimension_panel/format_selector.test.tsx index d59cb4f136fda..6763d6337880b 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/format_selector.test.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/format_selector.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { mount, shallow } from 'enzyme'; import { FormatSelector } from './format_selector'; import { act } from 'react-dom/test-utils'; -import { GenericIndexPatternColumn } from '../..'; +import { GenericIndexPatternColumn } from '../../..'; jest.mock('lodash', () => { const original = jest.requireActual('lodash'); diff --git a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/format_selector.tsx b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/format_selector.tsx similarity index 98% rename from x-pack/plugins/lens/public/form_based_datasource/dimension_panel/format_selector.tsx rename to x-pack/plugins/lens/public/datasources/form_based/dimension_panel/format_selector.tsx index 07a96f5d6dc38..62770711a62df 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/format_selector.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/format_selector.tsx @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n'; import { EuiFormRow, EuiComboBox, EuiSpacer, EuiRange, EuiFieldText } from '@elastic/eui'; import { GenericIndexPatternColumn } from '../form_based'; import { isColumnFormatted } from '../operations/definitions/helpers'; -import { useDebouncedValue } from '../../shared_components'; +import { useDebouncedValue } from '../../../shared_components'; const supportedFormats: Record = { number: { diff --git a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/index.ts b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/index.ts similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/dimension_panel/index.ts rename to x-pack/plugins/lens/public/datasources/form_based/dimension_panel/index.ts diff --git a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/operation_support.ts b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/operation_support.ts similarity index 98% rename from x-pack/plugins/lens/public/form_based_datasource/dimension_panel/operation_support.ts rename to x-pack/plugins/lens/public/datasources/form_based/dimension_panel/operation_support.ts index eb043807b3e6c..5c08b98023c74 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/operation_support.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/operation_support.ts @@ -6,7 +6,7 @@ */ import memoizeOne from 'memoize-one'; -import { DatasourceDimensionDropProps, IndexPatternMap, OperationMetadata } from '../../types'; +import { DatasourceDimensionDropProps, IndexPatternMap, OperationMetadata } from '../../../types'; import { OperationType } from '../form_based'; import { memoizedGetAvailableOperationsByMetadata, OperationFieldTuple } from '../operations'; import { FormBasedPrivateState } from '../types'; diff --git a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/reduced_time_range.tsx b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/reduced_time_range.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/dimension_panel/reduced_time_range.tsx rename to x-pack/plugins/lens/public/datasources/form_based/dimension_panel/reduced_time_range.tsx index 6638f24e5ea84..9af81b9c066a0 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/reduced_time_range.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/reduced_time_range.tsx @@ -18,7 +18,7 @@ import { operationDefinitionMap, } from '../operations'; import type { FormBasedLayer } from '../types'; -import type { IndexPattern } from '../../types'; +import type { IndexPattern } from '../../../types'; import { reducedTimeRangeOptions } from '../reduced_time_range_utils'; export function setReducedTimeRange( diff --git a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/reference_editor.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/reference_editor.test.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/dimension_panel/reference_editor.test.tsx rename to x-pack/plugins/lens/public/datasources/form_based/dimension_panel/reference_editor.test.tsx index 51d8cf20ada2f..d46dabf6c12f3 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/reference_editor.test.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/reference_editor.test.tsx @@ -16,7 +16,7 @@ import { fieldFormatsServiceMock } from '@kbn/field-formats-plugin/public/mocks' import type { IUiSettingsClient, SavedObjectsClientContract, HttpSetup } from '@kbn/core/public'; import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; import type { DataPublicPluginStart } from '@kbn/data-plugin/public'; -import { OperationMetadata } from '../../types'; +import { OperationMetadata } from '../../../types'; import { createMockedIndexPattern, createMockedIndexPatternWithoutType } from '../mocks'; import { ReferenceEditor, ReferenceEditorProps } from './reference_editor'; import { diff --git a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/reference_editor.tsx b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/reference_editor.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/dimension_panel/reference_editor.tsx rename to x-pack/plugins/lens/public/datasources/form_based/dimension_panel/reference_editor.tsx index cb628837782d7..cefee79349087 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/reference_editor.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/reference_editor.tsx @@ -15,7 +15,7 @@ import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; import type { FieldFormatsStart } from '@kbn/field-formats-plugin/public'; import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; import type { DataPublicPluginStart } from '@kbn/data-plugin/public'; -import type { DateRange } from '../../../common'; +import type { DateRange } from '../../../../common'; import type { OperationSupportMatrix } from './operation_support'; import type { GenericIndexPatternColumn, OperationType } from '../form_based'; import { @@ -34,7 +34,7 @@ import type { IndexPattern, IndexPatternField, ParamEditorCustomProps, -} from '../../types'; +} from '../../../types'; import type { FormBasedDimensionEditorProps } from './dimension_panel'; import { FormRow } from '../operations/definitions/shared_components'; diff --git a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/time_scaling.tsx b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/time_scaling.tsx similarity index 95% rename from x-pack/plugins/lens/public/form_based_datasource/dimension_panel/time_scaling.tsx rename to x-pack/plugins/lens/public/datasources/form_based/dimension_panel/time_scaling.tsx index 2861f9c8df600..816f14869a69c 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/time_scaling.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/time_scaling.tsx @@ -21,8 +21,8 @@ import { GenericIndexPatternColumn, operationDefinitionMap, } from '../operations'; -import type { TimeScaleUnit } from '../../../common/expressions'; -import { unitSuffixesLong } from '../../../common/suffix_formatter'; +import type { TimeScaleUnit } from '../../../../common/expressions'; +import { unitSuffixesLong } from '../../../../common/suffix_formatter'; import type { FormBasedLayer } from '../types'; export function setTimeScaling( diff --git a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/time_shift.tsx b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/time_shift.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/dimension_panel/time_shift.tsx rename to x-pack/plugins/lens/public/datasources/form_based/dimension_panel/time_shift.tsx index a5dfd8df9f006..35f278cbbe988 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/dimension_panel/time_shift.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/time_shift.tsx @@ -22,7 +22,7 @@ import { getLayerTimeShiftChecks, timeShiftOptions, } from '../time_shift_utils'; -import type { IndexPattern } from '../../types'; +import type { IndexPattern } from '../../../types'; export function setTimeShift( columnId: string, diff --git a/x-pack/plugins/lens/public/form_based_datasource/document_field.ts b/x-pack/plugins/lens/public/datasources/form_based/document_field.ts similarity index 85% rename from x-pack/plugins/lens/public/form_based_datasource/document_field.ts rename to x-pack/plugins/lens/public/datasources/form_based/document_field.ts index 208b9821601e6..3212f2cd18365 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/document_field.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/document_field.ts @@ -6,8 +6,8 @@ */ import { i18n } from '@kbn/i18n'; -import { DOCUMENT_FIELD_NAME } from '../../common'; -import type { IndexPatternField } from '../types'; +import { DOCUMENT_FIELD_NAME } from '../../../common'; +import type { IndexPatternField } from '../../types'; /** * This is a special-case field which allows us to perform diff --git a/x-pack/plugins/lens/public/form_based_datasource/field_item.scss b/x-pack/plugins/lens/public/datasources/form_based/field_item.scss similarity index 97% rename from x-pack/plugins/lens/public/form_based_datasource/field_item.scss rename to x-pack/plugins/lens/public/datasources/form_based/field_item.scss index a309e37938cda..336cb328b4c30 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/field_item.scss +++ b/x-pack/plugins/lens/public/datasources/form_based/field_item.scss @@ -1,4 +1,4 @@ -@import '../mixins'; +@import '../../mixins'; .lnsFieldItem { width: 100%; diff --git a/x-pack/plugins/lens/public/form_based_datasource/field_item.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/field_item.test.tsx similarity index 98% rename from x-pack/plugins/lens/public/form_based_datasource/field_item.test.tsx rename to x-pack/plugins/lens/public/datasources/form_based/field_item.test.tsx index 64de29b0691c3..5e3927da93ebe 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/field_item.test.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/field_item.test.tsx @@ -15,7 +15,7 @@ import { coreMock } from '@kbn/core/public/mocks'; import { mountWithIntl } from '@kbn/test-jest-helpers'; import { findTestSubject } from '@elastic/eui/lib/test'; import { fieldFormatsServiceMock } from '@kbn/field-formats-plugin/public/mocks'; -import { IndexPattern } from '../types'; +import { IndexPattern } from '../../types'; import { chartPluginMock } from '@kbn/charts-plugin/public/mocks'; import { documentField } from './document_field'; import { uiActionsPluginMock } from '@kbn/ui-actions-plugin/public/mocks'; @@ -26,8 +26,8 @@ import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; import type { DataView, DataViewField } from '@kbn/data-views-plugin/common'; import { loadFieldStats } from '@kbn/unified-field-list-plugin/public/services/field_stats'; import { FieldStats } from '@kbn/unified-field-list-plugin/public'; -import { DOCUMENT_FIELD_NAME } from '../../common'; -import { LensFieldIcon } from '../shared_components'; +import { DOCUMENT_FIELD_NAME } from '../../../common'; +import { LensFieldIcon } from '../../shared_components'; jest.mock('@kbn/unified-field-list-plugin/public/services/field_stats', () => ({ loadFieldStats: jest.fn().mockResolvedValue({}), diff --git a/x-pack/plugins/lens/public/form_based_datasource/field_item.tsx b/x-pack/plugins/lens/public/datasources/form_based/field_item.tsx similarity index 96% rename from x-pack/plugins/lens/public/form_based_datasource/field_item.tsx rename to x-pack/plugins/lens/public/datasources/form_based/field_item.tsx index 6434af979028d..4f8c7cd20eecd 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/field_item.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/field_item.tsx @@ -32,16 +32,16 @@ import { ChartsPluginSetup } from '@kbn/charts-plugin/public'; import { UiActionsStart } from '@kbn/ui-actions-plugin/public'; import { AddFieldFilterHandler, FieldStats } from '@kbn/unified-field-list-plugin/public'; import { generateFilters, getEsQueryConfig } from '@kbn/data-plugin/public'; -import { DragDrop, DragDropIdentifier } from '../drag_drop'; -import { DatasourceDataPanelProps, DataType, DraggedField } from '../types'; -import { DOCUMENT_FIELD_NAME } from '../../common'; -import type { IndexPattern, IndexPatternField } from '../types'; -import { LensFieldIcon } from '../shared_components/field_picker/lens_field_icon'; +import { DragDrop, DragDropIdentifier } from '../../drag_drop'; +import { DatasourceDataPanelProps, DataType, DraggedField } from '../../types'; +import { DOCUMENT_FIELD_NAME } from '../../../common'; +import type { IndexPattern, IndexPatternField } from '../../types'; +import { LensFieldIcon } from '../../shared_components/field_picker/lens_field_icon'; import { VisualizeGeoFieldButton } from './visualize_geo_field_button'; -import type { LensAppServices } from '../app_plugin/types'; -import { debouncedComponent } from '../debounced_component'; +import type { LensAppServices } from '../../app_plugin/types'; +import { debouncedComponent } from '../../debounced_component'; import { getFieldType } from './pure_utils'; -import { combineQueryAndFilters } from '../app_plugin/show_underlying_data'; +import { combineQueryAndFilters } from '../../app_plugin/show_underlying_data'; export interface FieldItemProps { core: DatasourceDataPanelProps['core']; diff --git a/x-pack/plugins/lens/public/form_based_datasource/field_list.scss b/x-pack/plugins/lens/public/datasources/form_based/field_list.scss similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/field_list.scss rename to x-pack/plugins/lens/public/datasources/form_based/field_list.scss diff --git a/x-pack/plugins/lens/public/form_based_datasource/field_list.tsx b/x-pack/plugins/lens/public/datasources/form_based/field_list.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/field_list.tsx rename to x-pack/plugins/lens/public/datasources/form_based/field_list.tsx index 18da8488db212..e2226def27a9a 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/field_list.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/field_list.tsx @@ -13,7 +13,7 @@ import { UiActionsStart } from '@kbn/ui-actions-plugin/public'; import { FieldItem } from './field_item'; import { NoFieldsCallout } from './no_fields_callout'; import { FieldItemSharedProps, FieldsAccordion } from './fields_accordion'; -import type { DatasourceDataPanelProps, IndexPatternField } from '../types'; +import type { DatasourceDataPanelProps, IndexPatternField } from '../../types'; const PAGINATION_SIZE = 50; export type FieldGroups = Record< diff --git a/x-pack/plugins/lens/public/form_based_datasource/fields_accordion.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/fields_accordion.test.tsx similarity index 98% rename from x-pack/plugins/lens/public/form_based_datasource/fields_accordion.test.tsx rename to x-pack/plugins/lens/public/datasources/form_based/fields_accordion.test.tsx index 864ba4ac55af9..a471f8e0fa309 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/fields_accordion.test.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/fields_accordion.test.tsx @@ -10,7 +10,7 @@ import { EuiLoadingSpinner, EuiNotificationBadge } from '@elastic/eui'; import { coreMock } from '@kbn/core/public/mocks'; import { mountWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers'; import { fieldFormatsServiceMock } from '@kbn/field-formats-plugin/public/mocks'; -import { IndexPattern } from '../types'; +import { IndexPattern } from '../../types'; import { FieldItem } from './field_item'; import { FieldsAccordion, FieldsAccordionProps, FieldItemSharedProps } from './fields_accordion'; import { chartPluginMock } from '@kbn/charts-plugin/public/mocks'; diff --git a/x-pack/plugins/lens/public/form_based_datasource/fields_accordion.tsx b/x-pack/plugins/lens/public/datasources/form_based/fields_accordion.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/fields_accordion.tsx rename to x-pack/plugins/lens/public/datasources/form_based/fields_accordion.tsx index c0904c320781a..929d5535bddd1 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/fields_accordion.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/fields_accordion.tsx @@ -23,7 +23,7 @@ import type { Query } from '@kbn/es-query'; import { ChartsPluginSetup } from '@kbn/charts-plugin/public'; import { UiActionsStart } from '@kbn/ui-actions-plugin/public'; import { FieldItem } from './field_item'; -import type { DatasourceDataPanelProps, IndexPattern, IndexPatternField } from '../types'; +import type { DatasourceDataPanelProps, IndexPattern, IndexPatternField } from '../../types'; export interface FieldItemSharedProps { core: DatasourceDataPanelProps['core']; diff --git a/x-pack/plugins/lens/public/form_based_datasource/form_based.test.ts b/x-pack/plugins/lens/public/datasources/form_based/form_based.test.ts similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/form_based.test.ts rename to x-pack/plugins/lens/public/datasources/form_based/form_based.test.ts index 369c6db90eb97..5a30dad263123 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/form_based.test.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/form_based.test.ts @@ -21,7 +21,7 @@ import { uiActionsPluginMock } from '@kbn/ui-actions-plugin/public/mocks'; import { fieldFormatsServiceMock } from '@kbn/field-formats-plugin/public/mocks'; import { TinymathAST } from '@kbn/tinymath'; import { getFormBasedDatasource, GenericIndexPatternColumn } from './form_based'; -import { DatasourcePublicAPI, Datasource, FramePublicAPI, OperationDescriptor } from '../types'; +import { DatasourcePublicAPI, Datasource, FramePublicAPI, OperationDescriptor } from '../../types'; import { getFieldByNameFactory } from './pure_helpers'; import { operationDefinitionMap, @@ -42,10 +42,10 @@ import { import { createMockedFullReference } from './operations/mocks'; import { cloneDeep } from 'lodash'; import { DatatableColumn } from '@kbn/expressions-plugin/common'; -import { createMockFramePublicAPI } from '../mocks'; +import { createMockFramePublicAPI } from '../../mocks'; jest.mock('./loader'); -jest.mock('../id_generator'); +jest.mock('../../id_generator'); jest.mock('./operations'); jest.mock('./dimension_panel/reference_editor', () => ({ ReferenceEditor: () => null, diff --git a/x-pack/plugins/lens/public/form_based_datasource/form_based.tsx b/x-pack/plugins/lens/public/datasources/form_based/form_based.tsx similarity index 98% rename from x-pack/plugins/lens/public/form_based_datasource/form_based.tsx rename to x-pack/plugins/lens/public/datasources/form_based/form_based.tsx index c49c9951d5228..984ce87dfefaf 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/form_based.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/form_based.tsx @@ -36,7 +36,7 @@ import type { IndexPatternField, IndexPattern, IndexPatternRef, -} from '../types'; +} from '../../types'; import { changeIndexPattern, changeLayerIndexPattern, @@ -69,7 +69,7 @@ import { isColumnInvalid, cloneLayer, } from './utils'; -import { isDraggedDataViewField } from '../utils'; +import { isDraggedDataViewField } from '../../utils'; import { normalizeOperationDataType } from './pure_utils'; import { LayerPanel } from './layerpanel'; import { @@ -83,13 +83,13 @@ import { import { getReferenceRoot } from './operations/layer_helpers'; import { FormBasedPrivateState, FormBasedPersistedState } from './types'; import { mergeLayer } from './state_helpers'; -import { Datasource, VisualizeEditorContext } from '../types'; +import { Datasource, VisualizeEditorContext } from '../../types'; import { deleteColumn, isReferenced } from './operations'; -import { GeoFieldWorkspacePanel } from '../editor_frame_service/editor_frame/workspace_panel/geo_field_workspace_panel'; -import { DraggingIdentifier } from '../drag_drop'; +import { GeoFieldWorkspacePanel } from '../../editor_frame_service/editor_frame/workspace_panel/geo_field_workspace_panel'; +import { DraggingIdentifier } from '../../drag_drop'; import { getStateTimeShiftWarningMessages } from './time_shift_utils'; import { getPrecisionErrorWarningMessages } from './utils'; -import { DOCUMENT_FIELD_NAME } from '../../common/constants'; +import { DOCUMENT_FIELD_NAME } from '../../../common/constants'; import { isColumnOfType } from './operations/definitions/helpers'; export type { OperationType, GenericIndexPatternColumn } from './operations'; export { deleteColumn } from './operations'; @@ -119,13 +119,13 @@ export function columnToOperation( }; } -export type { FormatColumnArgs, TimeScaleArgs, CounterRateArgs } from '../../common/expressions'; +export type { FormatColumnArgs, TimeScaleArgs, CounterRateArgs } from '../../../common/expressions'; export { getSuffixFormatter, unitSuffixesLong, suffixFormatterId, -} from '../../common/suffix_formatter'; +} from '../../../common/suffix_formatter'; export function getFormBasedDatasource({ core, diff --git a/x-pack/plugins/lens/public/form_based_datasource/form_based_suggestions.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/form_based_suggestions.test.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/form_based_suggestions.test.tsx rename to x-pack/plugins/lens/public/datasources/form_based/form_based_suggestions.test.tsx index e38a3005d4eba..d7a544a723e04 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/form_based_suggestions.test.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/form_based_suggestions.test.tsx @@ -12,8 +12,8 @@ import type { StaticValueColumn, CountColumn, } from '@kbn/visualizations-plugin/common/convert_to_lens'; -import { DatasourceSuggestion } from '../types'; -import { generateId } from '../id_generator'; +import { DatasourceSuggestion } from '../../types'; +import { generateId } from '../../id_generator'; import type { FormBasedPrivateState } from './types'; import { getDatasourceSuggestionsForField, @@ -33,7 +33,7 @@ import { } from './operations/definitions'; jest.mock('./loader'); -jest.mock('../id_generator'); +jest.mock('../../id_generator'); const fieldsOne = [ { diff --git a/x-pack/plugins/lens/public/form_based_datasource/form_based_suggestions.ts b/x-pack/plugins/lens/public/datasources/form_based/form_based_suggestions.ts similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/form_based_suggestions.ts rename to x-pack/plugins/lens/public/datasources/form_based/form_based_suggestions.ts index eec6b88329122..52008f10bcdeb 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/form_based_suggestions.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/form_based_suggestions.ts @@ -14,7 +14,7 @@ import type { AnyColumnWithSourceField, TermsColumn, } from '@kbn/visualizations-plugin/common/convert_to_lens'; -import { generateId } from '../id_generator'; +import { generateId } from '../../id_generator'; import type { DatasourceSuggestion, IndexPattern, @@ -22,7 +22,7 @@ import type { IndexPatternMap, TableChangeType, VisualizationDimensionGroupConfig, -} from '../types'; +} from '../../types'; import { columnToOperation } from './form_based'; import { insertNewColumn, diff --git a/x-pack/plugins/lens/public/form_based_datasource/help_popover.scss b/x-pack/plugins/lens/public/datasources/form_based/help_popover.scss similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/help_popover.scss rename to x-pack/plugins/lens/public/datasources/form_based/help_popover.scss diff --git a/x-pack/plugins/lens/public/form_based_datasource/help_popover.tsx b/x-pack/plugins/lens/public/datasources/form_based/help_popover.tsx similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/help_popover.tsx rename to x-pack/plugins/lens/public/datasources/form_based/help_popover.tsx diff --git a/x-pack/plugins/lens/public/form_based_datasource/index.ts b/x-pack/plugins/lens/public/datasources/form_based/index.ts similarity index 94% rename from x-pack/plugins/lens/public/form_based_datasource/index.ts rename to x-pack/plugins/lens/public/datasources/form_based/index.ts index 4f1b8c7f6a240..3b1f62829fa46 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/index.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/index.ts @@ -16,9 +16,9 @@ import type { IndexPatternFieldEditorStart } from '@kbn/data-view-field-editor-p import type { DataPublicPluginSetup, DataPublicPluginStart } from '@kbn/data-plugin/public'; import type { UiActionsStart } from '@kbn/ui-actions-plugin/public'; import type { FieldFormatsStart, FieldFormatsSetup } from '@kbn/field-formats-plugin/public'; -import type { EditorFrameSetup } from '../types'; +import type { EditorFrameSetup } from '../../types'; -export type { PersistedFormBasedLayer, FormulaPublicApi } from './types'; +export type { PersistedIndexPatternLayer, FormulaPublicApi } from './types'; export interface FormBasedDatasourceSetupPlugins { expressions: ExpressionsSetup; @@ -50,7 +50,7 @@ export class FormBasedDatasource { ) { editorFrame.registerDatasource(async () => { const { getFormBasedDatasource, getSuffixFormatter, suffixFormatterId } = await import( - '../async_services' + '../../async_services' ); if (!fieldFormatsSetup.has(suffixFormatterId)) { diff --git a/x-pack/plugins/lens/public/form_based_datasource/layerpanel.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/layerpanel.test.tsx similarity index 98% rename from x-pack/plugins/lens/public/form_based_datasource/layerpanel.test.tsx rename to x-pack/plugins/lens/public/datasources/form_based/layerpanel.test.tsx index d9912da5ff43a..defc505f1d9e1 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/layerpanel.test.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/layerpanel.test.tsx @@ -12,7 +12,7 @@ import { shallowWithIntl as shallow } from '@kbn/test-jest-helpers'; import { ShallowWrapper } from 'enzyme'; import { EuiSelectable } from '@elastic/eui'; import { DataViewsList } from '@kbn/unified-search-plugin/public'; -import { ChangeIndexPattern } from '../shared_components/dataview_picker/dataview_picker'; +import { ChangeIndexPattern } from '../../shared_components/dataview_picker/dataview_picker'; import { getFieldByNameFactory } from './pure_helpers'; import { TermsIndexPatternColumn } from './operations'; diff --git a/x-pack/plugins/lens/public/form_based_datasource/layerpanel.tsx b/x-pack/plugins/lens/public/datasources/form_based/layerpanel.tsx similarity index 85% rename from x-pack/plugins/lens/public/form_based_datasource/layerpanel.tsx rename to x-pack/plugins/lens/public/datasources/form_based/layerpanel.tsx index 54787d092ccb8..c18b79b28c58c 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/layerpanel.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/layerpanel.tsx @@ -8,12 +8,11 @@ import React from 'react'; import { I18nProvider } from '@kbn/i18n-react'; import { i18n } from '@kbn/i18n'; -import { DatasourceLayerPanelProps } from '../types'; +import { DatasourceLayerPanelProps } from '../../types'; import { FormBasedPrivateState } from './types'; -import { ChangeIndexPattern } from '../shared_components/dataview_picker/dataview_picker'; +import { ChangeIndexPattern } from '../../shared_components/dataview_picker/dataview_picker'; -export interface FormBasedLayerPanelProps - extends DatasourceLayerPanelProps { +export interface FormBasedLayerPanelProps extends DatasourceLayerPanelProps { state: FormBasedPrivateState; onChangeIndexPattern: (newId: string) => void; } diff --git a/x-pack/plugins/lens/public/form_based_datasource/loader.test.ts b/x-pack/plugins/lens/public/datasources/form_based/loader.test.ts similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/loader.test.ts rename to x-pack/plugins/lens/public/datasources/form_based/loader.test.ts index f7f721c38691a..896fbd0e6404f 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/loader.test.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/loader.test.ts @@ -14,7 +14,7 @@ import { } from './loader'; import { FormBasedPersistedState, FormBasedPrivateState } from './types'; import { DateHistogramIndexPatternColumn, TermsIndexPatternColumn } from './operations'; -import { sampleIndexPatterns } from '../data_views_service/mocks'; +import { sampleIndexPatterns } from '../../data_views_service/mocks'; const createMockStorage = (lastData?: Record) => { return { diff --git a/x-pack/plugins/lens/public/form_based_datasource/loader.ts b/x-pack/plugins/lens/public/datasources/form_based/loader.ts similarity index 97% rename from x-pack/plugins/lens/public/form_based_datasource/loader.ts rename to x-pack/plugins/lens/public/datasources/form_based/loader.ts index e9baf8c46a4bd..6aa021a6f363f 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/loader.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/loader.ts @@ -17,12 +17,12 @@ import { UiActionsStart, VisualizeFieldContext, } from '@kbn/ui-actions-plugin/public'; -import type { VisualizeEditorContext } from '../types'; +import type { VisualizeEditorContext } from '../../types'; import { FormBasedPersistedState, FormBasedPrivateState, FormBasedLayer } from './types'; import { memoizedGetAvailableOperationsByMetadata, updateLayerIndexPattern } from './operations'; -import { readFromStorage, writeToStorage } from '../settings_storage'; -import type { IndexPattern, IndexPatternRef } from '../types'; +import { readFromStorage, writeToStorage } from '../../settings_storage'; +import type { IndexPattern, IndexPatternRef } from '../../types'; export function onRefreshIndexPattern() { if (memoizedGetAvailableOperationsByMetadata.cache.clear) { diff --git a/x-pack/plugins/lens/public/form_based_datasource/mocks.ts b/x-pack/plugins/lens/public/datasources/form_based/mocks.ts similarity index 97% rename from x-pack/plugins/lens/public/form_based_datasource/mocks.ts rename to x-pack/plugins/lens/public/datasources/form_based/mocks.ts index 7cd3639547e14..c2a85fbf0bac4 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/mocks.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/mocks.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { DragContextState } from '../drag_drop'; +import { DragContextState } from '../../drag_drop'; import { getFieldByNameFactory } from './pure_helpers'; -import type { IndexPattern, IndexPatternField } from '../types'; +import type { IndexPattern, IndexPatternField } from '../../types'; export const createMockedIndexPattern = (someProps?: Partial): IndexPattern => { const fields = [ diff --git a/x-pack/plugins/lens/public/form_based_datasource/no_fields_callout.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/no_fields_callout.test.tsx similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/no_fields_callout.test.tsx rename to x-pack/plugins/lens/public/datasources/form_based/no_fields_callout.test.tsx diff --git a/x-pack/plugins/lens/public/form_based_datasource/no_fields_callout.tsx b/x-pack/plugins/lens/public/datasources/form_based/no_fields_callout.tsx similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/no_fields_callout.tsx rename to x-pack/plugins/lens/public/datasources/form_based/no_fields_callout.tsx diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/__mocks__/index.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/__mocks__/index.ts similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/__mocks__/index.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/__mocks__/index.ts diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions.test.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions.test.ts similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions.test.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions.test.ts index f298de18fe6a4..3dc58b7f1ef6c 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions.test.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions.test.ts @@ -19,7 +19,7 @@ import { import { getFieldByNameFactory } from '../pure_helpers'; import { documentField } from '../document_field'; import { FormBasedLayer } from '../types'; -import { IndexPattern, IndexPatternField } from '../../types'; +import { IndexPattern, IndexPatternField } from '../../../types'; import { GenericIndexPatternColumn } from '.'; import { DateHistogramIndexPatternColumn } from './definitions/date_histogram'; diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/counter_rate.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/calculations/counter_rate.tsx similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/counter_rate.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/calculations/counter_rate.tsx diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/cumulative_sum.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/calculations/cumulative_sum.tsx similarity index 98% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/cumulative_sum.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/calculations/cumulative_sum.tsx index c8c0d0b5f3897..339f5e4bc4003 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/cumulative_sum.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/calculations/cumulative_sum.tsx @@ -19,7 +19,7 @@ import { import { OperationDefinition } from '..'; import { getFormatFromPreviousColumn, getFilter, combineErrorMessages } from '../helpers'; import { getDisallowedPreviousShiftMessage } from '../../../time_shift_utils'; -import { DOCUMENT_FIELD_NAME } from '../../../../../common'; +import { DOCUMENT_FIELD_NAME } from '../../../../../../common'; const ofName = buildLabelFunction((name?: string) => { return i18n.translate('xpack.lens.indexPattern.cumulativeSumOf', { diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/differences.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/calculations/differences.tsx similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/differences.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/calculations/differences.tsx diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/index.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/calculations/index.ts similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/index.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/calculations/index.ts diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/moving_average.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/calculations/moving_average.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/moving_average.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/calculations/moving_average.tsx index 8d9d673f37a22..d7b46d09c0f1e 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/moving_average.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/calculations/moving_average.tsx @@ -9,7 +9,7 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; import React, { useState } from 'react'; import { EuiFieldNumber, EuiFormRow } from '@elastic/eui'; -import { useDebounceWithOptions } from '../../../../shared_components'; +import { useDebounceWithOptions } from '../../../../../shared_components'; import { FormattedIndexPatternColumn, ReferenceBasedIndexPatternColumn } from '../column_types'; import { FormBasedLayer } from '../../../types'; import { diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/overall_metric.test.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/calculations/overall_metric.test.ts similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/overall_metric.test.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/calculations/overall_metric.test.ts diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/overall_metric.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/calculations/overall_metric.tsx similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/overall_metric.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/calculations/overall_metric.tsx diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/time_scale.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/calculations/time_scale.tsx similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/time_scale.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/calculations/time_scale.tsx diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/utils.test.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/calculations/utils.test.ts similarity index 97% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/utils.test.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/calculations/utils.test.ts index 1dacb334413f8..8563ee2e69ad3 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/utils.test.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/calculations/utils.test.ts @@ -8,7 +8,7 @@ import { checkReferences, checkForDataLayerType } from './utils'; import { operationDefinitionMap } from '..'; import { createMockedFullReference } from '../../mocks'; -import { layerTypes } from '../../../../../common'; +import { layerTypes } from '../../../../../../common'; import { DateHistogramIndexPatternColumn } from '../date_histogram'; // Mock prevents issue with circular loading diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/utils.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/calculations/utils.ts similarity index 95% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/utils.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/calculations/utils.ts index fec97e0597a25..70c0c8325d70d 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/calculations/utils.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/calculations/utils.ts @@ -8,9 +8,9 @@ import { i18n } from '@kbn/i18n'; import type { AstFunction } from '@kbn/interpreter'; import memoizeOne from 'memoize-one'; -import type { IndexPattern } from '../../../../types'; -import { LayerType, layerTypes } from '../../../../../common'; -import type { TimeScaleUnit } from '../../../../../common/expressions'; +import type { IndexPattern } from '../../../../../types'; +import { LayerType, layerTypes } from '../../../../../../common'; +import type { TimeScaleUnit } from '../../../../../../common/expressions'; import type { FormBasedLayer } from '../../../types'; import { adjustTimeScaleLabelSuffix } from '../../time_scale_utils'; import type { ReferenceBasedIndexPatternColumn } from '../column_types'; @@ -127,11 +127,7 @@ export function checkReferences(layer: FormBasedLayer, columnId: string) { return errors.length ? errors : undefined; } -export function getErrorsForDateReference( - layer: FormBasedLayer, - columnId: string, - name: string -) { +export function getErrorsForDateReference(layer: FormBasedLayer, columnId: string, name: string) { const dateErrors = checkForDateHistogram(layer, name) ?? []; const referenceErrors = checkReferences(layer, columnId) ?? []; if (dateErrors.length || referenceErrors.length) { diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/cardinality.test.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/cardinality.test.ts similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/cardinality.test.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/cardinality.test.ts diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/cardinality.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/cardinality.tsx similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/cardinality.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/cardinality.tsx diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/column_types.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/column_types.ts similarity index 91% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/column_types.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/column_types.ts index 8af67468f0ac1..a0931a23f4e5a 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/column_types.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/column_types.ts @@ -6,8 +6,8 @@ */ import type { Query } from '@kbn/es-query'; -import type { Operation } from '../../../types'; -import type { TimeScaleUnit } from '../../../../common/expressions'; +import type { Operation } from '../../../../types'; +import type { TimeScaleUnit } from '../../../../../common/expressions'; import type { OperationType } from '.'; export interface BaseIndexPatternColumn extends Operation { diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/count.test.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/count.test.ts similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/count.test.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/count.test.ts diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/count.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/count.tsx similarity index 98% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/count.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/count.tsx index b911ac5394a23..e7dfa9466bd88 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/count.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/count.tsx @@ -11,10 +11,10 @@ import { euiThemeVars } from '@kbn/ui-theme'; import { EuiSwitch, EuiText } from '@elastic/eui'; import { AggFunctionsMapping } from '@kbn/data-plugin/public'; import { buildExpressionFunction } from '@kbn/expressions-plugin/public'; -import { TimeScaleUnit } from '../../../../common/expressions'; +import { TimeScaleUnit } from '../../../../../common/expressions'; import { OperationDefinition, ParamEditorProps } from '.'; import { FieldBasedIndexPatternColumn, ValueFormatConfig } from './column_types'; -import type { IndexPatternField } from '../../../types'; +import type { IndexPatternField } from '../../../../types'; import { getInvalidFieldMessage, getFilter, diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/date_histogram.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/date_histogram.test.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/date_histogram.test.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/date_histogram.test.tsx index cc8ba1030b1d0..c08f8703c723f 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/date_histogram.test.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/date_histogram.test.tsx @@ -19,7 +19,7 @@ import { UI_SETTINGS } from '@kbn/data-plugin/public'; import { dataPluginMock, getCalculateAutoTimeExpression } from '@kbn/data-plugin/public/mocks'; import { createMockedIndexPattern } from '../../mocks'; import type { FormBasedLayer } from '../../types'; -import type { IndexPattern } from '../../../types'; +import type { IndexPattern } from '../../../../types'; import { getFieldByNameFactory } from '../../pure_helpers'; import { act } from 'react-dom/test-utils'; diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/date_histogram.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/date_histogram.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/date_histogram.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/date_histogram.tsx index d0b53c837f4fd..87261f41338d0 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/date_histogram.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/date_histogram.tsx @@ -34,7 +34,7 @@ import { OperationDefinition, ParamEditorProps } from '.'; import { FieldBasedIndexPatternColumn } from './column_types'; import { getInvalidFieldMessage, getSafeName } from './helpers'; import { FormBasedLayer } from '../../types'; -import { TooltipWrapper } from '../../../shared_components'; +import { TooltipWrapper } from '../../../../shared_components'; const { isValidInterval } = search.aggs; const autoInterval = 'auto'; diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/filter_popover.scss b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/filters/filter_popover.scss similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/filter_popover.scss rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/filters/filter_popover.scss diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/filter_popover.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/filters/filter_popover.test.tsx similarity index 98% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/filter_popover.test.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/filters/filter_popover.test.tsx index 475761c94ec54..9fbc38732806c 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/filter_popover.test.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/filters/filter_popover.test.tsx @@ -13,7 +13,7 @@ import { createMockedIndexPattern } from '../../../mocks'; import { FilterPopover } from './filter_popover'; import { LabelInput } from '../shared_components'; import { QueryStringInput } from '@kbn/unified-search-plugin/public'; -import { QueryInput } from '../../../../shared_components'; +import { QueryInput } from '../../../../../shared_components'; jest.mock('.', () => ({ isQueryValid: () => true, diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/filter_popover.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/filters/filter_popover.tsx similarity index 94% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/filter_popover.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/filters/filter_popover.tsx index 17314bbc991c0..21a52f46e5c58 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/filter_popover.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/filters/filter_popover.tsx @@ -12,8 +12,8 @@ import { EuiPopover, EuiSpacer } from '@elastic/eui'; import type { Query } from '@kbn/es-query'; // Need to keep it separate to make it work Jest mocks in dimension_panel tests // import { QueryInput } from '../../../../shared_components/query_input'; -import { isQueryValid, QueryInput } from '../../../../shared_components'; -import { IndexPattern } from '../../../../types'; +import { isQueryValid, QueryInput } from '../../../../../shared_components'; +import { IndexPattern } from '../../../../../types'; import { FilterValue, defaultLabel } from '.'; import { LabelInput } from '../shared_components'; diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/filters.scss b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/filters/filters.scss similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/filters.scss rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/filters/filters.scss diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/filters.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/filters/filters.test.tsx similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/filters.test.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/filters/filters.test.tsx diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/filters.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/filters/filters.tsx similarity index 98% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/filters.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/filters/filters.tsx index 434dbb092bdb0..67f3af575f7db 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/filters.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/filters/filters.tsx @@ -19,8 +19,8 @@ import { DraggableBucketContainer, isQueryValid, NewBucketButton, -} from '../../../../shared_components'; -import { IndexPattern } from '../../../../types'; +} from '../../../../../shared_components'; +import { IndexPattern } from '../../../../../types'; import { updateColumnParam } from '../../layer_helpers'; import type { OperationDefinition } from '..'; import type { BaseIndexPatternColumn } from '../column_types'; diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/index.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/filters/index.tsx similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/filters/index.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/filters/index.tsx diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/formula.scss b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/editor/formula.scss similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/formula.scss rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/editor/formula.scss diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/formula_editor.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/editor/formula_editor.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/formula_editor.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/editor/formula_editor.tsx index 1e9a304ffa8a2..b390dd156dc56 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/formula_editor.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/editor/formula_editor.tsx @@ -27,7 +27,7 @@ import { monaco } from '@kbn/monaco'; import classNames from 'classnames'; import { CodeEditor } from '@kbn/kibana-react-plugin/public'; import type { CodeEditorProps } from '@kbn/kibana-react-plugin/public'; -import { TooltipWrapper, useDebounceWithOptions } from '../../../../../shared_components'; +import { TooltipWrapper, useDebounceWithOptions } from '../../../../../../shared_components'; import { ParamEditorProps } from '../..'; import { getManagedColumnsFrom } from '../../../layer_helpers'; import { ErrorWrapper, runASTValidation, tryToParse } from '../validation'; diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/formula_help.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/editor/formula_help.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/formula_help.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/editor/formula_help.tsx index 0a1cf746c19f8..c2bb8fe940a2c 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/formula_help.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/editor/formula_help.tsx @@ -21,7 +21,7 @@ import { EuiSpacer, } from '@elastic/eui'; import { Markdown } from '@kbn/kibana-react-plugin/public'; -import type { IndexPattern } from '../../../../../types'; +import type { IndexPattern } from '../../../../../../types'; import { tinymathFunctions } from '../util'; import { getPossibleFunctions } from './math_completion'; import { hasFunctionFieldArgument } from '../validation'; diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/index.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/editor/index.ts similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/index.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/editor/index.ts diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/math_completion.test.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/editor/math_completion.test.ts similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/math_completion.test.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/editor/math_completion.test.ts index d90a021a7cb12..2a92b1bf095eb 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/math_completion.test.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/editor/math_completion.test.ts @@ -11,7 +11,7 @@ import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; import { createMockedIndexPattern } from '../../../../mocks'; import { GenericOperationDefinition } from '../..'; -import type { OperationMetadata, IndexPatternField } from '../../../../../types'; +import type { OperationMetadata, IndexPatternField } from '../../../../../../types'; import { tinymathFunctions } from '../util'; import { getSignatureHelp, diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/math_completion.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/editor/math_completion.ts similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/math_completion.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/editor/math_completion.ts index 94b8dcc2a9681..8626accc8066f 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/math_completion.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/editor/math_completion.ts @@ -22,7 +22,7 @@ import type { } from '@kbn/unified-search-plugin/public'; import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; import { parseTimeShift } from '@kbn/data-plugin/common'; -import type { IndexPattern } from '../../../../../types'; +import type { IndexPattern } from '../../../../../../types'; import { memoizedGetAvailableOperationsByMetadata } from '../../../operations'; import { tinymathFunctions, groupArgsByType, unquotedStringRegex } from '../util'; import type { GenericOperationDefinition } from '../..'; diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/math_tokenization.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/editor/math_tokenization.tsx similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/editor/math_tokenization.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/editor/math_tokenization.tsx diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/formula.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/formula.test.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/formula.test.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/formula.test.tsx index 19f47a05f3f8f..7edb12068ea54 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/formula.test.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/formula.test.tsx @@ -10,7 +10,7 @@ import { formulaOperation, GenericOperationDefinition, GenericIndexPatternColumn import { FormulaIndexPatternColumn } from './formula'; import { insertOrReplaceFormulaColumn } from './parse'; import type { FormBasedLayer } from '../../../types'; -import { IndexPattern, IndexPatternField } from '../../../../types'; +import { IndexPattern, IndexPatternField } from '../../../../../types'; import { tinymathFunctions } from './util'; import { TermsIndexPatternColumn } from '../terms'; import { MovingAverageIndexPatternColumn } from '../calculations'; diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/formula.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/formula.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/formula.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/formula.tsx index be5a3f30282f9..028d2efb1eeb9 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/formula.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/formula.tsx @@ -8,7 +8,7 @@ import { i18n } from '@kbn/i18n'; import type { BaseIndexPatternColumn, OperationDefinition } from '..'; import type { ReferenceBasedIndexPatternColumn } from '../column_types'; -import type { IndexPattern } from '../../../../types'; +import type { IndexPattern } from '../../../../../types'; import { runASTValidation, tryToParse } from './validation'; import { WrappedFormulaEditor } from './editor'; import { insertOrReplaceFormulaColumn } from './parse'; diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/formula_public_api.test.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/formula_public_api.test.ts similarity index 91% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/formula_public_api.test.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/formula_public_api.test.ts index deb6cdd86d7cc..4c1ba662d1861 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/formula_public_api.test.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/formula_public_api.test.ts @@ -9,18 +9,18 @@ import { insertOrReplaceFormulaColumn } from './parse'; import { createFormulaPublicApi, FormulaPublicApi } from './formula_public_api'; import type { DataView } from '@kbn/data-views-plugin/public'; -import type { DateHistogramIndexPatternColumn, PersistedFormBasedLayer } from '../../../types'; -import { convertDataViewIntoLensIndexPattern } from '../../../../data_views_service/loader'; +import type { DateHistogramIndexPatternColumn, PersistedIndexPatternLayer } from '../../../types'; +import { convertDataViewIntoLensIndexPattern } from '../../../../../data_views_service/loader'; jest.mock('./parse', () => ({ insertOrReplaceFormulaColumn: jest.fn().mockReturnValue({}), })); -jest.mock('../../../../data_views_service/loader', () => ({ +jest.mock('../../../../../data_views_service/loader', () => ({ convertDataViewIntoLensIndexPattern: jest.fn((v) => v), })); -const getBaseLayer = (): PersistedFormBasedLayer => ({ +const getBaseLayer = (): PersistedIndexPatternLayer => ({ columnOrder: ['col1'], columns: { col1: { diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/formula_public_api.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/formula_public_api.ts similarity index 90% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/formula_public_api.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/formula_public_api.ts index d073db2b3d651..231cd82804c8f 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/formula_public_api.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/formula_public_api.ts @@ -6,9 +6,9 @@ */ import type { DataView } from '@kbn/data-views-plugin/public'; -import { convertDataViewIntoLensIndexPattern } from '../../../../data_views_service/loader'; -import type { IndexPattern } from '../../../../types'; -import type { PersistedFormBasedLayer } from '../../../types'; +import { convertDataViewIntoLensIndexPattern } from '../../../../../data_views_service/loader'; +import type { IndexPattern } from '../../../../../types'; +import type { PersistedIndexPatternLayer } from '../../../types'; import { insertOrReplaceFormulaColumn } from './parse'; @@ -38,9 +38,9 @@ export interface FormulaPublicApi { }; }; }, - layer: PersistedFormBasedLayer, + layer: PersistedIndexPatternLayer, dataView: DataView - ) => PersistedFormBasedLayer | undefined; + ) => PersistedIndexPatternLayer | undefined; } /** @public **/ diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/generate.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/generate.ts similarity index 98% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/generate.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/generate.ts index 01dc204d54021..2315d6d164fc8 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/generate.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/generate.ts @@ -6,7 +6,7 @@ */ import { isObject } from 'lodash'; -import { DOCUMENT_FIELD_NAME } from '../../../../../common'; +import { DOCUMENT_FIELD_NAME } from '../../../../../../common'; import { FieldBasedIndexPatternColumn, GenericOperationDefinition, diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/index.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/index.ts similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/index.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/index.ts diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/math.test.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/math.test.ts similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/math.test.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/math.test.ts index 0d3051ea0a82e..60fc7d5b72632 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/math.test.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/math.test.ts @@ -6,7 +6,7 @@ */ import { TinymathAST } from '@kbn/tinymath'; -import { IndexPattern } from '../../../../types'; +import { IndexPattern } from '../../../../../types'; import { FormBasedLayer } from '../../../types'; import { MathIndexPatternColumn, mathOperation } from './math'; diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/math.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/math.tsx similarity index 98% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/math.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/math.tsx index c4e0cbed627f2..de197c2de8189 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/math.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/math.tsx @@ -8,7 +8,7 @@ import type { TinymathAST } from '@kbn/tinymath'; import { OperationDefinition } from '..'; import { ValueFormatConfig, ReferenceBasedIndexPatternColumn } from '../column_types'; -import { IndexPattern } from '../../../../types'; +import { IndexPattern } from '../../../../../types'; export interface MathIndexPatternColumn extends ReferenceBasedIndexPatternColumn { operationType: 'math'; diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/math_examples.md b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/math_examples.md similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/math_examples.md rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/math_examples.md diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/parse.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/parse.ts similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/parse.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/parse.ts index 839db399d2993..6049bb7b3e250 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/parse.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/parse.ts @@ -8,7 +8,7 @@ import { i18n } from '@kbn/i18n'; import { isObject } from 'lodash'; import type { TinymathAST, TinymathVariable, TinymathLocation } from '@kbn/tinymath'; -import type { IndexPattern } from '../../../../types'; +import type { IndexPattern } from '../../../../../types'; import { OperationDefinition, GenericOperationDefinition, diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/types.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/types.ts similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/types.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/types.ts diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/util.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/util.ts similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/util.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/util.ts diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/validation.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/validation.ts similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/validation.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/validation.ts index 5c4e75e7543e9..6189166de43f8 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/formula/validation.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/validation.ts @@ -28,7 +28,7 @@ import type { GenericOperationDefinition, } from '..'; import type { FormBasedLayer } from '../../../types'; -import type { IndexPattern } from '../../../../types'; +import type { IndexPattern } from '../../../../../types'; import type { TinymathNodeTypes } from './types'; interface ValidationErrors { diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/get_group_by_key.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/get_group_by_key.ts similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/get_group_by_key.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/get_group_by_key.ts diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/helpers.test.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/helpers.test.ts similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/helpers.test.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/helpers.test.ts diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/helpers.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/helpers.tsx similarity index 98% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/helpers.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/helpers.tsx index 604cfe41b9128..32d39f9527ef4 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/helpers.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/helpers.tsx @@ -6,7 +6,7 @@ */ import { i18n } from '@kbn/i18n'; -import type { IndexPattern, IndexPatternField } from '../../../types'; +import type { IndexPattern, IndexPatternField } from '../../../../types'; import { GenericIndexPatternColumn, operationDefinitionMap } from '.'; import { FieldBasedIndexPatternColumn, diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/index.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/index.ts similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/index.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/index.ts index 9671807df9622..680331773cd13 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/index.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/index.ts @@ -55,7 +55,7 @@ import { IndexPatternField, OperationMetadata, ParamEditorCustomProps, -} from '../../../types'; +} from '../../../../types'; import type { BaseIndexPatternColumn, IncompleteColumn, @@ -63,7 +63,7 @@ import type { ReferenceBasedIndexPatternColumn, } from './column_types'; import { DataViewDragDropOperation, FormBasedLayer } from '../../types'; -import { DateRange, LayerType } from '../../../../common'; +import { DateRange, LayerType } from '../../../../../common'; import { rangeOperation } from './ranges'; import { FormBasedDimensionEditorProps, OperationSupportMatrix } from '../../dimension_panel'; import type { OriginalColumn } from '../../to_expression'; @@ -207,9 +207,7 @@ export interface FieldInputProps { selectedColumn?: C; columnId: string; indexPattern: IndexPattern; - updateLayer: ( - setter: FormBasedLayer | ((prevLayer: FormBasedLayer) => FormBasedLayer) - ) => void; + updateLayer: (setter: FormBasedLayer | ((prevLayer: FormBasedLayer) => FormBasedLayer)) => void; onDeleteColumn?: () => void; currentFieldIsInvalid: boolean; incompleteField: IncompleteColumn['sourceField'] | null; diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/last_value.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/last_value.test.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/last_value.test.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/last_value.test.tsx index eac2cbad86c73..16c6f2727ea50 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/last_value.test.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/last_value.test.tsx @@ -18,7 +18,7 @@ import { createMockedIndexPattern } from '../../mocks'; import { LastValueIndexPatternColumn } from './last_value'; import { lastValueOperation } from '.'; import type { FormBasedLayer } from '../../types'; -import type { IndexPattern } from '../../../types'; +import type { IndexPattern } from '../../../../types'; import { TermsIndexPatternColumn } from './terms'; import { EuiSwitch, EuiSwitchEvent } from '@elastic/eui'; import { buildExpression, parseExpression } from '@kbn/expressions-plugin/common'; diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/last_value.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/last_value.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/last_value.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/last_value.tsx index 4206cd8109760..59b77cd73fc9d 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/last_value.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/last_value.tsx @@ -20,8 +20,8 @@ import { AggFunctionsMapping } from '@kbn/data-plugin/public'; import { buildExpressionFunction } from '@kbn/expressions-plugin/public'; import { OperationDefinition } from '.'; import { FieldBasedIndexPatternColumn, ValueFormatConfig } from './column_types'; -import type { IndexPatternField, IndexPattern } from '../../../types'; -import { DataType } from '../../../types'; +import type { IndexPatternField, IndexPattern } from '../../../../types'; +import { DataType } from '../../../../types'; import { getFormatFromPreviousColumn, getInvalidFieldMessage, diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/metrics.test.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/metrics.test.ts similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/metrics.test.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/metrics.test.ts diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/metrics.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/metrics.tsx similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/metrics.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/metrics.tsx diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/percentile.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/percentile.test.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/percentile.test.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/percentile.test.tsx index bcb840f81d45c..e78ac9e9360da 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/percentile.test.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/percentile.test.tsx @@ -27,7 +27,7 @@ import { ExpressionAstExpressionBuilder, } from '@kbn/expressions-plugin/public'; import type { OriginalColumn } from '../../to_expression'; -import { IndexPattern } from '../../../types'; +import { IndexPattern } from '../../../../types'; import faker from 'faker'; jest.mock('lodash', () => { diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/percentile.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/percentile.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/percentile.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/percentile.tsx index ec4a3d569e7da..f391e3a6f9a2f 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/percentile.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/percentile.tsx @@ -28,7 +28,7 @@ import { } from './helpers'; import { FieldBasedIndexPatternColumn } from './column_types'; import { adjustTimeScaleLabelSuffix } from '../time_scale_utils'; -import { useDebouncedValue } from '../../../shared_components'; +import { useDebouncedValue } from '../../../../shared_components'; import { getDisallowedPreviousShiftMessage } from '../../time_shift_utils'; import { FormRow } from './shared_components'; import { getColumnReducedTimeRangeError } from '../../reduced_time_range_utils'; diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/percentile_ranks.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/percentile_ranks.test.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/percentile_ranks.test.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/percentile_ranks.test.tsx index bcf535dc1fc55..adb0d8e491fd7 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/percentile_ranks.test.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/percentile_ranks.test.tsx @@ -21,7 +21,7 @@ import { percentileRanksOperation } from '.'; import { FormBasedLayer } from '../../types'; import type { PercentileRanksIndexPatternColumn } from './percentile_ranks'; import { TermsIndexPatternColumn } from './terms'; -import { IndexPattern } from '../../../types'; +import { IndexPattern } from '../../../../types'; jest.mock('lodash', () => { const original = jest.requireActual('lodash'); diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/percentile_ranks.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/percentile_ranks.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/percentile_ranks.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/percentile_ranks.tsx index 45bd05f37372f..3d7b12802858c 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/percentile_ranks.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/percentile_ranks.tsx @@ -22,7 +22,7 @@ import { } from './helpers'; import { FieldBasedIndexPatternColumn } from './column_types'; import { adjustTimeScaleLabelSuffix } from '../time_scale_utils'; -import { useDebouncedValue } from '../../../shared_components'; +import { useDebouncedValue } from '../../../../shared_components'; import { getDisallowedPreviousShiftMessage } from '../../time_shift_utils'; import { FormRow } from './shared_components'; import { getColumnReducedTimeRangeError } from '../../reduced_time_range_utils'; diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/advanced_editor.scss b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/ranges/advanced_editor.scss similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/advanced_editor.scss rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/ranges/advanced_editor.scss diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/advanced_editor.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/ranges/advanced_editor.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/advanced_editor.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/ranges/advanced_editor.tsx index d3f5000646bc9..c3212642e0064 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/advanced_editor.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/ranges/advanced_editor.tsx @@ -28,7 +28,7 @@ import { DraggableBucketContainer, NewBucketButton, useDebounceWithOptions, -} from '../../../../shared_components'; +} from '../../../../../shared_components'; import { RangeTypeLens, isValidRange } from './ranges'; import { FROM_PLACEHOLDER, TO_PLACEHOLDER, TYPING_DEBOUNCE_TIME } from './constants'; import { LabelInput } from '../shared_components'; diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/constants.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/ranges/constants.ts similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/constants.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/ranges/constants.ts diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/index.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/ranges/index.ts similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/index.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/ranges/index.ts diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/range_editor.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/ranges/range_editor.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/range_editor.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/ranges/range_editor.tsx index 92f0196b9cbb5..1f7565c9d31d6 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/range_editor.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/ranges/range_editor.tsx @@ -26,7 +26,7 @@ import { UI_SETTINGS } from '@kbn/data-plugin/public'; import { RangeColumnParams, UpdateParamsFnType, MODES_TYPES } from './ranges'; import { AdvancedRangeEditor } from './advanced_editor'; import { TYPING_DEBOUNCE_TIME, MODES, MIN_HISTOGRAM_BARS } from './constants'; -import { useDebounceWithOptions } from '../../../../shared_components'; +import { useDebounceWithOptions } from '../../../../../shared_components'; import { HelpPopover, HelpPopoverButton } from '../../../help_popover'; const GranularityHelpPopover = () => { diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/ranges.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/ranges/ranges.test.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/ranges.test.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/ranges/ranges.test.tsx index 3c6f8f95d0fe8..d0dd9f6458612 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/ranges.test.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/ranges/ranges.test.tsx @@ -26,9 +26,9 @@ import { SLICES, } from './constants'; import { RangePopover } from './advanced_editor'; -import { DragDropBuckets } from '../../../../shared_components'; +import { DragDropBuckets } from '../../../../../shared_components'; import { getFieldByNameFactory } from '../../../pure_helpers'; -import { IndexPattern } from '../../../../types'; +import { IndexPattern } from '../../../../../types'; // mocking random id generator function jest.mock('@elastic/eui', () => { diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/ranges.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/ranges/ranges.tsx similarity index 98% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/ranges.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/ranges/ranges.tsx index 52c9471aefe0e..2dab571dcfc39 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/ranges/ranges.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/ranges/ranges.tsx @@ -15,9 +15,9 @@ import { RangeEditor } from './range_editor'; import { OperationDefinition } from '..'; import { FieldBasedIndexPatternColumn } from '../column_types'; import { updateColumnParam } from '../../layer_helpers'; -import { supportedFormats } from '../../../../../common/expressions/format_column/supported_formats'; +import { supportedFormats } from '../../../../../../common/expressions/format_column/supported_formats'; import { MODES, AUTO_BARS, DEFAULT_INTERVAL, MIN_HISTOGRAM_BARS, SLICES } from './constants'; -import { IndexPattern, IndexPatternField } from '../../../../types'; +import { IndexPattern, IndexPatternField } from '../../../../../types'; import { getInvalidFieldMessage, isValidNumber } from '../helpers'; type RangeType = Omit; diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/shared_components/form_row.scss b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/shared_components/form_row.scss similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/shared_components/form_row.scss rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/shared_components/form_row.scss diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/shared_components/form_row.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/shared_components/form_row.tsx similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/shared_components/form_row.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/shared_components/form_row.tsx diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/shared_components/index.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/shared_components/index.tsx similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/shared_components/index.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/shared_components/index.tsx diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/shared_components/label_input.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/shared_components/label_input.tsx similarity index 96% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/shared_components/label_input.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/shared_components/label_input.tsx index 4bc461aaa319b..9d8730d38216a 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/shared_components/label_input.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/shared_components/label_input.tsx @@ -8,7 +8,7 @@ import React, { useRef } from 'react'; import { EuiFieldText, keys } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { useDebouncedValue } from '../../../../shared_components'; +import { useDebouncedValue } from '../../../../../shared_components'; export const LabelInput = ({ value, diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/static_value.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/static_value.test.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/static_value.test.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/static_value.test.tsx index fd124ff93d92a..0ed6a60677f73 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/static_value.test.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/static_value.test.tsx @@ -18,7 +18,7 @@ import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; import { createMockedIndexPattern } from '../../mocks'; import { staticValueOperation } from '.'; import { FormBasedLayer } from '../../types'; -import { IndexPattern } from '../../../types'; +import { IndexPattern } from '../../../../types'; import { StaticValueIndexPatternColumn } from './static_value'; import { TermsIndexPatternColumn } from './terms'; diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/static_value.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/static_value.tsx similarity index 98% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/static_value.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/static_value.tsx index 61fcb290df95b..5292fac547b60 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/static_value.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/static_value.tsx @@ -13,8 +13,8 @@ import { GenericIndexPatternColumn, ValueFormatConfig, } from './column_types'; -import type { IndexPattern } from '../../../types'; -import { useDebouncedValue } from '../../../shared_components'; +import type { IndexPattern } from '../../../../types'; +import { useDebouncedValue } from '../../../../shared_components'; import { getFormatFromPreviousColumn, isValidNumber } from './helpers'; import { getColumnOrder } from '../layer_helpers'; diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/constants.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/constants.ts similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/constants.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/constants.ts diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/field_inputs.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/field_inputs.tsx similarity index 98% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/field_inputs.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/field_inputs.tsx index d22fc5392f2cc..17b0e5e475ffd 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/field_inputs.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/field_inputs.tsx @@ -8,14 +8,14 @@ import React, { useCallback, useMemo } from 'react'; import { htmlIdGenerator } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { ExistingFieldsMap, IndexPattern } from '../../../../types'; +import { ExistingFieldsMap, IndexPattern } from '../../../../../types'; import { DragDropBuckets, FieldsBucketContainer, NewBucketButton, useDebouncedValue, DraggableBucketContainer, -} from '../../../../shared_components'; +} from '../../../../../shared_components'; import { FieldSelect } from '../../../dimension_panel/field_select'; import type { TermsIndexPatternColumn } from './types'; import type { OperationSupportMatrix } from '../../../dimension_panel'; diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/helpers.test.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/helpers.test.ts similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/helpers.test.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/helpers.test.ts index 7909701e1d15c..35ad34b5b0583 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/helpers.test.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/helpers.test.ts @@ -7,7 +7,7 @@ import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; import { coreMock as corePluginMock } from '@kbn/core/public/mocks'; -import type { FrameDatasourceAPI } from '../../../../types'; +import type { FrameDatasourceAPI } from '../../../../../types'; import type { CountIndexPatternColumn } from '..'; import type { TermsIndexPatternColumn } from './types'; import type { GenericIndexPatternColumn } from '../../../form_based'; diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/helpers.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/helpers.ts similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/helpers.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/helpers.ts index a4ac3a5894853..27e6dc7b69d71 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/helpers.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/helpers.ts @@ -16,7 +16,7 @@ import { GenericIndexPatternColumn, operationDefinitionMap } from '..'; import { defaultLabel } from '../filters'; import { isReferenced } from '../../layer_helpers'; -import type { FrameDatasourceAPI, IndexPattern, IndexPatternField } from '../../../../types'; +import type { FrameDatasourceAPI, IndexPattern, IndexPatternField } from '../../../../../types'; import type { FiltersIndexPatternColumn } from '..'; import type { TermsIndexPatternColumn } from './types'; import type { LastValueIndexPatternColumn } from '../last_value'; diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/include_exclude_options.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/include_exclude_options.test.tsx similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/include_exclude_options.test.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/include_exclude_options.test.tsx diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/include_exclude_options.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/include_exclude_options.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/include_exclude_options.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/include_exclude_options.tsx index 212e213ff27eb..9a2af1474fd46 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/include_exclude_options.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/include_exclude_options.tsx @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n'; import { uniq } from 'lodash'; import { EuiComboBox, EuiFormRow, EuiSpacer, EuiSwitch, EuiFieldText, EuiText } from '@elastic/eui'; import type { DatatableRow } from '@kbn/expressions-plugin/common'; -import { useDebouncedValue } from '../../../../shared_components'; +import { useDebouncedValue } from '../../../../../shared_components'; export interface IncludeExcludeOptions { label: string; diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/index.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/index.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/index.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/index.tsx index 1f4b4846906d4..57e0688363eed 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/index.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/index.tsx @@ -25,9 +25,9 @@ import { import { uniq } from 'lodash'; import { AggFunctionsMapping } from '@kbn/data-plugin/public'; import { buildExpressionFunction } from '@kbn/expressions-plugin/public'; -import { DOCUMENT_FIELD_NAME } from '../../../../../common'; +import { DOCUMENT_FIELD_NAME } from '../../../../../../common'; import { insertOrReplaceColumn, updateColumnParam, updateDefaultLabels } from '../../layer_helpers'; -import type { DataType, OperationMetadata } from '../../../../types'; +import type { DataType, OperationMetadata } from '../../../../../types'; import { OperationDefinition } from '..'; import { FieldBasedIndexPatternColumn, @@ -42,7 +42,7 @@ import { getErrorMessage, } from '../../../dimension_panel/field_input'; import type { TermsIndexPatternColumn } from './types'; -import type { IndexPatternField } from '../../../../types'; +import type { IndexPatternField } from '../../../../../types'; import { getDisallowedTermsMessage, getMultiTermsScriptedFieldErrorMessage, diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/terms.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/terms.test.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/terms.test.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/terms.test.tsx index 80e4d3638dddd..58f2f479f401a 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/terms.test.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/terms.test.tsx @@ -26,12 +26,12 @@ import { operationDefinitionMap, } from '..'; import { FormBasedLayer, FormBasedPrivateState } from '../../../types'; -import { FrameDatasourceAPI } from '../../../../types'; +import { FrameDatasourceAPI } from '../../../../../types'; import { DateHistogramIndexPatternColumn } from '../date_histogram'; import { getOperationSupportMatrix } from '../../../dimension_panel/operation_support'; import { FieldSelect } from '../../../dimension_panel/field_select'; import { ReferenceEditor } from '../../../dimension_panel/reference_editor'; -import { IndexPattern } from '../../../../types'; +import { IndexPattern } from '../../../../../types'; import { cloneDeep } from 'lodash'; import { IncludeExcludeRow } from './include_exclude_options'; diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/types.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/types.ts similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/types.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/types.ts diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/values_input.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/values_input.test.tsx similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/values_input.test.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/values_input.test.tsx diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/values_input.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/values_input.tsx similarity index 97% rename from x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/values_input.tsx rename to x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/values_input.tsx index 9e86ea8525adc..33dd5b7206008 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/definitions/terms/values_input.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/values_input.tsx @@ -8,7 +8,7 @@ import React, { useState } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiFieldNumber, EuiFormRow } from '@elastic/eui'; -import { useDebounceWithOptions } from '../../../../shared_components'; +import { useDebounceWithOptions } from '../../../../../shared_components'; export const ValuesInput = ({ value, diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/index.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/index.ts similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/index.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/index.ts diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/layer_helpers.test.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/layer_helpers.test.ts similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/layer_helpers.test.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/layer_helpers.test.ts index c07ae9fa688cd..65b11c2605cc3 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/layer_helpers.test.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/layer_helpers.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { OperationMetadata } from '../../types'; +import type { OperationMetadata } from '../../../types'; import { copyColumn, insertNewColumn, @@ -26,7 +26,7 @@ import { AvgIndexPatternColumn } from './definitions/metrics'; import type { FormBasedLayer, FormBasedPrivateState } from '../types'; import { documentField } from '../document_field'; import { getFieldByNameFactory } from '../pure_helpers'; -import { generateId } from '../../id_generator'; +import { generateId } from '../../../id_generator'; import { createMockedFullReference, createMockedManagedReference } from './mocks'; import { FiltersIndexPatternColumn, @@ -38,13 +38,13 @@ import { } from './definitions'; import { TinymathAST } from '@kbn/tinymath'; import { CoreStart } from '@kbn/core/public'; -import { IndexPattern } from '../../types'; +import { IndexPattern } from '../../../types'; import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; const dataMock = dataPluginMock.createStartContract(); jest.mock('.'); -jest.mock('../../id_generator'); +jest.mock('../../../id_generator'); jest.mock('../dimension_panel/reference_editor', () => ({ ReferenceEditor: () => null, })); diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/layer_helpers.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/layer_helpers.ts similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/layer_helpers.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/layer_helpers.ts index ade932cf24c7b..76c7a7bbf4475 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/layer_helpers.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/layer_helpers.ts @@ -17,7 +17,7 @@ import type { IndexPatternField, OperationMetadata, VisualizationDimensionGroupConfig, -} from '../../types'; +} from '../../../types'; import { operationDefinitionMap, operationDefinitions, @@ -27,23 +27,19 @@ import { GenericOperationDefinition, TermsIndexPatternColumn, } from './definitions'; -import type { - DataViewDragDropOperation, - FormBasedLayer, - FormBasedPrivateState, -} from '../types'; +import type { DataViewDragDropOperation, FormBasedLayer, FormBasedPrivateState } from '../types'; import { getSortScoreByPriorityForField } from './operations'; -import { generateId } from '../../id_generator'; +import { generateId } from '../../../id_generator'; import { GenericIndexPatternColumn, ReferenceBasedIndexPatternColumn, BaseIndexPatternColumn, } from './definitions/column_types'; import { FormulaIndexPatternColumn, insertOrReplaceFormulaColumn } from './definitions/formula'; -import type { TimeScaleUnit } from '../../../common/expressions'; +import type { TimeScaleUnit } from '../../../../common/expressions'; import { documentField } from '../document_field'; import { isColumnOfType } from './definitions/helpers'; -import { DataType } from '../..'; +import { DataType } from '../../..'; export interface ColumnAdvancedParams { filter?: Query | undefined; diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/mocks.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/mocks.ts similarity index 97% rename from x-pack/plugins/lens/public/form_based_datasource/operations/mocks.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/mocks.ts index 2d7e70179fb3f..3884bab02f200 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/mocks.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/mocks.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { OperationMetadata } from '../../types'; +import type { OperationMetadata } from '../../../types'; import type { OperationType } from './definitions'; export const createMockedFullReference = () => { diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/operations.test.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/operations.test.ts similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/operations/operations.test.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/operations.test.ts diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/operations.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/operations.ts similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/operations/operations.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/operations.ts index 27071e5f0ee74..b44c0a0e4cc55 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/operations.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/operations.ts @@ -6,7 +6,7 @@ */ import { memoize } from 'lodash'; -import type { IndexPattern, IndexPatternField, OperationMetadata } from '../../types'; +import type { IndexPattern, IndexPatternField, OperationMetadata } from '../../../types'; import { operationDefinitionMap, operationDefinitions, diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/time_scale_utils.test.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/time_scale_utils.test.ts similarity index 98% rename from x-pack/plugins/lens/public/form_based_datasource/operations/time_scale_utils.test.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/time_scale_utils.test.ts index 559086cf69b84..e249be575aac2 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/time_scale_utils.test.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/time_scale_utils.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { TimeScaleUnit } from '../../../common/expressions'; +import type { TimeScaleUnit } from '../../../../common/expressions'; import { adjustTimeScaleLabelSuffix } from './time_scale_utils'; export const DEFAULT_TIME_SCALE = 's' as TimeScaleUnit; diff --git a/x-pack/plugins/lens/public/form_based_datasource/operations/time_scale_utils.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/time_scale_utils.ts similarity index 92% rename from x-pack/plugins/lens/public/form_based_datasource/operations/time_scale_utils.ts rename to x-pack/plugins/lens/public/datasources/form_based/operations/time_scale_utils.ts index 1ebf4ccc76a36..08dfa147bf88e 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/operations/time_scale_utils.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/time_scale_utils.ts @@ -6,8 +6,8 @@ */ import { i18n } from '@kbn/i18n'; -import { unitSuffixesLong } from '../../../common/suffix_formatter'; -import type { TimeScaleUnit } from '../../../common/expressions'; +import { unitSuffixesLong } from '../../../../common/suffix_formatter'; +import type { TimeScaleUnit } from '../../../../common/expressions'; export const DEFAULT_TIME_SCALE = 's' as TimeScaleUnit; diff --git a/x-pack/plugins/lens/public/form_based_datasource/pure_helpers.ts b/x-pack/plugins/lens/public/datasources/form_based/pure_helpers.ts similarity index 92% rename from x-pack/plugins/lens/public/form_based_datasource/pure_helpers.ts rename to x-pack/plugins/lens/public/datasources/form_based/pure_helpers.ts index ba3ba9bbb824f..6355809369804 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/pure_helpers.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/pure_helpers.ts @@ -6,7 +6,7 @@ */ import { keyBy } from 'lodash'; -import { IndexPatternField } from '../types'; +import { IndexPatternField } from '../../types'; import { documentField } from './document_field'; export function getFieldByNameFactory( diff --git a/x-pack/plugins/lens/public/form_based_datasource/pure_utils.ts b/x-pack/plugins/lens/public/datasources/form_based/pure_utils.ts similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/pure_utils.ts rename to x-pack/plugins/lens/public/datasources/form_based/pure_utils.ts index f19965f969cb7..5d8d823c30ab4 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/pure_utils.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/pure_utils.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { DataType, IndexPattern, IndexPatternField } from '../types'; +import type { DataType, IndexPattern, IndexPatternField } from '../../types'; import type { FormBasedLayer } from './types'; import type { BaseIndexPatternColumn, diff --git a/x-pack/plugins/lens/public/form_based_datasource/reduced_time_range_utils.tsx b/x-pack/plugins/lens/public/datasources/form_based/reduced_time_range_utils.tsx similarity index 98% rename from x-pack/plugins/lens/public/form_based_datasource/reduced_time_range_utils.tsx rename to x-pack/plugins/lens/public/datasources/form_based/reduced_time_range_utils.tsx index 5669f0cf21938..69e0fb4f07a5e 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/reduced_time_range_utils.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/reduced_time_range_utils.tsx @@ -7,7 +7,7 @@ import { i18n } from '@kbn/i18n'; import type { FormBasedLayer } from './types'; -import type { IndexPattern } from '../types'; +import type { IndexPattern } from '../../types'; export const reducedTimeRangeOptions = [ { diff --git a/x-pack/plugins/lens/public/form_based_datasource/state_helpers.ts b/x-pack/plugins/lens/public/datasources/form_based/state_helpers.ts similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/state_helpers.ts rename to x-pack/plugins/lens/public/datasources/form_based/state_helpers.ts diff --git a/x-pack/plugins/lens/public/form_based_datasource/time_shift_utils.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/time_shift_utils.test.tsx similarity index 100% rename from x-pack/plugins/lens/public/form_based_datasource/time_shift_utils.test.tsx rename to x-pack/plugins/lens/public/datasources/form_based/time_shift_utils.test.tsx diff --git a/x-pack/plugins/lens/public/form_based_datasource/time_shift_utils.tsx b/x-pack/plugins/lens/public/datasources/form_based/time_shift_utils.tsx similarity index 98% rename from x-pack/plugins/lens/public/form_based_datasource/time_shift_utils.tsx rename to x-pack/plugins/lens/public/datasources/form_based/time_shift_utils.tsx index f4c4a30917535..6dd4b88d3422a 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/time_shift_utils.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/time_shift_utils.tsx @@ -13,12 +13,8 @@ import type { DatatableUtilitiesService } from '@kbn/data-plugin/common'; import { Datatable } from '@kbn/expressions-plugin/common'; import { search } from '@kbn/data-plugin/public'; import { parseTimeShift } from '@kbn/data-plugin/common'; -import type { - GenericIndexPatternColumn, - FormBasedLayer, - FormBasedPrivateState, -} from './types'; -import type { FramePublicAPI, IndexPattern } from '../types'; +import type { GenericIndexPatternColumn, FormBasedLayer, FormBasedPrivateState } from './types'; +import type { FramePublicAPI, IndexPattern } from '../../types'; export const timeShiftOptions = [ { diff --git a/x-pack/plugins/lens/public/form_based_datasource/to_expression.ts b/x-pack/plugins/lens/public/datasources/form_based/to_expression.ts similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/to_expression.ts rename to x-pack/plugins/lens/public/datasources/form_based/to_expression.ts index 1a287275b1951..fc77aa6520bd0 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/to_expression.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/to_expression.ts @@ -26,7 +26,7 @@ import { FormBasedPrivateState, FormBasedLayer } from './types'; import { DateHistogramIndexPatternColumn, RangeIndexPatternColumn } from './operations/definitions'; import { FormattedIndexPatternColumn } from './operations/definitions/column_types'; import { isColumnFormatted, isColumnOfType } from './operations/definitions/helpers'; -import type { IndexPattern, IndexPatternMap } from '../types'; +import type { IndexPattern, IndexPatternMap } from '../../types'; import { dedupeAggs } from './dedupe_aggs'; export type OriginalColumn = { id: string } & GenericIndexPatternColumn; diff --git a/x-pack/plugins/lens/public/form_based_datasource/types.ts b/x-pack/plugins/lens/public/datasources/form_based/types.ts similarity index 89% rename from x-pack/plugins/lens/public/form_based_datasource/types.ts rename to x-pack/plugins/lens/public/datasources/form_based/types.ts index 2bb663e7ddc2d..2d33ed0bc1451 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/types.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/types.ts @@ -4,10 +4,9 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import type { DragDropIdentifier } from '../drag_drop/providers'; +import type { DragDropIdentifier } from '../../drag_drop/providers'; import type { IncompleteColumn, GenericIndexPatternColumn } from './operations'; -import type { DragDropOperation } from '../types'; -import type { IndexPattern, IndexPatternField } from '../types'; +import type { IndexPattern, IndexPatternField, DragDropOperation } from '../../types'; export type { GenericIndexPatternColumn, @@ -60,7 +59,7 @@ export interface FormBasedPersistedState { layers: Record>; } -export type PersistedFormBasedLayer = Omit; +export type PersistedIndexPatternLayer = Omit; export interface FormBasedPrivateState { currentIndexPatternId: string; diff --git a/x-pack/plugins/lens/public/form_based_datasource/utils.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/utils.test.tsx similarity index 99% rename from x-pack/plugins/lens/public/form_based_datasource/utils.test.tsx rename to x-pack/plugins/lens/public/datasources/form_based/utils.test.tsx index 7997170f2f4f3..5349e433f3cac 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/utils.test.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/utils.test.tsx @@ -10,7 +10,7 @@ import { shallow } from 'enzyme'; import { createDatatableUtilitiesMock } from '@kbn/data-plugin/common/mocks'; import { getPrecisionErrorWarningMessages, cloneLayer } from './utils'; import type { FormBasedPrivateState, GenericIndexPatternColumn } from './types'; -import type { FramePublicAPI } from '../types'; +import type { FramePublicAPI } from '../../types'; import type { DocLinksStart } from '@kbn/core/public'; import { EuiButton } from '@elastic/eui'; import { TermsIndexPatternColumn } from './operations'; diff --git a/x-pack/plugins/lens/public/form_based_datasource/utils.tsx b/x-pack/plugins/lens/public/datasources/form_based/utils.tsx similarity index 98% rename from x-pack/plugins/lens/public/form_based_datasource/utils.tsx rename to x-pack/plugins/lens/public/datasources/form_based/utils.tsx index bf6195912005b..04f10593cc8e0 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/utils.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/utils.tsx @@ -17,13 +17,9 @@ import type { DatatableColumn } from '@kbn/expressions-plugin/common'; import { groupBy, escape, uniq } from 'lodash'; import type { Query } from '@kbn/data-plugin/common'; import { SearchResponseWarning } from '@kbn/data-plugin/public/search/types'; -import type { FramePublicAPI, IndexPattern, StateSetter } from '../types'; -import { renewIDs } from '../utils'; -import type { - FormBasedLayer, - FormBasedPersistedState, - FormBasedPrivateState, -} from './types'; +import type { FramePublicAPI, IndexPattern, StateSetter } from '../../types'; +import { renewIDs } from '../../utils'; +import type { FormBasedLayer, FormBasedPersistedState, FormBasedPrivateState } from './types'; import type { ReferenceBasedIndexPatternColumn } from './operations/definitions/column_types'; import { @@ -44,8 +40,8 @@ import { hasField } from './pure_utils'; import { mergeLayer } from './state_helpers'; import { supportsRarityRanking } from './operations/definitions/terms'; import { DEFAULT_MAX_DOC_COUNT } from './operations/definitions/terms/constants'; -import { getOriginalId } from '../../common/expressions'; -import { isQueryValid } from '../shared_components'; +import { getOriginalId } from '../../../common/expressions'; +import { isQueryValid } from '../../shared_components'; export function isColumnInvalid( layer: FormBasedLayer, diff --git a/x-pack/plugins/lens/public/form_based_datasource/visualize_geo_field_button.tsx b/x-pack/plugins/lens/public/datasources/form_based/visualize_geo_field_button.tsx similarity index 95% rename from x-pack/plugins/lens/public/form_based_datasource/visualize_geo_field_button.tsx rename to x-pack/plugins/lens/public/datasources/form_based/visualize_geo_field_button.tsx index 308e66dc6bd38..b4be140f37313 100644 --- a/x-pack/plugins/lens/public/form_based_datasource/visualize_geo_field_button.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/visualize_geo_field_button.tsx @@ -13,8 +13,8 @@ import { VISUALIZE_GEO_FIELD_TRIGGER, UiActionsStart, } from '@kbn/ui-actions-plugin/public'; -import { APP_ID } from '../../common/constants'; -import { IndexPattern } from '../types'; +import { APP_ID } from '../../../common/constants'; +import { IndexPattern } from '../../types'; interface Props { indexPattern: IndexPattern; diff --git a/x-pack/plugins/lens/public/text_based_datasource/datapanel.test.tsx b/x-pack/plugins/lens/public/datasources/text_based/datapanel.test.tsx similarity index 96% rename from x-pack/plugins/lens/public/text_based_datasource/datapanel.test.tsx rename to x-pack/plugins/lens/public/datasources/text_based/datapanel.test.tsx index 5f6c1b2702349..781b6547f8e15 100644 --- a/x-pack/plugins/lens/public/text_based_datasource/datapanel.test.tsx +++ b/x-pack/plugins/lens/public/datasources/text_based/datapanel.test.tsx @@ -26,11 +26,11 @@ import type { TextBasedPrivateState } from './types'; import { mountWithIntl } from '@kbn/test-jest-helpers'; import { uiActionsPluginMock } from '@kbn/ui-actions-plugin/public/mocks'; -import { createIndexPatternServiceMock } from '../mocks/data_views_service_mock'; -import { createMockFramePublicAPI } from '../mocks'; +import { createIndexPatternServiceMock } from '../../mocks/data_views_service_mock'; +import { createMockFramePublicAPI } from '../../mocks'; import { createMockedDragDropContext } from './mocks'; -import { DataViewsState } from '../state_management'; -import { ExistingFieldsMap, IndexPattern } from '../types'; +import { DataViewsState } from '../../state_management'; +import { ExistingFieldsMap, IndexPattern } from '../../types'; const fieldsFromQuery = [ { diff --git a/x-pack/plugins/lens/public/text_based_datasource/datapanel.tsx b/x-pack/plugins/lens/public/datasources/text_based/datapanel.tsx similarity index 96% rename from x-pack/plugins/lens/public/text_based_datasource/datapanel.tsx rename to x-pack/plugins/lens/public/datasources/text_based/datapanel.tsx index 3c5492775d1f1..d924ce5675d24 100644 --- a/x-pack/plugins/lens/public/text_based_datasource/datapanel.tsx +++ b/x-pack/plugins/lens/public/datasources/text_based/datapanel.tsx @@ -17,12 +17,12 @@ import { isOfAggregateQueryType } from '@kbn/es-query'; import { ExpressionsStart } from '@kbn/expressions-plugin/public'; import { FieldButton } from '@kbn/react-field'; import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; -import { DatasourceDataPanelProps, DataType } from '../types'; +import { DatasourceDataPanelProps, DataType } from '../../types'; import type { TextBasedPrivateState } from './types'; import { getStateFromAggregateQuery } from './utils'; -import { DragDrop } from '../drag_drop'; -import { LensFieldIcon } from '../shared_components'; -import { ChildDragDropProvider } from '../drag_drop'; +import { DragDrop } from '../../drag_drop'; +import { LensFieldIcon } from '../../shared_components'; +import { ChildDragDropProvider } from '../../drag_drop'; export type TextBasedDataPanelProps = DatasourceDataPanelProps & { data: DataPublicPluginStart; diff --git a/x-pack/plugins/lens/public/text_based_datasource/fetch_data_from_aggregate_query.ts b/x-pack/plugins/lens/public/datasources/text_based/fetch_data_from_aggregate_query.ts similarity index 100% rename from x-pack/plugins/lens/public/text_based_datasource/fetch_data_from_aggregate_query.ts rename to x-pack/plugins/lens/public/datasources/text_based/fetch_data_from_aggregate_query.ts diff --git a/x-pack/plugins/lens/public/text_based_datasource/field_select.test.tsx b/x-pack/plugins/lens/public/datasources/text_based/field_select.test.tsx similarity index 96% rename from x-pack/plugins/lens/public/text_based_datasource/field_select.test.tsx rename to x-pack/plugins/lens/public/datasources/text_based/field_select.test.tsx index f1051f3b8f61d..b344131747b1b 100644 --- a/x-pack/plugins/lens/public/text_based_datasource/field_select.test.tsx +++ b/x-pack/plugins/lens/public/datasources/text_based/field_select.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import type { DatatableColumn } from '@kbn/expressions-plugin/public'; -import { FieldPicker, FieldOptionValue } from '../shared_components/field_picker'; +import { FieldPicker, FieldOptionValue } from '../../shared_components/field_picker'; import { FieldSelect, FieldSelectProps } from './field_select'; import { shallowWithIntl as shallow } from '@kbn/test-jest-helpers'; diff --git a/x-pack/plugins/lens/public/text_based_datasource/field_select.tsx b/x-pack/plugins/lens/public/datasources/text_based/field_select.tsx similarity index 94% rename from x-pack/plugins/lens/public/text_based_datasource/field_select.tsx rename to x-pack/plugins/lens/public/datasources/text_based/field_select.tsx index 893f3d337a6e5..e7cb5451d31ab 100644 --- a/x-pack/plugins/lens/public/text_based_datasource/field_select.tsx +++ b/x-pack/plugins/lens/public/datasources/text_based/field_select.tsx @@ -9,9 +9,9 @@ import React, { useMemo } from 'react'; import { EuiComboBoxOptionOption, EuiComboBoxProps } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import type { DatatableColumn } from '@kbn/expressions-plugin/public'; -import { FieldPicker, FieldOptionValue, FieldOption } from '../shared_components/field_picker'; +import { FieldPicker, FieldOptionValue, FieldOption } from '../../shared_components/field_picker'; import type { TextBasedLayerColumn } from './types'; -import type { DataType } from '../types'; +import type { DataType } from '../../types'; export interface FieldSelectProps extends EuiComboBoxProps { selectedField?: TextBasedLayerColumn; diff --git a/x-pack/plugins/lens/public/text_based_datasource/index.ts b/x-pack/plugins/lens/public/datasources/text_based/index.ts similarity index 91% rename from x-pack/plugins/lens/public/text_based_datasource/index.ts rename to x-pack/plugins/lens/public/datasources/text_based/index.ts index 4fc1eb821a596..1041e94eb7c61 100644 --- a/x-pack/plugins/lens/public/text_based_datasource/index.ts +++ b/x-pack/plugins/lens/public/datasources/text_based/index.ts @@ -10,7 +10,7 @@ import { Storage } from '@kbn/kibana-utils-plugin/public'; import { ExpressionsStart } from '@kbn/expressions-plugin/public'; import { DataPublicPluginSetup, DataPublicPluginStart } from '@kbn/data-plugin/public'; import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; -import { EditorFrameSetup } from '../types'; +import { EditorFrameSetup } from '../../types'; export interface TextBasedSetupPlugins { data: DataPublicPluginSetup; @@ -28,7 +28,7 @@ export class TextBasedDatasource { setup(core: CoreSetup, { editorFrame }: TextBasedSetupPlugins) { editorFrame.registerDatasource(async () => { - const { getTextBasedDatasource } = await import('../async_services'); + const { getTextBasedDatasource } = await import('../../async_services'); const [coreStart, { data, dataViews, expressions }] = await core.getStartServices(); return getTextBasedDatasource({ diff --git a/x-pack/plugins/lens/public/text_based_datasource/layerpanel.test.tsx b/x-pack/plugins/lens/public/datasources/text_based/layerpanel.test.tsx similarity index 93% rename from x-pack/plugins/lens/public/text_based_datasource/layerpanel.test.tsx rename to x-pack/plugins/lens/public/datasources/text_based/layerpanel.test.tsx index de53f8122137d..f0a9d147ddfd6 100644 --- a/x-pack/plugins/lens/public/text_based_datasource/layerpanel.test.tsx +++ b/x-pack/plugins/lens/public/datasources/text_based/layerpanel.test.tsx @@ -8,11 +8,11 @@ import React from 'react'; import type { DatatableColumn } from '@kbn/expressions-plugin/public'; import { TextBasedPrivateState } from './types'; -import type { DataViewsState } from '../state_management/types'; +import type { DataViewsState } from '../../state_management/types'; import { TextBasedLayerPanelProps, LayerPanel } from './layerpanel'; import { shallowWithIntl as shallow } from '@kbn/test-jest-helpers'; -import { ChangeIndexPattern } from '../shared_components/dataview_picker/dataview_picker'; +import { ChangeIndexPattern } from '../../shared_components/dataview_picker/dataview_picker'; const fields = [ { diff --git a/x-pack/plugins/lens/public/text_based_datasource/layerpanel.tsx b/x-pack/plugins/lens/public/datasources/text_based/layerpanel.tsx similarity index 90% rename from x-pack/plugins/lens/public/text_based_datasource/layerpanel.tsx rename to x-pack/plugins/lens/public/datasources/text_based/layerpanel.tsx index a01adb7ff9730..879d28a607c7f 100644 --- a/x-pack/plugins/lens/public/text_based_datasource/layerpanel.tsx +++ b/x-pack/plugins/lens/public/datasources/text_based/layerpanel.tsx @@ -8,9 +8,9 @@ import React from 'react'; import { I18nProvider } from '@kbn/i18n-react'; import { i18n } from '@kbn/i18n'; -import { DatasourceLayerPanelProps } from '../types'; +import { DatasourceLayerPanelProps } from '../../types'; import { TextBasedPrivateState } from './types'; -import { ChangeIndexPattern } from '../shared_components/dataview_picker/dataview_picker'; +import { ChangeIndexPattern } from '../../shared_components/dataview_picker/dataview_picker'; export interface TextBasedLayerPanelProps extends DatasourceLayerPanelProps { state: TextBasedPrivateState; diff --git a/x-pack/plugins/lens/public/text_based_datasource/mocks.ts b/x-pack/plugins/lens/public/datasources/text_based/mocks.ts similarity index 92% rename from x-pack/plugins/lens/public/text_based_datasource/mocks.ts rename to x-pack/plugins/lens/public/datasources/text_based/mocks.ts index adca02ab2299d..8b191b815100e 100644 --- a/x-pack/plugins/lens/public/text_based_datasource/mocks.ts +++ b/x-pack/plugins/lens/public/datasources/text_based/mocks.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { DragContextState } from '../drag_drop'; +import { DragContextState } from '../../drag_drop'; export function createMockedDragDropContext(): jest.Mocked { return { diff --git a/x-pack/plugins/lens/public/text_based_datasource/text_based_languages.test.ts b/x-pack/plugins/lens/public/datasources/text_based/text_based_languages.test.ts similarity index 98% rename from x-pack/plugins/lens/public/text_based_datasource/text_based_languages.test.ts rename to x-pack/plugins/lens/public/datasources/text_based/text_based_languages.test.ts index 93bc195a4968b..67c3a1b06bdb9 100644 --- a/x-pack/plugins/lens/public/text_based_datasource/text_based_languages.test.ts +++ b/x-pack/plugins/lens/public/datasources/text_based/text_based_languages.test.ts @@ -12,10 +12,10 @@ import { TextBasedPersistedState, TextBasedPrivateState } from './types'; import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; import { getTextBasedDatasource } from './text_based_languages'; -import { generateId } from '../id_generator'; -import { DatasourcePublicAPI, Datasource } from '../types'; +import { generateId } from '../../id_generator'; +import { DatasourcePublicAPI, Datasource } from '../../types'; -jest.mock('../id_generator'); +jest.mock('../../id_generator'); const fieldsOne = [ { @@ -79,10 +79,7 @@ const indexPatterns = expectedIndexPatterns; describe('IndexPattern Data Source', () => { let baseState: TextBasedPrivateState; - let TextBasedDatasource: Datasource< - TextBasedPrivateState, - TextBasedPersistedState - >; + let TextBasedDatasource: Datasource; beforeEach(() => { TextBasedDatasource = getTextBasedDatasource({ @@ -515,9 +512,7 @@ describe('IndexPattern Data Source', () => { describe('#toExpression', () => { it('should generate an empty expression when no columns are selected', async () => { const state = TextBasedDatasource.initialize(); - expect(TextBasedDatasource.toExpression(state, 'first', indexPatterns)).toEqual( - null - ); + expect(TextBasedDatasource.toExpression(state, 'first', indexPatterns)).toEqual(null); }); it('should generate an expression for an SQL query', async () => { diff --git a/x-pack/plugins/lens/public/text_based_datasource/text_based_languages.tsx b/x-pack/plugins/lens/public/datasources/text_based/text_based_languages.tsx similarity index 99% rename from x-pack/plugins/lens/public/text_based_datasource/text_based_languages.tsx rename to x-pack/plugins/lens/public/datasources/text_based/text_based_languages.tsx index dde2fc152674c..eb67eac52d9a7 100644 --- a/x-pack/plugins/lens/public/text_based_datasource/text_based_languages.tsx +++ b/x-pack/plugins/lens/public/datasources/text_based/text_based_languages.tsx @@ -25,8 +25,8 @@ import { DataType, TableChangeType, DatasourceDimensionTriggerProps, -} from '../types'; -import { generateId } from '../id_generator'; +} from '../../types'; +import { generateId } from '../../id_generator'; import { toExpression } from './to_expression'; import { TextBasedDataPanel } from './datapanel'; import type { @@ -36,7 +36,7 @@ import type { TextBasedField, } from './types'; import { FieldSelect } from './field_select'; -import type { Datasource, IndexPatternMap } from '../types'; +import type { Datasource, IndexPatternMap } from '../../types'; import { LayerPanel } from './layerpanel'; function getLayerReferenceName(layerId: string) { diff --git a/x-pack/plugins/lens/public/text_based_datasource/to_expression.ts b/x-pack/plugins/lens/public/datasources/text_based/to_expression.ts similarity index 91% rename from x-pack/plugins/lens/public/text_based_datasource/to_expression.ts rename to x-pack/plugins/lens/public/datasources/text_based/to_expression.ts index aa3b2f51637f9..dba9a93555ce2 100644 --- a/x-pack/plugins/lens/public/text_based_datasource/to_expression.ts +++ b/x-pack/plugins/lens/public/datasources/text_based/to_expression.ts @@ -7,13 +7,10 @@ import { Ast } from '@kbn/interpreter'; import { textBasedQueryStateToExpressionAst } from '@kbn/data-plugin/common'; -import type { OriginalColumn } from '../../common/types'; +import type { OriginalColumn } from '../../../common/types'; import { TextBasedPrivateState, TextBasedLayer, IndexPatternRef } from './types'; -function getExpressionForLayer( - layer: TextBasedLayer, - refs: IndexPatternRef[] -): Ast | null { +function getExpressionForLayer(layer: TextBasedLayer, refs: IndexPatternRef[]): Ast | null { if (!layer.columns || layer.columns?.length === 0) { return null; } diff --git a/x-pack/plugins/lens/public/text_based_datasource/types.ts b/x-pack/plugins/lens/public/datasources/text_based/types.ts similarity index 95% rename from x-pack/plugins/lens/public/text_based_datasource/types.ts rename to x-pack/plugins/lens/public/datasources/text_based/types.ts index 17fad0d8ffde0..0e30e0d517054 100644 --- a/x-pack/plugins/lens/public/text_based_datasource/types.ts +++ b/x-pack/plugins/lens/public/datasources/text_based/types.ts @@ -7,7 +7,7 @@ import type { DatatableColumn } from '@kbn/expressions-plugin/public'; import type { AggregateQuery } from '@kbn/es-query'; import type { VisualizeFieldContext } from '@kbn/ui-actions-plugin/public'; -import type { VisualizeEditorContext } from '../types'; +import type { VisualizeEditorContext } from '../../types'; export interface TextBasedLayerColumn { columnId: string; diff --git a/x-pack/plugins/lens/public/text_based_datasource/utils.test.ts b/x-pack/plugins/lens/public/datasources/text_based/utils.test.ts similarity index 98% rename from x-pack/plugins/lens/public/text_based_datasource/utils.test.ts rename to x-pack/plugins/lens/public/datasources/text_based/utils.test.ts index bc511bb2b86ce..40ac6e58f0758 100644 --- a/x-pack/plugins/lens/public/text_based_datasource/utils.test.ts +++ b/x-pack/plugins/lens/public/datasources/text_based/utils.test.ts @@ -9,7 +9,7 @@ import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; import { expressionsPluginMock } from '@kbn/expressions-plugin/public/mocks'; import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; -import { mockDataViewsService } from '../data_views_service/mocks'; +import { mockDataViewsService } from '../../data_views_service/mocks'; import { getIndexPatternFromTextBasedQuery, loadIndexPatternRefs, diff --git a/x-pack/plugins/lens/public/text_based_datasource/utils.ts b/x-pack/plugins/lens/public/datasources/text_based/utils.ts similarity index 95% rename from x-pack/plugins/lens/public/text_based_datasource/utils.ts rename to x-pack/plugins/lens/public/datasources/text_based/utils.ts index c91b10831e4e5..1809185a5bf46 100644 --- a/x-pack/plugins/lens/public/text_based_datasource/utils.ts +++ b/x-pack/plugins/lens/public/datasources/text_based/utils.ts @@ -10,14 +10,10 @@ import type { ExpressionsStart } from '@kbn/expressions-plugin/public'; import { type AggregateQuery, getIndexPatternFromSQLQuery } from '@kbn/es-query'; import type { DatatableColumn } from '@kbn/expressions-plugin/public'; -import { generateId } from '../id_generator'; +import { generateId } from '../../id_generator'; import { fetchDataFromAggregateQuery } from './fetch_data_from_aggregate_query'; -import type { - IndexPatternRef, - TextBasedPrivateState, - TextBasedLayerColumn, -} from './types'; +import type { IndexPatternRef, TextBasedPrivateState, TextBasedLayerColumn } from './types'; export async function loadIndexPatternRefs( indexPatternsService: DataViewsPublicPluginStart diff --git a/x-pack/plugins/lens/public/embeddable/embeddable_component.tsx b/x-pack/plugins/lens/public/embeddable/embeddable_component.tsx index 7e1c4ee25c928..14649925fed83 100644 --- a/x-pack/plugins/lens/public/embeddable/embeddable_component.tsx +++ b/x-pack/plugins/lens/public/embeddable/embeddable_component.tsx @@ -22,7 +22,7 @@ import { } from '@kbn/embeddable-plugin/public'; import type { LensByReferenceInput, LensByValueInput } from './embeddable'; import type { Document } from '../persistence'; -import type { FormBasedPersistedState } from '../form_based_datasource/types'; +import type { FormBasedPersistedState } from '../datasources/form_based/types'; import type { XYState } from '../visualizations/xy/types'; import type { PieVisualizationState, LegacyMetricState } from '../../common'; import type { DatatableVisualizationState } from '../visualizations/datatable/visualization'; diff --git a/x-pack/plugins/lens/public/index.ts b/x-pack/plugins/lens/public/index.ts index bd106f6eed359..1247877e8ab7d 100644 --- a/x-pack/plugins/lens/public/index.ts +++ b/x-pack/plugins/lens/public/index.ts @@ -44,7 +44,7 @@ export type { HeatmapVisualizationState } from './visualizations/heatmap/types'; export type { GaugeVisualizationState } from './visualizations/gauge/constants'; export type { FormBasedPersistedState, - PersistedFormBasedLayer, + PersistedIndexPatternLayer, OperationType, IncompleteColumn, GenericIndexPatternColumn, @@ -75,7 +75,7 @@ export type { StaticValueIndexPatternColumn, TimeScaleIndexPatternColumn, FormBasedLayer, -} from './form_based_datasource/types'; +} from './datasources/form_based/types'; export type { XYArgs, XYRender, diff --git a/x-pack/plugins/lens/public/plugin.ts b/x-pack/plugins/lens/public/plugin.ts index 3ae774c159422..af065d3679f21 100644 --- a/x-pack/plugins/lens/public/plugin.ts +++ b/x-pack/plugins/lens/public/plugin.ts @@ -55,8 +55,8 @@ import type { FormBasedDatasource as FormBasedDatasourceType, FormBasedDatasourceSetupPlugins, FormulaPublicApi, -} from './form_based_datasource'; -import type { TextBasedDatasource as TextBasedDatasourceType } from './text_based_datasource'; +} from './datasources/form_based'; +import type { TextBasedDatasource as TextBasedDatasourceType } from './datasources/text_based'; import type { XyVisualization as XyVisualizationType, diff --git a/x-pack/plugins/lens/public/shared_components/field_picker/lens_field_icon.tsx b/x-pack/plugins/lens/public/shared_components/field_picker/lens_field_icon.tsx index 024c8290e79c4..e3be012647e8c 100644 --- a/x-pack/plugins/lens/public/shared_components/field_picker/lens_field_icon.tsx +++ b/x-pack/plugins/lens/public/shared_components/field_picker/lens_field_icon.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { FieldIcon, FieldIconProps } from '@kbn/react-field'; import { DataType } from '../../types'; -import { normalizeOperationDataType } from '../../form_based_datasource/pure_utils'; +import { normalizeOperationDataType } from '../../datasources/form_based/pure_utils'; export function LensFieldIcon({ type, ...rest }: FieldIconProps & { type: DataType }) { return ( diff --git a/x-pack/plugins/lens/public/types.ts b/x-pack/plugins/lens/public/types.ts index 9251f5e8d7a54..bed1acfad574f 100644 --- a/x-pack/plugins/lens/public/types.ts +++ b/x-pack/plugins/lens/public/types.ts @@ -47,7 +47,7 @@ import { LENS_EDIT_PAGESIZE_ACTION, } from './visualizations/datatable/components/constants'; import type { LensInspector } from './lens_inspector_service'; -import type { FormatSelectorOptions } from './form_based_datasource/dimension_panel/format_selector'; +import type { FormatSelectorOptions } from './datasources/form_based/dimension_panel/format_selector'; import type { DataViewsState } from './state_management/types'; import type { IndexPatternServiceAPI } from './data_views_service/service'; import type { Document } from './persistence/saved_object_store'; diff --git a/x-pack/plugins/lens/public/visualizations/datatable/visualization.tsx b/x-pack/plugins/lens/public/visualizations/datatable/visualization.tsx index 20e62a28cc897..2806241657ef0 100644 --- a/x-pack/plugins/lens/public/visualizations/datatable/visualization.tsx +++ b/x-pack/plugins/lens/public/visualizations/datatable/visualization.tsx @@ -28,7 +28,7 @@ import { LayerType, layerTypes } from '../../../common'; import { getDefaultSummaryLabel, PagingState } from '../../../common/expressions'; import type { ColumnState, SortingState } from '../../../common/expressions'; import { DataTableToolbar } from './components/toolbar'; -import { FormBasedLayer } from '../../form_based_datasource/types'; +import { FormBasedLayer } from '../../datasources/form_based/types'; export interface DatatableVisualizationState { columns: ColumnState[]; diff --git a/x-pack/plugins/lens/public/visualizations/metric/visualization.tsx b/x-pack/plugins/lens/public/visualizations/metric/visualization.tsx index 955d6167899b7..fa224434855dc 100644 --- a/x-pack/plugins/lens/public/visualizations/metric/visualization.tsx +++ b/x-pack/plugins/lens/public/visualizations/metric/visualization.tsx @@ -31,8 +31,8 @@ import { GROUP_ID, LENS_METRIC_ID } from './constants'; import { DimensionEditor } from './dimension_editor'; import { Toolbar } from './toolbar'; import { generateId } from '../../id_generator'; -import { FormatSelectorOptions } from '../../form_based_datasource/dimension_panel/format_selector'; -import { FormBasedLayer } from '../../form_based_datasource/types'; +import { FormatSelectorOptions } from '../../datasources/form_based/dimension_panel/format_selector'; +import { FormBasedLayer } from '../../datasources/form_based/types'; export const DEFAULT_MAX_COLUMNS = 3; diff --git a/x-pack/plugins/lens/public/visualizations/xy/visualization.test.ts b/x-pack/plugins/lens/public/visualizations/xy/visualization.test.ts index 38247ef6d801e..515fd0a560abf 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/visualization.test.ts +++ b/x-pack/plugins/lens/public/visualizations/xy/visualization.test.ts @@ -28,7 +28,7 @@ import { EventAnnotationConfig } from '@kbn/event-annotation-plugin/common'; import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; import { DataViewsState } from '../../state_management'; -import { createMockedIndexPattern } from '../../form_based_datasource/mocks'; +import { createMockedIndexPattern } from '../../datasources/form_based/mocks'; import { createMockDataViewsState } from '../../data_views_service/mocks'; import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks'; diff --git a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/index.test.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/index.test.tsx index 6577891fce6eb..9f35e9d916d37 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/index.test.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/index.test.tsx @@ -18,7 +18,7 @@ import { chartPluginMock } from '@kbn/charts-plugin/public/mocks'; import moment from 'moment'; import { EventAnnotationConfig } from '@kbn/event-annotation-plugin/common'; import { createMockDataViewsState } from '../../../../data_views_service/mocks'; -import { createMockedIndexPattern } from '../../../../form_based_datasource/mocks'; +import { createMockedIndexPattern } from '../../../../datasources/form_based/mocks'; import { act } from 'react-dom/test-utils'; import { EuiButtonGroup } from '@elastic/eui'; From 69c6918015cfa286845857ed36c254db6889ca34 Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Tue, 4 Oct 2022 11:06:42 +0300 Subject: [PATCH 06/18] Fix types --- .../new_job/job_from_lens/visualization_extractor.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/visualization_extractor.ts b/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/visualization_extractor.ts index d3fe88a390c1e..f84606ddb6eb8 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/visualization_extractor.ts +++ b/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/visualization_extractor.ts @@ -14,8 +14,8 @@ import type { LensSavedObjectAttributes, FieldBasedIndexPatternColumn, XYDataLayerConfig, - IndexPatternPersistedState, - IndexPatternLayer, + FormBasedPersistedState, + FormBasedLayer, XYLayerConfig, } from '@kbn/lens-plugin/public'; import { layerTypes } from '@kbn/lens-plugin/public'; @@ -68,7 +68,7 @@ export class VisualizationExtractor { ); } - const indexpattern = vis.state.datasourceStates.indexpattern as IndexPatternPersistedState; + const indexpattern = vis.state.datasourceStates.indexpattern as FormBasedPersistedState; const compatibleIndexPatternLayer = Object.entries(indexpattern.layers).find( ([id]) => layer.layerId === id ); @@ -192,10 +192,7 @@ export class VisualizationExtractor { } } -function getColumns( - { columns }: Omit, - layer: XYDataLayerConfig -) { +function getColumns({ columns }: Omit, layer: XYDataLayerConfig) { layer.accessors.forEach((a) => { const col = columns[a]; // fail early if any of the cols being used as accessors From 0fbfe1c2580e80eb3ca985e182456717dd028d57 Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Tue, 4 Oct 2022 11:38:37 +0300 Subject: [PATCH 07/18] Revert css classes --- .../public/datasources/form_based/datapanel.scss | 16 ++++++++-------- .../public/datasources/form_based/datapanel.tsx | 10 +++++----- .../datasources/form_based/fields_accordion.tsx | 4 ++-- .../public/datasources/text_based/datapanel.tsx | 6 +++--- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/x-pack/plugins/lens/public/datasources/form_based/datapanel.scss b/x-pack/plugins/lens/public/datasources/form_based/datapanel.scss index ede6252711e65..ef68c784100e4 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/datapanel.scss +++ b/x-pack/plugins/lens/public/datasources/form_based/datapanel.scss @@ -1,41 +1,41 @@ -.lnsInnerFormBasedDataPanel { +.lnsInnerIndexPatternDataPanel { width: 100%; height: 100%; padding: $euiSize $euiSize 0; } -.lnsInnerFormBasedDataPanel__switcher { +.lnsInnerIndexPatternDataPanel__switcher { min-width: 0; } -.lnsInnerFormBasedDataPanel__header { +.lnsInnerIndexPatternDataPanel__header { display: flex; align-items: center; margin-bottom: $euiSizeS; } -.lnsInnerFormBasedDataPanel__titleTooltip { +.lnsInnerIndexPatternDataPanel__titleTooltip { margin-right: $euiSizeXS; } -.lnsInnerFormBasedDataPanel__fieldItems { +.lnsInnerIndexPatternDataPanel__fieldItems { // Quick fix for making sure the shadow and focus rings are visible outside the accordion bounds padding: $euiSizeXS; } -.lnsInnerFormBasedDataPanel__textField { +.lnsInnerIndexPatternDataPanel__textField { @include euiFormControlLayoutPadding(1, 'right'); @include euiFormControlLayoutPadding(1, 'left'); box-shadow: none; } -.lnsInnerFormBasedDataPanel__filterType { +.lnsInnerIndexPatternDataPanel__filterType { font-size: $euiFontSizeS; padding: $euiSizeS; border-bottom: 1px solid $euiColorLightestShade; } -.lnsInnerFormBasedDataPanel__filterTypeInner { +.lnsInnerIndexPatternDataPanel__filterTypeInner { display: flex; align-items: center; diff --git a/x-pack/plugins/lens/public/datasources/form_based/datapanel.tsx b/x-pack/plugins/lens/public/datasources/form_based/datapanel.tsx index 8b4b9a4259146..d5a9c52bd33d3 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/datapanel.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/datapanel.tsx @@ -193,7 +193,7 @@ export function FormBasedDataPanel({ {Object.keys(indexPatterns).length === 0 && indexPatternRefs.length === 0 ? ( @@ -615,7 +615,7 @@ export const InnerFormBasedDataPanel = function InnerFormBasedDataPanel({ @@ -672,7 +672,7 @@ export const InnerFormBasedDataPanel = function InnerFormBasedDataPanel({ data-test-subj="lnsIndexPatternTypeFilterOptions" items={(availableFieldTypes as DataType[]).map((type) => ( - + {fieldTypeNames[type]} @@ -695,7 +695,7 @@ export const InnerFormBasedDataPanel = function InnerFormBasedDataPanel({ } > { const titleClassname = classNames({ // eslint-disable-next-line @typescript-eslint/naming-convention - lnsInnerFormBasedDataPanel__titleTooltip: !!helpTooltip, + lnsInnerIndexPatternDataPanel__titleTooltip: !!helpTooltip, }); return ( @@ -190,7 +190,7 @@ export const FieldsAccordion = memo(function InnerFieldsAccordion({ {hasLoaded && (!!fieldsCount ? ( -
        +
          {paginatedFields && paginatedFields.map(renderField)}
        ) : ( diff --git a/x-pack/plugins/lens/public/datasources/text_based/datapanel.tsx b/x-pack/plugins/lens/public/datasources/text_based/datapanel.tsx index d924ce5675d24..925d92be5aa99 100644 --- a/x-pack/plugins/lens/public/datasources/text_based/datapanel.tsx +++ b/x-pack/plugins/lens/public/datasources/text_based/datapanel.tsx @@ -86,7 +86,7 @@ export function TextBasedDataPanel({ @@ -107,7 +107,7 @@ export function TextBasedDataPanel({ }} >
          {filteredFields.length > 0 && From 166af2a150f1e9a28fe72c35bb87c71c2f2b0b06 Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Tue, 4 Oct 2022 13:12:41 +0300 Subject: [PATCH 08/18] Add migration script --- .../make_lens_embeddable_factory.ts | 12 +++++++++++ .../server/migrations/common_migrations.ts | 17 +++++++++++++++ .../migrations/saved_object_migrations.ts | 10 +++++++++ .../plugins/lens/server/migrations/types.ts | 21 +++++++++++++++++++ 4 files changed, 60 insertions(+) diff --git a/x-pack/plugins/lens/server/embeddable/make_lens_embeddable_factory.ts b/x-pack/plugins/lens/server/embeddable/make_lens_embeddable_factory.ts index 8b977fbce5742..c9041c788a667 100644 --- a/x-pack/plugins/lens/server/embeddable/make_lens_embeddable_factory.ts +++ b/x-pack/plugins/lens/server/embeddable/make_lens_embeddable_factory.ts @@ -31,6 +31,7 @@ import { getLensDataViewMigrations, commonMigrateMetricIds, commonMigratePartitionChartGroups, + commonMigrateIndexPatternDatasource, } from '../migrations/common_migrations'; import { CustomVisualizationMigrations, @@ -155,6 +156,17 @@ export const makeLensEmbeddableFactory = attributes: migratedLensState, } as unknown as SerializableRecord; }, + '8.6.0': (state) => { + const lensState = state as unknown as { + attributes: LensDocShape850; + }; + + const migratedLensState = commonMigrateIndexPatternDatasource(lensState.attributes); + return { + ...lensState, + attributes: migratedLensState, + } as unknown as SerializableRecord; + }, }), getLensCustomVisualizationMigrations(customVisualizationMigrations) ), diff --git a/x-pack/plugins/lens/server/migrations/common_migrations.ts b/x-pack/plugins/lens/server/migrations/common_migrations.ts index 7fd65d44bb0b6..09ecd364811d4 100644 --- a/x-pack/plugins/lens/server/migrations/common_migrations.ts +++ b/x-pack/plugins/lens/server/migrations/common_migrations.ts @@ -33,6 +33,7 @@ import { XYVisStatePre850, VisState850, LensDocShape850, + LensDocShape860, } from './types'; import { DOCUMENT_FIELD_NAME, layerTypes, LegacyMetricState, isPartitionShape } from '../../common'; import { LensDocShape } from './saved_object_migrations'; @@ -475,6 +476,22 @@ export const commonMigrateMetricIds = ( return newAttributes; }; +export const commonMigrateIndexPatternDatasource = ( + attributes: LensDocShape850 +): LensDocShape860 => { + const newAttrs = { + ...attributes, + state: { + ...attributes.state, + datasourceStates: { + formBased: attributes.state.datasourceStates.indexpattern, + }, + }, + }; + + return newAttrs; +}; + export const commonMigratePartitionChartGroups = ( attributes: LensDocShape850<{ shape: string; diff --git a/x-pack/plugins/lens/server/migrations/saved_object_migrations.ts b/x-pack/plugins/lens/server/migrations/saved_object_migrations.ts index 2f02ca358fcc0..335fd2afc948e 100644 --- a/x-pack/plugins/lens/server/migrations/saved_object_migrations.ts +++ b/x-pack/plugins/lens/server/migrations/saved_object_migrations.ts @@ -38,6 +38,7 @@ import { LensDocShape850, LensDocShape840, VisState850, + LensDocShape860, } from './types'; import { commonRenameOperationsForFormula, @@ -59,6 +60,7 @@ import { getLensDataViewMigrations, commonMigrateMetricIds, commonMigratePartitionChartGroups, + commonMigrateIndexPatternDatasource, } from './common_migrations'; interface LensDocShapePre710 { @@ -533,6 +535,13 @@ const migrateMetricIds: SavedObjectMigrationFn attributes: commonMigrateMetricIds(doc.attributes), }); +const migrateIndexPatternDatasource: SavedObjectMigrationFn = ( + doc +) => ({ + ...doc, + attributes: commonMigrateIndexPatternDatasource(doc.attributes), +}); + const migratePartitionChartGroups: SavedObjectMigrationFn = ( doc ) => ({ @@ -566,6 +575,7 @@ const lensMigrations: SavedObjectMigrationMap = { ), '8.3.0': flow(lockOldMetricVisSettings, preserveOldLegendSizeDefault, fixValueLabelsInXY), '8.5.0': flow(migrateMetricIds, enrichAnnotationLayers, migratePartitionChartGroups), + '8.6.0': migrateIndexPatternDatasource, }; export const getAllMigrations = ( diff --git a/x-pack/plugins/lens/server/migrations/types.ts b/x-pack/plugins/lens/server/migrations/types.ts index 87c993a712e01..061ba113f734a 100644 --- a/x-pack/plugins/lens/server/migrations/types.ts +++ b/x-pack/plugins/lens/server/migrations/types.ts @@ -303,3 +303,24 @@ export type VisState840 = VisState830; export type LensDocShape840 = LensDocShape830; export type LensDocShape850 = LensDocShape840; + +export type LensDocShape860 = Omit< + LensDocShape850, + 'state' +> & { + state: Omit['state'], 'datasourceStates'> & { + datasourceStates: { + // This is hardcoded as our only datasource + formBased: { + currentIndexPatternId: string; + layers: Record< + string, + { + columnOrder: string[]; + columns: Record>; + } + >; + }; + }; + }; +}; From dda466f2a4eda59b5a11a480eb1dcc90be4ff856 Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Tue, 4 Oct 2022 15:00:56 +0300 Subject: [PATCH 09/18] Fix lens embeddable functional tests --- x-pack/examples/embedded_lens_example/public/app.tsx | 2 +- x-pack/examples/testing_embedded_lens/public/app.tsx | 2 +- .../third_party_lens_navigation_prompt/public/plugin.ts | 2 +- x-pack/examples/third_party_vis_lens_example/public/plugin.ts | 2 +- x-pack/plugins/lens/public/embeddable/embeddable_component.tsx | 2 +- .../plugins/lens/server/migrations/saved_object_migrations.ts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/x-pack/examples/embedded_lens_example/public/app.tsx b/x-pack/examples/embedded_lens_example/public/app.tsx index 42784984a0d44..e4df914a54c3c 100644 --- a/x-pack/examples/embedded_lens_example/public/app.tsx +++ b/x-pack/examples/embedded_lens_example/public/app.tsx @@ -100,7 +100,7 @@ function getLensAttributes( ], state: { datasourceStates: { - indexpattern: { + formBased: { layers: { layer1: dataLayer!, }, diff --git a/x-pack/examples/testing_embedded_lens/public/app.tsx b/x-pack/examples/testing_embedded_lens/public/app.tsx index cd550a9280004..2b8799c1951a3 100644 --- a/x-pack/examples/testing_embedded_lens/public/app.tsx +++ b/x-pack/examples/testing_embedded_lens/public/app.tsx @@ -148,7 +148,7 @@ function getBaseAttributes( ], state: { datasourceStates: { - indexpattern: { + formBased: { layers: { layer1: finalDataLayer, }, diff --git a/x-pack/examples/third_party_lens_navigation_prompt/public/plugin.ts b/x-pack/examples/third_party_lens_navigation_prompt/public/plugin.ts index aca5f5d0b37b8..0538c7f501742 100644 --- a/x-pack/examples/third_party_lens_navigation_prompt/public/plugin.ts +++ b/x-pack/examples/third_party_lens_navigation_prompt/public/plugin.ts @@ -71,7 +71,7 @@ function getLensAttributes(defaultDataView: DataView): TypedLensByValueInput['at ], state: { datasourceStates: { - indexpattern: { + formBased: { layers: { layer1: dataLayer, }, diff --git a/x-pack/examples/third_party_vis_lens_example/public/plugin.ts b/x-pack/examples/third_party_vis_lens_example/public/plugin.ts index f7a0378619b3a..38922ae676666 100644 --- a/x-pack/examples/third_party_vis_lens_example/public/plugin.ts +++ b/x-pack/examples/third_party_vis_lens_example/public/plugin.ts @@ -67,7 +67,7 @@ function getLensAttributes(defaultDataView: DataView): TypedLensByValueInput['at ], state: { datasourceStates: { - indexpattern: { + formBased: { layers: { layer1: dataLayer, }, diff --git a/x-pack/plugins/lens/public/embeddable/embeddable_component.tsx b/x-pack/plugins/lens/public/embeddable/embeddable_component.tsx index 14649925fed83..56939b54299ce 100644 --- a/x-pack/plugins/lens/public/embeddable/embeddable_component.tsx +++ b/x-pack/plugins/lens/public/embeddable/embeddable_component.tsx @@ -37,7 +37,7 @@ type LensAttributes = Omit< visualizationType: TVisType; state: Omit & { datasourceStates: { - indexpattern: FormBasedPersistedState; + formBased: FormBasedPersistedState; }; visualization: TVisState; }; diff --git a/x-pack/plugins/lens/server/migrations/saved_object_migrations.ts b/x-pack/plugins/lens/server/migrations/saved_object_migrations.ts index 335fd2afc948e..8e4914b94fe83 100644 --- a/x-pack/plugins/lens/server/migrations/saved_object_migrations.ts +++ b/x-pack/plugins/lens/server/migrations/saved_object_migrations.ts @@ -575,7 +575,7 @@ const lensMigrations: SavedObjectMigrationMap = { ), '8.3.0': flow(lockOldMetricVisSettings, preserveOldLegendSizeDefault, fixValueLabelsInXY), '8.5.0': flow(migrateMetricIds, enrichAnnotationLayers, migratePartitionChartGroups), - '8.6.0': migrateIndexPatternDatasource, + '8.6.0': flow(migrateIndexPatternDatasource), }; export const getAllMigrations = ( From 812f22b37b67389bd7896ac9ad0ddaecb4b22219 Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Tue, 4 Oct 2022 15:22:28 +0300 Subject: [PATCH 10/18] Fix types --- x-pack/examples/third_party_vis_lens_example/README.md | 2 +- .../components/field_data_row/action_menu/lens_utils.ts | 2 +- .../public/pages/metrics/hosts/components/hosts_table.tsx | 2 +- x-pack/plugins/lens/readme.md | 2 +- .../jobs/new_job/job_from_lens/visualization_extractor.ts | 2 +- .../configurations/lens_attributes.test.ts | 4 ++-- .../exploratory_view/configurations/lens_attributes.ts | 2 +- .../lens_attributes/sample_formula_metric_attribute.ts | 2 +- .../lens_attributes/single_metric_attributes.test.ts | 4 ++-- .../lens_attributes/single_metric_attributes.ts | 2 +- .../configurations/test_data/mobile_test_attribute.ts | 2 +- .../configurations/test_data/sample_attribute.ts | 2 +- .../configurations/test_data/sample_attribute_cwv.ts | 2 +- .../configurations/test_data/sample_attribute_kpi.ts | 2 +- .../test_data/sample_attribute_with_reference_lines.ts | 2 +- .../exploratory_view/embeddable/embeddable.test.tsx | 2 +- .../plugins/osquery/public/lens/view_results_in_lens.tsx | 2 +- .../osquery/public/packs/pack_queries_status_table.tsx | 2 +- .../common/__snapshots__/authentication.test.ts.snap | 2 +- .../common/__snapshots__/external_alert.test.ts.snap | 2 +- .../lens_attributes/common/authentication.ts | 2 +- .../lens_attributes/common/external_alert.ts | 2 +- .../hosts/__snapshots__/event.test.ts.snap | 2 +- .../hosts/__snapshots__/kpi_host_area.test.ts.snap | 2 +- .../hosts/__snapshots__/kpi_host_metric.test.ts.snap | 2 +- .../hosts/__snapshots__/kpi_unique_ips_area.test.ts.snap | 2 +- .../hosts/__snapshots__/kpi_unique_ips_bar.test.ts.snap | 2 +- .../kpi_unique_ips_destination_metric.test.ts.snap | 2 +- .../kpi_unique_ips_source_metric.test.ts.snap | 2 +- .../visualization_actions/lens_attributes/hosts/events.ts | 2 +- .../lens_attributes/hosts/kpi_host_area.ts | 2 +- .../lens_attributes/hosts/kpi_host_metric.ts | 2 +- .../lens_attributes/hosts/kpi_unique_ips_area.ts | 2 +- .../lens_attributes/hosts/kpi_unique_ips_bar.ts | 2 +- .../hosts/kpi_unique_ips_destination_metric.ts | 2 +- .../lens_attributes/hosts/kpi_unique_ips_source_metric.ts | 2 +- .../network/__snapshots__/dns_top_domains.test.ts.snap | 2 +- .../network/__snapshots__/kpi_dns_queries.test.ts.snap | 2 +- .../network/__snapshots__/kpi_network_events.test.ts.snap | 2 +- .../network/__snapshots__/kpi_tls_handshakes.test.ts.snap | 2 +- .../__snapshots__/kpi_unique_flow_ids.test.ts.snap | 2 +- .../kpi_unique_private_ips_area.test.ts.snap | 2 +- .../__snapshots__/kpi_unique_private_ips_bar.test.ts.snap | 2 +- ...kpi_unique_private_ips_destination_metric.test.ts.snap | 2 +- .../kpi_unique_private_ips_source_metric.test.ts.snap | 2 +- .../lens_attributes/network/dns_top_domains.ts | 2 +- .../lens_attributes/network/kpi_dns_queries.ts | 2 +- .../lens_attributes/network/kpi_network_events.ts | 2 +- .../lens_attributes/network/kpi_tls_handshakes.ts | 2 +- .../lens_attributes/network/kpi_unique_flow_ids.ts | 2 +- .../network/kpi_unique_private_ips_area.ts | 2 +- .../lens_attributes/network/kpi_unique_private_ips_bar.ts | 2 +- .../network/kpi_unique_private_ips_destination_metric.ts | 2 +- .../network/kpi_unique_private_ips_source_metric.ts | 2 +- .../users/__snapshots__/kpi_total_users_area.test.ts.snap | 2 +- .../__snapshots__/kpi_total_users_metric.test.ts.snap | 2 +- .../kpi_user_authentication_metric_failure.test.ts.snap | 2 +- .../kpi_user_authentications_area.test.ts.snap | 2 +- .../kpi_user_authentications_bar.test.ts.snap | 2 +- .../kpi_user_authentications_metric_success.test.ts.snap | 2 +- .../lens_attributes/users/kpi_total_users_area.ts | 2 +- .../lens_attributes/users/kpi_total_users_metric.ts | 2 +- .../users/kpi_user_authentication_metric_failure.ts | 2 +- .../users/kpi_user_authentications_area.ts | 2 +- .../lens_attributes/users/kpi_user_authentications_bar.ts | 2 +- .../users/kpi_user_authentications_metric_success.ts | 2 +- .../create_prebuilt_saved_objects.test.ts.snap | 8 ++++---- .../saved_object/host_risk_score_dashboards.ts | 4 ++-- .../saved_object/user_risk_score_dashboards.ts | 4 ++-- .../__snapshots__/visitor_breakdown_chart.test.tsx.snap | 2 +- .../app/rum_dashboard/charts/visitor_breakdown_chart.tsx | 2 +- 71 files changed, 78 insertions(+), 78 deletions(-) diff --git a/x-pack/examples/third_party_vis_lens_example/README.md b/x-pack/examples/third_party_vis_lens_example/README.md index f2fa563f33393..ccb8fc69d41ae 100644 --- a/x-pack/examples/third_party_vis_lens_example/README.md +++ b/x-pack/examples/third_party_vis_lens_example/README.md @@ -16,7 +16,7 @@ To test the migration, you can import the following ndjson file via saved object ``` {"attributes":{"fieldFormatMap":"{\"hour_of_day\":{}}","runtimeFieldMap":"{\"hour_of_day\":{\"type\":\"long\",\"script\":{\"source\":\"emit(doc['timestamp'].value.getHour());\"}}}","timeFieldName":"timestamp","title":"kibana_sample_data_logs"},"coreMigrationVersion":"8.0.0","id":"90943e30-9a47-11e8-b64d-95841ca0b247","migrationVersion":{"index-pattern":"8.0.0"},"references":[],"type":"index-pattern","updated_at":"2022-01-24T10:54:24.209Z","version":"WzQzMTQ3LDFd"} -{"attributes":{"description":"","state":{"datasourceStates":{"indexpattern":{"layers":{"f2700077-50bf-48e4-829c-f695f87e226d":{"columnOrder":["5e704cac-8490-457a-b635-01f3a5a132b7"],"columns":{"5e704cac-8490-457a-b635-01f3a5a132b7":{"dataType":"number","isBucketed":false,"label":"Count of records","operationType":"count","scale":"ratio","sourceField":"Records"}},"incompleteColumns":{}}}}},"filters":[],"query":{"language":"kuery","query":""},"visualization":{"column":"5e704cac-8490-457a-b635-01f3a5a132b7","layerId":"f2700077-50bf-48e4-829c-f695f87e226d"}},"title":"Rotating number test","visualizationType":"rotatingNumber"},"coreMigrationVersion":"8.0.0","id":"468f0be0-7e86-11ec-9739-d570ffd3fbe4","migrationVersion":{"lens":"8.0.0"},"references":[{"id":"90943e30-9a47-11e8-b64d-95841ca0b247","name":"indexpattern-datasource-current-indexpattern","type":"index-pattern"},{"id":"90943e30-9a47-11e8-b64d-95841ca0b247","name":"indexpattern-datasource-layer-f2700077-50bf-48e4-829c-f695f87e226d","type":"index-pattern"}],"type":"lens","updated_at":"2022-01-26T08:59:31.618Z","version":"WzQzNjUzLDFd"} +{"attributes":{"description":"","state":{"datasourceStates":{"formBased":{"layers":{"f2700077-50bf-48e4-829c-f695f87e226d":{"columnOrder":["5e704cac-8490-457a-b635-01f3a5a132b7"],"columns":{"5e704cac-8490-457a-b635-01f3a5a132b7":{"dataType":"number","isBucketed":false,"label":"Count of records","operationType":"count","scale":"ratio","sourceField":"Records"}},"incompleteColumns":{}}}}},"filters":[],"query":{"language":"kuery","query":""},"visualization":{"column":"5e704cac-8490-457a-b635-01f3a5a132b7","layerId":"f2700077-50bf-48e4-829c-f695f87e226d"}},"title":"Rotating number test","visualizationType":"rotatingNumber"},"coreMigrationVersion":"8.0.0","id":"468f0be0-7e86-11ec-9739-d570ffd3fbe4","migrationVersion":{"lens":"8.0.0"},"references":[{"id":"90943e30-9a47-11e8-b64d-95841ca0b247","name":"indexpattern-datasource-current-indexpattern","type":"index-pattern"},{"id":"90943e30-9a47-11e8-b64d-95841ca0b247","name":"indexpattern-datasource-layer-f2700077-50bf-48e4-829c-f695f87e226d","type":"index-pattern"}],"type":"lens","updated_at":"2022-01-26T08:59:31.618Z","version":"WzQzNjUzLDFd"} {"excludedObjects":[],"excludedObjectsCount":0,"exportedCount":2,"missingRefCount":0,"missingReferences":[]} ``` diff --git a/x-pack/plugins/data_visualizer/public/application/common/components/field_data_row/action_menu/lens_utils.ts b/x-pack/plugins/data_visualizer/public/application/common/components/field_data_row/action_menu/lens_utils.ts index 034f7037fc29a..b053715090c7b 100644 --- a/x-pack/plugins/data_visualizer/public/application/common/components/field_data_row/action_menu/lens_utils.ts +++ b/x-pack/plugins/data_visualizer/public/application/common/components/field_data_row/action_menu/lens_utils.ts @@ -282,7 +282,7 @@ export function getLensAttributes( ], state: { datasourceStates: { - indexpattern: { + formBased: { layers: { layer1: { columnOrder: ['col1', 'col2'], diff --git a/x-pack/plugins/infra/public/pages/metrics/hosts/components/hosts_table.tsx b/x-pack/plugins/infra/public/pages/metrics/hosts/components/hosts_table.tsx index 74f2468eb4c45..74bb41493a667 100644 --- a/x-pack/plugins/infra/public/pages/metrics/hosts/components/hosts_table.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/hosts/components/hosts_table.tsx @@ -33,7 +33,7 @@ const getLensHostsTable = ( ], state: { datasourceStates: { - indexpattern: { + formBased: { layers: { 'cbe5d8a0-381d-49bf-b8ac-f8f312ec7129': { columns: { diff --git a/x-pack/plugins/lens/readme.md b/x-pack/plugins/lens/readme.md index d8b80e864be58..d276a45eb00ac 100644 --- a/x-pack/plugins/lens/readme.md +++ b/x-pack/plugins/lens/readme.md @@ -82,7 +82,7 @@ References (`references`) are regular saved object references forming a graph of ### Datasource state -The data source state (`state.datasourceStates.indexPattern.layers`) contains the configuration state of the data fetching and processing part of Lens. It's not specific to a certain representation (xy, pie, gauge, ...), but instead it defines a data table per layer made out of columns with various properties. This data table is passed over to the visualization state which maps it to various dimensions of the specific visualization. Layer and columns have unique ids which are shared amongst visualization and datasource - it's important to make sure they are always in sync. The keys of the `state.datasourceStates.indexPattern.layers` object are the layer ids. Lens editor chooses uuids for these, but when programmatically generating Lens attributes, any string can be used for them. The `layers[].columns` object is constructed in a similar way (keys represent the column ids). The `operationType` property defines the type of the column, other properties depend on the specific operation. Types for individual parts of the datasource state are provided (check the `lens/public` export, e.g. there's the `MaxIndexPatternColumn` for a column of operation type `max`) +The data source state (`state.datasourceStates.formBased.layers`) contains the configuration state of the data fetching and processing part of Lens. It's not specific to a certain representation (xy, pie, gauge, ...), but instead it defines a data table per layer made out of columns with various properties. This data table is passed over to the visualization state which maps it to various dimensions of the specific visualization. Layer and columns have unique ids which are shared amongst visualization and datasource - it's important to make sure they are always in sync. The keys of the `state.datasourceStates.formBased.layers` object are the layer ids. Lens editor chooses uuids for these, but when programmatically generating Lens attributes, any string can be used for them. The `layers[].columns` object is constructed in a similar way (keys represent the column ids). The `operationType` property defines the type of the column, other properties depend on the specific operation. Types for individual parts of the datasource state are provided (check the `lens/public` export, e.g. there's the `MaxIndexPatternColumn` for a column of operation type `max`) ### Visualization state diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/visualization_extractor.ts b/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/visualization_extractor.ts index f84606ddb6eb8..31cec1635968f 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/visualization_extractor.ts +++ b/x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/visualization_extractor.ts @@ -68,7 +68,7 @@ export class VisualizationExtractor { ); } - const indexpattern = vis.state.datasourceStates.indexpattern as FormBasedPersistedState; + const indexpattern = vis.state.datasourceStates.formBased as FormBasedPersistedState; const compatibleIndexPatternLayer = Object.entries(indexpattern.layers).find( ([id]) => layer.layerId === id ); diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes.test.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes.test.ts index 8f2953a45834e..a21684bd0d08c 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes.test.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes.test.ts @@ -118,7 +118,7 @@ describe('Lens Attribute', () => { ReportTypes.KPI ); - expect(lnsAttrKpi.getJSON().state.datasourceStates.indexpattern.layers.layer0.columns).toEqual({ + expect(lnsAttrKpi.getJSON().state.datasourceStates.formBased.layers.layer0.columns).toEqual({ 'x-axis-column-layer0': { dataType: 'date', isBucketed: true, @@ -352,7 +352,7 @@ describe('Lens Attribute', () => { }); it('should return first layer', function () { - expect(lnsAttr.getLayers()).toEqual(sampleAttribute.state.datasourceStates.indexpattern.layers); + expect(lnsAttr.getLayers()).toEqual(sampleAttribute.state.datasourceStates.formBased.layers); }); it('should return expected XYState', function () { diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes.ts index 3c8c2e5d4bffb..50701e12f94be 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes.ts @@ -1100,7 +1100,7 @@ export class LensAttributes { references: this.getReferences(), state: { datasourceStates: { - indexpattern: { + formBased: { layers: this.layers, }, }, diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes/sample_formula_metric_attribute.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes/sample_formula_metric_attribute.ts index d6f572fcacde6..c70d0ee031451 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes/sample_formula_metric_attribute.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes/sample_formula_metric_attribute.ts @@ -21,7 +21,7 @@ export const sampleMetricFormulaAttribute = { ], state: { datasourceStates: { - indexpattern: { + formBased: { layers: { layer0: { columnOrder: [ diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes/single_metric_attributes.test.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes/single_metric_attributes.test.ts index 2f06db3ae144a..d6c5bfea5f1d6 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes/single_metric_attributes.test.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes/single_metric_attributes.test.ts @@ -74,7 +74,7 @@ describe('SingleMetricAttributes', () => { ], state: { datasourceStates: { - indexpattern: { + formBased: { layers: { layer0: { columnOrder: ['layer-0-column-1'], @@ -136,7 +136,7 @@ describe('SingleMetricAttributes', () => { ], state: { datasourceStates: { - indexpattern: { + formBased: { layers: { layer0: { columnOrder: ['layer-0-column-1'], diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes/single_metric_attributes.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes/single_metric_attributes.ts index fd53d9025d4dc..0169d3dd15ab5 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes/single_metric_attributes.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes/single_metric_attributes.ts @@ -176,7 +176,7 @@ export class SingleMetricLensAttributes extends LensAttributes { state: { visualization, datasourceStates: { - indexpattern: { + formBased: { layers: this.layers, }, }, diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/test_data/mobile_test_attribute.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/test_data/mobile_test_attribute.ts index 02678ad91ba12..874d6e45b2234 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/test_data/mobile_test_attribute.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/test_data/mobile_test_attribute.ts @@ -23,7 +23,7 @@ export const testMobileKPIAttr = { visualizationType: 'lnsXY', state: { datasourceStates: { - indexpattern: { + formBased: { layers: { layer0: { columnOrder: ['x-axis-column-layer0', 'y-axis-column-layer0'], diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/test_data/sample_attribute.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/test_data/sample_attribute.ts index dcc2775a54871..5302078d372ce 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/test_data/sample_attribute.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/test_data/sample_attribute.ts @@ -27,7 +27,7 @@ export const sampleAttribute = { ], state: { datasourceStates: { - indexpattern: { + formBased: { layers: { layer0: { columnOrder: [ diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/test_data/sample_attribute_cwv.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/test_data/sample_attribute_cwv.ts index a688962459a24..108112e43ae35 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/test_data/sample_attribute_cwv.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/test_data/sample_attribute_cwv.ts @@ -22,7 +22,7 @@ export const sampleAttributeCoreWebVital = { ], state: { datasourceStates: { - indexpattern: { + formBased: { layers: { layer0: { columnOrder: [ diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/test_data/sample_attribute_kpi.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/test_data/sample_attribute_kpi.ts index c5b62ce3f14b4..c1bd53c85b760 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/test_data/sample_attribute_kpi.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/test_data/sample_attribute_kpi.ts @@ -22,7 +22,7 @@ export const sampleAttributeKpi = { ], state: { datasourceStates: { - indexpattern: { + formBased: { layers: { layer0: { columnOrder: ['x-axis-column-layer0', 'y-axis-column-layer0'], diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/test_data/sample_attribute_with_reference_lines.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/test_data/sample_attribute_with_reference_lines.ts index 32d3d480e777d..2cf6cdc8a6054 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/test_data/sample_attribute_with_reference_lines.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/test_data/sample_attribute_with_reference_lines.ts @@ -27,7 +27,7 @@ export const sampleAttributeWithReferenceLines = { ], state: { datasourceStates: { - indexpattern: { + formBased: { layers: { layer0: { columnOrder: [ diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/embeddable/embeddable.test.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/embeddable/embeddable.test.tsx index fecb9e7172cc6..a6c3cd1777ec5 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/embeddable/embeddable.test.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/embeddable/embeddable.test.tsx @@ -32,7 +32,7 @@ const mockLensAttrs = { }, filters: [], datasourceStates: { - indexpattern: { + formBased: { layers: { '416b6fad-1923-4f6a-a2df-b223bb287e30': { columnOrder: ['b00c65ea-32be-4163-bfc8-f795b1ef9d06'], diff --git a/x-pack/plugins/osquery/public/lens/view_results_in_lens.tsx b/x-pack/plugins/osquery/public/lens/view_results_in_lens.tsx index 080c078f6a290..a61e986fd1201 100644 --- a/x-pack/plugins/osquery/public/lens/view_results_in_lens.tsx +++ b/x-pack/plugins/osquery/public/lens/view_results_in_lens.tsx @@ -174,7 +174,7 @@ function getLensAttributes( ], state: { datasourceStates: { - indexpattern: { + formBased: { layers: { layer1: dataLayer, }, diff --git a/x-pack/plugins/osquery/public/packs/pack_queries_status_table.tsx b/x-pack/plugins/osquery/public/packs/pack_queries_status_table.tsx index 2ba4a76c48515..df08fa6d1bf9b 100644 --- a/x-pack/plugins/osquery/public/packs/pack_queries_status_table.tsx +++ b/x-pack/plugins/osquery/public/packs/pack_queries_status_table.tsx @@ -151,7 +151,7 @@ function getLensAttributes( ], state: { datasourceStates: { - indexpattern: { + formBased: { layers: { layer1: dataLayer, }, diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/__snapshots__/authentication.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/__snapshots__/authentication.test.ts.snap index 747487203066b..f683d2828bae3 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/__snapshots__/authentication.test.ts.snap +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/__snapshots__/authentication.test.ts.snap @@ -27,7 +27,7 @@ Object { ], "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "3fd0c5d5-f762-4a27-8c56-14eee0223e13": Object { "columnOrder": Array [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/__snapshots__/external_alert.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/__snapshots__/external_alert.test.ts.snap index ac42b228012fe..425f545129ee6 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/__snapshots__/external_alert.test.ts.snap +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/__snapshots__/external_alert.test.ts.snap @@ -27,7 +27,7 @@ Object { ], "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "a3c54471-615f-4ff9-9fda-69b5b2ea3eef": Object { "columnOrder": Array [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/authentication.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/authentication.ts index 15d7f029ae612..4e69bac6287ec 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/authentication.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/authentication.ts @@ -98,7 +98,7 @@ export const authenticationLensAttributes: LensAttributes = { }, ], datasourceStates: { - indexpattern: { + formBased: { layers: { '3fd0c5d5-f762-4a27-8c56-14eee0223e13': { columns: { diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/external_alert.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/external_alert.ts index a815d442b043e..f5a664b98161b 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/external_alert.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/external_alert.ts @@ -71,7 +71,7 @@ export const getExternalAlertLensAttributes: GetLensAttributes = ( }, ], datasourceStates: { - indexpattern: { + formBased: { layers: { 'a3c54471-615f-4ff9-9fda-69b5b2ea3eef': { columns: { diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/event.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/event.test.ts.snap index 7f3fdb6c66107..129a82aa1692c 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/event.test.ts.snap +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/event.test.ts.snap @@ -17,7 +17,7 @@ Object { ], "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "0039eb0c-9a1a-4687-ae54-0f4e239bec75": Object { "columnOrder": Array [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_host_area.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_host_area.test.ts.snap index c5e4e272ec9c4..b9165ea5c38a8 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_host_area.test.ts.snap +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_host_area.test.ts.snap @@ -17,7 +17,7 @@ Object { ], "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "416b6fad-1923-4f6a-a2df-b223bb287e30": Object { "columnOrder": Array [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_host_metric.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_host_metric.test.ts.snap index 3669de2d30109..ea37bec0d1976 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_host_metric.test.ts.snap +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_host_metric.test.ts.snap @@ -17,7 +17,7 @@ Object { ], "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "416b6fad-1923-4f6a-a2df-b223bb287e30": Object { "columnOrder": Array [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_unique_ips_area.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_unique_ips_area.test.ts.snap index acaf78556269f..f45cd86c70ed2 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_unique_ips_area.test.ts.snap +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_unique_ips_area.test.ts.snap @@ -22,7 +22,7 @@ Object { ], "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "8be0156b-d423-4a39-adf1-f54d4c9f2e69": Object { "columnOrder": Array [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_unique_ips_bar.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_unique_ips_bar.test.ts.snap index 9f702ecb06412..0a66d46f9a7db 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_unique_ips_bar.test.ts.snap +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_unique_ips_bar.test.ts.snap @@ -22,7 +22,7 @@ Object { ], "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "8be0156b-d423-4a39-adf1-f54d4c9f2e69": Object { "columnOrder": Array [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_unique_ips_destination_metric.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_unique_ips_destination_metric.test.ts.snap index ebeb85e27a44f..3ca56d9f020b2 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_unique_ips_destination_metric.test.ts.snap +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_unique_ips_destination_metric.test.ts.snap @@ -17,7 +17,7 @@ Object { ], "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "8be0156b-d423-4a39-adf1-f54d4c9f2e69": Object { "columnOrder": Array [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_unique_ips_source_metric.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_unique_ips_source_metric.test.ts.snap index f8ec7bb8c70d7..2972842a6f419 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_unique_ips_source_metric.test.ts.snap +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_unique_ips_source_metric.test.ts.snap @@ -17,7 +17,7 @@ Object { ], "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "8be0156b-d423-4a39-adf1-f54d4c9f2e69": Object { "columnOrder": Array [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/events.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/events.ts index da244d40565fb..f07716f8c4bd7 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/events.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/events.ts @@ -53,7 +53,7 @@ export const getEventsHistogramLensAttributes: GetLensAttributes = ( }, filters: [], datasourceStates: { - indexpattern: { + formBased: { layers: { '0039eb0c-9a1a-4687-ae54-0f4e239bec75': { columns: { diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_host_area.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_host_area.ts index 64f62133e9406..6eb400734ebe0 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_host_area.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_host_area.ts @@ -12,7 +12,7 @@ export const kpiHostAreaLensAttributes: LensAttributes = { description: '', state: { datasourceStates: { - indexpattern: { + formBased: { layers: { '416b6fad-1923-4f6a-a2df-b223bb287e30': { columnOrder: [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_host_metric.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_host_metric.ts index 00ab0239acb40..66b6b63a69321 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_host_metric.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_host_metric.ts @@ -11,7 +11,7 @@ export const kpiHostMetricLensAttributes: LensAttributes = { description: '', state: { datasourceStates: { - indexpattern: { + formBased: { layers: { '416b6fad-1923-4f6a-a2df-b223bb287e30': { columnOrder: ['b00c65ea-32be-4163-bfc8-f795b1ef9d06'], diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_area.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_area.ts index ac0d102a5f03c..79539f40390af 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_area.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_area.ts @@ -12,7 +12,7 @@ export const kpiUniqueIpsAreaLensAttributes: LensAttributes = { description: '', state: { datasourceStates: { - indexpattern: { + formBased: { layers: { '8be0156b-d423-4a39-adf1-f54d4c9f2e69': { columnOrder: [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_bar.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_bar.ts index cf7dbf21913b5..862eb64b44eeb 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_bar.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_bar.ts @@ -12,7 +12,7 @@ export const kpiUniqueIpsBarLensAttributes: LensAttributes = { description: '', state: { datasourceStates: { - indexpattern: { + formBased: { layers: { '8be0156b-d423-4a39-adf1-f54d4c9f2e69': { columnOrder: [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_destination_metric.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_destination_metric.ts index 5c4aa31f65833..094bc189f1ac7 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_destination_metric.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_destination_metric.ts @@ -11,7 +11,7 @@ export const kpiUniqueIpsDestinationMetricLensAttributes: LensAttributes = { description: '', state: { datasourceStates: { - indexpattern: { + formBased: { layers: { '8be0156b-d423-4a39-adf1-f54d4c9f2e69': { columnOrder: ['d9a6eb6b-8b78-439e-98e7-a718f8ffbebe'], diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_source_metric.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_source_metric.ts index 4d308b95d796d..388f5ef53b301 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_source_metric.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_source_metric.ts @@ -11,7 +11,7 @@ export const kpiUniqueIpsSourceMetricLensAttributes: LensAttributes = { description: '', state: { datasourceStates: { - indexpattern: { + formBased: { layers: { '8be0156b-d423-4a39-adf1-f54d4c9f2e69': { columnOrder: ['d9a6eb6b-8b78-439e-98e7-a718f8ffbebe'], diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/dns_top_domains.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/dns_top_domains.test.ts.snap index 6e0f9c2bbd516..392d68b512b41 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/dns_top_domains.test.ts.snap +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/dns_top_domains.test.ts.snap @@ -22,7 +22,7 @@ Object { ], "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "b1c3efc6-c886-4fba-978f-3b6bb5e7948a": Object { "columnOrder": Array [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_dns_queries.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_dns_queries.test.ts.snap index 39f16779abaf4..173a1229e1282 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_dns_queries.test.ts.snap +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_dns_queries.test.ts.snap @@ -22,7 +22,7 @@ Object { ], "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "cea37c70-8f91-43bf-b9fe-72d8c049f6a3": Object { "columnOrder": Array [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_network_events.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_network_events.test.ts.snap index 03bacfac49ad7..c9b0441a25a4b 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_network_events.test.ts.snap +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_network_events.test.ts.snap @@ -27,7 +27,7 @@ Object { ], "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "eaadfec7-deaa-4aeb-a403-3b4e516416d2": Object { "columnOrder": Array [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_tls_handshakes.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_tls_handshakes.test.ts.snap index 6e695484fdc0f..532d81001ab06 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_tls_handshakes.test.ts.snap +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_tls_handshakes.test.ts.snap @@ -17,7 +17,7 @@ Object { ], "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "1f48a633-8eee-45ae-9471-861227e9ca03": Object { "columnOrder": Array [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_flow_ids.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_flow_ids.test.ts.snap index 1e3f1f63c40c8..60a52f4f5b4a9 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_flow_ids.test.ts.snap +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_flow_ids.test.ts.snap @@ -17,7 +17,7 @@ Object { ], "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "5d46d48f-6ce8-46be-a797-17ad50642564": Object { "columnOrder": Array [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_private_ips_area.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_private_ips_area.test.ts.snap index 2415dcc6c750c..11e3f62d0cd4c 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_private_ips_area.test.ts.snap +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_private_ips_area.test.ts.snap @@ -22,7 +22,7 @@ Object { ], "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "38aa6532-6bf9-4c8f-b2a6-da8d32f7d0d7": Object { "columnOrder": Array [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_private_ips_bar.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_private_ips_bar.test.ts.snap index 2ea658869183c..2a702bb87f3fd 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_private_ips_bar.test.ts.snap +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_private_ips_bar.test.ts.snap @@ -22,7 +22,7 @@ Object { ], "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "38aa6532-6bf9-4c8f-b2a6-da8d32f7d0d7": Object { "columnOrder": Array [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_private_ips_destination_metric.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_private_ips_destination_metric.test.ts.snap index 37311a980c6b4..9f205c5c23c07 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_private_ips_destination_metric.test.ts.snap +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_private_ips_destination_metric.test.ts.snap @@ -17,7 +17,7 @@ Object { ], "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "cea37c70-8f91-43bf-b9fe-72d8c049f6a3": Object { "columnOrder": Array [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_private_ips_source_metric.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_private_ips_source_metric.test.ts.snap index 2f7ba7d2997b1..b7e25a6ceb8f4 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_private_ips_source_metric.test.ts.snap +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_private_ips_source_metric.test.ts.snap @@ -17,7 +17,7 @@ Object { ], "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "cea37c70-8f91-43bf-b9fe-72d8c049f6a3": Object { "columnOrder": Array [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/dns_top_domains.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/dns_top_domains.ts index ef75bea77c3e0..0f195bdeaa8d4 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/dns_top_domains.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/dns_top_domains.ts @@ -89,7 +89,7 @@ export const dnsTopDomainsLensAttributes: LensAttributes = { }, ], datasourceStates: { - indexpattern: { + formBased: { layers: { 'b1c3efc6-c886-4fba-978f-3b6bb5e7948a': { columns: { diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_dns_queries.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_dns_queries.ts index 681cd278214b1..c4691a4797b5b 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_dns_queries.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_dns_queries.ts @@ -64,7 +64,7 @@ export const kpiDnsQueriesLensAttributes: LensAttributes = { }, ], datasourceStates: { - indexpattern: { + formBased: { layers: { 'cea37c70-8f91-43bf-b9fe-72d8c049f6a3': { columns: { diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_network_events.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_network_events.ts index 534ffeb2024e6..bb88ceb732c66 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_network_events.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_network_events.ts @@ -62,7 +62,7 @@ export const kpiNetworkEventsLensAttributes: LensAttributes = { }, ], datasourceStates: { - indexpattern: { + formBased: { layers: { 'eaadfec7-deaa-4aeb-a403-3b4e516416d2': { columns: { diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_tls_handshakes.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_tls_handshakes.ts index 367fe6fd40f6f..b7b651bf56362 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_tls_handshakes.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_tls_handshakes.ts @@ -93,7 +93,7 @@ export const kpiTlsHandshakesLensAttributes: LensAttributes = { }, ], datasourceStates: { - indexpattern: { + formBased: { layers: { '1f48a633-8eee-45ae-9471-861227e9ca03': { columns: { diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_flow_ids.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_flow_ids.ts index 5f31645c75eca..3660f2ff6ad06 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_flow_ids.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_flow_ids.ts @@ -56,7 +56,7 @@ export const kpiUniqueFlowIdsLensAttributes: LensAttributes = { }, ], datasourceStates: { - indexpattern: { + formBased: { layers: { '5d46d48f-6ce8-46be-a797-17ad50642564': { columns: { diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_area.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_area.ts index 394bc227e871c..86e9f21d7ffef 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_area.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_area.ts @@ -82,7 +82,7 @@ export const kpiUniquePrivateIpsAreaLensAttributes: LensAttributes = { }, filters: [], datasourceStates: { - indexpattern: { + formBased: { layers: { '38aa6532-6bf9-4c8f-b2a6-da8d32f7d0d7': { columns: { diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_bar.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_bar.ts index fe4a698aedf5e..07a81a273e2b5 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_bar.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_bar.ts @@ -85,7 +85,7 @@ export const kpiUniquePrivateIpsBarLensAttributes: LensAttributes = { }, filters: [], datasourceStates: { - indexpattern: { + formBased: { layers: { 'e406bf4f-942b-41ac-b516-edb5cef06ec8': { columns: { diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_destination_metric.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_destination_metric.ts index 6e3d440619e76..bcdd7d377b82b 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_destination_metric.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_destination_metric.ts @@ -11,7 +11,7 @@ export const kpiUniquePrivateIpsDestinationMetricLensAttributes: LensAttributes description: '', state: { datasourceStates: { - indexpattern: { + formBased: { layers: { 'cea37c70-8f91-43bf-b9fe-72d8c049f6a3': { columnOrder: ['bd17c23e-4f83-4108-8005-2669170d064b'], diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_source_metric.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_source_metric.ts index 3f1110d706300..411dd90828a7b 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_source_metric.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_source_metric.ts @@ -10,7 +10,7 @@ export const kpiUniquePrivateIpsSourceMetricLensAttributes: LensAttributes = { description: '', state: { datasourceStates: { - indexpattern: { + formBased: { layers: { 'cea37c70-8f91-43bf-b9fe-72d8c049f6a3': { columnOrder: ['bd17c23e-4f83-4108-8005-2669170d064b'], diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_total_users_area.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_total_users_area.test.ts.snap index 11df964f2eca1..f474a4c9d6e10 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_total_users_area.test.ts.snap +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_total_users_area.test.ts.snap @@ -17,7 +17,7 @@ Object { ], "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "416b6fad-1923-4f6a-a2df-b223bb287e30": Object { "columnOrder": Array [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_total_users_metric.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_total_users_metric.test.ts.snap index b53e1bd24d303..eef74c94537d4 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_total_users_metric.test.ts.snap +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_total_users_metric.test.ts.snap @@ -17,7 +17,7 @@ Object { ], "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "416b6fad-1923-4f6a-a2df-b223bb287e30": Object { "columnOrder": Array [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_user_authentication_metric_failure.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_user_authentication_metric_failure.test.ts.snap index 37c20b7e80265..b87fad1faa055 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_user_authentication_metric_failure.test.ts.snap +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_user_authentication_metric_failure.test.ts.snap @@ -17,7 +17,7 @@ Object { ], "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "4590dafb-4ac7-45aa-8641-47a3ff0b817c": Object { "columnOrder": Array [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_user_authentications_area.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_user_authentications_area.test.ts.snap index 1954bccfaffbe..1dcaab239de8e 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_user_authentications_area.test.ts.snap +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_user_authentications_area.test.ts.snap @@ -22,7 +22,7 @@ Object { ], "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "31213ae3-905b-4e88-b987-0cccb1f3209f": Object { "columnOrder": Array [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_user_authentications_bar.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_user_authentications_bar.test.ts.snap index 5335dca6057a6..ac7c883ca71b7 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_user_authentications_bar.test.ts.snap +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_user_authentications_bar.test.ts.snap @@ -22,7 +22,7 @@ Object { ], "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "31213ae3-905b-4e88-b987-0cccb1f3209f": Object { "columnOrder": Array [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_user_authentications_metric_success.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_user_authentications_metric_success.test.ts.snap index 4cadcaf19e91e..0b652257864c0 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_user_authentications_metric_success.test.ts.snap +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_user_authentications_metric_success.test.ts.snap @@ -17,7 +17,7 @@ Object { ], "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "4590dafb-4ac7-45aa-8641-47a3ff0b817c": Object { "columnOrder": Array [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_total_users_area.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_total_users_area.ts index c97748077a6be..c241d03266cc3 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_total_users_area.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_total_users_area.ts @@ -12,7 +12,7 @@ export const kpiTotalUsersAreaLensAttributes: LensAttributes = { description: '', state: { datasourceStates: { - indexpattern: { + formBased: { layers: { '416b6fad-1923-4f6a-a2df-b223bb287e30': { columnOrder: [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_total_users_metric.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_total_users_metric.ts index faa6b62e18b65..08cfed0cb91f7 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_total_users_metric.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_total_users_metric.ts @@ -11,7 +11,7 @@ export const kpiTotalUsersMetricLensAttributes: LensAttributes = { description: '', state: { datasourceStates: { - indexpattern: { + formBased: { layers: { '416b6fad-1923-4f6a-a2df-b223bb287e30': { columnOrder: ['3e51b035-872c-4b44-824b-fe069c222e91'], diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentication_metric_failure.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentication_metric_failure.ts index 3f421f8a1c30a..238a8b95e35d9 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentication_metric_failure.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentication_metric_failure.ts @@ -49,7 +49,7 @@ export const kpiUserAuthenticationsMetricFailureLensAttributes: LensAttributes = }, ], datasourceStates: { - indexpattern: { + formBased: { layers: { '4590dafb-4ac7-45aa-8641-47a3ff0b817c': { columnOrder: ['0eb97c09-a351-4280-97da-944e4bd30dd7'], diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_area.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_area.ts index d96ea21489bb2..da6bdf139a1ca 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_area.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_area.ts @@ -109,7 +109,7 @@ export const kpiUserAuthenticationsAreaLensAttributes: LensAttributes = { }, ], datasourceStates: { - indexpattern: { + formBased: { layers: { '31213ae3-905b-4e88-b987-0cccb1f3209f': { columnOrder: [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_bar.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_bar.ts index 4727c6010b751..a4a1629e360de 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_bar.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_bar.ts @@ -104,7 +104,7 @@ export const kpiUserAuthenticationsBarLensAttributes: LensAttributes = { }, ], datasourceStates: { - indexpattern: { + formBased: { layers: { '31213ae3-905b-4e88-b987-0cccb1f3209f': { columnOrder: [ diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_metric_success.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_metric_success.ts index 3af6f5734d458..58ee89ac81b42 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_metric_success.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_metric_success.ts @@ -49,7 +49,7 @@ export const kpiUserAuthenticationsMetricSuccessLensAttributes: LensAttributes = }, ], datasourceStates: { - indexpattern: { + formBased: { layers: { '4590dafb-4ac7-45aa-8641-47a3ff0b817c': { columnOrder: ['0eb97c09-a351-4280-97da-944e4bd30dd7'], diff --git a/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/routes/__snapshots__/create_prebuilt_saved_objects.test.ts.snap b/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/routes/__snapshots__/create_prebuilt_saved_objects.test.ts.snap index bcc3240778155..0ee3a4235fd72 100644 --- a/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/routes/__snapshots__/create_prebuilt_saved_objects.test.ts.snap +++ b/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/routes/__snapshots__/create_prebuilt_saved_objects.test.ts.snap @@ -30,7 +30,7 @@ Array [ "description": null, "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "b885eaad-3c68-49ad-9891-70158d912dbd": Object { "columnOrder": Array [ @@ -359,7 +359,7 @@ Array [ "description": null, "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "2f34d626-d0ee-4ade-9e75-13c480699485": Object { "columnOrder": Array [ @@ -544,7 +544,7 @@ Array [ "description": "", "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "b4c8cd6f-2499-4791-a0f7-01b0d3f75efc": Object { "columnOrder": Array [ @@ -686,7 +686,7 @@ Array [ "description": "", "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "b885eaad-3c68-49ad-9891-70158d912dbd": Object { "columnOrder": Array [ diff --git a/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/saved_object/host_risk_score_dashboards.ts b/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/saved_object/host_risk_score_dashboards.ts index 8b80748694369..34a4cc1ebbfb0 100644 --- a/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/saved_object/host_risk_score_dashboards.ts +++ b/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/saved_object/host_risk_score_dashboards.ts @@ -29,7 +29,7 @@ export const hostRiskScoreDashboards: SavedObject[] = [ description: null, state: { datasourceStates: { - indexpattern: { + formBased: { layers: { 'b885eaad-3c68-49ad-9891-70158d912dbd': { columnOrder: [ @@ -289,7 +289,7 @@ export const hostRiskScoreDashboards: SavedObject[] = [ description: null, state: { datasourceStates: { - indexpattern: { + formBased: { layers: { '2f34d626-d0ee-4ade-9e75-13c480699485': { columnOrder: [ diff --git a/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/saved_object/user_risk_score_dashboards.ts b/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/saved_object/user_risk_score_dashboards.ts index fea181e6907ca..bf9c2afca3265 100644 --- a/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/saved_object/user_risk_score_dashboards.ts +++ b/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/saved_object/user_risk_score_dashboards.ts @@ -29,7 +29,7 @@ export const userRiskScoreDashboards: SavedObject[] = [ description: '', state: { datasourceStates: { - indexpattern: { + formBased: { layers: { 'b4c8cd6f-2499-4791-a0f7-01b0d3f75efc': { columnOrder: [ @@ -131,7 +131,7 @@ export const userRiskScoreDashboards: SavedObject[] = [ description: '', state: { datasourceStates: { - indexpattern: { + formBased: { layers: { 'b885eaad-3c68-49ad-9891-70158d912dbd': { columnOrder: [ diff --git a/x-pack/plugins/ux/public/components/app/rum_dashboard/charts/__snapshots__/visitor_breakdown_chart.test.tsx.snap b/x-pack/plugins/ux/public/components/app/rum_dashboard/charts/__snapshots__/visitor_breakdown_chart.test.tsx.snap index c3bc67a02749c..263d63a00bd1e 100644 --- a/x-pack/plugins/ux/public/components/app/rum_dashboard/charts/__snapshots__/visitor_breakdown_chart.test.tsx.snap +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/charts/__snapshots__/visitor_breakdown_chart.test.tsx.snap @@ -16,7 +16,7 @@ Object { ], "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "layer1": Object { "columnOrder": Array [ diff --git a/x-pack/plugins/ux/public/components/app/rum_dashboard/charts/visitor_breakdown_chart.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/charts/visitor_breakdown_chart.tsx index 89176ea2e21c0..2bfe580abfed1 100644 --- a/x-pack/plugins/ux/public/components/app/rum_dashboard/charts/visitor_breakdown_chart.tsx +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/charts/visitor_breakdown_chart.tsx @@ -174,7 +174,7 @@ export function getVisitorBreakdownLensAttributes({ ], state: { datasourceStates: { - indexpattern: { + formBased: { layers: { layer1: dataLayer, }, From b112ba6e5684d7f6f421674b451dc993200f0862 Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Tue, 4 Oct 2022 16:49:33 +0300 Subject: [PATCH 11/18] Fixes cases test --- .../functional_with_es_ssl/apps/cases/attachment_framework.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/test/functional_with_es_ssl/apps/cases/attachment_framework.ts b/x-pack/test/functional_with_es_ssl/apps/cases/attachment_framework.ts index f9bcd5946d400..2d16926b47660 100644 --- a/x-pack/test/functional_with_es_ssl/apps/cases/attachment_framework.ts +++ b/x-pack/test/functional_with_es_ssl/apps/cases/attachment_framework.ts @@ -145,7 +145,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { query: { query: '', language: 'kuery' }, filters: [], datasourceStates: { - indexpattern: { + formBased: { layers: { '85863a23-73a0-4e11-9774-70f77b9a5898': { columns: { From 1909876814ea364d25320545ec17095387933321 Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Wed, 5 Oct 2022 09:54:01 +0300 Subject: [PATCH 12/18] Adds migration script test --- .../server/migrations/common_migrations.ts | 8 +- .../saved_object_migrations.test.ts | 96 +++++++++++++++++++ 2 files changed, 101 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/lens/server/migrations/common_migrations.ts b/x-pack/plugins/lens/server/migrations/common_migrations.ts index 09ecd364811d4..e7d328fc99cbe 100644 --- a/x-pack/plugins/lens/server/migrations/common_migrations.ts +++ b/x-pack/plugins/lens/server/migrations/common_migrations.ts @@ -479,13 +479,15 @@ export const commonMigrateMetricIds = ( export const commonMigrateIndexPatternDatasource = ( attributes: LensDocShape850 ): LensDocShape860 => { + const datasourceStates = { + ...attributes.state.datasourceStates, + formBased: attributes.state.datasourceStates.indexpattern, + }; const newAttrs = { ...attributes, state: { ...attributes.state, - datasourceStates: { - formBased: attributes.state.datasourceStates.indexpattern, - }, + datasourceStates, }, }; diff --git a/x-pack/plugins/lens/server/migrations/saved_object_migrations.test.ts b/x-pack/plugins/lens/server/migrations/saved_object_migrations.test.ts index 8264ed4853d35..44fda995975bd 100644 --- a/x-pack/plugins/lens/server/migrations/saved_object_migrations.test.ts +++ b/x-pack/plugins/lens/server/migrations/saved_object_migrations.test.ts @@ -2362,4 +2362,100 @@ describe('Lens migrations', () => { expect(result.attributes.visualizationType).toBe('lnsMetric'); }); }); + + describe('8.6.0 migrates indexpattern datasource', () => { + const context = { log: { warn: () => {} } } as unknown as SavedObjectMigrationContext; + const example = { + type: 'lens', + id: 'mock-saved-object-id', + attributes: { + state: { + datasourceMetaData: { + filterableIndexPatterns: [ + { + id: 'logstash-*', + title: 'logstash-*', + }, + ], + }, + datasourceStates: { + indexpattern: { + currentIndexPatternId: 'logstash-*', + layers: { + 'c61a8afb-a185-4fae-a064-fb3846f6c451': { + columnOrder: ['2cd09808-3915-49f4-b3b0-82767eba23f7'], + columns: { + '2cd09808-3915-49f4-b3b0-82767eba23f7': { + dataType: 'number', + isBucketed: false, + label: 'Maximum of bytes', + operationType: 'max', + scale: 'ratio', + sourceField: 'bytes', + }, + 'd3e62a7a-c259-4fff-a2fc-eebf20b7008a': { + dataType: 'number', + isBucketed: false, + label: 'Minimum of bytes', + operationType: 'min', + scale: 'ratio', + sourceField: 'bytes', + }, + 'd6e40cea-6299-43b4-9c9d-b4ee305a2ce8': { + dataType: 'date', + isBucketed: true, + label: 'Date Histogram of @timestamp', + operationType: 'date_histogram', + params: { + interval: 'auto', + }, + scale: 'interval', + sourceField: '@timestamp', + }, + }, + indexPatternId: 'logstash-*', + }, + }, + }, + }, + filters: [], + query: { + language: 'kuery', + query: '', + }, + visualization: { + accessor: '2cd09808-3915-49f4-b3b0-82767eba23f7', + isHorizontal: false, + layerId: 'c61a8afb-a185-4fae-a064-fb3846f6c451', + layers: [ + { + accessors: [ + 'd3e62a7a-c259-4fff-a2fc-eebf20b7008a', + '26ef70a9-c837-444c-886e-6bd905ee7335', + ], + layerId: 'c61a8afb-a185-4fae-a064-fb3846f6c451', + seriesType: 'area', + splitAccessor: '54cd64ed-2a44-4591-af84-b2624504569a', + xAccessor: 'd6e40cea-6299-43b4-9c9d-b4ee305a2ce8', + }, + ], + legend: { + isVisible: true, + position: 'right', + }, + preferredSeriesType: 'area', + }, + }, + title: 'Artistpreviouslyknownaslens', + visualizationType: 'lnsXY', + }, + }; + + it('migrates the indexpattern datasource to formBased', () => { + const result = migrations['8.6.0'](example, context); + expect(result.attributes.state.datasourceStates.formBased).toBe( + example.attributes.state.datasourceStates.indexpattern + ); + }); + }); }); From fc83eea06ca4b2955d3949bbc81d4e685b866c43 Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Wed, 5 Oct 2022 11:25:08 +0300 Subject: [PATCH 13/18] Revert --- .../plugins/lens/server/migrations/common_migrations.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/lens/server/migrations/common_migrations.ts b/x-pack/plugins/lens/server/migrations/common_migrations.ts index e7d328fc99cbe..09ecd364811d4 100644 --- a/x-pack/plugins/lens/server/migrations/common_migrations.ts +++ b/x-pack/plugins/lens/server/migrations/common_migrations.ts @@ -479,15 +479,13 @@ export const commonMigrateMetricIds = ( export const commonMigrateIndexPatternDatasource = ( attributes: LensDocShape850 ): LensDocShape860 => { - const datasourceStates = { - ...attributes.state.datasourceStates, - formBased: attributes.state.datasourceStates.indexpattern, - }; const newAttrs = { ...attributes, state: { ...attributes.state, - datasourceStates, + datasourceStates: { + formBased: attributes.state.datasourceStates.indexpattern, + }, }, }; From 374431be441e07e8a877383a4ac4fd8d5e1c533d Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Thu, 6 Oct 2022 14:56:51 +0300 Subject: [PATCH 14/18] Update jest integration test --- .../migrations/check_registered_types.test.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/server/integration_tests/saved_objects/migrations/check_registered_types.test.ts b/src/core/server/integration_tests/saved_objects/migrations/check_registered_types.test.ts index d7704db87476f..983d0d4a5ce85 100644 --- a/src/core/server/integration_tests/saved_objects/migrations/check_registered_types.test.ts +++ b/src/core/server/integration_tests/saved_objects/migrations/check_registered_types.test.ts @@ -62,11 +62,11 @@ describe('checking migration metadata changes on all registered SO types', () => "app_search_telemetry": "7fc4fc08852bf0924ee29942bb394fda9aa8954d", "application_usage_daily": "6e645e0b60ef3af2e8fde80963c2a4f09a190d61", "application_usage_totals": "b2af3577dcd50bfae492b166a7804f69e2cc41dc", - "canvas-element": "5f32b99ba6ff9c1f17cc093591b975be65a27b9b", - "canvas-workpad": "b60252414fb6159a14f9febf98dbe41e5a8bf199", - "canvas-workpad-template": "c371cad0a8d61385f4782cab9a9063d3cf241ee0", + "canvas-element": "c27505dcf2970760bea8a0fe1d000253f0c40f08", + "canvas-workpad": "eb7b28a3b1c24af615edbf29becddf2e750a4bb5", + "canvas-workpad-template": "34454b811e32993eaa55c6ec85a7aecca00c4cfc", "cases": "7ff5ce930146a2d6fc8fbf536ce2ee16e9df296f", - "cases-comments": "8cfbad4ede637305eb6fb79db680f03dc0ce5ec4", + "cases-comments": "d7c4c1d24e97620cd415e27e5eb7d5b5f2c5b461", "cases-configure": "1afc414f5563a36e4612fa269193d3ed7277c7bd", "cases-connector-mappings": "4b16d440af966e5d6e0fa33368bfa15d987a4b69", "cases-telemetry": "16e261e7378a72acd0806f18df92525dd1da4f37", @@ -76,7 +76,7 @@ describe('checking migration metadata changes on all registered SO types', () => "core-usage-stats": "f40a213da2c597b0de94e364a4326a5a1baa4ca9", "csp-rule-template": "3679c5f2431da8153878db79c78a4e695357fb61", "csp_rule": "d2bb53ea5d2bdfba1a835ad8956dfcd2b2c32e19", - "dashboard": "0b0842b6aa40c125d64233fd81cee11080580dc2", + "dashboard": "742f2d9f110709fd8599b14f7766f38efc30de61", "endpoint:user-artifact": "f94c250a52b30d0a2d32635f8b4c5bdabd1e25c0", "endpoint:user-artifact-manifest": "8c14d49a385d5d1307d956aa743ec78de0b2be88", "enterprise_search_telemetry": "fafcc8318528d34f721c42d1270787c52565bad5", @@ -102,7 +102,7 @@ describe('checking migration metadata changes on all registered SO types', () => "inventory-view": "bc2bd1e7ec7c186159447ab228d269f22bd39056", "kql-telemetry": "29544cd7d3b767c5399878efae6bd724d24c03fd", "legacy-url-alias": "7172dfd54f2e0c89fe263fd7095519b2d826a930", - "lens": "08769c789ad6d1b8a4d0cffebc9d9bb08bf01ad9", + "lens": "236ecd358ed3a4ecfc03ed676d958b64acf0b697", "lens-ui-telemetry": "df2844565c9e18fed2bdb1f6cc3aadd58cf1e45b", "map": "00ca6c4cf46ae59f70f1436262eb9f457b45eb14", "maps-telemetry": "5adbde35bd50ec2b8e9ea5b96d4d9f886e31ecfb", From ed008b79c162a475727b9c0ff769832223825917 Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Mon, 10 Oct 2022 10:39:02 +0300 Subject: [PATCH 15/18] Fix security solution tests --- .../saved_object/host_risk_score_dashboards.ts | 2 +- .../saved_object/user_risk_score_dashboards.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/saved_object/host_risk_score_dashboards.ts b/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/saved_object/host_risk_score_dashboards.ts index 34a4cc1ebbfb0..6333c41161fdc 100644 --- a/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/saved_object/host_risk_score_dashboards.ts +++ b/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/saved_object/host_risk_score_dashboards.ts @@ -289,7 +289,7 @@ export const hostRiskScoreDashboards: SavedObject[] = [ description: null, state: { datasourceStates: { - formBased: { + indexpattern: { layers: { '2f34d626-d0ee-4ade-9e75-13c480699485': { columnOrder: [ diff --git a/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/saved_object/user_risk_score_dashboards.ts b/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/saved_object/user_risk_score_dashboards.ts index bf9c2afca3265..5e4f996090b60 100644 --- a/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/saved_object/user_risk_score_dashboards.ts +++ b/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/saved_object/user_risk_score_dashboards.ts @@ -131,7 +131,7 @@ export const userRiskScoreDashboards: SavedObject[] = [ description: '', state: { datasourceStates: { - formBased: { + indexpattern: { layers: { 'b885eaad-3c68-49ad-9891-70158d912dbd': { columnOrder: [ From 2dff2ec6384b865a6b96f527a69293c4dc9741a7 Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Mon, 10 Oct 2022 12:12:10 +0300 Subject: [PATCH 16/18] Fix jest test --- .../create_prebuilt_saved_objects.test.ts.snap | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/routes/__snapshots__/create_prebuilt_saved_objects.test.ts.snap b/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/routes/__snapshots__/create_prebuilt_saved_objects.test.ts.snap index 62b2ce5955aeb..cc9fa306834c8 100644 --- a/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/routes/__snapshots__/create_prebuilt_saved_objects.test.ts.snap +++ b/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/routes/__snapshots__/create_prebuilt_saved_objects.test.ts.snap @@ -30,7 +30,7 @@ Array [ "description": null, "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "b885eaad-3c68-49ad-9891-70158d912dbd": Object { "columnOrder": Array [ @@ -359,7 +359,7 @@ Array [ "description": null, "state": Object { "datasourceStates": Object { - "formBased": Object { + "indexpattern": Object { "layers": Object { "2f34d626-d0ee-4ade-9e75-13c480699485": Object { "columnOrder": Array [ @@ -544,7 +544,7 @@ Array [ "description": "", "state": Object { "datasourceStates": Object { - "indexpattern": Object { + "formBased": Object { "layers": Object { "b4c8cd6f-2499-4791-a0f7-01b0d3f75efc": Object { "columnOrder": Array [ @@ -686,7 +686,7 @@ Array [ "description": "", "state": Object { "datasourceStates": Object { - "formBased": Object { + "indexpattern": Object { "layers": Object { "b885eaad-3c68-49ad-9891-70158d912dbd": Object { "columnOrder": Array [ From 64b93b3250381341303afb0e9859b168c39e98d6 Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Mon, 10 Oct 2022 12:57:06 +0300 Subject: [PATCH 17/18] Address type nit --- .../lens/server/embeddable/make_lens_embeddable_factory.ts | 5 ++--- .../__snapshots__/create_prebuilt_saved_objects.test.ts.snap | 4 ++-- .../saved_object/host_risk_score_dashboards.ts | 2 +- .../saved_object/user_risk_score_dashboards.ts | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/x-pack/plugins/lens/server/embeddable/make_lens_embeddable_factory.ts b/x-pack/plugins/lens/server/embeddable/make_lens_embeddable_factory.ts index c9041c788a667..42846e84377dd 100644 --- a/x-pack/plugins/lens/server/embeddable/make_lens_embeddable_factory.ts +++ b/x-pack/plugins/lens/server/embeddable/make_lens_embeddable_factory.ts @@ -7,6 +7,7 @@ import { EmbeddableRegistryDefinition } from '@kbn/embeddable-plugin/server'; import type { SerializableRecord } from '@kbn/utility-types'; +import type { SavedObject } from '@kbn/core-saved-objects-common'; import { mergeMigrationFunctionMaps, MigrateFunctionsObject, @@ -157,9 +158,7 @@ export const makeLensEmbeddableFactory = } as unknown as SerializableRecord; }, '8.6.0': (state) => { - const lensState = state as unknown as { - attributes: LensDocShape850; - }; + const lensState = state as unknown as SavedObject>; const migratedLensState = commonMigrateIndexPatternDatasource(lensState.attributes); return { diff --git a/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/routes/__snapshots__/create_prebuilt_saved_objects.test.ts.snap b/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/routes/__snapshots__/create_prebuilt_saved_objects.test.ts.snap index cc9fa306834c8..014e7ccc66ade 100644 --- a/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/routes/__snapshots__/create_prebuilt_saved_objects.test.ts.snap +++ b/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/routes/__snapshots__/create_prebuilt_saved_objects.test.ts.snap @@ -30,7 +30,7 @@ Array [ "description": null, "state": Object { "datasourceStates": Object { - "formBased": Object { + "indexpattern": Object { "layers": Object { "b885eaad-3c68-49ad-9891-70158d912dbd": Object { "columnOrder": Array [ @@ -544,7 +544,7 @@ Array [ "description": "", "state": Object { "datasourceStates": Object { - "formBased": Object { + "indexpattern": Object { "layers": Object { "b4c8cd6f-2499-4791-a0f7-01b0d3f75efc": Object { "columnOrder": Array [ diff --git a/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/saved_object/host_risk_score_dashboards.ts b/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/saved_object/host_risk_score_dashboards.ts index 6333c41161fdc..8b80748694369 100644 --- a/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/saved_object/host_risk_score_dashboards.ts +++ b/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/saved_object/host_risk_score_dashboards.ts @@ -29,7 +29,7 @@ export const hostRiskScoreDashboards: SavedObject[] = [ description: null, state: { datasourceStates: { - formBased: { + indexpattern: { layers: { 'b885eaad-3c68-49ad-9891-70158d912dbd': { columnOrder: [ diff --git a/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/saved_object/user_risk_score_dashboards.ts b/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/saved_object/user_risk_score_dashboards.ts index 5e4f996090b60..fea181e6907ca 100644 --- a/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/saved_object/user_risk_score_dashboards.ts +++ b/x-pack/plugins/security_solution/server/lib/risk_score/prebuilt_saved_objects/saved_object/user_risk_score_dashboards.ts @@ -29,7 +29,7 @@ export const userRiskScoreDashboards: SavedObject[] = [ description: '', state: { datasourceStates: { - formBased: { + indexpattern: { layers: { 'b4c8cd6f-2499-4791-a0f7-01b0d3f75efc': { columnOrder: [ From e32e5e093746919bf425b8093caaf8bce01b563f Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Wed, 12 Oct 2022 08:54:25 +0300 Subject: [PATCH 18/18] Fix types --- .../lens/public/visualizations/gauge/visualization.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/lens/public/visualizations/gauge/visualization.tsx b/x-pack/plugins/lens/public/visualizations/gauge/visualization.tsx index 99120c90942d4..f78529a17c8f4 100644 --- a/x-pack/plugins/lens/public/visualizations/gauge/visualization.tsx +++ b/x-pack/plugins/lens/public/visualizations/gauge/visualization.tsx @@ -37,7 +37,7 @@ import { applyPaletteParams } from '../../shared_components'; import { GaugeDimensionEditor } from './dimension_editor'; import { generateId } from '../../id_generator'; import { getAccessorsFromState } from './utils'; -import { IndexPatternLayer } from '../..'; +import { FormBasedLayer } from '../..'; const groupLabelForGauge = i18n.translate('xpack.lens.metric.groupLabel', { defaultMessage: 'Goal and single value', @@ -50,7 +50,7 @@ interface GaugeVisualizationDeps { interface GaugeDatasourceState { [prop: string]: unknown; - layers: IndexPatternLayer[]; + layers: FormBasedLayer[]; } export interface GaugeSuggestion extends Suggestion {