diff --git a/api_docs/deprecations.mdx b/api_docs/deprecations.mdx
index d9261b943d170..74dae7faf838a 100644
--- a/api_docs/deprecations.mdx
+++ b/api_docs/deprecations.mdx
@@ -111,6 +111,8 @@ warning: This document is auto-generated and is meant to be viewed inside our ex
| | [clone_panel_action.tsx#L14](https://github.com/elastic/kibana/tree/master/src/plugins/dashboard/public/application/actions/clone_panel_action.tsx#L14) | - |
| | [clone_panel_action.tsx#L98](https://github.com/elastic/kibana/tree/master/src/plugins/dashboard/public/application/actions/clone_panel_action.tsx#L98) | - |
| | [clone_panel_action.tsx#L126](https://github.com/elastic/kibana/tree/master/src/plugins/dashboard/public/application/actions/clone_panel_action.tsx#L126) | - |
+| | [use_dashboard_state_manager.ts#L23](https://github.com/elastic/kibana/tree/master/src/plugins/dashboard/public/application/hooks/use_dashboard_state_manager.ts#L23) | - |
+| | [use_dashboard_state_manager.ts#L35](https://github.com/elastic/kibana/tree/master/src/plugins/dashboard/public/application/hooks/use_dashboard_state_manager.ts#L35) | - |
@@ -127,8 +129,6 @@ warning: This document is auto-generated and is meant to be viewed inside our ex
| | [search_embeddable.ts#L23](https://github.com/elastic/kibana/tree/master/src/plugins/discover/public/application/embeddable/search_embeddable.ts#L23) | - |
| | [search_embeddable.ts#L59](https://github.com/elastic/kibana/tree/master/src/plugins/discover/public/application/embeddable/search_embeddable.ts#L59) | - |
| | [kibana_services.ts#L104](https://github.com/elastic/kibana/tree/master/src/plugins/discover/public/kibana_services.ts#L104) | - |
-| | [search_embeddable.ts#L23](https://github.com/elastic/kibana/tree/master/src/plugins/discover/public/application/embeddable/search_embeddable.ts#L23) | - |
-| | [search_embeddable.ts#L59](https://github.com/elastic/kibana/tree/master/src/plugins/discover/public/application/embeddable/search_embeddable.ts#L59) | - |
| | [kibana_services.ts#L101](https://github.com/elastic/kibana/tree/master/src/plugins/discover/public/kibana_services.ts#L101) | - |
| | [create_doc_table_react.tsx#L15](https://github.com/elastic/kibana/tree/master/src/plugins/discover/public/application/angular/doc_table/create_doc_table_react.tsx#L15) | - |
| | [create_doc_table_react.tsx#L25](https://github.com/elastic/kibana/tree/master/src/plugins/discover/public/application/angular/doc_table/create_doc_table_react.tsx#L25) | - |
@@ -153,7 +153,7 @@ warning: This document is auto-generated and is meant to be viewed inside our ex
| Deprecated API | Reference location | Remove By |
| ---------------|-----------|-----------|
| | [attribute_service.tsx#L13](https://github.com/elastic/kibana/tree/master/src/plugins/embeddable/public/lib/attribute_service/attribute_service.tsx#L13) | - |
-| | [attribute_service.tsx#L165](https://github.com/elastic/kibana/tree/master/src/plugins/embeddable/public/lib/attribute_service/attribute_service.tsx#L165) | - |
+| | [attribute_service.tsx#L167](https://github.com/elastic/kibana/tree/master/src/plugins/embeddable/public/lib/attribute_service/attribute_service.tsx#L167) | - |
@@ -189,7 +189,7 @@ warning: This document is auto-generated and is meant to be viewed inside our ex
| | [query_bar.tsx#L30](https://github.com/elastic/kibana/tree/master/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/query_bar.tsx#L30) | - |
| | [query_bar.tsx#L38](https://github.com/elastic/kibana/tree/master/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/query_bar.tsx#L38) | - |
| | [plugin.ts#L14](https://github.com/elastic/kibana/tree/master/x-pack/plugins/fleet/server/plugin.ts#L14) | - |
-| | [plugin.ts#L190](https://github.com/elastic/kibana/tree/master/x-pack/plugins/fleet/server/plugin.ts#L190) | - |
+| | [plugin.ts#L189](https://github.com/elastic/kibana/tree/master/x-pack/plugins/fleet/server/plugin.ts#L189) | - |
| | [plugin.d.ts#L2](https://github.com/elastic/kibana/tree/master/x-pack/plugins/fleet/target/types/server/plugin.d.ts#L2) | - |
| | [plugin.d.ts#L84](https://github.com/elastic/kibana/tree/master/x-pack/plugins/fleet/target/types/server/plugin.d.ts#L84) | - |
@@ -228,18 +228,18 @@ warning: This document is auto-generated and is meant to be viewed inside our ex
| Deprecated API | Reference location | Remove By |
| ---------------|-----------|-----------|
-| | [plugin.ts#L12](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/server/plugin.ts#L12) | 7.16 |
-| | [plugin.ts#L38](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/server/plugin.ts#L38) | 7.16 |
+| | [plugin.ts#L14](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/server/plugin.ts#L14) | 7.16 |
+| | [plugin.ts#L42](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/server/plugin.ts#L42) | 7.16 |
| | [types.ts#L9](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/server/types.ts#L9) | 7.16 |
-| | [types.ts#L39](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/server/types.ts#L39) | 7.16 |
+| | [types.ts#L40](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/server/types.ts#L40) | 7.16 |
| | [types.d.ts#L1](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/target/types/server/types.d.ts#L1) | 7.16 |
-| | [types.d.ts#L24](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/target/types/server/types.d.ts#L24) | 7.16 |
+| | [types.d.ts#L25](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/target/types/server/types.d.ts#L25) | 7.16 |
| | [types.ts#L10](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/server/types.ts#L10) | 7.16 |
-| | [types.ts#L42](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/server/types.ts#L42) | 7.16 |
-| | [types.ts#L49](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/server/types.ts#L49) | 7.16 |
+| | [types.ts#L43](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/server/types.ts#L43) | 7.16 |
+| | [types.ts#L50](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/server/types.ts#L50) | 7.16 |
| | [types.d.ts#L1](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/target/types/server/types.d.ts#L1) | 7.16 |
-| | [types.d.ts#L26](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/target/types/server/types.d.ts#L26) | 7.16 |
-| | [types.d.ts#L32](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/target/types/server/types.d.ts#L32) | 7.16 |
+| | [types.d.ts#L27](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/target/types/server/types.d.ts#L27) | 7.16 |
+| | [types.d.ts#L33](https://github.com/elastic/kibana/tree/master/x-pack/plugins/index_management/target/types/server/types.d.ts#L33) | 7.16 |
@@ -578,6 +578,11 @@ warning: This document is auto-generated and is meant to be viewed inside our ex
| | [custom_metric_form.d.ts#L8](https://github.com/elastic/kibana/tree/master/x-pack/plugins/infra/target/types/public/pages/metrics/inventory_view/components/waffle/metric_control/custom_metric_form.d.ts#L8) | - |
| | [index.d.ts#L1](https://github.com/elastic/kibana/tree/master/x-pack/plugins/infra/target/types/public/pages/metrics/inventory_view/components/waffle/metric_control/index.d.ts#L1) | - |
| | [index.d.ts#L9](https://github.com/elastic/kibana/tree/master/x-pack/plugins/infra/target/types/public/pages/metrics/inventory_view/components/waffle/metric_control/index.d.ts#L9) | - |
+| | [log_entry_categories_analysis.ts#L9](https://github.com/elastic/kibana/tree/master/x-pack/plugins/infra/server/lib/log_analysis/log_entry_categories_analysis.ts#L9) | 7.16 |
+| | [log_entry_categories_analysis.ts#L139](https://github.com/elastic/kibana/tree/master/x-pack/plugins/infra/server/lib/log_analysis/log_entry_categories_analysis.ts#L139) | 7.16 |
+| | [log_entry_categories_analysis.ts#L405](https://github.com/elastic/kibana/tree/master/x-pack/plugins/infra/server/lib/log_analysis/log_entry_categories_analysis.ts#L405) | 7.16 |
+| | [log_entry_categories_analysis.d.ts#L1](https://github.com/elastic/kibana/tree/master/x-pack/plugins/infra/target/types/server/lib/log_analysis/log_entry_categories_analysis.d.ts#L1) | 7.16 |
+| | [log_entry_categories_analysis.d.ts#L58](https://github.com/elastic/kibana/tree/master/x-pack/plugins/infra/target/types/server/lib/log_analysis/log_entry_categories_analysis.d.ts#L58) | 7.16 |
@@ -587,8 +592,6 @@ warning: This document is auto-generated and is meant to be viewed inside our ex
| ---------------|-----------|-----------|
| | [embeddable.tsx#L14](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/public/editor_frame_service/embeddable/embeddable.tsx#L14) | - |
| | [embeddable.tsx#L85](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/public/editor_frame_service/embeddable/embeddable.tsx#L85) | - |
-| | [index.tsx#L25](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/terms/index.tsx#L25) | - |
-| | [index.tsx#L102](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/terms/index.tsx#L102) | - |
| | [field_item.tsx#L47](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/public/indexpattern_datasource/field_item.tsx#L47) | - |
| | [field_item.tsx#L172](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/public/indexpattern_datasource/field_item.tsx#L172) | - |
| | [datapanel.tsx#L42](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.tsx#L42) | - |
@@ -603,10 +606,10 @@ warning: This document is auto-generated and is meant to be viewed inside our ex
| | [types.ts#L8](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/public/indexpattern_datasource/types.ts#L8) | - |
| | [types.ts#L57](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/public/indexpattern_datasource/types.ts#L57) | - |
| | [field_stats.ts#L11](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/server/routes/field_stats.ts#L11) | - |
-| | [field_stats.ts#L141](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/server/routes/field_stats.ts#L141) | - |
-| | [field_stats.ts#L250](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/server/routes/field_stats.ts#L250) | - |
-| | [field_stats.ts#L290](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/server/routes/field_stats.ts#L290) | - |
-| | [field_stats.ts#L332](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/server/routes/field_stats.ts#L332) | - |
+| | [field_stats.ts#L139](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/server/routes/field_stats.ts#L139) | - |
+| | [field_stats.ts#L248](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/server/routes/field_stats.ts#L248) | - |
+| | [field_stats.ts#L287](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/server/routes/field_stats.ts#L287) | - |
+| | [field_stats.ts#L329](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/server/routes/field_stats.ts#L329) | - |
| | [types.d.ts#L1](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/target/types/public/indexpattern_datasource/types.d.ts#L1) | - |
| | [types.d.ts#L22](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/target/types/public/indexpattern_datasource/types.d.ts#L22) | - |
| | [field_stats.d.ts#L3](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/target/types/server/routes/field_stats.d.ts#L3) | - |
@@ -618,10 +621,10 @@ warning: This document is auto-generated and is meant to be viewed inside our ex
| | [types.ts#L8](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/public/indexpattern_datasource/types.ts#L8) | - |
| | [types.ts#L57](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/public/indexpattern_datasource/types.ts#L57) | - |
| | [field_stats.ts#L11](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/server/routes/field_stats.ts#L11) | - |
-| | [field_stats.ts#L141](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/server/routes/field_stats.ts#L141) | - |
-| | [field_stats.ts#L250](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/server/routes/field_stats.ts#L250) | - |
-| | [field_stats.ts#L290](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/server/routes/field_stats.ts#L290) | - |
-| | [field_stats.ts#L332](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/server/routes/field_stats.ts#L332) | - |
+| | [field_stats.ts#L139](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/server/routes/field_stats.ts#L139) | - |
+| | [field_stats.ts#L248](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/server/routes/field_stats.ts#L248) | - |
+| | [field_stats.ts#L287](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/server/routes/field_stats.ts#L287) | - |
+| | [field_stats.ts#L329](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/server/routes/field_stats.ts#L329) | - |
| | [types.d.ts#L1](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/target/types/public/indexpattern_datasource/types.d.ts#L1) | - |
| | [types.d.ts#L22](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/target/types/public/indexpattern_datasource/types.d.ts#L22) | - |
| | [field_stats.d.ts#L3](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/target/types/server/routes/field_stats.d.ts#L3) | - |
@@ -630,8 +633,6 @@ warning: This document is auto-generated and is meant to be viewed inside our ex
| | [field_stats.d.ts#L9](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/target/types/server/routes/field_stats.d.ts#L9) | - |
| | [embeddable.tsx#L14](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/public/editor_frame_service/embeddable/embeddable.tsx#L14) | - |
| | [embeddable.tsx#L85](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/public/editor_frame_service/embeddable/embeddable.tsx#L85) | - |
-| | [index.tsx#L25](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/terms/index.tsx#L25) | - |
-| | [index.tsx#L102](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/terms/index.tsx#L102) | - |
| | [field_item.tsx#L47](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/public/indexpattern_datasource/field_item.tsx#L47) | - |
| | [field_item.tsx#L172](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/public/indexpattern_datasource/field_item.tsx#L172) | - |
| | [datapanel.tsx#L42](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.tsx#L42) | - |
@@ -646,10 +647,10 @@ warning: This document is auto-generated and is meant to be viewed inside our ex
| | [types.ts#L8](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/public/indexpattern_datasource/types.ts#L8) | - |
| | [types.ts#L57](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/public/indexpattern_datasource/types.ts#L57) | - |
| | [field_stats.ts#L11](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/server/routes/field_stats.ts#L11) | - |
-| | [field_stats.ts#L141](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/server/routes/field_stats.ts#L141) | - |
-| | [field_stats.ts#L250](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/server/routes/field_stats.ts#L250) | - |
-| | [field_stats.ts#L290](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/server/routes/field_stats.ts#L290) | - |
-| | [field_stats.ts#L332](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/server/routes/field_stats.ts#L332) | - |
+| | [field_stats.ts#L139](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/server/routes/field_stats.ts#L139) | - |
+| | [field_stats.ts#L248](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/server/routes/field_stats.ts#L248) | - |
+| | [field_stats.ts#L287](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/server/routes/field_stats.ts#L287) | - |
+| | [field_stats.ts#L329](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/server/routes/field_stats.ts#L329) | - |
| | [types.d.ts#L1](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/target/types/public/indexpattern_datasource/types.d.ts#L1) | - |
| | [types.d.ts#L22](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/target/types/public/indexpattern_datasource/types.d.ts#L22) | - |
| | [field_stats.d.ts#L3](https://github.com/elastic/kibana/tree/master/x-pack/plugins/lens/target/types/server/routes/field_stats.d.ts#L3) | - |
@@ -935,7 +936,7 @@ warning: This document is auto-generated and is meant to be viewed inside our ex
| Deprecated API | Reference location | Remove By |
| ---------------|-----------|-----------|
| | [types.ts#L8](https://github.com/elastic/kibana/tree/master/x-pack/plugins/maps/public/embeddable/types.ts#L8) | - |
-| | [types.ts#L44](https://github.com/elastic/kibana/tree/master/x-pack/plugins/maps/public/embeddable/types.ts#L44) | - |
+| | [types.ts#L45](https://github.com/elastic/kibana/tree/master/x-pack/plugins/maps/public/embeddable/types.ts#L45) | - |
| | [es_doc_field.ts#L12](https://github.com/elastic/kibana/tree/master/x-pack/plugins/maps/public/classes/fields/es_doc_field.ts#L12) | - |
| | [es_doc_field.ts#L45](https://github.com/elastic/kibana/tree/master/x-pack/plugins/maps/public/classes/fields/es_doc_field.ts#L45) | - |
| | [es_source.ts#L10](https://github.com/elastic/kibana/tree/master/x-pack/plugins/maps/public/classes/sources/es_source/es_source.ts#L10) | - |
@@ -1125,7 +1126,7 @@ warning: This document is auto-generated and is meant to be viewed inside our ex
| | [get_docvalue_source_fields.test.ts#L10](https://github.com/elastic/kibana/tree/master/x-pack/plugins/maps/public/classes/sources/es_search_source/get_docvalue_source_fields.test.ts#L10) | - |
| | [get_docvalue_source_fields.test.ts#L12](https://github.com/elastic/kibana/tree/master/x-pack/plugins/maps/public/classes/sources/es_search_source/get_docvalue_source_fields.test.ts#L12) | - |
| | [types.ts#L8](https://github.com/elastic/kibana/tree/master/x-pack/plugins/maps/public/embeddable/types.ts#L8) | - |
-| | [types.ts#L44](https://github.com/elastic/kibana/tree/master/x-pack/plugins/maps/public/embeddable/types.ts#L44) | - |
+| | [types.ts#L45](https://github.com/elastic/kibana/tree/master/x-pack/plugins/maps/public/embeddable/types.ts#L45) | - |
| | [es_doc_field.ts#L12](https://github.com/elastic/kibana/tree/master/x-pack/plugins/maps/public/classes/fields/es_doc_field.ts#L12) | - |
| | [es_doc_field.ts#L45](https://github.com/elastic/kibana/tree/master/x-pack/plugins/maps/public/classes/fields/es_doc_field.ts#L45) | - |
| | [es_source.ts#L10](https://github.com/elastic/kibana/tree/master/x-pack/plugins/maps/public/classes/sources/es_source/es_source.ts#L10) | - |
@@ -1360,7 +1361,7 @@ warning: This document is auto-generated and is meant to be viewed inside our ex
| | [static_globals.ts#L43](https://github.com/elastic/kibana/tree/master/x-pack/plugins/monitoring/server/static_globals.ts#L43) | 7.16 |
| | [plugin.ts#L18](https://github.com/elastic/kibana/tree/master/x-pack/plugins/monitoring/server/plugin.ts#L18) | 7.16 |
| | [plugin.ts#L74](https://github.com/elastic/kibana/tree/master/x-pack/plugins/monitoring/server/plugin.ts#L74) | 7.16 |
-| | [plugin.ts#L284](https://github.com/elastic/kibana/tree/master/x-pack/plugins/monitoring/server/plugin.ts#L284) | 7.16 |
+| | [plugin.ts#L279](https://github.com/elastic/kibana/tree/master/x-pack/plugins/monitoring/server/plugin.ts#L279) | 7.16 |
| | [types.d.ts#L2](https://github.com/elastic/kibana/tree/master/x-pack/plugins/monitoring/target/types/server/types.d.ts#L2) | 7.16 |
| | [types.d.ts#L47](https://github.com/elastic/kibana/tree/master/x-pack/plugins/monitoring/target/types/server/types.d.ts#L47) | 7.16 |
| | [plugin.d.ts#L1](https://github.com/elastic/kibana/tree/master/x-pack/plugins/monitoring/target/types/server/plugin.d.ts#L1) | 7.16 |
@@ -1449,22 +1450,22 @@ warning: This document is auto-generated and is meant to be viewed inside our ex
| Deprecated API | Reference location | Remove By |
| ---------------|-----------|-----------|
-| | [types.ts#L19](https://github.com/elastic/kibana/tree/master/x-pack/plugins/observability/public/components/shared/exploratory_view/types.ts#L19) | - |
-| | [types.ts#L104](https://github.com/elastic/kibana/tree/master/x-pack/plugins/observability/public/components/shared/exploratory_view/types.ts#L104) | - |
+| | [types.ts#L18](https://github.com/elastic/kibana/tree/master/x-pack/plugins/observability/public/components/shared/exploratory_view/types.ts#L18) | - |
+| | [types.ts#L95](https://github.com/elastic/kibana/tree/master/x-pack/plugins/observability/public/components/shared/exploratory_view/types.ts#L95) | - |
| | [utils.ts#L10](https://github.com/elastic/kibana/tree/master/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/utils.ts#L10) | - |
| | [utils.ts#L53](https://github.com/elastic/kibana/tree/master/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/utils.ts#L53) | - |
| | [utils.ts#L61](https://github.com/elastic/kibana/tree/master/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/utils.ts#L61) | - |
| | [utils.ts#L69](https://github.com/elastic/kibana/tree/master/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/utils.ts#L69) | - |
| | [default_configs.ts#L19](https://github.com/elastic/kibana/tree/master/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/default_configs.ts#L19) | - |
-| | [default_configs.ts#L25](https://github.com/elastic/kibana/tree/master/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/default_configs.ts#L25) | - |
-| | [types.ts#L19](https://github.com/elastic/kibana/tree/master/x-pack/plugins/observability/public/components/shared/exploratory_view/types.ts#L19) | - |
-| | [types.ts#L104](https://github.com/elastic/kibana/tree/master/x-pack/plugins/observability/public/components/shared/exploratory_view/types.ts#L104) | - |
+| | [default_configs.ts#L24](https://github.com/elastic/kibana/tree/master/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/default_configs.ts#L24) | - |
+| | [types.ts#L18](https://github.com/elastic/kibana/tree/master/x-pack/plugins/observability/public/components/shared/exploratory_view/types.ts#L18) | - |
+| | [types.ts#L95](https://github.com/elastic/kibana/tree/master/x-pack/plugins/observability/public/components/shared/exploratory_view/types.ts#L95) | - |
| | [utils.ts#L10](https://github.com/elastic/kibana/tree/master/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/utils.ts#L10) | - |
| | [utils.ts#L53](https://github.com/elastic/kibana/tree/master/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/utils.ts#L53) | - |
| | [utils.ts#L61](https://github.com/elastic/kibana/tree/master/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/utils.ts#L61) | - |
| | [utils.ts#L69](https://github.com/elastic/kibana/tree/master/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/utils.ts#L69) | - |
| | [default_configs.ts#L19](https://github.com/elastic/kibana/tree/master/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/default_configs.ts#L19) | - |
-| | [default_configs.ts#L25](https://github.com/elastic/kibana/tree/master/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/default_configs.ts#L25) | - |
+| | [default_configs.ts#L24](https://github.com/elastic/kibana/tree/master/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/default_configs.ts#L24) | - |
@@ -1540,9 +1541,9 @@ warning: This document is auto-generated and is meant to be viewed inside our ex
| Deprecated API | Reference location | Remove By |
| ---------------|-----------|-----------|
-| | [types.ts#L22](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/types.ts#L22) | - |
-| | [types.ts#L72](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/types.ts#L72) | - |
-| | [action.ts#L20](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/action.ts#L20) | - |
+| | [types.ts#L21](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/types.ts#L21) | - |
+| | [types.ts#L66](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/types.ts#L66) | - |
+| | [action.ts#L19](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/action.ts#L19) | - |
| | [action.ts#L100](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/action.ts#L100) | - |
| | [index.ts#L8](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/common/search_strategy/index_fields/index.ts#L8) | - |
| | [index.ts#L86](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/common/search_strategy/index_fields/index.ts#L86) | - |
@@ -1579,9 +1580,9 @@ warning: This document is auto-generated and is meant to be viewed inside our ex
| | [types.ts#L41](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/network/pages/details/types.ts#L41) | - |
| | [index.tsx#L12](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/network/components/network_top_countries_table/index.tsx#L12) | - |
| | [index.tsx#L34](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/network/components/network_top_countries_table/index.tsx#L34) | - |
-| | [middleware.ts#L48](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/middleware.ts#L48) | - |
-| | [middleware.ts#L64](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/middleware.ts#L64) | - |
-| | [middleware.ts#L69](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/middleware.ts#L69) | - |
+| | [middleware.ts#L44](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/middleware.ts#L44) | - |
+| | [middleware.ts#L60](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/middleware.ts#L60) | - |
+| | [middleware.ts#L65](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/middleware.ts#L65) | - |
| | [types.ts#L12](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/detections/components/rules/description_step/types.ts#L12) | - |
| | [types.ts#L28](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/detections/components/rules/description_step/types.ts#L28) | - |
| | [index.tsx#L15](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/detections/components/rules/description_step/index.tsx#L15) | - |
@@ -1636,8 +1637,6 @@ warning: This document is auto-generated and is meant to be viewed inside our ex
| | [use_field_value_autocomplete.ts#L31](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/common/components/autocomplete/hooks/use_field_value_autocomplete.ts#L31) | - |
| | [field_value_match.tsx#L19](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_match.tsx#L19) | - |
| | [field_value_match.tsx#L30](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_match.tsx#L30) | - |
-| | [query.ts#L13](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/lib/detection_engine/reference_rules/query.ts#L13) | - |
-| | [query.ts#L52](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/lib/detection_engine/reference_rules/query.ts#L52) | - |
| | [model.ts#L8](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/common/store/sourcerer/model.ts#L8) | - |
| | [model.ts#L30](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/common/store/sourcerer/model.ts#L30) | - |
| | [index.tsx#L33](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/detections/components/rules/severity_mapping/index.tsx#L33) | - |
@@ -1754,9 +1753,9 @@ warning: This document is auto-generated and is meant to be viewed inside our ex
| | [index.tsx#L242](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/detections/components/rules/risk_score_mapping/index.tsx#L242) | - |
| | [index.tsx#L12](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/detections/components/rules/autocomplete_field/index.tsx#L12) | - |
| | [index.tsx#L35](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/detections/components/rules/autocomplete_field/index.tsx#L35) | - |
-| | [types.ts#L22](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/types.ts#L22) | - |
-| | [types.ts#L72](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/types.ts#L72) | - |
-| | [action.ts#L20](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/action.ts#L20) | - |
+| | [types.ts#L21](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/types.ts#L21) | - |
+| | [types.ts#L66](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/types.ts#L66) | - |
+| | [action.ts#L19](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/action.ts#L19) | - |
| | [action.ts#L100](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/action.ts#L100) | - |
| | [index.ts#L8](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/common/search_strategy/index_fields/index.ts#L8) | - |
| | [index.ts#L86](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/common/search_strategy/index_fields/index.ts#L86) | - |
@@ -1793,9 +1792,9 @@ warning: This document is auto-generated and is meant to be viewed inside our ex
| | [types.ts#L41](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/network/pages/details/types.ts#L41) | - |
| | [index.tsx#L12](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/network/components/network_top_countries_table/index.tsx#L12) | - |
| | [index.tsx#L34](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/network/components/network_top_countries_table/index.tsx#L34) | - |
-| | [middleware.ts#L48](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/middleware.ts#L48) | - |
-| | [middleware.ts#L64](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/middleware.ts#L64) | - |
-| | [middleware.ts#L69](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/middleware.ts#L69) | - |
+| | [middleware.ts#L44](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/middleware.ts#L44) | - |
+| | [middleware.ts#L60](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/middleware.ts#L60) | - |
+| | [middleware.ts#L65](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/middleware.ts#L65) | - |
| | [types.ts#L12](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/detections/components/rules/description_step/types.ts#L12) | - |
| | [types.ts#L28](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/detections/components/rules/description_step/types.ts#L28) | - |
| | [index.tsx#L15](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/detections/components/rules/description_step/index.tsx#L15) | - |
@@ -1850,8 +1849,6 @@ warning: This document is auto-generated and is meant to be viewed inside our ex
| | [use_field_value_autocomplete.ts#L31](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/common/components/autocomplete/hooks/use_field_value_autocomplete.ts#L31) | - |
| | [field_value_match.tsx#L19](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_match.tsx#L19) | - |
| | [field_value_match.tsx#L30](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/common/components/autocomplete/field_value_match.tsx#L30) | - |
-| | [query.ts#L13](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/lib/detection_engine/reference_rules/query.ts#L13) | - |
-| | [query.ts#L52](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/server/lib/detection_engine/reference_rules/query.ts#L52) | - |
| | [model.ts#L8](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/common/store/sourcerer/model.ts#L8) | - |
| | [model.ts#L30](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/common/store/sourcerer/model.ts#L30) | - |
| | [index.tsx#L33](https://github.com/elastic/kibana/tree/master/x-pack/plugins/security_solution/public/detections/components/rules/severity_mapping/index.tsx#L33) | - |
diff --git a/src/plugins/discover/public/application/angular/create_discover_grid_directive.tsx b/src/plugins/discover/public/application/angular/create_discover_grid_directive.tsx
index 1fc8edcb4d065..810be94ce24b0 100644
--- a/src/plugins/discover/public/application/angular/create_discover_grid_directive.tsx
+++ b/src/plugins/discover/public/application/angular/create_discover_grid_directive.tsx
@@ -51,5 +51,6 @@ export function createDiscoverGridDirective(reactDirective: any) {
['settings', { watchDepth: 'reference' }],
['showTimeCol', { watchDepth: 'value' }],
['sort', { watchDepth: 'value' }],
+ ['className', { watchDepth: 'value' }],
]);
}
diff --git a/src/plugins/discover/public/application/angular/doc_table/create_doc_table_embeddable.tsx b/src/plugins/discover/public/application/angular/doc_table/create_doc_table_embeddable.tsx
new file mode 100644
index 0000000000000..19913ed6de870
--- /dev/null
+++ b/src/plugins/discover/public/application/angular/doc_table/create_doc_table_embeddable.tsx
@@ -0,0 +1,85 @@
+/*
+ * 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, { useRef, useEffect } from 'react';
+import { I18nProvider } from '@kbn/i18n/react';
+import { IScope } from 'angular';
+import { getServices } from '../../../kibana_services';
+import { DocTableLegacyProps, injectAngularElement } from './create_doc_table_react';
+
+type AngularEmbeddableScope = IScope & { renderProps?: DocTableEmbeddableProps };
+
+export interface DocTableEmbeddableProps extends Partial {
+ refs: HTMLElement;
+}
+
+function getRenderFn(domNode: Element, props: DocTableEmbeddableProps) {
+ const directive = {
+ template: ``,
+ };
+
+ return async () => {
+ try {
+ const injector = await getServices().getEmbeddableInjector();
+ return await injectAngularElement(domNode, directive.template, props, injector);
+ } catch (e) {
+ // eslint-disable-next-line no-console
+ console.error(e);
+ throw e;
+ }
+ };
+}
+
+export function DiscoverDocTableEmbeddable(props: DocTableEmbeddableProps) {
+ return (
+
+
+
+ );
+}
+
+function DocTableLegacyInner(renderProps: DocTableEmbeddableProps) {
+ const scope = useRef();
+
+ useEffect(() => {
+ if (renderProps.refs && !scope.current) {
+ const fn = getRenderFn(renderProps.refs, renderProps);
+ fn().then((newScope) => {
+ scope.current = newScope;
+ });
+ } else if (scope?.current) {
+ scope.current.renderProps = { ...renderProps };
+ scope.current.$applyAsync();
+ }
+ }, [renderProps]);
+
+ useEffect(() => {
+ return () => {
+ scope.current?.$destroy();
+ };
+ }, []);
+ return ;
+}
diff --git a/src/plugins/discover/public/application/angular/doc_table/index.ts b/src/plugins/discover/public/application/angular/doc_table/index.ts
index 2aaf5a8bda7b6..3a8f170f8680d 100644
--- a/src/plugins/discover/public/application/angular/doc_table/index.ts
+++ b/src/plugins/discover/public/application/angular/doc_table/index.ts
@@ -9,3 +9,4 @@
export { createDocTableDirective } from './doc_table';
export { getSort, getSortArray } from './lib/get_sort';
export { getSortForSearchSource } from './lib/get_sort_for_search_source';
+export { getDefaultSort } from './lib/get_default_sort';
diff --git a/src/plugins/discover/public/application/components/discover_grid/discover_grid.tsx b/src/plugins/discover/public/application/components/discover_grid/discover_grid.tsx
index 65a6ee80564e9..f1c56b7a57195 100644
--- a/src/plugins/discover/public/application/components/discover_grid/discover_grid.tsx
+++ b/src/plugins/discover/public/application/components/discover_grid/discover_grid.tsx
@@ -51,6 +51,10 @@ export interface DiscoverGridProps {
* Determines which element labels the grid for ARIA
*/
ariaLabelledBy: string;
+ /**
+ * Optional class name to apply
+ */
+ className?: string;
/**
* Determines which columns are displayed
*/
@@ -175,6 +179,7 @@ export const DiscoverGrid = ({
isSortEnabled = true,
isPaginationEnabled = true,
controlColumnIds = ['openDetails', 'select'],
+ className,
}: DiscoverGridProps) => {
const [selectedDocs, setSelectedDocs] = useState([]);
const [isFilterActive, setIsFilterActive] = useState(false);
@@ -284,6 +289,7 @@ export const DiscoverGrid = ({
),
[displayedColumns, indexPattern, showTimeCol, settings, defaultColumns, isSortEnabled]
);
+
const schemaDetectors = useMemo(() => getSchemaDetectors(), []);
const columnsVisibility = useMemo(
() => ({
@@ -368,6 +374,7 @@ export const DiscoverGrid = ({
data-title={searchTitle}
data-description={searchDescription}
data-document-number={displayedRows.length}
+ className={className}
>
{
settings?: DiscoverGridSettings;
description?: string;
- sort?: SortOrder[];
sharedItemTitle?: string;
inspectorAdapters?: Adapters;
- setSortOrder?: (sortPair: SortOrder[]) => void;
- setColumns?: (columns: string[]) => void;
- removeColumn?: (column: string) => void;
- addColumn?: (column: string) => void;
- moveColumn?: (column: string, index: number) => void;
+
filter?: (field: IFieldType, value: string[], operator: string) => void;
hits?: ElasticSearchHit[];
- indexPattern?: IndexPattern;
totalHitCount?: number;
- isLoading?: boolean;
- showTimeCol?: boolean;
- useNewFieldsApi?: boolean;
+ onMoveColumn?: (column: string, index: number) => void;
}
interface SearchEmbeddableConfig {
- $rootScope: ng.IRootScopeService;
- $compile: ng.ICompileService;
savedSearch: SavedSearch;
editUrl: string;
editPath: string;
@@ -77,17 +66,13 @@ interface SearchEmbeddableConfig {
services: DiscoverServices;
}
-export class SearchEmbeddable
+export class SavedSearchEmbeddable
extends Embeddable
implements ISearchEmbeddable {
private readonly savedSearch: SavedSearch;
- private $rootScope: ng.IRootScopeService;
- private $compile: ng.ICompileService;
private inspectorAdapters: Adapters;
- private searchScope?: SearchScope;
private panelTitle: string = '';
- private filtersSearchSource?: ISearchSource;
- private searchInstance?: JQLite;
+ private filtersSearchSource!: ISearchSource;
private subscription?: Subscription;
public readonly type = SEARCH_EMBEDDABLE_TYPE;
private filterManager: FilterManager;
@@ -98,11 +83,12 @@ export class SearchEmbeddable
private prevFilters?: Filter[];
private prevQuery?: Query;
private prevSearchSessionId?: string;
+ private searchProps?: SearchProps;
+
+ private node?: HTMLElement;
constructor(
{
- $rootScope,
- $compile,
savedSearch,
editUrl,
editPath,
@@ -130,164 +116,24 @@ export class SearchEmbeddable
this.services = services;
this.filterManager = filterManager;
this.savedSearch = savedSearch;
- this.$rootScope = $rootScope;
- this.$compile = $compile;
this.inspectorAdapters = {
requests: new RequestAdapter(),
};
- this.initializeSearchScope();
+ this.initializeSearchEmbeddableProps();
this.subscription = this.getUpdated$().subscribe(() => {
this.panelTitle = this.output.title || '';
- if (this.searchScope) {
- this.pushContainerStateParamsToScope(this.searchScope);
+ if (this.searchProps) {
+ this.pushContainerStateParamsToProps(this.searchProps);
}
});
}
- public getInspectorAdapters() {
- return this.inspectorAdapters;
- }
-
- public getSavedSearch() {
- return this.savedSearch;
- }
-
- /**
- *
- * @param {Element} domNode
- */
- public render(domNode: HTMLElement) {
- if (!this.searchScope) {
- throw new Error('Search scope not defined');
- }
- this.searchInstance = this.$compile(
- this.services.uiSettings.get('doc_table:legacy') ? searchTemplate : searchTemplateGrid
- )(this.searchScope);
- const rootNode = angular.element(domNode);
- rootNode.append(this.searchInstance);
-
- this.pushContainerStateParamsToScope(this.searchScope);
- }
-
- public destroy() {
- super.destroy();
- this.savedSearch.destroy();
- if (this.searchInstance) {
- this.searchInstance.remove();
- }
- if (this.searchScope) {
- this.searchScope.$destroy();
- delete this.searchScope;
- }
- if (this.subscription) {
- this.subscription.unsubscribe();
- }
-
- if (this.abortController) this.abortController.abort();
- }
-
- private initializeSearchScope() {
- const searchScope: SearchScope = (this.searchScope = this.$rootScope.$new());
-
- searchScope.description = this.savedSearch.description;
- searchScope.inspectorAdapters = this.inspectorAdapters;
-
- const { searchSource } = this.savedSearch;
- const indexPattern = (searchScope.indexPattern = searchSource.getField('index'))!;
-
- if (!this.savedSearch.sort || !this.savedSearch.sort.length) {
- this.savedSearch.sort = getDefaultSort(
- indexPattern,
- getServices().uiSettings.get(SORT_DEFAULT_ORDER_SETTING, 'desc')
- );
- }
-
- const timeRangeSearchSource = searchSource.create();
- timeRangeSearchSource.setField('filter', () => {
- if (!this.searchScope || !this.input.timeRange) return;
- return this.services.timefilter.createFilter(indexPattern, this.input.timeRange);
- });
-
- this.filtersSearchSource = searchSource.create();
- this.filtersSearchSource.setParent(timeRangeSearchSource);
-
- searchSource.setParent(this.filtersSearchSource);
-
- this.pushContainerStateParamsToScope(searchScope);
-
- searchScope.setSortOrder = (sort) => {
- this.updateInput({ sort });
- };
-
- searchScope.isLoading = true;
-
- const useNewFieldsApi = !getServices().uiSettings.get(SEARCH_FIELDS_FROM_SOURCE, false);
- searchScope.useNewFieldsApi = useNewFieldsApi;
-
- searchScope.addColumn = (columnName: string) => {
- if (!searchScope.columns) {
- return;
- }
- const columns = columnActions.addColumn(searchScope.columns, columnName, useNewFieldsApi);
- this.updateInput({ columns });
- };
-
- searchScope.removeColumn = (columnName: string) => {
- if (!searchScope.columns) {
- return;
- }
- const columns = columnActions.removeColumn(searchScope.columns, columnName, useNewFieldsApi);
- this.updateInput({ columns });
- };
-
- searchScope.moveColumn = (columnName, newIndex: number) => {
- if (!searchScope.columns) {
- return;
- }
- const columns = columnActions.moveColumn(searchScope.columns, columnName, newIndex);
- this.updateInput({ columns });
- };
-
- searchScope.setColumns = (columns: string[]) => {
- this.updateInput({ columns });
- };
-
- if (this.savedSearch.grid) {
- searchScope.settings = this.savedSearch.grid;
- }
- searchScope.showTimeCol = !this.services.uiSettings.get(DOC_HIDE_TIME_COLUMN_SETTING, false);
-
- searchScope.filter = async (field, value, operator) => {
- let filters = esFilters.generateFilters(
- this.filterManager,
- field,
- value,
- operator,
- indexPattern.id!
- );
- filters = filters.map((filter) => ({
- ...filter,
- $state: { store: esFilters.FilterStateStore.APP_STATE },
- }));
-
- await this.executeTriggerActions(APPLY_FILTER_TRIGGER, {
- embeddable: this,
- filters,
- });
- };
- }
-
- public reload() {
- if (this.searchScope)
- this.pushContainerStateParamsToScope(this.searchScope, { forceFetch: true });
- }
-
private fetch = async () => {
const searchSessionId = this.input.searchSessionId;
const useNewFieldsApi = !this.services.uiSettings.get(SEARCH_FIELDS_FROM_SOURCE, false);
- if (!this.searchScope) return;
+ if (!this.searchProps) return;
const { searchSource } = this.savedSearch;
@@ -299,8 +145,8 @@ export class SearchEmbeddable
searchSource.setField(
'sort',
getSortForSearchSource(
- this.searchScope.sort,
- this.searchScope.indexPattern,
+ this.searchProps!.sort,
+ this.searchProps!.indexPattern,
this.services.uiSettings.get(SORT_DEFAULT_ORDER_SETTING)
)
);
@@ -310,8 +156,8 @@ export class SearchEmbeddable
searchSource.setField('fields', [fields]);
} else {
searchSource.removeField('fields');
- if (this.searchScope.indexPattern) {
- const fieldNames = this.searchScope.indexPattern.fields.map((field) => field.name);
+ if (this.searchProps.indexPattern) {
+ const fieldNames = this.searchProps.indexPattern.fields.map((field) => field.name);
searchSource.setField('fieldsFromSource', fieldNames);
}
}
@@ -319,9 +165,8 @@ export class SearchEmbeddable
// Log request to inspector
this.inspectorAdapters.requests!.reset();
- this.searchScope.$apply(() => {
- this.searchScope!.isLoading = true;
- });
+ this.searchProps!.isLoading = true;
+
this.updateOutput({ loading: true, error: undefined });
try {
@@ -344,64 +189,222 @@ export class SearchEmbeddable
.toPromise();
this.updateOutput({ loading: false, error: undefined });
- // Apply the changes to the angular scope
- this.searchScope.$apply(() => {
- this.searchScope!.hits = resp.hits.hits;
- this.searchScope!.totalHitCount = resp.hits.total as number;
- this.searchScope!.isLoading = false;
- });
+ this.searchProps!.rows = resp.hits.hits;
+ this.searchProps!.totalHitCount = resp.hits.total as number;
+ this.searchProps!.isLoading = false;
} catch (error) {
this.updateOutput({ loading: false, error });
- this.searchScope.$apply(() => {
- this.searchScope!.isLoading = false;
- });
+
+ this.searchProps!.isLoading = false;
}
};
- private pushContainerStateParamsToScope(
- searchScope: SearchScope,
+ private initializeSearchEmbeddableProps() {
+ const { searchSource } = this.savedSearch;
+
+ const indexPattern = searchSource.getField('index');
+
+ if (!indexPattern) {
+ return;
+ }
+
+ if (!this.savedSearch.sort || !this.savedSearch.sort.length) {
+ this.savedSearch.sort = getDefaultSort(
+ indexPattern,
+ getServices().uiSettings.get(SORT_DEFAULT_ORDER_SETTING, 'desc')
+ );
+ }
+
+ const props: SearchProps = {
+ columns: this.savedSearch.columns,
+ indexPattern,
+ isLoading: false,
+ sort: getDefaultSort(
+ indexPattern,
+ getServices().uiSettings.get(SORT_DEFAULT_ORDER_SETTING, 'desc')
+ ),
+ rows: [],
+ searchDescription: this.savedSearch.description,
+ description: this.savedSearch.description,
+ inspectorAdapters: this.inspectorAdapters,
+ searchTitle: this.savedSearch.lastSavedTitle,
+ services: this.services,
+ onAddColumn: (columnName: string) => {
+ if (!props.columns) {
+ return;
+ }
+ const updatedColumns = columnActions.addColumn(props.columns, columnName, true);
+ this.updateInput({ columns: updatedColumns });
+ },
+ onRemoveColumn: (columnName: string) => {
+ if (!props.columns) {
+ return;
+ }
+ const updatedColumns = columnActions.removeColumn(props.columns, columnName, true);
+ this.updateInput({ columns: updatedColumns });
+ },
+ onMoveColumn: (columnName: string, newIndex: number) => {
+ if (!props.columns) {
+ return;
+ }
+ const columns = columnActions.moveColumn(props.columns, columnName, newIndex);
+ this.updateInput({ columns });
+ },
+ onSetColumns: (columns: string[]) => {
+ this.updateInput({ columns });
+ },
+ onSort: (sort: string[][]) => {
+ const sortOrderArr: SortOrder[] = [];
+ sort.forEach((arr) => {
+ sortOrderArr.push(arr as SortOrder);
+ });
+ this.updateInput({ sort: sortOrderArr });
+ },
+ sampleSize: 500,
+ onFilter: async (field, value, operator) => {
+ let filters = esFilters.generateFilters(
+ this.filterManager,
+ // @ts-expect-error
+ field,
+ value,
+ operator,
+ indexPattern.id!
+ );
+ filters = filters.map((filter) => ({
+ ...filter,
+ $state: { store: esFilters.FilterStateStore.APP_STATE },
+ }));
+
+ await this.executeTriggerActions(APPLY_FILTER_TRIGGER, {
+ embeddable: this,
+ filters,
+ });
+ },
+ useNewFieldsApi: !this.services.uiSettings.get(SEARCH_FIELDS_FROM_SOURCE, false),
+ showTimeCol: !this.services.uiSettings.get(DOC_HIDE_TIME_COLUMN_SETTING, false),
+ ariaLabelledBy: 'documentsAriaLabel',
+ };
+
+ const timeRangeSearchSource = searchSource.create();
+ timeRangeSearchSource.setField('filter', () => {
+ if (!this.searchProps || !this.input.timeRange) return;
+ return this.services.timefilter.createFilter(indexPattern, this.input.timeRange);
+ });
+
+ this.filtersSearchSource = searchSource.create();
+ this.filtersSearchSource.setParent(timeRangeSearchSource);
+
+ searchSource.setParent(this.filtersSearchSource);
+
+ this.pushContainerStateParamsToProps(props);
+
+ props.isLoading = true;
+
+ if (this.savedSearch.grid) {
+ props.settings = this.savedSearch.grid;
+ }
+ }
+
+ private async pushContainerStateParamsToProps(
+ searchProps: SearchProps,
{ forceFetch = false }: { forceFetch: boolean } = { forceFetch: false }
) {
const isFetchRequired =
!esFilters.onlyDisabledFiltersChanged(this.input.filters, this.prevFilters) ||
- !_.isEqual(this.prevQuery, this.input.query) ||
- !_.isEqual(this.prevTimeRange, this.input.timeRange) ||
- !_.isEqual(searchScope.sort, this.input.sort || this.savedSearch.sort) ||
+ !isEqual(this.prevQuery, this.input.query) ||
+ !isEqual(this.prevTimeRange, this.input.timeRange) ||
+ !isEqual(searchProps.sort, this.input.sort || this.savedSearch.sort) ||
this.prevSearchSessionId !== this.input.searchSessionId;
// If there is column or sort data on the panel, that means the original columns or sort settings have
// been overridden in a dashboard.
- searchScope.columns = handleSourceColumnState(
+ searchProps.columns = handleSourceColumnState(
{ columns: this.input.columns || this.savedSearch.columns },
this.services.core.uiSettings
).columns;
+
const savedSearchSort =
this.savedSearch.sort && this.savedSearch.sort.length
? this.savedSearch.sort
: getDefaultSort(
- this.searchScope?.indexPattern,
+ this.searchProps?.indexPattern,
getServices().uiSettings.get(SORT_DEFAULT_ORDER_SETTING, 'desc')
);
- searchScope.sort = this.input.sort || savedSearchSort;
- searchScope.sharedItemTitle = this.panelTitle;
-
+ searchProps.sort = this.input.sort || savedSearchSort;
+ searchProps.sharedItemTitle = this.panelTitle;
if (forceFetch || isFetchRequired) {
- this.filtersSearchSource!.setField('filter', this.input.filters);
- this.filtersSearchSource!.setField('query', this.input.query);
+ this.filtersSearchSource.setField('filter', this.input.filters);
+ this.filtersSearchSource.setField('query', this.input.query);
if (this.input.query?.query || this.input.filters?.length) {
- this.filtersSearchSource!.setField('highlightAll', true);
+ this.filtersSearchSource.setField('highlightAll', true);
} else {
- this.filtersSearchSource!.removeField('highlightAll');
+ this.filtersSearchSource.removeField('highlightAll');
}
this.prevFilters = this.input.filters;
this.prevQuery = this.input.query;
this.prevTimeRange = this.input.timeRange;
this.prevSearchSessionId = this.input.searchSessionId;
- this.fetch();
- } else if (this.searchScope) {
- // trigger a digest cycle to make sure non-fetch relevant changes are propagated
- this.searchScope.$applyAsync();
+ this.searchProps = searchProps;
+ await this.fetch();
+ } else if (this.searchProps && this.node) {
+ this.searchProps = searchProps;
+ }
+
+ if (this.node) {
+ this.renderReactComponent(this.node, this.searchProps!);
+ }
+ }
+
+ /**
+ *
+ * @param {Element} domNode
+ */
+ public async render(domNode: HTMLElement) {
+ if (!this.searchProps) {
+ throw new Error('Search props not defined');
+ }
+ if (this.node) {
+ ReactDOM.unmountComponentAtNode(this.node);
+ }
+ this.node = domNode;
+ }
+
+ private renderReactComponent(domNode: HTMLElement, searchProps: SearchProps) {
+ if (!this.searchProps) {
+ return;
+ }
+ const useLegacyTable = this.services.uiSettings.get(DOC_TABLE_LEGACY);
+ const props = {
+ searchProps,
+ useLegacyTable,
+ refs: domNode,
+ };
+ ReactDOM.render(, domNode);
+ }
+
+ public reload() {
+ if (this.searchProps) {
+ this.pushContainerStateParamsToProps(this.searchProps, { forceFetch: true });
}
}
+
+ public getSavedSearch(): SavedSearch {
+ return this.savedSearch;
+ }
+
+ public getInspectorAdapters() {
+ return this.inspectorAdapters;
+ }
+
+ public destroy() {
+ super.destroy();
+ this.savedSearch.destroy();
+ if (this.searchProps) {
+ delete this.searchProps;
+ }
+ this.subscription?.unsubscribe();
+
+ if (this.abortController) this.abortController.abort();
+ }
}
diff --git a/src/plugins/discover/public/application/embeddable/saved_search_embeddable_component.tsx b/src/plugins/discover/public/application/embeddable/saved_search_embeddable_component.tsx
new file mode 100644
index 0000000000000..5b2a2635d04bd
--- /dev/null
+++ b/src/plugins/discover/public/application/embeddable/saved_search_embeddable_component.tsx
@@ -0,0 +1,39 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 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 { DiscoverGridEmbeddable } from '../angular/create_discover_grid_directive';
+import { DiscoverDocTableEmbeddable } from '../angular/doc_table/create_doc_table_embeddable';
+import { DiscoverGridProps } from '../components/discover_grid/discover_grid';
+import { SearchProps } from './saved_search_embeddable';
+
+interface SavedSearchEmbeddableComponentProps {
+ searchProps: SearchProps;
+ useLegacyTable: boolean;
+ refs: HTMLElement;
+}
+
+const DiscoverDocTableEmbeddableMemoized = React.memo(DiscoverDocTableEmbeddable);
+const DiscoverGridEmbeddableMemoized = React.memo(DiscoverGridEmbeddable);
+
+export function SavedSearchEmbeddableComponent({
+ searchProps,
+ useLegacyTable,
+ refs,
+}: SavedSearchEmbeddableComponentProps) {
+ if (useLegacyTable) {
+ const docTableProps = {
+ ...searchProps,
+ refs,
+ };
+ return ;
+ }
+ const discoverGridProps = searchProps as DiscoverGridProps;
+ return ;
+}
diff --git a/src/plugins/discover/public/application/embeddable/search_embeddable_factory.ts b/src/plugins/discover/public/application/embeddable/search_embeddable_factory.ts
index 77da138d118dd..360844976284e 100644
--- a/src/plugins/discover/public/application/embeddable/search_embeddable_factory.ts
+++ b/src/plugins/discover/public/application/embeddable/search_embeddable_factory.ts
@@ -18,8 +18,9 @@ import {
import { TimeRange } from '../../../../data/public';
-import { SearchInput, SearchOutput, SearchEmbeddable } from './types';
+import { SearchInput, SearchOutput } from './types';
import { SEARCH_EMBEDDABLE_TYPE } from './constants';
+import { SavedSearchEmbeddable } from './saved_search_embeddable';
interface StartServices {
executeTriggerActions: UiActionsStart['executeTriggerActions'];
@@ -27,7 +28,7 @@ interface StartServices {
}
export class SearchEmbeddableFactory
- implements EmbeddableFactoryDefinition {
+ implements EmbeddableFactoryDefinition {
public readonly type = SEARCH_EMBEDDABLE_TYPE;
private $injector: auto.IInjectorService | null;
private getInjector: () => Promise | null;
@@ -65,14 +66,11 @@ export class SearchEmbeddableFactory
savedObjectId: string,
input: Partial & { id: string; timeRange: TimeRange },
parent?: Container
- ): Promise => {
+ ): Promise => {
if (!this.$injector) {
this.$injector = await this.getInjector();
}
- const $injector = this.$injector as auto.IInjectorService;
- const $compile = $injector.get('$compile');
- const $rootScope = $injector.get('$rootScope');
const filterManager = getServices().filterManager;
const url = await getServices().getSavedSearchUrlById(savedObjectId);
@@ -81,12 +79,12 @@ export class SearchEmbeddableFactory
const savedObject = await getServices().getSavedSearchById(savedObjectId);
const indexPattern = savedObject.searchSource.getField('index');
const { executeTriggerActions } = await this.getStartServices();
- const { SearchEmbeddable: SearchEmbeddableClass } = await import('./search_embeddable');
- return new SearchEmbeddableClass(
+ const { SavedSearchEmbeddable: SavedSearchEmbeddableClass } = await import(
+ './saved_search_embeddable'
+ );
+ return new SavedSearchEmbeddableClass(
{
savedSearch: savedObject,
- $rootScope,
- $compile,
editUrl,
editPath: url,
filterManager,
diff --git a/src/plugins/discover/public/application/embeddable/search_template.html b/src/plugins/discover/public/application/embeddable/search_template.html
deleted file mode 100644
index 3e37b3645650f..0000000000000
--- a/src/plugins/discover/public/application/embeddable/search_template.html
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
diff --git a/src/plugins/discover/public/application/embeddable/search_template_datagrid.html b/src/plugins/discover/public/application/embeddable/search_template_datagrid.html
deleted file mode 100644
index 8ad7938350d9c..0000000000000
--- a/src/plugins/discover/public/application/embeddable/search_template_datagrid.html
+++ /dev/null
@@ -1,19 +0,0 @@
-