From 7e7208446a1abdf6c1f6e5c24fba388753fde395 Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Tue, 17 Jul 2018 18:49:46 -0700 Subject: [PATCH] Add SearchStrategyRegistry and defaultSearchStrategy to support existing search behavior, and integrate it with CallClient. (#20497) * Add SearchStrategyRegistry and defaultSearchStrategy to support existing search behavior, and integrate it with CallClient. * Move fetch param logic from CallClient into defaultSearchStrategy. * Move defaultSearchStrategy configuration into kibana plugin via search uiExport to avoid race conditions with other plugins. * Add call-out react directive. * Show error in Discover if user tries to access a rollup index pattern without the right search strategy. Sentence-case copy in field chooser. * Add tests with multiple searchStrategies and fix errors in logic. --- .../field_chooser/field_chooser.html | 14 +- .../public/discover/controllers/discover.js | 16 +- .../public/discover/directives/index.js | 9 + .../directives/unsupported_index_pattern.js | 50 +++++ .../kibana/public/discover/index.html | 5 + src/core_plugins/kibana/public/kibana.js | 1 + src/ui/public/courier/courier.js | 4 +- .../courier/fetch/__tests__/call_client.js | 99 ++++++++- src/ui/public/courier/fetch/call_client.js | 209 +++++++++--------- src/ui/public/courier/index.js | 7 + .../default_search_strategy.js | 91 ++++++++ .../public/courier/search_strategy/index.js | 26 +++ .../is_default_type_index_pattern.js | 23 ++ .../search_strategy_registry.js | 87 ++++++++ .../search_strategy_registry.test.js | 79 +++++++ src/ui/public/react_components.js | 3 + src/ui/ui_exports/ui_export_defaults.js | 5 +- src/ui/ui_exports/ui_export_types/index.js | 3 +- .../ui_export_types/ui_app_extensions.js | 1 + .../dashboard_mode/public/dashboard_viewer.js | 1 + 20 files changed, 618 insertions(+), 115 deletions(-) create mode 100644 src/core_plugins/kibana/public/discover/directives/unsupported_index_pattern.js create mode 100644 src/ui/public/courier/search_strategy/default_search_strategy.js create mode 100644 src/ui/public/courier/search_strategy/index.js create mode 100644 src/ui/public/courier/search_strategy/is_default_type_index_pattern.js create mode 100644 src/ui/public/courier/search_strategy/search_strategy_registry.js create mode 100644 src/ui/public/courier/search_strategy/search_strategy_registry.test.js diff --git a/src/core_plugins/kibana/public/discover/components/field_chooser/field_chooser.html b/src/core_plugins/kibana/public/discover/components/field_chooser/field_chooser.html index 010cad19d1a96..3820555d7b700 100644 --- a/src/core_plugins/kibana/public/discover/components/field_chooser/field_chooser.html +++ b/src/core_plugins/kibana/public/discover/components/field_chooser/field_chooser.html @@ -31,8 +31,10 @@ -