From 3e2761d981178b19aacc5638c268980b90e61beb Mon Sep 17 00:00:00 2001 From: Nodir Latipov Date: Tue, 5 Apr 2022 12:23:31 +0500 Subject: [PATCH] [Unified search] Create unified search plugin (#127651) * [Unified search] Create unified search plugin * add unified_search into USES_STYLED_COMPONENTS * fix JEST group 4 * update limits for data plugin * fix: remove unifiedSearch plugin from x-pack/plugins/file_upload * feat: updated .github/CODEOWNERS and set @elastic/kibana-app-services as a code owner * apply PR comments * [CI] Auto-commit changed files from 'node scripts/build_plugin_list_docs' * feat: moved filter bar, apply filters folders and apply filter action from Data plugin to unified search plugin * fix Checks * fix Checks * fix Linting and Default CI Group #16 * fix Checks * fix Checks * fix Linting (with types) * fix show FILTER_BAR * fix Jest Tests * feat replece indexPatternsContranct in setIndexPatterns to DataViewsContract * feat: removed unnecessary interface in unified search * fix Checks * fix Checks * fix Jest Tests, Checks * fix Checks * resolve comments Co-authored-by: Alexey Antonov Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .github/CODEOWNERS | 1 + .i18nrc.json | 3 +- docs/developer/plugin-list.asciidoc | 4 + examples/search_examples/kibana.json | 2 +- .../search_examples/public/application.tsx | 4 +- .../search_examples/public/search/app.tsx | 5 +- .../public/search_sessions/app.tsx | 5 +- examples/search_examples/public/types.ts | 2 + .../styled_components_files.js | 2 +- packages/kbn-optimizer/limits.yml | 3 +- src/plugins/data/public/actions/index.ts | 2 - src/plugins/data/public/deprecated.ts | 5 - src/plugins/data/public/index.scss | 1 - src/plugins/data/public/index.ts | 18 +- src/plugins/data/public/mocks.ts | 4 - src/plugins/data/public/plugin.ts | 32 +-- src/plugins/data/public/query/index.tsx | 1 + src/plugins/data/public/query/lib/index.ts | 4 - .../public/search/fetch/handle_response.tsx | 2 +- src/plugins/data/public/search/index.ts | 2 + .../__mocks__/shard_failure_request.ts | 0 .../__mocks__/shard_failure_response.ts | 0 .../shard_failure_description.test.tsx.snap | 0 .../shard_failure_modal.test.tsx.snap | 0 .../shard_failure_table.test.tsx.snap | 0 .../_shard_failure_modal.scss | 0 .../{ui => }/shard_failure_modal/index.tsx | 0 .../shard_failure_description.test.tsx | 0 .../shard_failure_description.tsx | 0 .../shard_failure_description_header.tsx | 0 .../shard_failure_modal.test.tsx | 0 .../shard_failure_modal.tsx | 0 ...d_failure_open_modal_button.test.mocks.tsx | 2 +- .../shard_failure_open_modal_button.test.tsx | 0 .../shard_failure_open_modal_button.tsx | 7 +- .../shard_failure_table.test.tsx | 0 .../shard_failure_table.tsx | 0 .../shard_failure_types.ts | 0 src/plugins/data/public/types.ts | 15 -- .../filter_editor/lib/filter_label.test.tsx | 143 ----------- src/plugins/data/public/ui/index.ts | 15 -- src/plugins/data/tsconfig.json | 2 +- src/plugins/data_view_management/kibana.json | 2 +- .../components/scripting_help/test_script.tsx | 2 +- .../mount_management_section.tsx | 3 +- .../data_view_management/public/mocks.ts | 3 + .../data_view_management/public/plugin.ts | 2 + .../data_view_management/public/types.ts | 2 + .../data_view_management/tsconfig.json | 1 + src/plugins/input_control_vis/kibana.json | 2 +- .../editor/index_pattern_select_form_row.tsx | 2 +- .../components/editor/list_control_editor.tsx | 6 +- .../editor/range_control_editor.tsx | 6 +- .../input_control_vis/public/plugin.ts | 2 + .../public/test_utils/get_deps_mock.tsx | 8 +- src/plugins/input_control_vis/tsconfig.json | 1 + src/plugins/navigation/kibana.json | 2 +- src/plugins/navigation/public/plugin.ts | 4 +- .../top_nav_menu/create_top_nav_menu.tsx | 6 +- .../public/top_nav_menu/top_nav_menu.test.tsx | 18 +- .../public/top_nav_menu/top_nav_menu.tsx | 15 +- src/plugins/navigation/public/types.ts | 4 +- src/plugins/navigation/tsconfig.json | 1 + src/plugins/unified_search/README.md | 12 + src/plugins/unified_search/config.ts | 13 + src/plugins/unified_search/jest.config.js | 16 ++ src/plugins/unified_search/kibana.json | 14 ++ .../public/actions/apply_filter_action.ts | 6 +- .../unified_search/public/actions/index.ts | 10 + .../apply_filter_popover_content.tsx | 11 +- .../apply_filters/apply_filters_popover.tsx | 2 +- .../public}/apply_filters/index.ts | 0 .../filter_bar/_global_filter_group.scss | 0 .../filter_bar/_global_filter_item.scss | 0 .../public}/filter_bar/_index.scss | 0 .../public}/filter_bar/_variables.scss | 0 .../public}/filter_bar/filter_bar.tsx | 14 +- .../filter_editor/filter_editor.test.tsx | 4 +- .../filter_editor/generic_combo_box.tsx | 0 .../filter_bar/filter_editor/index.tsx | 38 +-- .../__snapshots__/filter_label.test.tsx.snap | 68 +++++ .../lib/filter_editor_utils.test.ts | 4 +- .../filter_editor/lib/filter_editor_utils.ts | 2 +- .../filter_editor/lib/filter_label.test.tsx | 64 +++++ .../filter_editor/lib/filter_label.tsx | 4 +- .../filter_editor/lib/filter_operators.ts | 18 +- .../filter_editor/phrase_suggestor.tsx | 6 +- .../filter_editor/phrase_value_input.tsx | 8 +- .../filter_editor/phrases_values_input.tsx | 6 +- .../filter_editor/range_value_input.tsx | 10 +- .../filter_editor/value_input_type.tsx | 6 +- .../public}/filter_bar/filter_item.tsx | 32 +-- .../public}/filter_bar/filter_options.tsx | 20 +- .../public}/filter_bar/filter_view/index.tsx | 35 ++- .../public}/filter_bar/index.tsx | 7 + .../public/index.scss} | 5 +- src/plugins/unified_search/public/index.ts | 27 ++ .../create_index_pattern_select.tsx | 2 +- .../public}/index_pattern_select/index.tsx | 0 .../index_pattern_select.tsx | 3 +- src/plugins/unified_search/public/mocks.ts | 25 ++ src/plugins/unified_search/public/plugin.ts | 75 ++++++ .../public}/query_string_input/_index.scss | 0 .../query_string_input/_query_bar.scss | 0 .../fetch_index_patterns.ts | 2 +- .../query_string_input}/from_user.test.ts | 2 +- .../public/query_string_input}/from_user.ts | 0 .../public}/query_string_input/index.tsx | 3 +- .../language_switcher.test.tsx | 4 +- .../query_string_input/language_switcher.tsx | 29 ++- .../public/query_string_input}/match_pairs.ts | 0 .../no_data_popover.test.tsx | 0 .../query_string_input/no_data_popover.tsx | 16 +- .../query_bar_top_row.test.tsx | 10 +- .../query_string_input/query_bar_top_row.tsx | 19 +- .../query_string_input.test.mocks.ts | 4 +- .../query_string_input.test.tsx | 8 +- .../query_string_input/query_string_input.tsx | 45 ++-- .../query_string_input}/to_user.test.ts | 2 +- .../public/query_string_input}/to_user.ts | 0 .../public}/saved_query_form/index.ts | 0 .../saved_query_form/save_query_form.tsx | 36 +-- .../saved_query_management/_index.scss | 0 .../_saved_query_list_item.scss | 0 .../_saved_query_management_component.scss | 0 .../public}/saved_query_management/index.ts | 0 .../saved_query_list_item.tsx | 40 +-- .../saved_query_management_component.tsx | 42 ++-- .../public}/search_bar/create_search_bar.tsx | 13 +- .../public}/search_bar/index.tsx | 3 +- .../search_bar/lib/clear_saved_query.test.ts | 5 +- .../search_bar/lib/clear_saved_query.ts | 2 +- .../populate_state_from_saved_query.test.ts | 10 +- .../lib/populate_state_from_saved_query.ts | 2 +- .../search_bar/lib/use_filter_manager.ts | 2 +- .../lib/use_query_string_manager.ts | 4 +- .../public}/search_bar/lib/use_saved_query.ts | 7 +- .../public}/search_bar/lib/use_timefilter.ts | 2 +- .../public}/search_bar/search_bar.test.tsx | 8 +- .../public}/search_bar/search_bar.tsx | 11 +- src/plugins/unified_search/public/services.ts | 18 ++ .../public/test_helpers/get_stub_filter.ts | 34 +++ .../suggestion_component.test.tsx.snap | 0 .../public}/typeahead/_index.scss | 0 .../public}/typeahead/_suggestion.scss | 0 .../public}/typeahead/constants.ts | 0 .../public}/typeahead/index.tsx | 0 .../typeahead/suggestion_component.test.tsx | 2 +- .../typeahead/suggestion_component.tsx | 2 +- .../typeahead/suggestions_component.test.tsx | 2 +- .../typeahead/suggestions_component.tsx | 8 +- .../public}/typeahead/types.ts | 2 +- src/plugins/unified_search/public/types.ts | 46 ++++ .../public}/utils/index.ts | 1 + .../public}/utils/on_raf.ts | 0 .../public/utils/shallow_equal.ts | 36 +++ src/plugins/unified_search/tsconfig.json | 23 ++ src/plugins/vis_default_editor/kibana.json | 2 +- .../public/components/controls/filter.tsx | 9 +- src/plugins/vis_default_editor/tsconfig.json | 3 +- src/plugins/vis_types/timeseries/kibana.json | 2 +- .../components/query_bar_wrapper.tsx | 2 +- .../vis_types/timeseries/tsconfig.json | 1 + test/tsconfig.json | 1 + .../exploratory_view_example/public/plugin.ts | 6 +- .../ui_actions_enhanced_examples/kibana.json | 3 +- .../drilldown.tsx | 6 +- .../dashboard_to_discover_drilldown/types.ts | 2 +- .../cloud_security_posture/kibana.json | 2 +- .../public/pages/findings/findings.test.tsx | 21 +- .../pages/findings/findings_search_bar.tsx | 2 +- .../cloud_security_posture/public/types.ts | 3 +- x-pack/plugins/dashboard_enhanced/kibana.json | 2 +- ...embeddable_to_dashboard_drilldown.test.tsx | 2 +- .../embeddable_to_dashboard_drilldown.tsx | 2 +- x-pack/plugins/data_visualizer/kibana.json | 3 +- .../components/search_panel/search_panel.tsx | 4 +- .../index_data_visualizer.tsx | 2 + .../plugins/data_visualizer/public/plugin.ts | 2 + x-pack/plugins/data_visualizer/tsconfig.json | 2 + .../explore_data/explore_data_chart_action.ts | 6 +- .../drilldowns/url_drilldown/tsconfig.json | 3 +- x-pack/plugins/file_upload/public/plugin.ts | 2 +- x-pack/plugins/fleet/kibana.json | 2 +- .../fleet/components/search_bar.tsx | 2 +- .../components/agent_logs/query_bar.tsx | 2 +- x-pack/plugins/fleet/tsconfig.json | 1 + x-pack/plugins/graph/kibana.json | 1 + .../public/components/search_bar.test.tsx | 2 +- .../graph/public/components/search_bar.tsx | 7 +- x-pack/plugins/graph/tsconfig.json | 3 +- x-pack/plugins/infra/kibana.json | 1 + .../inventory/components/expression.tsx | 5 +- .../metric_anomaly/components/expression.tsx | 2 +- .../components/expression.tsx | 5 +- .../public/pages/logs/stream/page_toolbar.tsx | 2 +- x-pack/plugins/infra/tsconfig.json | 3 +- x-pack/plugins/lens/kibana.json | 3 +- .../filters/filter_popover.test.tsx | 4 +- .../definitions/filters/filters.test.tsx | 2 +- .../indexpattern_datasource/query_input.tsx | 3 +- x-pack/plugins/lens/tsconfig.json | 42 ++-- x-pack/plugins/maps/kibana.json | 4 +- .../draw_forms/distance_filter_form.tsx | 2 +- .../geometry_filter_form.tsx | 2 +- .../filter_editor/filter_editor.tsx | 4 +- .../resources/where_expression.tsx | 4 +- .../feature_geometry_filter_form.tsx | 2 +- .../feature_properties.test.tsx | 2 +- .../features_tooltip/feature_properties.tsx | 2 +- .../maps/public/embeddable/map_embeddable.tsx | 8 +- x-pack/plugins/maps/public/kibana_services.ts | 4 +- x-pack/plugins/maps/public/plugin.ts | 2 + x-pack/plugins/maps/tsconfig.json | 3 +- x-pack/plugins/ml/kibana.json | 3 +- .../exploration_query_bar.tsx | 3 +- .../explorer_query_bar/explorer_query_bar.tsx | 3 +- x-pack/plugins/ml/tsconfig.json | 3 +- x-pack/plugins/observability/kibana.json | 4 +- .../shared/exploratory_view/rtl_helpers.tsx | 5 +- .../filter_value_label/filter_value_label.tsx | 2 +- .../alerts/components/alerts_search_bar.tsx | 3 +- x-pack/plugins/observability/tsconfig.json | 3 +- x-pack/plugins/security_solution/kibana.json | 1 + .../components/query_bar/index.test.tsx | 3 +- .../common/components/query_bar/index.tsx | 2 +- .../components/search_bar/index.test.tsx | 2 + .../common/components/search_bar/index.tsx | 4 +- .../public/common/lib/kibana/services.ts | 5 +- .../mock/endpoint/dependencies_start_mock.ts | 8 +- .../rules/description_step/helpers.test.tsx | 7 +- .../rules/description_step/helpers.tsx | 7 +- .../view/components/search_bar.tsx | 3 +- .../plugins/security_solution/public/types.ts | 2 + .../plugins/security_solution/tsconfig.json | 1 + x-pack/plugins/stack_alerts/kibana.json | 1 + .../expression/es_query_expression.test.tsx | 3 + .../expression/read_only_filter_items.tsx | 6 +- .../search_source_expression.test.tsx | 3 + .../expressions/boundary_index_expression.tsx | 5 +- .../expressions/entity_index_expression.tsx | 5 +- ...containment_alert_type_expression.test.tsx | 5 + .../geo_containment/query_builder/index.tsx | 7 +- .../alert_types/threshold/expression.tsx | 2 +- x-pack/plugins/stack_alerts/tsconfig.json | 3 +- x-pack/plugins/transform/kibana.json | 1 + .../source_search_bar/source_search_bar.tsx | 2 +- x-pack/plugins/transform/tsconfig.json | 1 + .../translations/translations/fr-FR.json | 232 ++++++++--------- .../translations/translations/ja-JP.json | 234 +++++++++--------- .../translations/translations/zh-CN.json | 234 +++++++++--------- .../plugins/triggers_actions_ui/kibana.json | 2 +- .../public/application/app.tsx | 2 + .../sections/rule_form/rule_form.tsx | 2 + .../common/lib/kibana/kibana_react.mock.ts | 2 + .../triggers_actions_ui/public/plugin.ts | 3 + .../triggers_actions_ui/public/types.ts | 10 +- .../plugins/triggers_actions_ui/tsconfig.json | 1 + x-pack/plugins/uptime/kibana.json | 2 +- .../alerts/alert_query_bar/query_bar.tsx | 2 +- .../overview/query_bar/query_bar.tsx | 2 +- x-pack/plugins/uptime/tsconfig.json | 3 + 262 files changed, 1467 insertions(+), 1058 deletions(-) rename src/plugins/data/public/{ui => }/shard_failure_modal/__mocks__/shard_failure_request.ts (100%) rename src/plugins/data/public/{ui => }/shard_failure_modal/__mocks__/shard_failure_response.ts (100%) rename src/plugins/data/public/{ui => }/shard_failure_modal/__snapshots__/shard_failure_description.test.tsx.snap (100%) rename src/plugins/data/public/{ui => }/shard_failure_modal/__snapshots__/shard_failure_modal.test.tsx.snap (100%) rename src/plugins/data/public/{ui => }/shard_failure_modal/__snapshots__/shard_failure_table.test.tsx.snap (100%) rename src/plugins/data/public/{ui => }/shard_failure_modal/_shard_failure_modal.scss (100%) rename src/plugins/data/public/{ui => }/shard_failure_modal/index.tsx (100%) rename src/plugins/data/public/{ui => }/shard_failure_modal/shard_failure_description.test.tsx (100%) rename src/plugins/data/public/{ui => }/shard_failure_modal/shard_failure_description.tsx (100%) rename src/plugins/data/public/{ui => }/shard_failure_modal/shard_failure_description_header.tsx (100%) rename src/plugins/data/public/{ui => }/shard_failure_modal/shard_failure_modal.test.tsx (100%) rename src/plugins/data/public/{ui => }/shard_failure_modal/shard_failure_modal.tsx (100%) rename src/plugins/data/public/{ui => }/shard_failure_modal/shard_failure_open_modal_button.test.mocks.tsx (91%) rename src/plugins/data/public/{ui => }/shard_failure_modal/shard_failure_open_modal_button.test.tsx (100%) rename src/plugins/data/public/{ui => }/shard_failure_modal/shard_failure_open_modal_button.tsx (91%) rename src/plugins/data/public/{ui => }/shard_failure_modal/shard_failure_table.test.tsx (100%) rename src/plugins/data/public/{ui => }/shard_failure_modal/shard_failure_table.tsx (100%) rename src/plugins/data/public/{ui => }/shard_failure_modal/shard_failure_types.ts (100%) delete mode 100644 src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_label.test.tsx delete mode 100644 src/plugins/data/public/ui/index.ts create mode 100755 src/plugins/unified_search/README.md create mode 100644 src/plugins/unified_search/config.ts create mode 100644 src/plugins/unified_search/jest.config.js create mode 100755 src/plugins/unified_search/kibana.json rename src/plugins/{data => unified_search}/public/actions/apply_filter_action.ts (95%) create mode 100644 src/plugins/unified_search/public/actions/index.ts rename src/plugins/{data/public/ui => unified_search/public}/apply_filters/apply_filter_popover_content.tsx (89%) rename src/plugins/{data/public/ui => unified_search/public}/apply_filters/apply_filters_popover.tsx (94%) rename src/plugins/{data/public/ui => unified_search/public}/apply_filters/index.ts (100%) rename src/plugins/{data/public/ui => unified_search/public}/filter_bar/_global_filter_group.scss (100%) rename src/plugins/{data/public/ui => unified_search/public}/filter_bar/_global_filter_item.scss (100%) rename src/plugins/{data/public/ui => unified_search/public}/filter_bar/_index.scss (100%) rename src/plugins/{data/public/ui => unified_search/public}/filter_bar/_variables.scss (100%) rename src/plugins/{data/public/ui => unified_search/public}/filter_bar/filter_bar.tsx (94%) rename src/plugins/{data/public/ui => unified_search/public}/filter_bar/filter_editor/filter_editor.test.tsx (93%) rename src/plugins/{data/public/ui => unified_search/public}/filter_bar/filter_editor/generic_combo_box.tsx (100%) rename src/plugins/{data/public/ui => unified_search/public}/filter_bar/filter_editor/index.tsx (91%) create mode 100644 src/plugins/unified_search/public/filter_bar/filter_editor/lib/__snapshots__/filter_label.test.tsx.snap rename src/plugins/{data/public/ui => unified_search/public}/filter_bar/filter_editor/lib/filter_editor_utils.test.ts (98%) rename src/plugins/{data/public/ui => unified_search/public}/filter_bar/filter_editor/lib/filter_editor_utils.ts (98%) create mode 100644 src/plugins/unified_search/public/filter_bar/filter_editor/lib/filter_label.test.tsx rename src/plugins/{data/public/ui => unified_search/public}/filter_bar/filter_editor/lib/filter_label.tsx (94%) rename src/plugins/{data/public/ui => unified_search/public}/filter_bar/filter_editor/lib/filter_operators.ts (76%) rename src/plugins/{data/public/ui => unified_search/public}/filter_bar/filter_editor/phrase_suggestor.tsx (94%) rename src/plugins/{data/public/ui => unified_search/public}/filter_bar/filter_editor/phrase_value_input.tsx (90%) rename src/plugins/{data/public/ui => unified_search/public}/filter_bar/filter_editor/phrases_values_input.tsx (90%) rename src/plugins/{data/public/ui => unified_search/public}/filter_bar/filter_editor/range_value_input.tsx (89%) rename src/plugins/{data/public/ui => unified_search/public}/filter_bar/filter_editor/value_input_type.tsx (95%) rename src/plugins/{data/public/ui => unified_search/public}/filter_bar/filter_item.tsx (90%) rename src/plugins/{data/public/ui => unified_search/public}/filter_bar/filter_options.tsx (85%) rename src/plugins/{data/public/ui => unified_search/public}/filter_bar/filter_view/index.tsx (71%) rename src/plugins/{data/public/ui => unified_search/public}/filter_bar/index.tsx (79%) rename src/plugins/{data/public/ui/_index.scss => unified_search/public/index.scss} (72%) mode change 100644 => 100755 create mode 100755 src/plugins/unified_search/public/index.ts rename src/plugins/{data/public/ui => unified_search/public}/index_pattern_select/create_index_pattern_select.tsx (92%) rename src/plugins/{data/public/ui => unified_search/public}/index_pattern_select/index.tsx (100%) rename src/plugins/{data/public/ui => unified_search/public}/index_pattern_select/index_pattern_select.tsx (98%) create mode 100644 src/plugins/unified_search/public/mocks.ts create mode 100755 src/plugins/unified_search/public/plugin.ts rename src/plugins/{data/public/ui => unified_search/public}/query_string_input/_index.scss (100%) rename src/plugins/{data/public/ui => unified_search/public}/query_string_input/_query_bar.scss (100%) rename src/plugins/{data/public/ui => unified_search/public}/query_string_input/fetch_index_patterns.ts (94%) rename src/plugins/{data/public/query/lib => unified_search/public/query_string_input}/from_user.test.ts (96%) rename src/plugins/{data/public/query/lib => unified_search/public/query_string_input}/from_user.ts (100%) rename src/plugins/{data/public/ui => unified_search/public}/query_string_input/index.tsx (94%) rename src/plugins/{data/public/ui => unified_search/public}/query_string_input/language_switcher.test.tsx (97%) rename src/plugins/{data/public/ui => unified_search/public}/query_string_input/language_switcher.tsx (80%) rename src/plugins/{data/public/query/lib => unified_search/public/query_string_input}/match_pairs.ts (100%) rename src/plugins/{data/public/ui => unified_search/public}/query_string_input/no_data_popover.test.tsx (100%) rename src/plugins/{data/public/ui => unified_search/public}/query_string_input/no_data_popover.tsx (84%) rename src/plugins/{data/public/ui => unified_search/public}/query_string_input/query_bar_top_row.test.tsx (95%) rename src/plugins/{data/public/ui => unified_search/public}/query_string_input/query_bar_top_row.tsx (96%) rename src/plugins/{data/public/ui => unified_search/public}/query_string_input/query_string_input.test.mocks.ts (89%) rename src/plugins/{data/public/ui => unified_search/public}/query_string_input/query_string_input.test.tsx (97%) rename src/plugins/{data/public/ui => unified_search/public}/query_string_input/query_string_input.tsx (95%) rename src/plugins/{data/public/query/lib => unified_search/public/query_string_input}/to_user.test.ts (96%) rename src/plugins/{data/public/query/lib => unified_search/public/query_string_input}/to_user.ts (100%) rename src/plugins/{data/public/ui => unified_search/public}/saved_query_form/index.ts (100%) rename src/plugins/{data/public/ui => unified_search/public}/saved_query_form/save_query_form.tsx (84%) rename src/plugins/{data/public/ui => unified_search/public}/saved_query_management/_index.scss (100%) rename src/plugins/{data/public/ui => unified_search/public}/saved_query_management/_saved_query_list_item.scss (100%) rename src/plugins/{data/public/ui => unified_search/public}/saved_query_management/_saved_query_management_component.scss (100%) rename src/plugins/{data/public/ui => unified_search/public}/saved_query_management/index.ts (100%) rename src/plugins/{data/public/ui => unified_search/public}/saved_query_management/saved_query_list_item.tsx (77%) rename src/plugins/{data/public/ui => unified_search/public}/saved_query_management/saved_query_management_component.tsx (86%) rename src/plugins/{data/public/ui => unified_search/public}/search_bar/create_search_bar.tsx (94%) rename src/plugins/{data/public/ui => unified_search/public}/search_bar/index.tsx (89%) rename src/plugins/{data/public/ui => unified_search/public}/search_bar/lib/clear_saved_query.test.ts (87%) rename src/plugins/{data/public/ui => unified_search/public}/search_bar/lib/clear_saved_query.ts (90%) rename src/plugins/{data/public/ui => unified_search/public}/search_bar/lib/populate_state_from_saved_query.test.ts (91%) rename src/plugins/{data/public/ui => unified_search/public}/search_bar/lib/populate_state_from_saved_query.ts (94%) rename src/plugins/{data/public/ui => unified_search/public}/search_bar/lib/use_filter_manager.ts (94%) rename src/plugins/{data/public/ui => unified_search/public}/search_bar/lib/use_query_string_manager.ts (92%) rename src/plugins/{data/public/ui => unified_search/public}/search_bar/lib/use_saved_query.ts (92%) rename src/plugins/{data/public/ui => unified_search/public}/search_bar/lib/use_timefilter.ts (98%) rename src/plugins/{data/public/ui => unified_search/public}/search_bar/search_bar.test.tsx (96%) rename src/plugins/{data/public/ui => unified_search/public}/search_bar/search_bar.tsx (97%) create mode 100644 src/plugins/unified_search/public/services.ts create mode 100644 src/plugins/unified_search/public/test_helpers/get_stub_filter.ts rename src/plugins/{data/public/ui => unified_search/public}/typeahead/__snapshots__/suggestion_component.test.tsx.snap (100%) rename src/plugins/{data/public/ui => unified_search/public}/typeahead/_index.scss (100%) rename src/plugins/{data/public/ui => unified_search/public}/typeahead/_suggestion.scss (100%) rename src/plugins/{data/public/ui => unified_search/public}/typeahead/constants.ts (100%) rename src/plugins/{data/public/ui => unified_search/public}/typeahead/index.tsx (100%) rename src/plugins/{data/public/ui => unified_search/public}/typeahead/suggestion_component.test.tsx (97%) rename src/plugins/{data/public/ui => unified_search/public}/typeahead/suggestion_component.tsx (98%) rename src/plugins/{data/public/ui => unified_search/public}/typeahead/suggestions_component.test.tsx (98%) rename src/plugins/{data/public/ui => unified_search/public}/typeahead/suggestions_component.tsx (98%) rename src/plugins/{data/public/ui => unified_search/public}/typeahead/types.ts (90%) create mode 100755 src/plugins/unified_search/public/types.ts rename src/plugins/{data/public/ui => unified_search/public}/utils/index.ts (89%) rename src/plugins/{data/public/ui => unified_search/public}/utils/on_raf.ts (100%) create mode 100644 src/plugins/unified_search/public/utils/shallow_equal.ts create mode 100644 src/plugins/unified_search/tsconfig.json diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index c88a787e1c04..405972b4f919 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -82,6 +82,7 @@ /src/plugins/bfetch/ @elastic/kibana-app-services /src/plugins/data_view_management/ @elastic/kibana-app-services /src/plugins/inspector/ @elastic/kibana-app-services +/src/plugins/unified_search/ @elastic/kibana-app-services /x-pack/examples/ui_actions_enhanced_examples/ @elastic/kibana-app-services /x-pack/plugins/data_enhanced/ @elastic/kibana-app-services /x-pack/plugins/embeddable_enhanced/ @elastic/kibana-app-services diff --git a/.i18nrc.json b/.i18nrc.json index 908963ca4d99..d6256e753df6 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -90,7 +90,8 @@ "visTypeVega": "src/plugins/vis_types/vega", "visTypeVislib": "src/plugins/vis_types/vislib", "visTypeXy": "src/plugins/vis_types/xy", - "visualizations": "src/plugins/visualizations" + "visualizations": "src/plugins/visualizations", + "unifiedSearch": "src/plugins/unified_search" }, "translations": [] } \ No newline at end of file diff --git a/docs/developer/plugin-list.asciidoc b/docs/developer/plugin-list.asciidoc index 0b9e48020c68..04b21bf73781 100644 --- a/docs/developer/plugin-list.asciidoc +++ b/docs/developer/plugin-list.asciidoc @@ -291,6 +291,10 @@ In general this plugin provides: - Exposing a context menu for the user to choose the appropriate action when there are multiple actions attached to a single trigger. +|{kib-repo}blob/{branch}/src/plugins/unified_search/README.md[unifiedSearch] +|Contains all the components of Kibana's unified search experience. Specifically: + + |{kib-repo}blob/{branch}/src/plugins/url_forwarding/README.md[urlForwarding] |This plugins contains helpers to redirect legacy URLs. It can be used to forward old URLs to their new counterparts. diff --git a/examples/search_examples/kibana.json b/examples/search_examples/kibana.json index 87839f2037f9..70e934759be0 100644 --- a/examples/search_examples/kibana.json +++ b/examples/search_examples/kibana.json @@ -9,7 +9,7 @@ "description": "Example plugin of how to use data plugin search services", "server": true, "ui": true, - "requiredPlugins": ["navigation", "data", "developerExamples", "kibanaUtils", "share"], + "requiredPlugins": ["navigation", "data", "developerExamples", "kibanaUtils", "share", "unifiedSearch"], "optionalPlugins": [], "requiredBundles": ["kibanaReact"], "owner": { diff --git a/examples/search_examples/public/application.tsx b/examples/search_examples/public/application.tsx index 9bd5bb0f3f8a..2c1d92451fe6 100644 --- a/examples/search_examples/public/application.tsx +++ b/examples/search_examples/public/application.tsx @@ -39,7 +39,7 @@ const LINKS: ExampleLink[] = [ export const renderApp = ( { notifications, savedObjects, http, application }: CoreStart, - { data, navigation }: AppPluginStartDependencies, + { data, navigation, unifiedSearch }: AppPluginStartDependencies, { element, history }: AppMountParameters ) => { ReactDOM.render( @@ -53,6 +53,7 @@ export const renderApp = ( navigation={navigation} data={data} http={http} + unifiedSearch={unifiedSearch} /> @@ -63,6 +64,7 @@ export const renderApp = ( navigation={navigation} notifications={notifications} data={data} + unifiedSearch={unifiedSearch} /> diff --git a/examples/search_examples/public/search/app.tsx b/examples/search_examples/public/search/app.tsx index 922082786385..9bd7bf8f7d43 100644 --- a/examples/search_examples/public/search/app.tsx +++ b/examples/search_examples/public/search/app.tsx @@ -44,6 +44,7 @@ import { isCompleteResponse, isErrorResponse, } from '../../../../src/plugins/data/public'; +import { UnifiedSearchPublicPluginStart } from '../../../../src/plugins/unified_search/public'; import type { DataViewField, DataView } from '../../../../src/plugins/data_views/public'; import { IMyStrategyResponse } from '../../common/types'; import { AbortError } from '../../../../src/plugins/kibana_utils/common'; @@ -53,6 +54,7 @@ interface SearchExamplesAppDeps { http: CoreStart['http']; navigation: NavigationPublicPluginStart; data: DataPublicPluginStart; + unifiedSearch: UnifiedSearchPublicPluginStart; } function getNumeric(fields?: DataViewField[]) { @@ -85,8 +87,9 @@ export const SearchExamplesApp = ({ notifications, navigation, data, + unifiedSearch, }: SearchExamplesAppDeps) => { - const { IndexPatternSelect } = data.ui; + const { IndexPatternSelect } = unifiedSearch.ui; const [getCool, setGetCool] = useState(false); const [fibonacciN, setFibonacciN] = useState(10); const [timeTook, setTimeTook] = useState(); diff --git a/examples/search_examples/public/search_sessions/app.tsx b/examples/search_examples/public/search_sessions/app.tsx index fbca346af8a3..fa9ec526e02f 100644 --- a/examples/search_examples/public/search_sessions/app.tsx +++ b/examples/search_examples/public/search_sessions/app.tsx @@ -49,6 +49,7 @@ import { SearchSessionState, TimeRange, } from '../../../../src/plugins/data/public'; +import { UnifiedSearchPublicPluginStart } from '../../../../src/plugins/unified_search/public'; import type { DataView, DataViewField } from '../../../../src/plugins/data_views/public'; import { createStateContainer, @@ -60,6 +61,7 @@ interface SearchSessionsExampleAppDeps { notifications: CoreStart['notifications']; navigation: NavigationPublicPluginStart; data: DataPublicPluginStart; + unifiedSearch: UnifiedSearchPublicPluginStart; } /** @@ -89,8 +91,9 @@ export const SearchSessionsExampleApp = ({ notifications, navigation, data, + unifiedSearch, }: SearchSessionsExampleAppDeps) => { - const { IndexPatternSelect } = data.ui; + const { IndexPatternSelect } = unifiedSearch.ui; const [isSearching, setIsSearching] = useState(false); const [request, setRequest] = useState(null); diff --git a/examples/search_examples/public/types.ts b/examples/search_examples/public/types.ts index fd3b869af3fe..02f0ad28cfd7 100644 --- a/examples/search_examples/public/types.ts +++ b/examples/search_examples/public/types.ts @@ -8,6 +8,7 @@ import { NavigationPublicPluginStart } from '../../../src/plugins/navigation/public'; import { DataPublicPluginStart } from '../../../src/plugins/data/public'; +import { UnifiedSearchPublicPluginStart } from '../../../src/plugins/unified_search/public'; import { DeveloperExamplesSetup } from '../../developer_examples/public'; import { SharePluginSetup } from '../../../src/plugins/share/public'; @@ -24,4 +25,5 @@ export interface AppPluginSetupDependencies { export interface AppPluginStartDependencies { navigation: NavigationPublicPluginStart; data: DataPublicPluginStart; + unifiedSearch: UnifiedSearchPublicPluginStart; } diff --git a/packages/kbn-babel-preset/styled_components_files.js b/packages/kbn-babel-preset/styled_components_files.js index 2efe4b1474b4..a1d94136ebfb 100644 --- a/packages/kbn-babel-preset/styled_components_files.js +++ b/packages/kbn-babel-preset/styled_components_files.js @@ -13,7 +13,7 @@ module.exports = { */ USES_STYLED_COMPONENTS: [ /packages[\/\\]kbn-ui-shared-deps-(npm|src)[\/\\]/, - /src[\/\\]plugins[\/\\](data|kibana_react)[\/\\]/, + /src[\/\\]plugins[\/\\](unified_search|kibana_react)[\/\\]/, /x-pack[\/\\]plugins[\/\\](apm|beats_management|cases|fleet|infra|lists|observability|osquery|security_solution|timelines|uptime|ux)[\/\\]/, /x-pack[\/\\]test[\/\\]plugin_functional[\/\\]plugins[\/\\]resolver_test[\/\\]/, ], diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index e137bd005590..8d0e03218ddb 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -99,7 +99,6 @@ pageLoadAssetSize: visTypeMetric: 23332 bfetch: 22837 kibanaUtils: 79713 - data: 491273 dataViews: 43532 expressions: 140958 fieldFormats: 65209 @@ -124,5 +123,7 @@ pageLoadAssetSize: sessionView: 77750 cloudSecurityPosture: 19109 visTypeGauge: 24113 + unifiedSearch: 49195 + data: 454087 expressionXY: 26500 eventAnnotation: 19334 diff --git a/src/plugins/data/public/actions/index.ts b/src/plugins/data/public/actions/index.ts index 0ec33f7e4652..4a5839065c5c 100644 --- a/src/plugins/data/public/actions/index.ts +++ b/src/plugins/data/public/actions/index.ts @@ -6,8 +6,6 @@ * Side Public License, v 1. */ -export type { ApplyGlobalFilterActionContext } from './apply_filter_action'; -export { ACTION_GLOBAL_APPLY_FILTER, createFilterAction } from './apply_filter_action'; export { createFiltersFromValueClickAction } from './filters/create_filters_from_value_click'; export { createFiltersFromRangeSelectAction } from './filters/create_filters_from_range_select'; export * from './select_range_action'; diff --git a/src/plugins/data/public/deprecated.ts b/src/plugins/data/public/deprecated.ts index 6a6c7bbb2cd2..ac8f273eb720 100644 --- a/src/plugins/data/public/deprecated.ts +++ b/src/plugins/data/public/deprecated.ts @@ -51,8 +51,6 @@ import { getEsQueryConfig, } from '../common'; -import { FilterLabel, FilterItem } from './ui'; - import { getDisplayValueFromFilter, generateFilters, @@ -90,9 +88,6 @@ const convertRangeFilterToTimeRangeString = oldConvertRangeFilterToTimeRangeStri * @removeBy 8.1 */ export const esFilters = { - FilterLabel, - FilterItem, - FILTERS, FilterStateStore, diff --git a/src/plugins/data/public/index.scss b/src/plugins/data/public/index.scss index 467efa98934e..00d3b53865e7 100644 --- a/src/plugins/data/public/index.scss +++ b/src/plugins/data/public/index.scss @@ -1,2 +1 @@ -@import './ui/index'; @import './utils/table_inspector_view/index'; diff --git a/src/plugins/data/public/index.ts b/src/plugins/data/public/index.ts index 77f17d3a63ee..6fd357447fad 100644 --- a/src/plugins/data/public/index.ts +++ b/src/plugins/data/public/index.ts @@ -19,7 +19,6 @@ export * from './deprecated'; */ export { getEsQueryConfig, FilterStateStore } from '../common'; -export { FilterLabel, FilterItem } from './ui'; export { getDisplayValueFromFilter, generateFilters, @@ -259,15 +258,6 @@ export const search = { * UI components */ -export type { - SearchBarProps, - StatefulSearchBarProps, - IndexPatternSelectProps, - QueryStringInputProps, -} from './ui'; - -export { QueryStringInput, SearchBar } from './ui'; - /** * Types to be shared externally * @public @@ -281,6 +271,8 @@ export { getDefaultQuery, FilterManager, TimeHistory, + getQueryLog, + mapAndFlattenFilters, } from './query'; export type { @@ -293,6 +285,9 @@ export type { QueryStateChange, QueryStart, AutoRefreshDoneFn, + PersistedLog, + QueryStringContract, + QuerySetup, } from './query'; export type { AggsStart } from './search/aggs'; @@ -303,8 +298,6 @@ export type { SavedObject } from '../common'; export { isTimeRange, isQuery, flattenHit, calculateBounds, tabifyAggResponse } from '../common'; -export type { ApplyGlobalFilterActionContext } from './actions'; -export { ACTION_GLOBAL_APPLY_FILTER } from './actions'; export { APPLY_FILTER_TRIGGER } from './triggers'; /* @@ -321,7 +314,6 @@ export type { DataPublicPluginSetup, DataPublicPluginStart, IDataPluginServices, - DataPublicPluginStartUi, DataPublicPluginStartActions, } from './types'; diff --git a/src/plugins/data/public/mocks.ts b/src/plugins/data/public/mocks.ts index 630a29a8a785..3c0c58c979db 100644 --- a/src/plugins/data/public/mocks.ts +++ b/src/plugins/data/public/mocks.ts @@ -63,10 +63,6 @@ const createStartContract = (): Start => { search: searchServiceMock.createStartContract(), fieldFormats: fieldFormatsServiceMock.createStartContract(), query: queryStartMock, - ui: { - IndexPatternSelect: jest.fn(), - SearchBar: jest.fn().mockReturnValue(null), - }, dataViews, /** * @deprecated Use dataViews service instead. All index pattern interfaces were renamed. diff --git a/src/plugins/data/public/plugin.ts b/src/plugins/data/public/plugin.ts index 50795b441624..1402a01a3b05 100644 --- a/src/plugins/data/public/plugin.ts +++ b/src/plugins/data/public/plugin.ts @@ -20,7 +20,6 @@ import type { import { AutocompleteService } from './autocomplete'; import { SearchService } from './search/search_service'; import { QueryService } from './query'; -import { createIndexPatternSelect } from './ui/index_pattern_select'; import { setIndexPatterns, setNotifications, @@ -29,17 +28,13 @@ import { setUiSettings, setTheme, } from './services'; -import { createSearchBar } from './ui/search_bar/create_search_bar'; import { - ACTION_GLOBAL_APPLY_FILTER, - createFilterAction, createFiltersFromValueClickAction, createFiltersFromRangeSelectAction, createValueClickAction, createSelectRangeAction, } from './actions'; -import { APPLY_FILTER_TRIGGER, applyFilterTrigger } from './triggers'; -import { UsageCollectionSetup } from '../../usage_collection/public'; +import { applyFilterTrigger } from './triggers'; import { getTableViewDescription } from './utils/table_inspector_view'; import { NowProvider, NowProviderInternalContract } from './now_provider'; import { getAggsFormats, DatatableUtilitiesService } from '../common'; @@ -57,7 +52,6 @@ export class DataPublicPlugin private readonly searchService: SearchService; private readonly queryService: QueryService; private readonly storage: IStorageWrapper; - private usageCollection: UsageCollectionSetup | undefined; private readonly nowProvider: NowProviderInternalContract; constructor(initializerContext: PluginInitializerContext) { @@ -82,7 +76,6 @@ export class DataPublicPlugin ): DataPublicPluginSetup { const startServices = createStartServicesGetter(core.getStartServices); - this.usageCollection = usageCollection; setTheme(core.theme); const searchService = this.searchService.setup(core, { @@ -99,9 +92,6 @@ export class DataPublicPlugin }); uiActions.registerTrigger(applyFilterTrigger); - uiActions.registerAction( - createFilterAction(queryService.filterManager, queryService.timefilter.timefilter, core.theme) - ); inspector.registerView( getTableViewDescription(() => ({ @@ -161,11 +151,6 @@ export class DataPublicPlugin })) ); - uiActions.addTriggerAction( - APPLY_FILTER_TRIGGER, - uiActions.getAction(ACTION_GLOBAL_APPLY_FILTER) - ); - const datatableUtilities = new DatatableUtilitiesService(search.aggs, dataViews, fieldFormats); const dataServices = { actions: { @@ -182,20 +167,7 @@ export class DataPublicPlugin nowProvider: this.nowProvider, }; - const SearchBar = createSearchBar({ - core, - data: dataServices, - storage: this.storage, - usageCollection: this.usageCollection, - }); - - return { - ...dataServices, - ui: { - IndexPatternSelect: createIndexPatternSelect(dataViews), - SearchBar, - }, - }; + return dataServices; } public stop() { diff --git a/src/plugins/data/public/query/index.tsx b/src/plugins/data/public/query/index.tsx index c4622f5701b3..f426573e1bd6 100644 --- a/src/plugins/data/public/query/index.tsx +++ b/src/plugins/data/public/query/index.tsx @@ -14,3 +14,4 @@ export * from './timefilter'; export * from './saved_query'; export * from './persisted_log'; export * from './state_sync'; +export type { QueryStringContract } from './query_string'; diff --git a/src/plugins/data/public/query/lib/index.ts b/src/plugins/data/public/query/lib/index.ts index 5966a7a8ad0e..79e8c38cb6e9 100644 --- a/src/plugins/data/public/query/lib/index.ts +++ b/src/plugins/data/public/query/lib/index.ts @@ -7,9 +7,5 @@ */ export * from './add_to_query_log'; -export * from './from_user'; export * from './get_default_query'; export * from './get_query_log'; -export * from './match_pairs'; -export * from './to_user'; -export * from './to_user'; diff --git a/src/plugins/data/public/search/fetch/handle_response.tsx b/src/plugins/data/public/search/fetch/handle_response.tsx index 618efcb702ec..6199e52f4595 100644 --- a/src/plugins/data/public/search/fetch/handle_response.tsx +++ b/src/plugins/data/public/search/fetch/handle_response.tsx @@ -10,7 +10,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; import { EuiSpacer } from '@elastic/eui'; import { IKibanaSearchResponse } from 'src/plugins/data/common'; -import { ShardFailureOpenModalButton } from '../../ui/shard_failure_modal'; +import { ShardFailureOpenModalButton } from '../../shard_failure_modal'; import { ThemeServiceStart } from '../../../../../core/public'; import { toMountPoint } from '../../../../kibana_react/public'; import { getNotifications } from '../../services'; diff --git a/src/plugins/data/public/search/index.ts b/src/plugins/data/public/search/index.ts index 6923ec7e8705..1e69d60af84f 100644 --- a/src/plugins/data/public/search/index.ts +++ b/src/plugins/data/public/search/index.ts @@ -59,3 +59,5 @@ export { handleResponse } from './fetch'; export type { SearchInterceptorDeps } from './search_interceptor'; export { SearchInterceptor } from './search_interceptor'; export * from './errors'; + +export { SearchService } from './search_service'; diff --git a/src/plugins/data/public/ui/shard_failure_modal/__mocks__/shard_failure_request.ts b/src/plugins/data/public/shard_failure_modal/__mocks__/shard_failure_request.ts similarity index 100% rename from src/plugins/data/public/ui/shard_failure_modal/__mocks__/shard_failure_request.ts rename to src/plugins/data/public/shard_failure_modal/__mocks__/shard_failure_request.ts diff --git a/src/plugins/data/public/ui/shard_failure_modal/__mocks__/shard_failure_response.ts b/src/plugins/data/public/shard_failure_modal/__mocks__/shard_failure_response.ts similarity index 100% rename from src/plugins/data/public/ui/shard_failure_modal/__mocks__/shard_failure_response.ts rename to src/plugins/data/public/shard_failure_modal/__mocks__/shard_failure_response.ts diff --git a/src/plugins/data/public/ui/shard_failure_modal/__snapshots__/shard_failure_description.test.tsx.snap b/src/plugins/data/public/shard_failure_modal/__snapshots__/shard_failure_description.test.tsx.snap similarity index 100% rename from src/plugins/data/public/ui/shard_failure_modal/__snapshots__/shard_failure_description.test.tsx.snap rename to src/plugins/data/public/shard_failure_modal/__snapshots__/shard_failure_description.test.tsx.snap diff --git a/src/plugins/data/public/ui/shard_failure_modal/__snapshots__/shard_failure_modal.test.tsx.snap b/src/plugins/data/public/shard_failure_modal/__snapshots__/shard_failure_modal.test.tsx.snap similarity index 100% rename from src/plugins/data/public/ui/shard_failure_modal/__snapshots__/shard_failure_modal.test.tsx.snap rename to src/plugins/data/public/shard_failure_modal/__snapshots__/shard_failure_modal.test.tsx.snap diff --git a/src/plugins/data/public/ui/shard_failure_modal/__snapshots__/shard_failure_table.test.tsx.snap b/src/plugins/data/public/shard_failure_modal/__snapshots__/shard_failure_table.test.tsx.snap similarity index 100% rename from src/plugins/data/public/ui/shard_failure_modal/__snapshots__/shard_failure_table.test.tsx.snap rename to src/plugins/data/public/shard_failure_modal/__snapshots__/shard_failure_table.test.tsx.snap diff --git a/src/plugins/data/public/ui/shard_failure_modal/_shard_failure_modal.scss b/src/plugins/data/public/shard_failure_modal/_shard_failure_modal.scss similarity index 100% rename from src/plugins/data/public/ui/shard_failure_modal/_shard_failure_modal.scss rename to src/plugins/data/public/shard_failure_modal/_shard_failure_modal.scss diff --git a/src/plugins/data/public/ui/shard_failure_modal/index.tsx b/src/plugins/data/public/shard_failure_modal/index.tsx similarity index 100% rename from src/plugins/data/public/ui/shard_failure_modal/index.tsx rename to src/plugins/data/public/shard_failure_modal/index.tsx diff --git a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_description.test.tsx b/src/plugins/data/public/shard_failure_modal/shard_failure_description.test.tsx similarity index 100% rename from src/plugins/data/public/ui/shard_failure_modal/shard_failure_description.test.tsx rename to src/plugins/data/public/shard_failure_modal/shard_failure_description.test.tsx diff --git a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_description.tsx b/src/plugins/data/public/shard_failure_modal/shard_failure_description.tsx similarity index 100% rename from src/plugins/data/public/ui/shard_failure_modal/shard_failure_description.tsx rename to src/plugins/data/public/shard_failure_modal/shard_failure_description.tsx diff --git a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_description_header.tsx b/src/plugins/data/public/shard_failure_modal/shard_failure_description_header.tsx similarity index 100% rename from src/plugins/data/public/ui/shard_failure_modal/shard_failure_description_header.tsx rename to src/plugins/data/public/shard_failure_modal/shard_failure_description_header.tsx diff --git a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_modal.test.tsx b/src/plugins/data/public/shard_failure_modal/shard_failure_modal.test.tsx similarity index 100% rename from src/plugins/data/public/ui/shard_failure_modal/shard_failure_modal.test.tsx rename to src/plugins/data/public/shard_failure_modal/shard_failure_modal.test.tsx diff --git a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_modal.tsx b/src/plugins/data/public/shard_failure_modal/shard_failure_modal.tsx similarity index 100% rename from src/plugins/data/public/ui/shard_failure_modal/shard_failure_modal.tsx rename to src/plugins/data/public/shard_failure_modal/shard_failure_modal.tsx diff --git a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_open_modal_button.test.mocks.tsx b/src/plugins/data/public/shard_failure_modal/shard_failure_open_modal_button.test.mocks.tsx similarity index 91% rename from src/plugins/data/public/ui/shard_failure_modal/shard_failure_open_modal_button.test.mocks.tsx rename to src/plugins/data/public/shard_failure_modal/shard_failure_open_modal_button.test.mocks.tsx index 44996497cc0c..757d318e1d1b 100644 --- a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_open_modal_button.test.mocks.tsx +++ b/src/plugins/data/public/shard_failure_modal/shard_failure_open_modal_button.test.mocks.tsx @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { setOverlays } from '../../services'; +import { setOverlays } from '../services'; import { OverlayStart } from 'kibana/public'; export const openModal = jest.fn(); diff --git a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_open_modal_button.test.tsx b/src/plugins/data/public/shard_failure_modal/shard_failure_open_modal_button.test.tsx similarity index 100% rename from src/plugins/data/public/ui/shard_failure_modal/shard_failure_open_modal_button.test.tsx rename to src/plugins/data/public/shard_failure_modal/shard_failure_open_modal_button.test.tsx diff --git a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_open_modal_button.tsx b/src/plugins/data/public/shard_failure_modal/shard_failure_open_modal_button.tsx similarity index 91% rename from src/plugins/data/public/ui/shard_failure_modal/shard_failure_open_modal_button.tsx rename to src/plugins/data/public/shard_failure_modal/shard_failure_open_modal_button.tsx index 585268824fb9..a20fe3da06e5 100644 --- a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_open_modal_button.tsx +++ b/src/plugins/data/public/shard_failure_modal/shard_failure_open_modal_button.tsx @@ -10,10 +10,9 @@ import React from 'react'; import { FormattedMessage } from '@kbn/i18n-react'; import { EuiButton, EuiTextAlign } from '@elastic/eui'; import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; - -import { getOverlays } from '../../services'; -import { ThemeServiceStart } from '../../../../../core/public'; -import { toMountPoint } from '../../../../kibana_react/public'; +import { getOverlays } from '../services'; +import { ThemeServiceStart } from '../../../../core/public'; +import { toMountPoint } from '../../../kibana_react/public'; import { ShardFailureModal } from './shard_failure_modal'; import { ShardFailureRequest } from './shard_failure_types'; diff --git a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_table.test.tsx b/src/plugins/data/public/shard_failure_modal/shard_failure_table.test.tsx similarity index 100% rename from src/plugins/data/public/ui/shard_failure_modal/shard_failure_table.test.tsx rename to src/plugins/data/public/shard_failure_modal/shard_failure_table.test.tsx diff --git a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_table.tsx b/src/plugins/data/public/shard_failure_modal/shard_failure_table.tsx similarity index 100% rename from src/plugins/data/public/ui/shard_failure_modal/shard_failure_table.tsx rename to src/plugins/data/public/shard_failure_modal/shard_failure_table.tsx diff --git a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_types.ts b/src/plugins/data/public/shard_failure_modal/shard_failure_types.ts similarity index 100% rename from src/plugins/data/public/ui/shard_failure_modal/shard_failure_types.ts rename to src/plugins/data/public/shard_failure_modal/shard_failure_types.ts diff --git a/src/plugins/data/public/types.ts b/src/plugins/data/public/types.ts index bfc35b8f39c5..55b2637e874e 100644 --- a/src/plugins/data/public/types.ts +++ b/src/plugins/data/public/types.ts @@ -6,7 +6,6 @@ * Side Public License, v 1. */ -import React from 'react'; import { CoreStart } from 'src/core/public'; import { BfetchPublicSetup } from 'src/plugins/bfetch/public'; import { IStorageWrapper } from 'src/plugins/kibana_utils/public'; @@ -20,7 +19,6 @@ import { createFiltersFromRangeSelectAction, createFiltersFromValueClickAction } import type { ISearchSetup, ISearchStart } from './search'; import { QuerySetup, QueryStart } from './query'; import { DataViewsContract } from './data_views'; -import { IndexPatternSelectProps, StatefulSearchBarProps } from './ui'; import { UsageCollectionSetup, UsageCollectionStart } from '../../usage_collection/public'; import { Setup as InspectorSetup } from '../../inspector/public'; import { NowProviderPublicContract } from './now_provider'; @@ -49,14 +47,6 @@ export interface DataPublicPluginSetup { query: QuerySetup; } -/** - * Data plugin prewired UI components - */ -export interface DataPublicPluginStartUi { - IndexPatternSelect: React.ComponentType; - SearchBar: React.ComponentType; -} - /** * utilities to generate filters from action context */ @@ -110,11 +100,6 @@ export interface DataPublicPluginStart { * {@link QueryStart} */ query: QueryStart; - /** - * prewired UI components - * {@link DataPublicPluginStartUi} - */ - ui: DataPublicPluginStartUi; nowProvider: NowProviderPublicContract; } diff --git a/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_label.test.tsx b/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_label.test.tsx deleted file mode 100644 index f7e9d3930c0e..000000000000 --- a/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_label.test.tsx +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React from 'react'; -import FilterLabel from './filter_label'; -import { render } from '@testing-library/react'; -import { phraseFilter } from '../../../../stubs'; - -test('alias', () => { - const filter = { - ...phraseFilter, - meta: { - ...phraseFilter.meta, - alias: 'geo.coordinates in US', - }, - }; - const { container } = render(); - expect(container).toMatchInlineSnapshot(` -
- - geo.coordinates in US -
- `); -}); - -test('negated alias', () => { - const filter = { - ...phraseFilter, - meta: { - ...phraseFilter.meta, - alias: 'geo.coordinates in US', - negate: true, - }, - }; - const { container } = render(); - expect(container).toMatchInlineSnapshot(` -
- - NOT - - geo.coordinates in US -
- `); -}); - -test('alias with warning status', () => { - const filter = { - ...phraseFilter, - meta: { - ...phraseFilter.meta, - alias: 'geo.coordinates in US', - negate: true, - }, - }; - const { container } = render( - - ); - expect(container).toMatchInlineSnapshot(` -
- - NOT - - geo.coordinates in US - : - - Warning - -
- `); -}); - -test('alias with error status', () => { - const filter = { - ...phraseFilter, - meta: { - ...phraseFilter.meta, - alias: 'geo.coordinates in US', - negate: true, - }, - }; - const { container } = render( - - ); - expect(container).toMatchInlineSnapshot(` -
- - NOT - - geo.coordinates in US - : - - Error - -
- `); -}); - -test('warning', () => { - const { container } = render(); - expect(container).toMatchInlineSnapshot(` -
- - machine.os - : - - Warning - -
- `); -}); - -test('error', () => { - const { container } = render(); - expect(container).toMatchInlineSnapshot(` -
- - machine.os - : - - Error - -
- `); -}); diff --git a/src/plugins/data/public/ui/index.ts b/src/plugins/data/public/ui/index.ts deleted file mode 100644 index 026db1b7c09e..000000000000 --- a/src/plugins/data/public/ui/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -export type { IndexPatternSelectProps } from './index_pattern_select'; -export { FilterLabel, FilterItem } from './filter_bar'; -export type { QueryStringInputProps } from './query_string_input'; -export { QueryStringInput } from './query_string_input'; -export type { SearchBarProps, StatefulSearchBarProps } from './search_bar'; -export { SearchBar } from './search_bar'; -export { SuggestionsComponent } from './typeahead'; diff --git a/src/plugins/data/tsconfig.json b/src/plugins/data/tsconfig.json index 92f80f47eca6..b618a047f375 100644 --- a/src/plugins/data/tsconfig.json +++ b/src/plugins/data/tsconfig.json @@ -12,7 +12,7 @@ "server/**/*", "config.ts", "common/**/*.json", - "public/**/*.json" + "public/**/*.json", ], "references": [ { "path": "../../core/tsconfig.json" }, diff --git a/src/plugins/data_view_management/kibana.json b/src/plugins/data_view_management/kibana.json index a8a0f694bd17..43d22f545bf9 100644 --- a/src/plugins/data_view_management/kibana.json +++ b/src/plugins/data_view_management/kibana.json @@ -3,7 +3,7 @@ "version": "kibana", "server": true, "ui": true, - "requiredPlugins": ["management", "data", "urlForwarding", "dataViewFieldEditor", "dataViewEditor", "dataViews", "fieldFormats"], + "requiredPlugins": ["management", "data", "urlForwarding", "dataViewFieldEditor", "dataViewEditor", "dataViews", "fieldFormats", "unifiedSearch"], "requiredBundles": ["kibanaReact", "kibanaUtils"], "optionalPlugins": ["spaces"], "owner": { diff --git a/src/plugins/data_view_management/public/components/field_editor/components/scripting_help/test_script.tsx b/src/plugins/data_view_management/public/components/field_editor/components/scripting_help/test_script.tsx index 89f80f8a87e3..4b5609cf1970 100644 --- a/src/plugins/data_view_management/public/components/field_editor/components/scripting_help/test_script.tsx +++ b/src/plugins/data_view_management/public/components/field_editor/components/scripting_help/test_script.tsx @@ -224,7 +224,7 @@ export class TestScript extends Component {
- {}, diff --git a/src/plugins/data_view_management/public/plugin.ts b/src/plugins/data_view_management/public/plugin.ts index 84686dd666f9..f78f81297dcb 100644 --- a/src/plugins/data_view_management/public/plugin.ts +++ b/src/plugins/data_view_management/public/plugin.ts @@ -17,6 +17,7 @@ import { IndexPatternFieldEditorStart } from '../../data_view_field_editor/publi import { DataViewEditorStart } from '../../data_view_editor/public'; import { DataViewsPublicPluginStart } from '../../data_views/public'; import { SpacesPluginStart } from '../../../../x-pack/plugins/spaces/public'; +import { UnifiedSearchPublicPluginStart } from '../../unified_search/public'; export interface IndexPatternManagementSetupDependencies { management: ManagementSetup; @@ -30,6 +31,7 @@ export interface IndexPatternManagementStartDependencies { dataViews: DataViewsPublicPluginStart; fieldFormats: FieldFormatsStart; spaces?: SpacesPluginStart; + unifiedSearch: UnifiedSearchPublicPluginStart; } // eslint-disable-next-line @typescript-eslint/no-empty-interface diff --git a/src/plugins/data_view_management/public/types.ts b/src/plugins/data_view_management/public/types.ts index 0cea57c1bcd7..53e576f32fcb 100644 --- a/src/plugins/data_view_management/public/types.ts +++ b/src/plugins/data_view_management/public/types.ts @@ -16,6 +16,7 @@ import { ApplicationStart, } from 'src/core/public'; import { DataPublicPluginStart } from 'src/plugins/data/public'; +import { UnifiedSearchPublicPluginStart } from '../../unified_search/public'; import { ManagementAppMountParams } from '../../management/public'; import { IndexPatternManagementStart } from './index'; import { KibanaReactContextValue } from '../../kibana_react/public'; @@ -34,6 +35,7 @@ export interface IndexPatternManagmentContext { http: HttpSetup; docLinks: DocLinksStart; data: DataPublicPluginStart; + unifiedSearch: UnifiedSearchPublicPluginStart; dataViews: DataViewsPublicPluginStart; dataViewFieldEditor: IndexPatternFieldEditorStart; indexPatternManagementStart: IndexPatternManagementStart; diff --git a/src/plugins/data_view_management/tsconfig.json b/src/plugins/data_view_management/tsconfig.json index 9710111bcfde..9b8a7e688e0c 100644 --- a/src/plugins/data_view_management/tsconfig.json +++ b/src/plugins/data_view_management/tsconfig.json @@ -20,6 +20,7 @@ { "path": "../es_ui_shared/tsconfig.json" }, { "path": "../data_view_field_editor/tsconfig.json" }, { "path": "../data_view_editor/tsconfig.json" }, + { "path": "../unified_search/tsconfig.json" }, { "path": "../../../x-pack/plugins/spaces/tsconfig.json" } ] } diff --git a/src/plugins/input_control_vis/kibana.json b/src/plugins/input_control_vis/kibana.json index 83d2c92a7009..ad9a0e3accb6 100644 --- a/src/plugins/input_control_vis/kibana.json +++ b/src/plugins/input_control_vis/kibana.json @@ -9,6 +9,6 @@ "kibanaVersion": "kibana", "server": false, "ui": true, - "requiredPlugins": ["data", "expressions", "visDefaultEditor", "visualizations"], + "requiredPlugins": ["data", "expressions", "visDefaultEditor", "visualizations", "unifiedSearch"], "requiredBundles": ["kibanaReact"] } diff --git a/src/plugins/input_control_vis/public/components/editor/index_pattern_select_form_row.tsx b/src/plugins/input_control_vis/public/components/editor/index_pattern_select_form_row.tsx index 5363a988226e..57fb9cdce6d8 100644 --- a/src/plugins/input_control_vis/public/components/editor/index_pattern_select_form_row.tsx +++ b/src/plugins/input_control_vis/public/components/editor/index_pattern_select_form_row.tsx @@ -9,7 +9,7 @@ import React, { ComponentType } from 'react'; import { injectI18n, InjectedIntlProps } from '@kbn/i18n-react'; import { EuiFormRow } from '@elastic/eui'; -import { IndexPatternSelectProps } from 'src/plugins/data/public'; +import { IndexPatternSelectProps } from '../../../../unified_search/public'; export type IndexPatternSelectFormRowUiProps = InjectedIntlProps & { onChange: (opt: any) => void; diff --git a/src/plugins/input_control_vis/public/components/editor/list_control_editor.tsx b/src/plugins/input_control_vis/public/components/editor/list_control_editor.tsx index 720b1325142e..3a8dcccce651 100644 --- a/src/plugins/input_control_vis/public/components/editor/list_control_editor.tsx +++ b/src/plugins/input_control_vis/public/components/editor/list_control_editor.tsx @@ -14,7 +14,7 @@ import { EuiFormRow, EuiFieldNumber, EuiSwitch, EuiSelect } from '@elastic/eui'; import { IndexPatternSelectFormRow } from './index_pattern_select_form_row'; import { FieldSelect } from './field_select'; import { ControlParams, ControlParamsOptions } from '../../editor_utils'; -import { IndexPatternSelectProps } from '../../../../data/public'; +import { IndexPatternSelectProps } from '../../../../unified_search/public'; import { DataView, DataViewField } from '../../../../data_views/public'; import { InputControlVisDependencies } from '../../plugin'; @@ -93,9 +93,9 @@ export class ListControlEditor extends PureComponent< }; async getIndexPatternSelect() { - const [, { data }] = await this.props.deps.core.getStartServices(); + const [, { unifiedSearch }] = await this.props.deps.core.getStartServices(); this.setState({ - IndexPatternSelect: data.ui.IndexPatternSelect, + IndexPatternSelect: unifiedSearch.ui.IndexPatternSelect, }); } diff --git a/src/plugins/input_control_vis/public/components/editor/range_control_editor.tsx b/src/plugins/input_control_vis/public/components/editor/range_control_editor.tsx index 913eb49c96cf..32d1f9aef554 100644 --- a/src/plugins/input_control_vis/public/components/editor/range_control_editor.tsx +++ b/src/plugins/input_control_vis/public/components/editor/range_control_editor.tsx @@ -14,7 +14,7 @@ import { FormattedMessage } from '@kbn/i18n-react'; import { IndexPatternSelectFormRow } from './index_pattern_select_form_row'; import { FieldSelect } from './field_select'; import { ControlParams, ControlParamsOptions } from '../../editor_utils'; -import { IndexPatternSelectProps } from '../../../../data/public'; +import { IndexPatternSelectProps } from '../../../../unified_search/public'; import { DataView, DataViewField } from '../../../../data_views/public'; import { InputControlVisDependencies } from '../../plugin'; @@ -53,9 +53,9 @@ export class RangeControlEditor extends Component< } async getIndexPatternSelect() { - const [, { data }] = await this.props.deps.core.getStartServices(); + const [, { unifiedSearch }] = await this.props.deps.core.getStartServices(); this.setState({ - IndexPatternSelect: data.ui.IndexPatternSelect, + IndexPatternSelect: unifiedSearch.ui.IndexPatternSelect, }); } diff --git a/src/plugins/input_control_vis/public/plugin.ts b/src/plugins/input_control_vis/public/plugin.ts index c086bc7f74d6..0f8f601d5edb 100644 --- a/src/plugins/input_control_vis/public/plugin.ts +++ b/src/plugins/input_control_vis/public/plugin.ts @@ -9,6 +9,7 @@ import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from 'kibana/public'; import { DataPublicPluginSetup, DataPublicPluginStart } from 'src/plugins/data/public'; +import { UnifiedSearchPublicPluginStart } from 'src/plugins/unified_search/public'; import { Plugin as ExpressionsPublicPlugin } from '../../expressions/public'; import { VisualizationsSetup, VisualizationsStart } from '../../visualizations/public'; import { createInputControlVisFn } from './input_control_fn'; @@ -40,6 +41,7 @@ export interface InputControlVisPluginStartDependencies { expressions: ReturnType; visualizations: VisualizationsStart; data: DataPublicPluginStart; + unifiedSearch: UnifiedSearchPublicPluginStart; } /** @internal */ diff --git a/src/plugins/input_control_vis/public/test_utils/get_deps_mock.tsx b/src/plugins/input_control_vis/public/test_utils/get_deps_mock.tsx index e0964c481189..03102e42a603 100644 --- a/src/plugins/input_control_vis/public/test_utils/get_deps_mock.tsx +++ b/src/plugins/input_control_vis/public/test_utils/get_deps_mock.tsx @@ -31,15 +31,17 @@ export const getDepsMock = ({ search: { searchSource, }, - ui: { - IndexPatternSelect: () => (
) as any, - }, indexPatterns: { get: () => ({ fields, }), }, }, + unifiedSearch: { + ui: { + IndexPatternSelect: () => (
) as any, + }, + }, }, ]), }, diff --git a/src/plugins/input_control_vis/tsconfig.json b/src/plugins/input_control_vis/tsconfig.json index 43b1539e87da..1840efb32bbc 100644 --- a/src/plugins/input_control_vis/tsconfig.json +++ b/src/plugins/input_control_vis/tsconfig.json @@ -17,5 +17,6 @@ { "path": "../expressions/tsconfig.json" }, { "path": "../visualizations/tsconfig.json" }, { "path": "../vis_default_editor/tsconfig.json" }, + { "path": "../unified_search/tsconfig.json" } ] } diff --git a/src/plugins/navigation/kibana.json b/src/plugins/navigation/kibana.json index aa1294847cef..ae188be0c6d3 100644 --- a/src/plugins/navigation/kibana.json +++ b/src/plugins/navigation/kibana.json @@ -7,6 +7,6 @@ "version": "kibana", "server": false, "ui": true, - "requiredPlugins": ["data"], + "requiredPlugins": ["unifiedSearch"], "requiredBundles": ["kibanaReact"] } diff --git a/src/plugins/navigation/public/plugin.ts b/src/plugins/navigation/public/plugin.ts index e9a95312cba9..dc3d8f2043a7 100644 --- a/src/plugins/navigation/public/plugin.ts +++ b/src/plugins/navigation/public/plugin.ts @@ -32,13 +32,13 @@ export class NavigationPublicPlugin public start( { i18n }: CoreStart, - { data }: NavigationPluginStartDependencies + { unifiedSearch }: NavigationPluginStartDependencies ): NavigationPublicPluginStart { const extensions = this.topNavMenuExtensionsRegistry.getAll(); return { ui: { - TopNavMenu: createTopNav(data, extensions, i18n), + TopNavMenu: createTopNav(unifiedSearch, extensions, i18n), }, }; } diff --git a/src/plugins/navigation/public/top_nav_menu/create_top_nav_menu.tsx b/src/plugins/navigation/public/top_nav_menu/create_top_nav_menu.tsx index 1e5cecb5346a..a26627c84a52 100644 --- a/src/plugins/navigation/public/top_nav_menu/create_top_nav_menu.tsx +++ b/src/plugins/navigation/public/top_nav_menu/create_top_nav_menu.tsx @@ -8,12 +8,12 @@ import React from 'react'; import { I18nStart } from 'kibana/public'; -import { DataPublicPluginStart } from 'src/plugins/data/public'; +import { UnifiedSearchPublicPluginStart } from 'src/plugins/unified_search/public'; import { TopNavMenuProps, TopNavMenu } from './top_nav_menu'; import { RegisteredTopNavMenuData } from './top_nav_menu_data'; export function createTopNav( - data: DataPublicPluginStart, + unifiedSearch: UnifiedSearchPublicPluginStart, extraConfig: RegisteredTopNavMenuData[], i18n: I18nStart ) { @@ -25,7 +25,7 @@ export function createTopNav( return ( - + ); }; diff --git a/src/plugins/navigation/public/top_nav_menu/top_nav_menu.test.tsx b/src/plugins/navigation/public/top_nav_menu/top_nav_menu.test.tsx index 682154dd5d5d..7d263d010d46 100644 --- a/src/plugins/navigation/public/top_nav_menu/top_nav_menu.test.tsx +++ b/src/plugins/navigation/public/top_nav_menu/top_nav_menu.test.tsx @@ -13,12 +13,13 @@ import { MountPoint } from 'kibana/public'; import { TopNavMenu } from './top_nav_menu'; import { TopNavMenuData } from './top_nav_menu_data'; import { shallowWithIntl, mountWithIntl } from '@kbn/test-jest-helpers'; +import type { UnifiedSearchPublicPluginStart } from '../../../unified_search/public'; -const dataShim = { +const unifiedSearch = { ui: { SearchBar: () =>
, }, -}; +} as unknown as UnifiedSearchPublicPluginStart; describe('TopNavMenu', () => { const WRAPPER_SELECTOR = '.kbnTopNavMenu__wrapper'; @@ -72,7 +73,7 @@ describe('TopNavMenu', () => { it('Should render search bar', () => { const component = shallowWithIntl( - + ); expect(component.find(WRAPPER_SELECTOR).length).toBe(1); expect(component.find(TOP_NAV_ITEM_SELECTOR).length).toBe(0); @@ -81,7 +82,12 @@ describe('TopNavMenu', () => { it('Should render menu items and search bar', () => { const component = shallowWithIntl( - + ); expect(component.find(WRAPPER_SELECTOR).length).toBe(1); expect(component.find(TOP_NAV_ITEM_SELECTOR).length).toBe(menuItems.length); @@ -94,7 +100,7 @@ describe('TopNavMenu', () => { appName={'test'} config={menuItems} showSearchBar={true} - data={dataShim as any} + unifiedSearch={unifiedSearch} className={'myCoolClass'} /> ); @@ -142,7 +148,7 @@ describe('TopNavMenu', () => { appName={'test'} config={menuItems} showSearchBar={true} - data={dataShim as any} + unifiedSearch={unifiedSearch} setMenuMountPoint={setMountPoint} /> ); diff --git a/src/plugins/navigation/public/top_nav_menu/top_nav_menu.tsx b/src/plugins/navigation/public/top_nav_menu/top_nav_menu.tsx index 22edf9c45446..fcc2f0826339 100644 --- a/src/plugins/navigation/public/top_nav_menu/top_nav_menu.tsx +++ b/src/plugins/navigation/public/top_nav_menu/top_nav_menu.tsx @@ -12,11 +12,8 @@ import classNames from 'classnames'; import { MountPoint } from '../../../../core/public'; import { MountPointPortal } from '../../../kibana_react/public'; -import { - StatefulSearchBarProps, - DataPublicPluginStart, - SearchBarProps, -} from '../../../data/public'; +import { UnifiedSearchPublicPluginStart } from '../../../unified_search/public'; +import { StatefulSearchBarProps, SearchBarProps } from '../../../unified_search/public'; import { TopNavMenuData } from './top_nav_menu_data'; import { TopNavMenuItem } from './top_nav_menu_item'; @@ -29,7 +26,7 @@ export type TopNavMenuProps = StatefulSearchBarProps & showQueryInput?: boolean; showDatePicker?: boolean; showFilterBar?: boolean; - data?: DataPublicPluginStart; + unifiedSearch?: UnifiedSearchPublicPluginStart; className?: string; /** * If provided, the menu part of the component will be rendered as a portal inside the given mount point. @@ -64,7 +61,7 @@ export type TopNavMenuProps = StatefulSearchBarProps & export function TopNavMenu(props: TopNavMenuProps): ReactElement | null { const { config, badges, showSearchBar, ...searchBarProps } = props; - if ((!config || config.length === 0) && (!showSearchBar || !props.data)) { + if ((!config || config.length === 0) && (!showSearchBar || !props.unifiedSearch)) { return null; } @@ -102,8 +99,8 @@ export function TopNavMenu(props: TopNavMenuProps): ReactElement | null { function renderSearchBar(): ReactElement | null { // Validate presense of all required fields - if (!showSearchBar || !props.data) return null; - const { SearchBar } = props.data.ui; + if (!showSearchBar || !props.unifiedSearch) return null; + const { SearchBar } = props.unifiedSearch.ui; return ; } diff --git a/src/plugins/navigation/public/types.ts b/src/plugins/navigation/public/types.ts index d23bc249dd01..29b204a798fa 100644 --- a/src/plugins/navigation/public/types.ts +++ b/src/plugins/navigation/public/types.ts @@ -7,7 +7,7 @@ */ import { TopNavMenuProps, TopNavMenuExtensionsRegistrySetup } from './top_nav_menu'; -import { DataPublicPluginStart } from '../../data/public'; +import { UnifiedSearchPublicPluginStart } from '../../unified_search/public'; export interface NavigationPublicPluginSetup { registerMenuItem: TopNavMenuExtensionsRegistrySetup['register']; @@ -20,5 +20,5 @@ export interface NavigationPublicPluginStart { } export interface NavigationPluginStartDependencies { - data: DataPublicPluginStart; + unifiedSearch: UnifiedSearchPublicPluginStart; } diff --git a/src/plugins/navigation/tsconfig.json b/src/plugins/navigation/tsconfig.json index 1b7e87aaba41..ca9acf96f419 100644 --- a/src/plugins/navigation/tsconfig.json +++ b/src/plugins/navigation/tsconfig.json @@ -11,5 +11,6 @@ { "path": "../../core/tsconfig.json" }, { "path": "../kibana_react/tsconfig.json" }, { "path": "../data/tsconfig.json" }, + { "path": "../unified_search/tsconfig.json" } ] } diff --git a/src/plugins/unified_search/README.md b/src/plugins/unified_search/README.md new file mode 100755 index 000000000000..dd2c65a2d03f --- /dev/null +++ b/src/plugins/unified_search/README.md @@ -0,0 +1,12 @@ +# unifiedSearch + +Contains all the components of Kibana's unified search experience. Specifically: + - UI components for rendering unified search bar; + - Current state of the search (`data view`, `applied filters, …); + - Saved queries management. + +--- + +## Development + +See the [kibana contributing guide](https://github.com/elastic/kibana/blob/main/CONTRIBUTING.md) for instructions setting up your development environment. diff --git a/src/plugins/unified_search/config.ts b/src/plugins/unified_search/config.ts new file mode 100644 index 000000000000..c0067771b680 --- /dev/null +++ b/src/plugins/unified_search/config.ts @@ -0,0 +1,13 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { schema, TypeOf } from '@kbn/config-schema'; + +export const configSchema = schema.object({}); + +export type ConfigSchema = TypeOf; diff --git a/src/plugins/unified_search/jest.config.js b/src/plugins/unified_search/jest.config.js new file mode 100644 index 000000000000..783631ba05d5 --- /dev/null +++ b/src/plugins/unified_search/jest.config.js @@ -0,0 +1,16 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +module.exports = { + preset: '@kbn/test', + rootDir: '../../..', + roots: ['/src/plugins/unified_search'], + coverageDirectory: '/target/kibana-coverage/jest/src/plugins/unified_search', + coverageReporters: ['text', 'html'], + collectCoverageFrom: ['/src/plugins/unified_search/public/**/*.{ts,tsx}'], +}; diff --git a/src/plugins/unified_search/kibana.json b/src/plugins/unified_search/kibana.json new file mode 100755 index 000000000000..8673c6ec783b --- /dev/null +++ b/src/plugins/unified_search/kibana.json @@ -0,0 +1,14 @@ +{ + "id": "unifiedSearch", + "version": "1.0.0", + "description": "Contains all the key functionality of Kibana's unified search experience.Contains all the key functionality of Kibana's unified search experience.", + "kibanaVersion": "kibana", + "owner": { + "name": "Unified Search", + "githubTeam": "kibana-app-services" + }, + "server": false, + "ui": true, + "requiredPlugins": ["dataViews", "data", "uiActions"], + "requiredBundles": ["kibanaUtils", "kibanaReact", "data"] +} diff --git a/src/plugins/data/public/actions/apply_filter_action.ts b/src/plugins/unified_search/public/actions/apply_filter_action.ts similarity index 95% rename from src/plugins/data/public/actions/apply_filter_action.ts rename to src/plugins/unified_search/public/actions/apply_filter_action.ts index 97e332dfa01f..e9fb75c5bd6d 100644 --- a/src/plugins/data/public/actions/apply_filter_action.ts +++ b/src/plugins/unified_search/public/actions/apply_filter_action.ts @@ -11,8 +11,8 @@ import { ThemeServiceSetup } from 'kibana/public'; import { toMountPoint } from '../../../kibana_react/public'; import { Action, createAction, IncompatibleActionError } from '../../../ui_actions/public'; import { getOverlays, getIndexPatterns } from '../services'; -import { applyFiltersPopover } from '../ui/apply_filters'; -import { Filter, FilterManager, TimefilterContract, esFilters } from '..'; +import { applyFiltersPopover } from '../apply_filters'; +import { Filter, FilterManager, TimefilterContract, esFilters } from '../../../data/public'; export const ACTION_GLOBAL_APPLY_FILTER = 'ACTION_GLOBAL_APPLY_FILTER'; @@ -42,7 +42,7 @@ export function createFilterAction( order: 100, getIconType: () => 'filter', getDisplayName: () => { - return i18n.translate('data.filter.applyFilterActionTitle', { + return i18n.translate('unifiedSearch.filter.applyFilterActionTitle', { defaultMessage: 'Apply filter to current view', }); }, diff --git a/src/plugins/unified_search/public/actions/index.ts b/src/plugins/unified_search/public/actions/index.ts new file mode 100644 index 000000000000..3a8d41b64995 --- /dev/null +++ b/src/plugins/unified_search/public/actions/index.ts @@ -0,0 +1,10 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export type { ApplyGlobalFilterActionContext } from './apply_filter_action'; +export { ACTION_GLOBAL_APPLY_FILTER } from './apply_filter_action'; diff --git a/src/plugins/data/public/ui/apply_filters/apply_filter_popover_content.tsx b/src/plugins/unified_search/public/apply_filters/apply_filter_popover_content.tsx similarity index 89% rename from src/plugins/data/public/ui/apply_filters/apply_filter_popover_content.tsx rename to src/plugins/unified_search/public/apply_filters/apply_filter_popover_content.tsx index 64bf7975e393..03e377036b3d 100644 --- a/src/plugins/data/public/ui/apply_filters/apply_filter_popover_content.tsx +++ b/src/plugins/unified_search/public/apply_filters/apply_filter_popover_content.tsx @@ -19,10 +19,9 @@ import { } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import React, { Component } from 'react'; -import { IIndexPattern } from '../..'; -import { Filter } from '../../../common'; +import { getDisplayValueFromFilter, mapAndFlattenFilters } from '../../../data/public'; import { FilterLabel } from '../filter_bar'; -import { mapAndFlattenFilters, getDisplayValueFromFilter } from '../../query'; +import { Filter, IIndexPattern } from '../../../data/common'; interface Props { filters: Filter[]; @@ -80,7 +79,7 @@ export default class ApplyFiltersPopoverContent extends Component @@ -91,13 +90,13 @@ export default class ApplyFiltersPopoverContent extends Component diff --git a/src/plugins/data/public/ui/apply_filters/apply_filters_popover.tsx b/src/plugins/unified_search/public/apply_filters/apply_filters_popover.tsx similarity index 94% rename from src/plugins/data/public/ui/apply_filters/apply_filters_popover.tsx rename to src/plugins/unified_search/public/apply_filters/apply_filters_popover.tsx index 4912e96df9d6..4d6e045cdb70 100644 --- a/src/plugins/data/public/ui/apply_filters/apply_filters_popover.tsx +++ b/src/plugins/unified_search/public/apply_filters/apply_filters_popover.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { IIndexPattern, Filter } from '../..'; +import { IIndexPattern, Filter } from '../../../data/common'; type CancelFnType = () => void; type SubmitFnType = (filters: Filter[]) => void; diff --git a/src/plugins/data/public/ui/apply_filters/index.ts b/src/plugins/unified_search/public/apply_filters/index.ts similarity index 100% rename from src/plugins/data/public/ui/apply_filters/index.ts rename to src/plugins/unified_search/public/apply_filters/index.ts diff --git a/src/plugins/data/public/ui/filter_bar/_global_filter_group.scss b/src/plugins/unified_search/public/filter_bar/_global_filter_group.scss similarity index 100% rename from src/plugins/data/public/ui/filter_bar/_global_filter_group.scss rename to src/plugins/unified_search/public/filter_bar/_global_filter_group.scss diff --git a/src/plugins/data/public/ui/filter_bar/_global_filter_item.scss b/src/plugins/unified_search/public/filter_bar/_global_filter_item.scss similarity index 100% rename from src/plugins/data/public/ui/filter_bar/_global_filter_item.scss rename to src/plugins/unified_search/public/filter_bar/_global_filter_item.scss diff --git a/src/plugins/data/public/ui/filter_bar/_index.scss b/src/plugins/unified_search/public/filter_bar/_index.scss similarity index 100% rename from src/plugins/data/public/ui/filter_bar/_index.scss rename to src/plugins/unified_search/public/filter_bar/_index.scss diff --git a/src/plugins/data/public/ui/filter_bar/_variables.scss b/src/plugins/unified_search/public/filter_bar/_variables.scss similarity index 100% rename from src/plugins/data/public/ui/filter_bar/_variables.scss rename to src/plugins/unified_search/public/filter_bar/_variables.scss diff --git a/src/plugins/data/public/ui/filter_bar/filter_bar.tsx b/src/plugins/unified_search/public/filter_bar/filter_bar.tsx similarity index 94% rename from src/plugins/data/public/ui/filter_bar/filter_bar.tsx rename to src/plugins/unified_search/public/filter_bar/filter_bar.tsx index 00557dfab0e9..405580dc0534 100644 --- a/src/plugins/data/public/ui/filter_bar/filter_bar.tsx +++ b/src/plugins/unified_search/public/filter_bar/filter_bar.tsx @@ -25,10 +25,9 @@ import { METRIC_TYPE } from '@kbn/analytics'; import { FilterEditor } from './filter_editor'; import { FILTER_EDITOR_WIDTH, FilterItem } from './filter_item'; import { FilterOptions } from './filter_options'; -import { useKibana } from '../../../../kibana_react/public'; -import { IDataPluginServices, IIndexPattern } from '../..'; - -import { UI_SETTINGS } from '../../../common'; +import { useKibana } from '../../../kibana_react/public'; +import { IIndexPattern, UI_SETTINGS } from '../../../data/common'; +import { IDataPluginServices } from '../../../data/public'; export interface Props { filters: Filter[]; @@ -89,7 +88,7 @@ const FilterBarUI = React.memo(function FilterBarUI(props: Props) { > +{' '} @@ -228,4 +227,7 @@ const FilterBarUI = React.memo(function FilterBarUI(props: Props) { ); }); -export const FilterBar = injectI18n(FilterBarUI); +const FilterBar = injectI18n(FilterBarUI); +// Needed for React.lazy +// eslint-disable-next-line import/no-default-export +export default FilterBar; diff --git a/src/plugins/data/public/ui/filter_bar/filter_editor/filter_editor.test.tsx b/src/plugins/unified_search/public/filter_bar/filter_editor/filter_editor.test.tsx similarity index 93% rename from src/plugins/data/public/ui/filter_bar/filter_editor/filter_editor.test.tsx rename to src/plugins/unified_search/public/filter_bar/filter_editor/filter_editor.test.tsx index 8f48bef8e0e5..9bc8aa382bb0 100644 --- a/src/plugins/data/public/ui/filter_bar/filter_editor/filter_editor.test.tsx +++ b/src/plugins/unified_search/public/filter_bar/filter_editor/filter_editor.test.tsx @@ -10,8 +10,8 @@ import { registerTestBed, TestBed } from '@kbn/test-jest-helpers'; import { FilterEditor, Props } from '.'; import React from 'react'; -jest.mock('../../../../../kibana_react/public', () => { - const original = jest.requireActual('../../../../../kibana_react/public'); +jest.mock('../../../../kibana_react/public', () => { + const original = jest.requireActual('../../../../kibana_react/public'); return { ...original, diff --git a/src/plugins/data/public/ui/filter_bar/filter_editor/generic_combo_box.tsx b/src/plugins/unified_search/public/filter_bar/filter_editor/generic_combo_box.tsx similarity index 100% rename from src/plugins/data/public/ui/filter_bar/filter_editor/generic_combo_box.tsx rename to src/plugins/unified_search/public/filter_bar/filter_editor/generic_combo_box.tsx diff --git a/src/plugins/data/public/ui/filter_bar/filter_editor/index.tsx b/src/plugins/unified_search/public/filter_bar/filter_editor/index.tsx similarity index 91% rename from src/plugins/data/public/ui/filter_bar/filter_editor/index.tsx rename to src/plugins/unified_search/public/filter_bar/filter_editor/index.tsx index 35ac8f386946..7eb2cde56b80 100644 --- a/src/plugins/data/public/ui/filter_bar/filter_editor/index.tsx +++ b/src/plugins/unified_search/public/filter_bar/filter_editor/index.tsx @@ -44,9 +44,9 @@ import { Operator } from './lib/filter_operators'; import { PhraseValueInput } from './phrase_value_input'; import { PhrasesValuesInput } from './phrases_values_input'; import { RangeValueInput } from './range_value_input'; -import { getIndexPatternFromFilter } from '../../../query'; -import { IIndexPattern, IFieldType } from '../../..'; -import { CodeEditor } from '../../../../../kibana_react/public'; +import { IIndexPattern, IFieldType } from '../../../../data/common'; +import { getIndexPatternFromFilter } from '../../../../data/public'; +import { CodeEditor } from '../../../../kibana_react/public'; export interface Props { filter: Filter; @@ -90,7 +90,7 @@ class FilterEditorUI extends Component { @@ -103,12 +103,12 @@ class FilterEditorUI extends Component { > {this.state.isCustomEditorOpen ? ( ) : ( )} @@ -129,7 +129,7 @@ class FilterEditorUI extends Component { id="filterEditorCustomLabelSwitch" data-test-subj="createCustomLabel" label={this.props.intl.formatMessage({ - id: 'data.filter.filterEditor.createCustomLabelSwitchLabel', + id: 'unifiedSearch.filter.filterEditor.createCustomLabelSwitchLabel', defaultMessage: 'Create custom label?', })} checked={this.state.useCustomLabel} @@ -141,7 +141,7 @@ class FilterEditorUI extends Component { { data-test-subj="saveFilter" > @@ -178,7 +178,7 @@ class FilterEditorUI extends Component { data-test-subj="cancelSaveFilter" > @@ -212,14 +212,14 @@ class FilterEditorUI extends Component { { @@ -268,7 +268,7 @@ class FilterEditorUI extends Component { id="fieldInput" isDisabled={!selectedIndexPattern} placeholder={this.props.intl.formatMessage({ - id: 'data.filter.filterEditor.fieldSelectPlaceholder', + id: 'unifiedSearch.filter.filterEditor.fieldSelectPlaceholder', defaultMessage: 'Select a field first', })} options={fields} @@ -290,7 +290,7 @@ class FilterEditorUI extends Component { @@ -300,11 +300,11 @@ class FilterEditorUI extends Component { placeholder={ selectedField ? this.props.intl.formatMessage({ - id: 'data.filter.filterEditor.operatorSelectPlaceholderSelect', + id: 'unifiedSearch.filter.filterEditor.operatorSelectPlaceholderSelect', defaultMessage: 'Select', }) : this.props.intl.formatMessage({ - id: 'data.filter.filterEditor.operatorSelectPlaceholderWaiting', + id: 'unifiedSearch.filter.filterEditor.operatorSelectPlaceholderWaiting', defaultMessage: 'Waiting', }) } @@ -324,7 +324,7 @@ class FilterEditorUI extends Component { return ( @@ -335,7 +335,7 @@ class FilterEditorUI extends Component { value={this.state.queryDsl} onChange={this.onQueryDslChange} data-test-subj="customEditorInput" - aria-label={i18n.translate('data.filter.filterEditor.queryDslAriaLabel', { + aria-label={i18n.translate('unifiedSearch.filter.filterEditor.queryDslAriaLabel', { defaultMessage: 'Elasticsearch Query DSL editor', })} /> diff --git a/src/plugins/unified_search/public/filter_bar/filter_editor/lib/__snapshots__/filter_label.test.tsx.snap b/src/plugins/unified_search/public/filter_bar/filter_editor/lib/__snapshots__/filter_label.test.tsx.snap new file mode 100644 index 000000000000..208af5049d13 --- /dev/null +++ b/src/plugins/unified_search/public/filter_bar/filter_editor/lib/__snapshots__/filter_label.test.tsx.snap @@ -0,0 +1,68 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`alias 1`] = ` +
+ + geo.coordinates in US +
+`; + +exports[`alias with error status 1`] = ` +
+ + NOT + + geo.coordinates in US + : + + Error + +
+`; + +exports[`alias with warning status 1`] = ` +
+ + NOT + + geo.coordinates in US + : + + Warning + +
+`; + +exports[`error 1`] = ` +
+ + machine.os + : + + Error + +
+`; + +exports[`warning 1`] = ` +
+ + machine.os + : + + Warning + +
+`; diff --git a/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_editor_utils.test.ts b/src/plugins/unified_search/public/filter_bar/filter_editor/lib/filter_editor_utils.test.ts similarity index 98% rename from src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_editor_utils.test.ts rename to src/plugins/unified_search/public/filter_bar/filter_editor/lib/filter_editor_utils.test.ts index 32e82df91086..7790bd601dcf 100644 --- a/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_editor_utils.test.ts +++ b/src/plugins/unified_search/public/filter_bar/filter_editor/lib/filter_editor_utils.test.ts @@ -13,8 +13,8 @@ import { rangeFilter, stubIndexPattern, stubFields, -} from '../../../../stubs'; -import { toggleFilterNegated } from '../../../../../common'; +} from '../../../../../data/common/stubs'; +import { toggleFilterNegated } from '../../../../../data/common'; import { getFieldFromFilter, getFilterableFields, diff --git a/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_editor_utils.ts b/src/plugins/unified_search/public/filter_bar/filter_editor/lib/filter_editor_utils.ts similarity index 98% rename from src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_editor_utils.ts rename to src/plugins/unified_search/public/filter_bar/filter_editor/lib/filter_editor_utils.ts index 7d433bb1f273..3b8fb867c361 100644 --- a/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_editor_utils.ts +++ b/src/plugins/unified_search/public/filter_bar/filter_editor/lib/filter_editor_utils.ts @@ -11,7 +11,7 @@ import { Filter, FieldFilter } from '@kbn/es-query'; import { ES_FIELD_TYPES } from '@kbn/field-types'; import isSemverValid from 'semver/functions/valid'; import { FILTER_OPERATORS, Operator } from './filter_operators'; -import { isFilterable, IIndexPattern, IFieldType, IpAddress } from '../../../../../common'; +import { isFilterable, IIndexPattern, IFieldType, IpAddress } from '../../../../../data/common'; export function getFieldFromFilter(filter: FieldFilter, indexPattern: IIndexPattern) { return indexPattern.fields.find((field) => field.name === filter.meta.key); diff --git a/src/plugins/unified_search/public/filter_bar/filter_editor/lib/filter_label.test.tsx b/src/plugins/unified_search/public/filter_bar/filter_editor/lib/filter_label.test.tsx new file mode 100644 index 000000000000..b3756701aaa9 --- /dev/null +++ b/src/plugins/unified_search/public/filter_bar/filter_editor/lib/filter_label.test.tsx @@ -0,0 +1,64 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React from 'react'; +import FilterLabel from './filter_label'; +import { render } from '@testing-library/react'; +import { phraseFilter } from '../../../../../data/common/stubs'; + +test('alias', () => { + const filter = { + ...phraseFilter, + meta: { + ...phraseFilter.meta, + alias: 'geo.coordinates in US', + }, + }; + const { container } = render(); + expect(container).toMatchSnapshot(); +}); + +test('alias with warning status', () => { + const filter = { + ...phraseFilter, + meta: { + ...phraseFilter.meta, + alias: 'geo.coordinates in US', + negate: true, + }, + }; + const { container } = render( + + ); + expect(container).toMatchSnapshot(); +}); + +test('alias with error status', () => { + const filter = { + ...phraseFilter, + meta: { + ...phraseFilter.meta, + alias: 'geo.coordinates in US', + negate: true, + }, + }; + const { container } = render( + + ); + expect(container).toMatchSnapshot(); +}); + +test('warning', () => { + const { container } = render(); + expect(container).toMatchSnapshot(); +}); + +test('error', () => { + const { container } = render(); + expect(container).toMatchSnapshot(); +}); diff --git a/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_label.tsx b/src/plugins/unified_search/public/filter_bar/filter_editor/lib/filter_label.tsx similarity index 94% rename from src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_label.tsx rename to src/plugins/unified_search/public/filter_bar/filter_editor/lib/filter_label.tsx index d0924258831c..099f211deef0 100644 --- a/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_label.tsx +++ b/src/plugins/unified_search/public/filter_bar/filter_editor/lib/filter_label.tsx @@ -10,7 +10,7 @@ import React, { Fragment } from 'react'; import { EuiTextColor } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { existsOperator, isOneOfOperator } from './filter_operators'; -import { Filter, FILTERS } from '../../../../../common'; +import { Filter, FILTERS } from '../../../../../data/common'; import type { FilterLabelStatus } from '../../filter_item'; export interface FilterLabelProps { @@ -29,7 +29,7 @@ export default function FilterLabel({ hideAlias, }: FilterLabelProps) { const prefixText = filter.meta.negate - ? ` ${i18n.translate('data.filter.filterBar.negatedFilterPrefix', { + ? ` ${i18n.translate('unifiedSearch.filter.filterBar.negatedFilterPrefix', { defaultMessage: 'NOT ', })}` : ''; diff --git a/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_operators.ts b/src/plugins/unified_search/public/filter_bar/filter_editor/lib/filter_operators.ts similarity index 76% rename from src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_operators.ts rename to src/plugins/unified_search/public/filter_bar/filter_editor/lib/filter_operators.ts index 0be9c200c8d8..515a4e7f85f6 100644 --- a/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_operators.ts +++ b/src/plugins/unified_search/public/filter_bar/filter_editor/lib/filter_operators.ts @@ -9,7 +9,7 @@ import { i18n } from '@kbn/i18n'; import { FILTERS } from '@kbn/es-query'; import { ES_FIELD_TYPES } from '@kbn/field-types'; -import { IFieldType } from '../../../../../../data_views/common'; +import { IFieldType } from '../../../../../data_views/common'; export interface Operator { message: string; @@ -29,7 +29,7 @@ export interface Operator { } export const isOperator = { - message: i18n.translate('data.filter.filterEditor.isOperatorOptionLabel', { + message: i18n.translate('unifiedSearch.filter.filterEditor.isOperatorOptionLabel', { defaultMessage: 'is', }), type: FILTERS.PHRASE, @@ -37,7 +37,7 @@ export const isOperator = { }; export const isNotOperator = { - message: i18n.translate('data.filter.filterEditor.isNotOperatorOptionLabel', { + message: i18n.translate('unifiedSearch.filter.filterEditor.isNotOperatorOptionLabel', { defaultMessage: 'is not', }), type: FILTERS.PHRASE, @@ -45,7 +45,7 @@ export const isNotOperator = { }; export const isOneOfOperator = { - message: i18n.translate('data.filter.filterEditor.isOneOfOperatorOptionLabel', { + message: i18n.translate('unifiedSearch.filter.filterEditor.isOneOfOperatorOptionLabel', { defaultMessage: 'is one of', }), type: FILTERS.PHRASES, @@ -54,7 +54,7 @@ export const isOneOfOperator = { }; export const isNotOneOfOperator = { - message: i18n.translate('data.filter.filterEditor.isNotOneOfOperatorOptionLabel', { + message: i18n.translate('unifiedSearch.filter.filterEditor.isNotOneOfOperatorOptionLabel', { defaultMessage: 'is not one of', }), type: FILTERS.PHRASES, @@ -63,7 +63,7 @@ export const isNotOneOfOperator = { }; export const isBetweenOperator = { - message: i18n.translate('data.filter.filterEditor.isBetweenOperatorOptionLabel', { + message: i18n.translate('unifiedSearch.filter.filterEditor.isBetweenOperatorOptionLabel', { defaultMessage: 'is between', }), type: FILTERS.RANGE, @@ -79,7 +79,7 @@ export const isBetweenOperator = { }; export const isNotBetweenOperator = { - message: i18n.translate('data.filter.filterEditor.isNotBetweenOperatorOptionLabel', { + message: i18n.translate('unifiedSearch.filter.filterEditor.isNotBetweenOperatorOptionLabel', { defaultMessage: 'is not between', }), type: FILTERS.RANGE, @@ -95,7 +95,7 @@ export const isNotBetweenOperator = { }; export const existsOperator = { - message: i18n.translate('data.filter.filterEditor.existsOperatorOptionLabel', { + message: i18n.translate('unifiedSearch.filter.filterEditor.existsOperatorOptionLabel', { defaultMessage: 'exists', }), type: FILTERS.EXISTS, @@ -103,7 +103,7 @@ export const existsOperator = { }; export const doesNotExistOperator = { - message: i18n.translate('data.filter.filterEditor.doesNotExistOperatorOptionLabel', { + message: i18n.translate('unifiedSearch.filter.filterEditor.doesNotExistOperatorOptionLabel', { defaultMessage: 'does not exist', }), type: FILTERS.EXISTS, diff --git a/src/plugins/data/public/ui/filter_bar/filter_editor/phrase_suggestor.tsx b/src/plugins/unified_search/public/filter_bar/filter_editor/phrase_suggestor.tsx similarity index 94% rename from src/plugins/data/public/ui/filter_bar/filter_editor/phrase_suggestor.tsx rename to src/plugins/unified_search/public/filter_bar/filter_editor/phrase_suggestor.tsx index ba39ee78dafa..18464f04de0b 100644 --- a/src/plugins/data/public/ui/filter_bar/filter_editor/phrase_suggestor.tsx +++ b/src/plugins/unified_search/public/filter_bar/filter_editor/phrase_suggestor.tsx @@ -9,9 +9,9 @@ import React from 'react'; import { debounce } from 'lodash'; -import { withKibana, KibanaReactContextValue } from '../../../../../kibana_react/public'; -import { IDataPluginServices, IIndexPattern, IFieldType } from '../../..'; -import { UI_SETTINGS } from '../../../../common'; +import { withKibana, KibanaReactContextValue } from '../../../../kibana_react/public'; +import { IIndexPattern, IFieldType, UI_SETTINGS } from '../../../../data/common'; +import { IDataPluginServices } from '../../../../data/public'; export interface PhraseSuggestorProps { kibana: KibanaReactContextValue; diff --git a/src/plugins/data/public/ui/filter_bar/filter_editor/phrase_value_input.tsx b/src/plugins/unified_search/public/filter_bar/filter_editor/phrase_value_input.tsx similarity index 90% rename from src/plugins/data/public/ui/filter_bar/filter_editor/phrase_value_input.tsx rename to src/plugins/unified_search/public/filter_bar/filter_editor/phrase_value_input.tsx index 32a713361dbd..6b8667b5043f 100644 --- a/src/plugins/data/public/ui/filter_bar/filter_editor/phrase_value_input.tsx +++ b/src/plugins/unified_search/public/filter_bar/filter_editor/phrase_value_input.tsx @@ -13,7 +13,7 @@ import React from 'react'; import { GenericComboBox, GenericComboBoxProps } from './generic_combo_box'; import { PhraseSuggestorUI, PhraseSuggestorProps } from './phrase_suggestor'; import { ValueInputType } from './value_input_type'; -import { withKibana } from '../../../../../kibana_react/public'; +import { withKibana } from '../../../../kibana_react/public'; interface Props extends PhraseSuggestorProps { value?: string; @@ -28,7 +28,7 @@ class PhraseValueInputUI extends PhraseSuggestorUI { @@ -38,7 +38,7 @@ class PhraseValueInputUI extends PhraseSuggestorUI { { { @@ -90,7 +90,7 @@ function RangeValueInputUI(props: Props) { onToChange(formatDateChange(value)); }} placeholder={props.intl.formatMessage({ - id: 'data.filter.filterEditor.rangeEndInputPlaceholder', + id: 'unifiedSearch.filter.filterEditor.rangeEndInputPlaceholder', defaultMessage: 'End of the range', })} /> diff --git a/src/plugins/data/public/ui/filter_bar/filter_editor/value_input_type.tsx b/src/plugins/unified_search/public/filter_bar/filter_editor/value_input_type.tsx similarity index 95% rename from src/plugins/data/public/ui/filter_bar/filter_editor/value_input_type.tsx rename to src/plugins/unified_search/public/filter_bar/filter_editor/value_input_type.tsx index 9b00c71472f3..3b6f8a6879df 100644 --- a/src/plugins/data/public/ui/filter_bar/filter_editor/value_input_type.tsx +++ b/src/plugins/unified_search/public/filter_bar/filter_editor/value_input_type.tsx @@ -11,7 +11,7 @@ import { InjectedIntl, injectI18n } from '@kbn/i18n-react'; import { isEmpty } from 'lodash'; import React, { Component } from 'react'; import { validateParams } from './lib/filter_editor_utils'; -import { IFieldType } from '../../../../../data_views/common'; +import { IFieldType } from '../../../../data_views/common'; interface Props { value?: string | number; @@ -94,14 +94,14 @@ class ValueInputTypeUI extends Component { { value: 'true', text: this.props.intl.formatMessage({ - id: 'data.filter.filterEditor.trueOptionLabel', + id: 'unifiedSearch.filter.filterEditor.trueOptionLabel', defaultMessage: 'true', }), }, { value: 'false', text: this.props.intl.formatMessage({ - id: 'data.filter.filterEditor.falseOptionLabel', + id: 'unifiedSearch.filter.filterEditor.falseOptionLabel', defaultMessage: 'false', }), }, diff --git a/src/plugins/data/public/ui/filter_bar/filter_item.tsx b/src/plugins/unified_search/public/filter_bar/filter_item.tsx similarity index 90% rename from src/plugins/data/public/ui/filter_bar/filter_item.tsx rename to src/plugins/unified_search/public/filter_bar/filter_item.tsx index 5f5707242584..4f71718d13d0 100644 --- a/src/plugins/data/public/ui/filter_bar/filter_item.tsx +++ b/src/plugins/unified_search/public/filter_bar/filter_item.tsx @@ -20,9 +20,9 @@ import React, { MouseEvent, useState, useEffect, HTMLAttributes } from 'react'; import { IUiSettingsClient } from 'src/core/public'; import { FilterEditor } from './filter_editor'; import { FilterView } from './filter_view'; -import { IIndexPattern } from '../..'; -import { getDisplayValueFromFilter, getIndexPatternFromFilter } from '../../query'; -import { getIndexPatterns } from '../../services'; +import { IIndexPattern } from '../../../data/common'; +import { getIndexPatternFromFilter, getDisplayValueFromFilter } from '../../../data/public'; +import { getIndexPatterns } from '../services'; type PanelOptions = 'pinFilter' | 'editFilter' | 'negateFilter' | 'disableFilter' | 'deleteFilter'; @@ -164,11 +164,11 @@ export function FilterItem(props: FilterItemProps) { { name: isFilterPinned(filter) ? props.intl.formatMessage({ - id: 'data.filter.filterBar.unpinFilterButtonLabel', + id: 'unifiedSearch.filter.filterBar.unpinFilterButtonLabel', defaultMessage: 'Unpin', }) : props.intl.formatMessage({ - id: 'data.filter.filterBar.pinFilterButtonLabel', + id: 'unifiedSearch.filter.filterBar.pinFilterButtonLabel', defaultMessage: 'Pin across all apps', }), icon: 'pin', @@ -180,7 +180,7 @@ export function FilterItem(props: FilterItemProps) { }, { name: props.intl.formatMessage({ - id: 'data.filter.filterBar.editFilterButtonLabel', + id: 'unifiedSearch.filter.filterBar.editFilterButtonLabel', defaultMessage: 'Edit filter', }), icon: 'pencil', @@ -190,11 +190,11 @@ export function FilterItem(props: FilterItemProps) { { name: negate ? props.intl.formatMessage({ - id: 'data.filter.filterBar.includeFilterButtonLabel', + id: 'unifiedSearch.filter.filterBar.includeFilterButtonLabel', defaultMessage: 'Include results', }) : props.intl.formatMessage({ - id: 'data.filter.filterBar.excludeFilterButtonLabel', + id: 'unifiedSearch.filter.filterBar.excludeFilterButtonLabel', defaultMessage: 'Exclude results', }), icon: negate ? 'plusInCircle' : 'minusInCircle', @@ -207,11 +207,11 @@ export function FilterItem(props: FilterItemProps) { { name: disabled ? props.intl.formatMessage({ - id: 'data.filter.filterBar.enableFilterButtonLabel', + id: 'unifiedSearch.filter.filterBar.enableFilterButtonLabel', defaultMessage: 'Re-enable', }) : props.intl.formatMessage({ - id: 'data.filter.filterBar.disableFilterButtonLabel', + id: 'unifiedSearch.filter.filterBar.disableFilterButtonLabel', defaultMessage: 'Temporarily disable', }), icon: `${disabled ? 'eye' : 'eyeClosed'}`, @@ -223,7 +223,7 @@ export function FilterItem(props: FilterItemProps) { }, { name: props.intl.formatMessage({ - id: 'data.filter.filterBar.deleteFilterButtonLabel', + id: 'unifiedSearch.filter.filterBar.deleteFilterButtonLabel', defaultMessage: 'Delete', }), icon: 'trash', @@ -298,12 +298,12 @@ export function FilterItem(props: FilterItemProps) { if (indexPatternExists === false) { label.status = FILTER_ITEM_ERROR; label.title = props.intl.formatMessage({ - id: 'data.filter.filterBar.labelErrorText', + id: 'unifiedSearch.filter.filterBar.labelErrorText', defaultMessage: `Error`, }); label.message = props.intl.formatMessage( { - id: 'data.filter.filterBar.labelErrorInfo', + id: 'unifiedSearch.filter.filterBar.labelErrorInfo', defaultMessage: 'Index pattern {indexPattern} not found', }, { @@ -316,7 +316,7 @@ export function FilterItem(props: FilterItemProps) { } catch (e) { label.status = FILTER_ITEM_ERROR; label.title = props.intl.formatMessage({ - id: 'data.filter.filterBar.labelErrorText', + id: 'unifiedSearch.filter.filterBar.labelErrorText', defaultMessage: `Error`, }); label.message = e.message; @@ -324,12 +324,12 @@ export function FilterItem(props: FilterItemProps) { } else { label.status = FILTER_ITEM_WARNING; label.title = props.intl.formatMessage({ - id: 'data.filter.filterBar.labelWarningText', + id: 'unifiedSearch.filter.filterBar.labelWarningText', defaultMessage: `Warning`, }); label.message = props.intl.formatMessage( { - id: 'data.filter.filterBar.labelWarningInfo', + id: 'unifiedSearch.filter.filterBar.labelWarningInfo', defaultMessage: 'Field {fieldName} does not exist in current view', }, { diff --git a/src/plugins/data/public/ui/filter_bar/filter_options.tsx b/src/plugins/unified_search/public/filter_bar/filter_options.tsx similarity index 85% rename from src/plugins/data/public/ui/filter_bar/filter_options.tsx rename to src/plugins/unified_search/public/filter_bar/filter_options.tsx index c3a217c8479d..d2e229c98871 100644 --- a/src/plugins/data/public/ui/filter_bar/filter_options.tsx +++ b/src/plugins/unified_search/public/filter_bar/filter_options.tsx @@ -50,7 +50,7 @@ class FilterOptionsUI extends Component { items: [ { name: this.props.intl.formatMessage({ - id: 'data.filter.options.enableAllFiltersButtonLabel', + id: 'unifiedSearch.filter.options.enableAllFiltersButtonLabel', defaultMessage: 'Enable all', }), icon: 'eye', @@ -62,7 +62,7 @@ class FilterOptionsUI extends Component { }, { name: this.props.intl.formatMessage({ - id: 'data.filter.options.disableAllFiltersButtonLabel', + id: 'unifiedSearch.filter.options.disableAllFiltersButtonLabel', defaultMessage: 'Disable all', }), icon: 'eyeClosed', @@ -74,7 +74,7 @@ class FilterOptionsUI extends Component { }, { name: this.props.intl.formatMessage({ - id: 'data.filter.options.pinAllFiltersButtonLabel', + id: 'unifiedSearch.filter.options.pinAllFiltersButtonLabel', defaultMessage: 'Pin all', }), icon: 'pin', @@ -86,7 +86,7 @@ class FilterOptionsUI extends Component { }, { name: this.props.intl.formatMessage({ - id: 'data.filter.options.unpinAllFiltersButtonLabel', + id: 'unifiedSearch.filter.options.unpinAllFiltersButtonLabel', defaultMessage: 'Unpin all', }), icon: 'pin', @@ -98,7 +98,7 @@ class FilterOptionsUI extends Component { }, { name: this.props.intl.formatMessage({ - id: 'data.filter.options.invertNegatedFiltersButtonLabel', + id: 'unifiedSearch.filter.options.invertNegatedFiltersButtonLabel', defaultMessage: 'Invert inclusion', }), icon: 'invert', @@ -110,7 +110,7 @@ class FilterOptionsUI extends Component { }, { name: this.props.intl.formatMessage({ - id: 'data.filter.options.invertDisabledFiltersButtonLabel', + id: 'unifiedSearch.filter.options.invertDisabledFiltersButtonLabel', defaultMessage: 'Invert enabled/disabled', }), icon: 'eye', @@ -122,7 +122,7 @@ class FilterOptionsUI extends Component { }, { name: this.props.intl.formatMessage({ - id: 'data.filter.options.deleteAllFiltersButtonLabel', + id: 'unifiedSearch.filter.options.deleteAllFiltersButtonLabel', defaultMessage: 'Remove all', }), icon: 'trash', @@ -146,11 +146,11 @@ class FilterOptionsUI extends Component { onClick={this.togglePopover} iconType="filter" aria-label={this.props.intl.formatMessage({ - id: 'data.filter.options.changeAllFiltersButtonLabel', + id: 'unifiedSearch.filter.options.changeAllFiltersButtonLabel', defaultMessage: 'Change all filters', })} title={this.props.intl.formatMessage({ - id: 'data.filter.options.changeAllFiltersButtonLabel', + id: 'unifiedSearch.filter.options.changeAllFiltersButtonLabel', defaultMessage: 'Change all filters', })} data-test-subj="showFilterActions" @@ -163,7 +163,7 @@ class FilterOptionsUI extends Component { > diff --git a/src/plugins/data/public/ui/filter_bar/filter_view/index.tsx b/src/plugins/unified_search/public/filter_bar/filter_view/index.tsx similarity index 71% rename from src/plugins/data/public/ui/filter_bar/filter_view/index.tsx rename to src/plugins/unified_search/public/filter_bar/filter_view/index.tsx index e5345462b7df..69ef9edee580 100644 --- a/src/plugins/data/public/ui/filter_bar/filter_view/index.tsx +++ b/src/plugins/unified_search/public/filter_bar/filter_view/index.tsx @@ -38,18 +38,18 @@ export const FilterView: FC = ({ let title = errorMessage || - i18n.translate('data.filter.filterBar.moreFilterActionsMessage', { + i18n.translate('unifiedSearch.filter.filterBar.moreFilterActionsMessage', { defaultMessage: 'Filter: {innerText}. Select for more filter actions.', values: { innerText }, }); if (isFilterPinned(filter)) { - title = `${i18n.translate('data.filter.filterBar.pinnedFilterPrefix', { + title = `${i18n.translate('unifiedSearch.filter.filterBar.pinnedFilterPrefix', { defaultMessage: 'Pinned', })} ${title}`; } if (filter.meta.disabled) { - title = `${i18n.translate('data.filter.filterBar.disabledFilterPrefix', { + title = `${i18n.translate('unifiedSearch.filter.filterBar.disabledFilterPrefix', { defaultMessage: 'Disabled', })} ${title}`; } @@ -59,9 +59,12 @@ export const FilterView: FC = ({ title, color: 'hollow', onClick, - onClickAriaLabel: i18n.translate('data.filter.filterBar.filterItemReadOnlyBadgeAriaLabel', { - defaultMessage: 'Filter entry', - }), + onClickAriaLabel: i18n.translate( + 'unifiedSearch.filter.filterBar.filterItemReadOnlyBadgeAriaLabel', + { + defaultMessage: 'Filter entry', + } + ), iconOnClick, } : { @@ -75,14 +78,20 @@ export const FilterView: FC = ({ tabIndex: -1, }, iconOnClick, - iconOnClickAriaLabel: i18n.translate('data.filter.filterBar.filterItemBadgeIconAriaLabel', { - defaultMessage: 'Delete {filter}', - values: { filter: innerText }, - }), + iconOnClickAriaLabel: i18n.translate( + 'unifiedSearch.filter.filterBar.filterItemBadgeIconAriaLabel', + { + defaultMessage: 'Delete {filter}', + values: { filter: innerText }, + } + ), onClick, - onClickAriaLabel: i18n.translate('data.filter.filterBar.filterItemBadgeAriaLabel', { - defaultMessage: 'Filter actions', - }), + onClickAriaLabel: i18n.translate( + 'unifiedSearch.filter.filterBar.filterItemBadgeAriaLabel', + { + defaultMessage: 'Filter actions', + } + ), }; return ( diff --git a/src/plugins/data/public/ui/filter_bar/index.tsx b/src/plugins/unified_search/public/filter_bar/index.tsx similarity index 79% rename from src/plugins/data/public/ui/filter_bar/index.tsx rename to src/plugins/unified_search/public/filter_bar/index.tsx index b3c02b2863c8..70a108f35979 100644 --- a/src/plugins/data/public/ui/filter_bar/index.tsx +++ b/src/plugins/unified_search/public/filter_bar/index.tsx @@ -10,6 +10,13 @@ import React from 'react'; const Fallback = () =>
; +const LazyFilterBar = React.lazy(() => import('./filter_bar')); +export const FilterBar = (props: React.ComponentProps) => ( + }> + + +); + const LazyFilterLabel = React.lazy(() => import('./filter_editor/lib/filter_label')); export const FilterLabel = (props: React.ComponentProps) => ( }> diff --git a/src/plugins/data/public/ui/_index.scss b/src/plugins/unified_search/public/index.scss old mode 100644 new mode 100755 similarity index 72% rename from src/plugins/data/public/ui/_index.scss rename to src/plugins/unified_search/public/index.scss index 1ca49963f3de..7f7704c64e9b --- a/src/plugins/data/public/ui/_index.scss +++ b/src/plugins/unified_search/public/index.scss @@ -1,10 +1,7 @@ - -@import './filter_bar/index'; - @import './typeahead/index'; @import './saved_query_management/index'; @import './query_string_input/index'; -@import './shard_failure_modal/shard_failure_modal'; \ No newline at end of file +@import './filter_bar/index'; diff --git a/src/plugins/unified_search/public/index.ts b/src/plugins/unified_search/public/index.ts new file mode 100755 index 000000000000..3eb528dc07ba --- /dev/null +++ b/src/plugins/unified_search/public/index.ts @@ -0,0 +1,27 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ +import { PluginInitializerContext } from '../../../core/public'; +import { ConfigSchema } from '../config'; +import { UnifiedSearchPublicPlugin } from './plugin'; + +export type { IndexPatternSelectProps } from './index_pattern_select'; +export type { QueryStringInputProps } from './query_string_input'; +export { QueryStringInput } from './query_string_input'; +export type { StatefulSearchBarProps, SearchBarProps } from './search_bar'; +export type { UnifiedSearchPublicPluginStart } from './types'; +export { SearchBar } from './search_bar'; +export { FilterLabel, FilterItem } from './filter_bar'; + +export type { ApplyGlobalFilterActionContext } from './actions'; +export { ACTION_GLOBAL_APPLY_FILTER } from './actions'; + +// This exports static code and TypeScript types, +// as well as, Kibana Platform `plugin()` initializer. +export function plugin(initializerContext: PluginInitializerContext) { + return new UnifiedSearchPublicPlugin(initializerContext); +} diff --git a/src/plugins/data/public/ui/index_pattern_select/create_index_pattern_select.tsx b/src/plugins/unified_search/public/index_pattern_select/create_index_pattern_select.tsx similarity index 92% rename from src/plugins/data/public/ui/index_pattern_select/create_index_pattern_select.tsx rename to src/plugins/unified_search/public/index_pattern_select/create_index_pattern_select.tsx index 16b36534c748..4a86ab32db9e 100644 --- a/src/plugins/data/public/ui/index_pattern_select/create_index_pattern_select.tsx +++ b/src/plugins/unified_search/public/index_pattern_select/create_index_pattern_select.tsx @@ -9,7 +9,7 @@ import _ from 'lodash'; import React from 'react'; -import { IndexPatternsContract } from 'src/plugins/data/public'; +import { IndexPatternsContract } from '../../../data/public'; import { IndexPatternSelect, IndexPatternSelectProps } from './'; // Takes in stateful runtime dependencies and pre-wires them to the component diff --git a/src/plugins/data/public/ui/index_pattern_select/index.tsx b/src/plugins/unified_search/public/index_pattern_select/index.tsx similarity index 100% rename from src/plugins/data/public/ui/index_pattern_select/index.tsx rename to src/plugins/unified_search/public/index_pattern_select/index.tsx diff --git a/src/plugins/data/public/ui/index_pattern_select/index_pattern_select.tsx b/src/plugins/unified_search/public/index_pattern_select/index_pattern_select.tsx similarity index 98% rename from src/plugins/data/public/ui/index_pattern_select/index_pattern_select.tsx rename to src/plugins/unified_search/public/index_pattern_select/index_pattern_select.tsx index 2b45d8efc4d9..7555d00bac8b 100644 --- a/src/plugins/data/public/ui/index_pattern_select/index_pattern_select.tsx +++ b/src/plugins/unified_search/public/index_pattern_select/index_pattern_select.tsx @@ -11,8 +11,7 @@ import React, { Component } from 'react'; import { Required } from '@kbn/utility-types'; import { EuiComboBox, EuiComboBoxProps } from '@elastic/eui'; - -import { IndexPatternsContract } from 'src/plugins/data/public'; +import { IndexPatternsContract } from '../../../data/public'; export type IndexPatternSelectProps = Required< Omit< diff --git a/src/plugins/unified_search/public/mocks.ts b/src/plugins/unified_search/public/mocks.ts new file mode 100644 index 000000000000..eacbb72cc55a --- /dev/null +++ b/src/plugins/unified_search/public/mocks.ts @@ -0,0 +1,25 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { UnifiedSearchPublicPlugin } from './plugin'; + +export type Setup = jest.Mocked>; +export type Start = jest.Mocked>; + +const createStartContract = (): Start => { + return { + ui: { + IndexPatternSelect: jest.fn(), + SearchBar: jest.fn().mockReturnValue(null), + }, + }; +}; + +export const unifiedSearchPluginMock = { + createStartContract, +}; diff --git a/src/plugins/unified_search/public/plugin.ts b/src/plugins/unified_search/public/plugin.ts new file mode 100755 index 000000000000..9a7121ddc911 --- /dev/null +++ b/src/plugins/unified_search/public/plugin.ts @@ -0,0 +1,75 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import './index.scss'; + +import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from '../../../core/public'; +import { Storage, IStorageWrapper } from '../../kibana_utils/public'; +import { ConfigSchema } from '../config'; +import { setIndexPatterns, setTheme, setOverlays } from './services'; +import type { UsageCollectionSetup } from '../../usage_collection/public'; +import { createSearchBar } from './search_bar'; +import { createIndexPatternSelect } from './index_pattern_select'; +import { UnifiedSearchPluginSetup, UnifiedSearchPublicPluginStart } from './types'; +import type { UnifiedSearchStartDependencies, UnifiedSearchSetupDependencies } from './types'; +import { createFilterAction } from './actions/apply_filter_action'; +import { ACTION_GLOBAL_APPLY_FILTER } from './actions'; +import { APPLY_FILTER_TRIGGER } from '../../data/public'; + +export class UnifiedSearchPublicPlugin + implements Plugin +{ + private readonly storage: IStorageWrapper; + private usageCollection: UsageCollectionSetup | undefined; + + constructor(initializerContext: PluginInitializerContext) { + this.storage = new Storage(window.localStorage); + } + + public setup( + core: CoreSetup, + { uiActions, data }: UnifiedSearchSetupDependencies + ): UnifiedSearchPluginSetup { + const { query } = data; + uiActions.registerAction( + createFilterAction(query.filterManager, query.timefilter.timefilter, core.theme) + ); + + return {}; + } + + public start( + core: CoreStart, + { data, dataViews, uiActions }: UnifiedSearchStartDependencies + ): UnifiedSearchPublicPluginStart { + setTheme(core.theme); + setOverlays(core.overlays); + setIndexPatterns(dataViews); + + const SearchBar = createSearchBar({ + core, + data, + storage: this.storage, + usageCollection: this.usageCollection, + }); + + uiActions.addTriggerAction( + APPLY_FILTER_TRIGGER, + uiActions.getAction(ACTION_GLOBAL_APPLY_FILTER) + ); + + return { + ui: { + IndexPatternSelect: createIndexPatternSelect(dataViews), + SearchBar, + }, + }; + } + + public stop() {} +} diff --git a/src/plugins/data/public/ui/query_string_input/_index.scss b/src/plugins/unified_search/public/query_string_input/_index.scss similarity index 100% rename from src/plugins/data/public/ui/query_string_input/_index.scss rename to src/plugins/unified_search/public/query_string_input/_index.scss diff --git a/src/plugins/data/public/ui/query_string_input/_query_bar.scss b/src/plugins/unified_search/public/query_string_input/_query_bar.scss similarity index 100% rename from src/plugins/data/public/ui/query_string_input/_query_bar.scss rename to src/plugins/unified_search/public/query_string_input/_query_bar.scss diff --git a/src/plugins/data/public/ui/query_string_input/fetch_index_patterns.ts b/src/plugins/unified_search/public/query_string_input/fetch_index_patterns.ts similarity index 94% rename from src/plugins/data/public/ui/query_string_input/fetch_index_patterns.ts rename to src/plugins/unified_search/public/query_string_input/fetch_index_patterns.ts index 5eca12cd5502..4d37e5375337 100644 --- a/src/plugins/data/public/ui/query_string_input/fetch_index_patterns.ts +++ b/src/plugins/unified_search/public/query_string_input/fetch_index_patterns.ts @@ -7,7 +7,7 @@ */ import { isEmpty } from 'lodash'; -import { IndexPatternsContract } from '../..'; +import { IndexPatternsContract } from '../../../data/public'; export async function fetchIndexPatterns( indexPatternsService: IndexPatternsContract, diff --git a/src/plugins/data/public/query/lib/from_user.test.ts b/src/plugins/unified_search/public/query_string_input/from_user.test.ts similarity index 96% rename from src/plugins/data/public/query/lib/from_user.test.ts rename to src/plugins/unified_search/public/query_string_input/from_user.test.ts index 38a0c9efbb59..35f6e576181a 100644 --- a/src/plugins/data/public/query/lib/from_user.test.ts +++ b/src/plugins/unified_search/public/query_string_input/from_user.test.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { fromUser } from '../'; +import { fromUser } from './from_user'; describe('user input helpers', function () { describe('user input parser', function () { diff --git a/src/plugins/data/public/query/lib/from_user.ts b/src/plugins/unified_search/public/query_string_input/from_user.ts similarity index 100% rename from src/plugins/data/public/query/lib/from_user.ts rename to src/plugins/unified_search/public/query_string_input/from_user.ts diff --git a/src/plugins/data/public/ui/query_string_input/index.tsx b/src/plugins/unified_search/public/query_string_input/index.tsx similarity index 94% rename from src/plugins/data/public/ui/query_string_input/index.tsx rename to src/plugins/unified_search/public/query_string_input/index.tsx index 655640d2cd87..d0f22a2f41c5 100644 --- a/src/plugins/data/public/ui/query_string_input/index.tsx +++ b/src/plugins/unified_search/public/query_string_input/index.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { withKibana } from '../../../../kibana_react/public'; +import { withKibana } from '../../../kibana_react/public'; import type { QueryBarTopRowProps } from './query_bar_top_row'; import type { QueryStringInputProps } from './query_string_input'; @@ -21,6 +21,7 @@ export const QueryBarTopRow = (props: QueryBarTopRowProps) => ( ); const LazyQueryStringInputUI = withKibana(React.lazy(() => import('./query_string_input'))); + export const QueryStringInput = (props: QueryStringInputProps) => ( }> diff --git a/src/plugins/data/public/ui/query_string_input/language_switcher.test.tsx b/src/plugins/unified_search/public/query_string_input/language_switcher.test.tsx similarity index 97% rename from src/plugins/data/public/ui/query_string_input/language_switcher.test.tsx rename to src/plugins/unified_search/public/query_string_input/language_switcher.test.tsx index 67d36f465568..8106c9daf281 100644 --- a/src/plugins/data/public/ui/query_string_input/language_switcher.test.tsx +++ b/src/plugins/unified_search/public/query_string_input/language_switcher.test.tsx @@ -8,8 +8,8 @@ import React from 'react'; import { QueryLanguageSwitcher, QueryLanguageSwitcherProps } from './language_switcher'; -import { KibanaContextProvider } from 'src/plugins/kibana_react/public'; -import { coreMock } from '../../../../../core/public/mocks'; +import { KibanaContextProvider } from '../../../kibana_react/public'; +import { coreMock } from '../../../../core/public/mocks'; import { mountWithIntl } from '@kbn/test-jest-helpers'; import { EuiButtonEmpty, EuiIcon, EuiPopover } from '@elastic/eui'; const startMock = coreMock.createStart(); diff --git a/src/plugins/data/public/ui/query_string_input/language_switcher.tsx b/src/plugins/unified_search/public/query_string_input/language_switcher.tsx similarity index 80% rename from src/plugins/data/public/ui/query_string_input/language_switcher.tsx rename to src/plugins/unified_search/public/query_string_input/language_switcher.tsx index 3d66edd6a022..0454d3066cd1 100644 --- a/src/plugins/data/public/ui/query_string_input/language_switcher.tsx +++ b/src/plugins/unified_search/public/query_string_input/language_switcher.tsx @@ -22,7 +22,7 @@ import { import { FormattedMessage } from '@kbn/i18n-react'; import { i18n } from '@kbn/i18n'; import React, { useState } from 'react'; -import { useKibana } from '../../../../kibana_react/public'; +import { useKibana } from '../../../kibana_react/public'; export interface QueryLanguageSwitcherProps { language: string; @@ -43,20 +43,23 @@ export const QueryLanguageSwitcher = React.memo(function QueryLanguageSwitcher({ const kueryQuerySyntaxDocs = kibana.services.docLinks!.links.query.kueryQuerySyntax; const [isPopoverOpen, setIsPopoverOpen] = useState(false); const luceneLabel = ( - + ); const kqlLabel = ( - + ); const kqlFullName = ( ); - const kqlModeTitle = i18n.translate('data.query.queryBar.languageSwitcher.toText', { + const kqlModeTitle = i18n.translate('unifiedSearch.query.queryBar.languageSwitcher.toText', { defaultMessage: 'Switch to Kibana Query Language for search', }); @@ -91,7 +94,7 @@ export const QueryLanguageSwitcher = React.memo(function QueryLanguageSwitcher({ > @@ -99,7 +102,7 @@ export const QueryLanguageSwitcher = React.memo(function QueryLanguageSwitcher({

+ ) : ( - + ) } checked={language === 'kuery'} diff --git a/src/plugins/data/public/query/lib/match_pairs.ts b/src/plugins/unified_search/public/query_string_input/match_pairs.ts similarity index 100% rename from src/plugins/data/public/query/lib/match_pairs.ts rename to src/plugins/unified_search/public/query_string_input/match_pairs.ts diff --git a/src/plugins/data/public/ui/query_string_input/no_data_popover.test.tsx b/src/plugins/unified_search/public/query_string_input/no_data_popover.test.tsx similarity index 100% rename from src/plugins/data/public/ui/query_string_input/no_data_popover.test.tsx rename to src/plugins/unified_search/public/query_string_input/no_data_popover.test.tsx diff --git a/src/plugins/data/public/ui/query_string_input/no_data_popover.tsx b/src/plugins/unified_search/public/query_string_input/no_data_popover.tsx similarity index 84% rename from src/plugins/data/public/ui/query_string_input/no_data_popover.tsx rename to src/plugins/unified_search/public/query_string_input/no_data_popover.tsx index 672d992dc7d7..e417f274fa55 100644 --- a/src/plugins/data/public/ui/query_string_input/no_data_popover.tsx +++ b/src/plugins/unified_search/public/query_string_input/no_data_popover.tsx @@ -6,11 +6,11 @@ * Side Public License, v 1. */ -import { ReactElement, useEffect, useState } from 'react'; import React from 'react'; -import { EuiButtonEmpty, EuiText, EuiTourStep } from '@elastic/eui'; -import { IStorageWrapper } from 'src/plugins/kibana_utils/public'; +import { ReactElement, useEffect, useState } from 'react'; import { i18n } from '@kbn/i18n'; +import { EuiButtonEmpty, EuiText, EuiTourStep } from '@elastic/eui'; +import { IStorageWrapper } from '../../../kibana_utils/public'; const NO_DATA_POPOVER_STORAGE_KEY = 'data.noDataPopover'; @@ -43,7 +43,7 @@ export function NoDataPopover({ content={

- {i18n.translate('data.noDataPopover.content', { + {i18n.translate('unifiedSearch.noDataPopover.content', { defaultMessage: "This time range doesn't contain any data. Increase or adjust the time range to see more fields and create charts.", })} @@ -56,8 +56,10 @@ export function NoDataPopover({ step={1} stepsTotal={1} isStepOpen={noDataPopoverVisible} - subtitle={i18n.translate('data.noDataPopover.subtitle', { defaultMessage: 'Tip' })} - title={i18n.translate('data.noDataPopover.title', { defaultMessage: 'Empty dataset' })} + subtitle={i18n.translate('unifiedSearch.noDataPopover.subtitle', { defaultMessage: 'Tip' })} + title={i18n.translate('unifiedSearch.noDataPopover.title', { + defaultMessage: 'Empty dataset', + })} footerAction={ - {i18n.translate('data.noDataPopover.dismissAction', { + {i18n.translate('unifiedSearch.noDataPopover.dismissAction', { defaultMessage: "Don't show again", })} diff --git a/src/plugins/data/public/ui/query_string_input/query_bar_top_row.test.tsx b/src/plugins/unified_search/public/query_string_input/query_bar_top_row.test.tsx similarity index 95% rename from src/plugins/data/public/ui/query_string_input/query_bar_top_row.test.tsx rename to src/plugins/unified_search/public/query_string_input/query_bar_top_row.test.tsx index 9f99049d3e78..e8ca82782d11 100644 --- a/src/plugins/data/public/ui/query_string_input/query_bar_top_row.test.tsx +++ b/src/plugins/unified_search/public/query_string_input/query_bar_top_row.test.tsx @@ -14,12 +14,12 @@ import { render } from '@testing-library/react'; import { EMPTY } from 'rxjs'; import QueryBarTopRow from './query_bar_top_row'; -import { coreMock } from '../../../../../core/public/mocks'; -import { dataPluginMock } from '../../mocks'; -import { KibanaContextProvider } from 'src/plugins/kibana_react/public'; +import { coreMock } from '../../../../core/public/mocks'; +import { dataPluginMock } from '../../../data/public/mocks'; +import { KibanaContextProvider } from '../../../kibana_react/public'; import { I18nProvider } from '@kbn/i18n-react'; -import { stubIndexPattern } from '../../stubs'; -import { UI_SETTINGS } from '../../../common'; +import { stubIndexPattern } from '../../../data/public/stubs'; +import { UI_SETTINGS } from '../../../data/common'; const startMock = coreMock.createStart(); const mockTimeHistory = { diff --git a/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx b/src/plugins/unified_search/public/query_string_input/query_bar_top_row.tsx similarity index 96% rename from src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx rename to src/plugins/unified_search/public/query_string_input/query_bar_top_row.tsx index 424347834c3d..ddba035b91fd 100644 --- a/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx +++ b/src/plugins/unified_search/public/query_string_input/query_bar_top_row.tsx @@ -13,7 +13,6 @@ import deepEqual from 'fast-deep-equal'; import useObservable from 'react-use/lib/useObservable'; import { EMPTY } from 'rxjs'; import { map } from 'rxjs/operators'; - import { EuiFlexGroup, EuiFlexItem, @@ -24,14 +23,20 @@ import { EuiSuperUpdateButton, OnRefreshProps, } from '@elastic/eui'; -import { IDataPluginServices, IIndexPattern, TimeRange, TimeHistoryContract, Query } from '../..'; -import { useKibana, withKibana } from '../../../../kibana_react/public'; +import { + IDataPluginServices, + IIndexPattern, + TimeRange, + TimeHistoryContract, + Query, + getQueryLog, +} from '../../../data/public'; +import type { PersistedLog } from '../../../data/public'; +import { useKibana, withKibana } from '../../../kibana_react/public'; import QueryStringInputUI from './query_string_input'; -import { UI_SETTINGS } from '../../../common'; -import { getQueryLog } from '../../query'; -import type { PersistedLog } from '../../query'; +import { UI_SETTINGS } from '../../../data/common'; import { NoDataPopover } from './no_data_popover'; -import { shallowEqual } from '../../utils/shallow_equal'; +import { shallowEqual } from '../utils'; const SuperDatePicker = React.memo( EuiSuperDatePicker as any diff --git a/src/plugins/data/public/ui/query_string_input/query_string_input.test.mocks.ts b/src/plugins/unified_search/public/query_string_input/query_string_input.test.mocks.ts similarity index 89% rename from src/plugins/data/public/ui/query_string_input/query_string_input.test.mocks.ts rename to src/plugins/unified_search/public/query_string_input/query_string_input.test.mocks.ts index 9e9498fa465c..f8c80473d4f0 100644 --- a/src/plugins/data/public/ui/query_string_input/query_string_input.test.mocks.ts +++ b/src/plugins/unified_search/public/query_string_input/query_string_input.test.mocks.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { stubIndexPattern } from '../../stubs'; +import { stubIndexPattern } from '../../../data/public/stubs'; export const mockPersistedLog = { add: jest.fn(), @@ -21,7 +21,7 @@ export const mockFetchIndexPatterns = jest .fn() .mockReturnValue(Promise.resolve([stubIndexPattern])); -jest.mock('../../query/persisted_log', () => ({ +jest.mock('../../../data/public/query/persisted_log', () => ({ PersistedLog: mockPersistedLogFactory, })); diff --git a/src/plugins/data/public/ui/query_string_input/query_string_input.test.tsx b/src/plugins/unified_search/public/query_string_input/query_string_input.test.tsx similarity index 97% rename from src/plugins/data/public/ui/query_string_input/query_string_input.test.tsx rename to src/plugins/unified_search/public/query_string_input/query_string_input.test.tsx index 764ad45c78d3..4a48b3cc4242 100644 --- a/src/plugins/data/public/ui/query_string_input/query_string_input.test.tsx +++ b/src/plugins/unified_search/public/query_string_input/query_string_input.test.tsx @@ -23,10 +23,10 @@ import { EuiTextArea, EuiIcon } from '@elastic/eui'; import { QueryLanguageSwitcher } from './language_switcher'; import QueryStringInputUI from './query_string_input'; -import { coreMock } from '../../../../../core/public/mocks'; -import { dataPluginMock } from '../../mocks'; -import { stubIndexPattern } from '../../stubs'; -import { KibanaContextProvider, withKibana } from 'src/plugins/kibana_react/public'; +import { coreMock } from '../../../../core/public/mocks'; +import { dataPluginMock } from '../../../data/public/mocks'; +import { stubIndexPattern } from '../../../data/public/stubs'; +import { KibanaContextProvider, withKibana } from '../../../kibana_react/public'; jest.useFakeTimers(); diff --git a/src/plugins/data/public/ui/query_string_input/query_string_input.tsx b/src/plugins/unified_search/public/query_string_input/query_string_input.tsx similarity index 95% rename from src/plugins/data/public/ui/query_string_input/query_string_input.tsx rename to src/plugins/unified_search/public/query_string_input/query_string_input.tsx index 6464f02dd7cb..1a075812ac20 100644 --- a/src/plugins/data/public/ui/query_string_input/query_string_input.tsx +++ b/src/plugins/unified_search/public/query_string_input/query_string_input.tsx @@ -10,6 +10,7 @@ import React, { PureComponent } from 'react'; import { i18n } from '@kbn/i18n'; import classNames from 'classnames'; +import { METRIC_TYPE } from '@kbn/analytics'; import { EuiButton, @@ -26,21 +27,27 @@ import { } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import { compact, debounce, isEqual, isFunction } from 'lodash'; -import { Toast } from 'src/core/public'; -import { METRIC_TYPE } from '@kbn/analytics'; - -import { IDataPluginServices, IIndexPattern, Query } from '../..'; -import { QuerySuggestion, QuerySuggestionTypes } from '../../autocomplete'; -import { KibanaReactContextValue, toMountPoint } from '../../../../kibana_react/public'; +import { Toast } from '../../../../core/public'; +import { + IDataPluginServices, + IIndexPattern, + Query, + QuerySuggestion, + QuerySuggestionTypes, + getQueryLog, +} from '../../../data/public'; +import { matchPairs } from './match_pairs'; +import { toUser } from './to_user'; +import { fromUser } from './from_user'; +import type { PersistedLog } from '../../../data/public'; +import { getFieldSubtypeNested, KIBANA_USER_QUERY_LANGUAGE_KEY } from '../../../data/common'; +import { KibanaReactContextValue, toMountPoint } from '../../../kibana_react/public'; import { fetchIndexPatterns } from './fetch_index_patterns'; import { QueryLanguageSwitcher } from './language_switcher'; -import { getQueryLog, matchPairs, toUser, fromUser } from '../../query'; -import type { PersistedLog } from '../../query'; import type { SuggestionsListSize } from '../typeahead/suggestions_component'; -import { SuggestionsComponent } from '..'; -import { getFieldSubtypeNested, KIBANA_USER_QUERY_LANGUAGE_KEY } from '../../../common'; +import { SuggestionsComponent } from '../typeahead'; import { onRaf } from '../utils'; -import { getTheme } from '../../services'; +import { getTheme } from '../services'; export interface QueryStringInputProps { indexPatterns: Array; @@ -455,14 +462,14 @@ export default class QueryStringInputUI extends PureComponent { if (notifications && docLinks) { const toast = notifications.toasts.add({ - title: i18n.translate('data.query.queryBar.KQLNestedQuerySyntaxInfoTitle', { + title: i18n.translate('unifiedSearch.query.queryBar.KQLNestedQuerySyntaxInfoTitle', { defaultMessage: 'KQL nested query syntax', }), text: toMountPoint(

{ link: ( @@ -482,7 +489,7 @@ export default class QueryStringInputUI extends PureComponent { onKQLNestedQuerySyntaxInfoOptOut(toast)}> @@ -705,7 +712,7 @@ export default class QueryStringInputUI extends PureComponent {

{ { inputRef={this.assignInputRef} autoComplete="off" spellCheck={false} - aria-label={i18n.translate('data.query.queryBar.searchInputAriaLabel', { + aria-label={i18n.translate('unifiedSearch.query.queryBar.searchInputAriaLabel', { defaultMessage: 'Start typing to search and filter the {pageType} page', values: { pageType: this.services.appName }, })} @@ -769,7 +776,7 @@ export default class QueryStringInputUI extends PureComponent {