diff --git a/.buildkite/scripts/common/env.sh b/.buildkite/scripts/common/env.sh index 0715b07fd58e..b5acfe140df2 100755 --- a/.buildkite/scripts/common/env.sh +++ b/.buildkite/scripts/common/env.sh @@ -38,8 +38,10 @@ export ELASTIC_APM_TRANSACTION_SAMPLE_RATE=0.1 if is_pr; then if [[ "${GITHUB_PR_LABELS:-}" == *"ci:collect-apm"* ]]; then export ELASTIC_APM_ACTIVE=true + export ELASTIC_APM_CONTEXT_PROPAGATION_ONLY=false else - export ELASTIC_APM_ACTIVE=false + export ELASTIC_APM_ACTIVE=true + export ELASTIC_APM_CONTEXT_PROPAGATION_ONLY=true fi if [[ "${GITHUB_STEP_COMMIT_STATUS_ENABLED:-}" != "true" ]]; then @@ -61,6 +63,7 @@ if is_pr; then export PR_TARGET_BRANCH="$GITHUB_PR_TARGET_BRANCH" else export ELASTIC_APM_ACTIVE=true + export ELASTIC_APM_CONTEXT_PROPAGATION_ONLY=false export CHECKS_REPORTER_ACTIVE=false fi diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index d532d4b681c7..d5c569ac9d55 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -59,6 +59,7 @@ /examples/url_generators_explorer/ @elastic/kibana-app-services /examples/field_formats_example/ @elastic/kibana-app-services /examples/partial_results_example/ @elastic/kibana-app-services +/examples/search_examples/ @elastic/kibana-app-services /packages/elastic-datemath/ @elastic/kibana-app-services /packages/kbn-interpreter/ @elastic/kibana-app-services /packages/kbn-react-field/ @elastic/kibana-app-services @@ -78,24 +79,33 @@ /src/plugins/ui_actions/ @elastic/kibana-app-services /src/plugins/index_pattern_field_editor @elastic/kibana-app-services /src/plugins/screenshot_mode @elastic/kibana-app-services +/src/plugins/bfetch/ @elastic/kibana-app-services +/src/plugins/index_pattern_management/ @elastic/kibana-app-services +/src/plugins/inspector/ @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 /x-pack/plugins/ui_actions_enhanced/ @elastic/kibana-app-services /x-pack/plugins/runtime_fields @elastic/kibana-app-services /x-pack/test/search_sessions_integration/ @elastic/kibana-app-services -#CC# /src/plugins/bfetch/ @elastic/kibana-app-services -#CC# /src/plugins/index_pattern_management/ @elastic/kibana-app-services -#CC# /src/plugins/inspector/ @elastic/kibana-app-services -#CC# /src/plugins/share/ @elastic/kibana-app-services -#CC# /x-pack/plugins/drilldowns/ @elastic/kibana-app-services -#CC# /packages/kbn-interpreter/ @elastic/kibana-app-services ### Observability Plugins # Observability Shared /x-pack/plugins/observability/ @elastic/observability-ui +# Unified Observability +/x-pack/plugins/observability/public/pages/overview @elastic/unified-observability +/x-pack/plugins/observability/public/pages/home @elastic/unified-observability +/x-pack/plugins/observability/public/pages/landing @elastic/unified-observability +/x-pack/plugins/observability/public/context @elastic/unified-observability + +# Actionable Observability +/x-pack/plugins/observability/common/rules @elastic/actionable-observability +/x-pack/plugins/observability/public/rules @elastic/actionable-observability +/x-pack/plugins/observability/public/pages/alerts @elastic/actionable-observability +/x-pack/plugins/observability/public/pages/cases @elastic/actionable-observability + # Infra Monitoring /x-pack/plugins/infra/ @elastic/infra-monitoring-ui /x-pack/test/functional/apps/infra @elastic/infra-monitoring-ui diff --git a/api_docs/apm.json b/api_docs/apm.json index a97e5428b2b8..2fd290d8b9c3 100644 --- a/api_docs/apm.json +++ b/api_docs/apm.json @@ -737,7 +737,7 @@ "label": "APIEndpoint", "description": [], "signature": [ - "\"POST /internal/apm/data_view/static\" | \"GET /internal/apm/data_view/dynamic\" | \"GET /internal/apm/environments\" | \"GET /internal/apm/services/{serviceName}/errors\" | \"GET /internal/apm/services/{serviceName}/errors/{groupId}\" | \"GET /internal/apm/services/{serviceName}/errors/distribution\" | \"POST /internal/apm/latency/overall_distribution\" | \"GET /internal/apm/services/{serviceName}/metrics/charts\" | \"GET /internal/apm/observability_overview\" | \"GET /internal/apm/observability_overview/has_data\" | \"GET /api/apm/rum/client-metrics\" | \"GET /api/apm/rum-client/page-load-distribution\" | \"GET /api/apm/rum-client/page-load-distribution/breakdown\" | \"GET /api/apm/rum-client/page-view-trends\" | \"GET /api/apm/rum-client/services\" | \"GET /api/apm/rum-client/visitor-breakdown\" | \"GET /api/apm/rum-client/web-core-vitals\" | \"GET /api/apm/rum-client/long-task-metrics\" | \"GET /api/apm/rum-client/url-search\" | \"GET /api/apm/rum-client/js-errors\" | \"GET /api/apm/observability_overview/has_rum_data\" | \"GET /internal/apm/service-map\" | \"GET /internal/apm/service-map/service/{serviceName}\" | \"GET /internal/apm/service-map/backend\" | \"GET /internal/apm/services/{serviceName}/serviceNodes\" | \"GET /internal/apm/services\" | \"GET /internal/apm/services/detailed_statistics\" | \"GET /internal/apm/services/{serviceName}/metadata/details\" | \"GET /internal/apm/services/{serviceName}/metadata/icons\" | \"GET /internal/apm/services/{serviceName}/agent\" | \"GET /internal/apm/services/{serviceName}/transaction_types\" | \"GET /internal/apm/services/{serviceName}/node/{serviceNodeName}/metadata\" | \"GET /api/apm/services/{serviceName}/annotation/search\" | \"POST /api/apm/services/{serviceName}/annotation\" | \"GET /internal/apm/services/{serviceName}/error_groups/main_statistics\" | \"GET /internal/apm/services/{serviceName}/error_groups/detailed_statistics\" | \"GET /internal/apm/services/{serviceName}/service_overview_instances/details/{serviceNodeName}\" | \"GET /internal/apm/services/{serviceName}/throughput\" | \"GET /internal/apm/services/{serviceName}/service_overview_instances/main_statistics\" | \"GET /internal/apm/services/{serviceName}/service_overview_instances/detailed_statistics\" | \"GET /internal/apm/services/{serviceName}/dependencies\" | \"GET /internal/apm/services/{serviceName}/dependencies/breakdown\" | \"GET /internal/apm/services/{serviceName}/profiling/timeline\" | \"GET /internal/apm/services/{serviceName}/profiling/statistics\" | \"GET /internal/apm/services/{serviceName}/alerts\" | \"GET /internal/apm/services/{serviceName}/infrastructure\" | \"GET /internal/apm/suggestions\" | \"GET /internal/apm/traces/{traceId}\" | \"GET /internal/apm/traces\" | \"GET /internal/apm/traces/{traceId}/root_transaction\" | \"GET /internal/apm/transactions/{transactionId}\" | \"GET /internal/apm/services/{serviceName}/transactions/groups/main_statistics\" | \"GET /internal/apm/services/{serviceName}/transactions/groups/detailed_statistics\" | \"GET /internal/apm/services/{serviceName}/transactions/charts/latency\" | \"GET /internal/apm/services/{serviceName}/transactions/traces/samples\" | \"GET /internal/apm/services/{serviceName}/transaction/charts/breakdown\" | \"GET /internal/apm/services/{serviceName}/transactions/charts/error_rate\" | \"GET /internal/apm/alerts/chart_preview/transaction_error_rate\" | \"GET /internal/apm/alerts/chart_preview/transaction_duration\" | \"GET /internal/apm/alerts/chart_preview/transaction_error_count\" | \"GET /api/apm/settings/agent-configuration\" | \"GET /api/apm/settings/agent-configuration/view\" | \"DELETE /api/apm/settings/agent-configuration\" | \"PUT /api/apm/settings/agent-configuration\" | \"POST /api/apm/settings/agent-configuration/search\" | \"GET /api/apm/settings/agent-configuration/services\" | \"GET /api/apm/settings/agent-configuration/environments\" | \"GET /api/apm/settings/agent-configuration/agent_name\" | \"GET /internal/apm/settings/anomaly-detection/jobs\" | \"POST /internal/apm/settings/anomaly-detection/jobs\" | \"GET /internal/apm/settings/anomaly-detection/environments\" | \"GET /internal/apm/settings/apm-index-settings\" | \"GET /internal/apm/settings/apm-indices\" | \"POST /internal/apm/settings/apm-indices/save\" | \"GET /internal/apm/settings/custom_links/transaction\" | \"GET /internal/apm/settings/custom_links\" | \"POST /internal/apm/settings/custom_links\" | \"PUT /internal/apm/settings/custom_links/{id}\" | \"DELETE /internal/apm/settings/custom_links/{id}\" | \"GET /api/apm/sourcemaps\" | \"POST /api/apm/sourcemaps\" | \"DELETE /api/apm/sourcemaps/{id}\" | \"GET /internal/apm/fleet/has_data\" | \"GET /internal/apm/fleet/agents\" | \"POST /api/apm/fleet/apm_server_schema\" | \"GET /internal/apm/fleet/apm_server_schema/unsupported\" | \"GET /internal/apm/fleet/migration_check\" | \"POST /internal/apm/fleet/cloud_apm_package_policy\" | \"GET /internal/apm/backends/top_backends\" | \"GET /internal/apm/backends/upstream_services\" | \"GET /internal/apm/backends/metadata\" | \"GET /internal/apm/backends/charts/latency\" | \"GET /internal/apm/backends/charts/throughput\" | \"GET /internal/apm/backends/charts/error_rate\" | \"GET /internal/apm/fallback_to_transactions\" | \"GET /internal/apm/has_data\" | \"GET /internal/apm/event_metadata/{processorEvent}/{id}\"" + "\"POST /internal/apm/data_view/static\" | \"GET /internal/apm/data_view/dynamic\" | \"GET /internal/apm/environments\" | \"GET /internal/apm/services/{serviceName}/errors\" | \"GET /internal/apm/services/{serviceName}/errors/{groupId}\" | \"GET /internal/apm/services/{serviceName}/errors/distribution\" | \"POST /internal/apm/latency/overall_distribution\" | \"GET /internal/apm/services/{serviceName}/metrics/charts\" | \"GET /internal/apm/observability_overview\" | \"GET /internal/apm/observability_overview/has_data\" | \"GET /internal/apm/ux/client-metrics\" | \"GET /internal/apm/ux/page-load-distribution\" | \"GET /internal/apm/ux/page-load-distribution/breakdown\" | \"GET /internal/apm/ux/page-view-trends\" | \"GET /internal/apm/ux/services\" | \"GET /internal/apm/ux/visitor-breakdown\" | \"GET /internal/apm/ux/web-core-vitals\" | \"GET /internal/apm/ux/long-task-metrics\" | \"GET /internal/apm/ux/url-search\" | \"GET /internal/apm/ux/js-errors\" | \"GET /api/apm/observability_overview/has_rum_data\" | \"GET /internal/apm/service-map\" | \"GET /internal/apm/service-map/service/{serviceName}\" | \"GET /internal/apm/service-map/backend\" | \"GET /internal/apm/services/{serviceName}/serviceNodes\" | \"GET /internal/apm/services\" | \"GET /internal/apm/services/detailed_statistics\" | \"GET /internal/apm/services/{serviceName}/metadata/details\" | \"GET /internal/apm/services/{serviceName}/metadata/icons\" | \"GET /internal/apm/services/{serviceName}/agent\" | \"GET /internal/apm/services/{serviceName}/transaction_types\" | \"GET /internal/apm/services/{serviceName}/node/{serviceNodeName}/metadata\" | \"GET /api/apm/services/{serviceName}/annotation/search\" | \"POST /api/apm/services/{serviceName}/annotation\" | \"GET /internal/apm/services/{serviceName}/error_groups/main_statistics\" | \"GET /internal/apm/services/{serviceName}/error_groups/detailed_statistics\" | \"GET /internal/apm/services/{serviceName}/service_overview_instances/details/{serviceNodeName}\" | \"GET /internal/apm/services/{serviceName}/throughput\" | \"GET /internal/apm/services/{serviceName}/service_overview_instances/main_statistics\" | \"GET /internal/apm/services/{serviceName}/service_overview_instances/detailed_statistics\" | \"GET /internal/apm/services/{serviceName}/dependencies\" | \"GET /internal/apm/services/{serviceName}/dependencies/breakdown\" | \"GET /internal/apm/services/{serviceName}/profiling/timeline\" | \"GET /internal/apm/services/{serviceName}/profiling/statistics\" | \"GET /internal/apm/services/{serviceName}/alerts\" | \"GET /internal/apm/services/{serviceName}/infrastructure\" | \"GET /internal/apm/suggestions\" | \"GET /internal/apm/traces/{traceId}\" | \"GET /internal/apm/traces\" | \"GET /internal/apm/traces/{traceId}/root_transaction\" | \"GET /internal/apm/transactions/{transactionId}\" | \"GET /internal/apm/services/{serviceName}/transactions/groups/main_statistics\" | \"GET /internal/apm/services/{serviceName}/transactions/groups/detailed_statistics\" | \"GET /internal/apm/services/{serviceName}/transactions/charts/latency\" | \"GET /internal/apm/services/{serviceName}/transactions/traces/samples\" | \"GET /internal/apm/services/{serviceName}/transaction/charts/breakdown\" | \"GET /internal/apm/services/{serviceName}/transactions/charts/error_rate\" | \"GET /internal/apm/alerts/chart_preview/transaction_error_rate\" | \"GET /internal/apm/alerts/chart_preview/transaction_duration\" | \"GET /internal/apm/alerts/chart_preview/transaction_error_count\" | \"GET /api/apm/settings/agent-configuration\" | \"GET /api/apm/settings/agent-configuration/view\" | \"DELETE /api/apm/settings/agent-configuration\" | \"PUT /api/apm/settings/agent-configuration\" | \"POST /api/apm/settings/agent-configuration/search\" | \"GET /api/apm/settings/agent-configuration/services\" | \"GET /api/apm/settings/agent-configuration/environments\" | \"GET /api/apm/settings/agent-configuration/agent_name\" | \"GET /internal/apm/settings/anomaly-detection/jobs\" | \"POST /internal/apm/settings/anomaly-detection/jobs\" | \"GET /internal/apm/settings/anomaly-detection/environments\" | \"GET /internal/apm/settings/apm-index-settings\" | \"GET /internal/apm/settings/apm-indices\" | \"POST /internal/apm/settings/apm-indices/save\" | \"GET /internal/apm/settings/custom_links/transaction\" | \"GET /internal/apm/settings/custom_links\" | \"POST /internal/apm/settings/custom_links\" | \"PUT /internal/apm/settings/custom_links/{id}\" | \"DELETE /internal/apm/settings/custom_links/{id}\" | \"GET /api/apm/sourcemaps\" | \"POST /api/apm/sourcemaps\" | \"DELETE /api/apm/sourcemaps/{id}\" | \"GET /internal/apm/fleet/has_data\" | \"GET /internal/apm/fleet/agents\" | \"POST /api/apm/fleet/apm_server_schema\" | \"GET /internal/apm/fleet/apm_server_schema/unsupported\" | \"GET /internal/apm/fleet/migration_check\" | \"POST /internal/apm/fleet/cloud_apm_package_policy\" | \"GET /internal/apm/backends/top_backends\" | \"GET /internal/apm/backends/upstream_services\" | \"GET /internal/apm/backends/metadata\" | \"GET /internal/apm/backends/charts/latency\" | \"GET /internal/apm/backends/charts/throughput\" | \"GET /internal/apm/backends/charts/error_rate\" | \"GET /internal/apm/fallback_to_transactions\" | \"GET /internal/apm/has_data\" | \"GET /internal/apm/event_metadata/{processorEvent}/{id}\"" ], "path": "x-pack/plugins/apm/server/routes/get_global_apm_server_route_repository.ts", "deprecated": false, @@ -1222,7 +1222,7 @@ "section": "def-server.APMRouteHandlerResources", "text": "APMRouteHandlerResources" }, - ", { serviceCount: number; transactionPerMinute: { value: undefined; timeseries: never[]; } | { value: number; timeseries: { x: number; y: number; }[]; }; }, ", + ", { serviceCount: number; transactionPerMinute: { value: undefined; timeseries: never[]; } | { value: number; timeseries: { x: number; y: number | null; }[]; }; }, ", "APMRouteCreateOptions", ">; } & { \"GET /internal/apm/observability_overview/has_data\": ", { @@ -1244,7 +1244,7 @@ "ApmIndicesConfig", "; }, ", "APMRouteCreateOptions", - ">; } & { \"GET /api/apm/rum/client-metrics\": ", + ">; } & { \"GET /internal/apm/ux/client-metrics\": ", { "pluginId": "@kbn/server-route-repository", "scope": "server", @@ -1252,7 +1252,7 @@ "section": "def-server.ServerRoute", "text": "ServerRoute" }, - "<\"GET /api/apm/rum/client-metrics\", ", + "<\"GET /internal/apm/ux/client-metrics\", ", "TypeC", "<{ query: ", "IntersectionC", @@ -1282,7 +1282,7 @@ }, ", { pageViews: { value: number; }; totalPageLoadDuration: { value: number; }; backEnd: { value: number; }; frontEnd: { value: number; }; }, ", "APMRouteCreateOptions", - ">; } & { \"GET /api/apm/rum-client/page-load-distribution\": ", + ">; } & { \"GET /internal/apm/ux/page-load-distribution\": ", { "pluginId": "@kbn/server-route-repository", "scope": "server", @@ -1290,7 +1290,7 @@ "section": "def-server.ServerRoute", "text": "ServerRoute" }, - "<\"GET /api/apm/rum-client/page-load-distribution\", ", + "<\"GET /internal/apm/ux/page-load-distribution\", ", "TypeC", "<{ query: ", "IntersectionC", @@ -1328,7 +1328,7 @@ }, ", { pageLoadDistribution: { pageLoadDistribution: { x: number; y: number; }[]; percentiles: Record | undefined; minDuration: number; maxDuration: number; } | null; }, ", "APMRouteCreateOptions", - ">; } & { \"GET /api/apm/rum-client/page-load-distribution/breakdown\": ", + ">; } & { \"GET /internal/apm/ux/page-load-distribution/breakdown\": ", { "pluginId": "@kbn/server-route-repository", "scope": "server", @@ -1336,7 +1336,7 @@ "section": "def-server.ServerRoute", "text": "ServerRoute" }, - "<\"GET /api/apm/rum-client/page-load-distribution/breakdown\", ", + "<\"GET /internal/apm/ux/page-load-distribution/breakdown\", ", "TypeC", "<{ query: ", "IntersectionC", @@ -1378,7 +1378,7 @@ }, ", { pageLoadDistBreakdown: { name: string; data: { x: number; y: number; }[]; }[] | undefined; }, ", "APMRouteCreateOptions", - ">; } & { \"GET /api/apm/rum-client/page-view-trends\": ", + ">; } & { \"GET /internal/apm/ux/page-view-trends\": ", { "pluginId": "@kbn/server-route-repository", "scope": "server", @@ -1386,7 +1386,7 @@ "section": "def-server.ServerRoute", "text": "ServerRoute" }, - "<\"GET /api/apm/rum-client/page-view-trends\", ", + "<\"GET /internal/apm/ux/page-view-trends\", ", "TypeC", "<{ query: ", "IntersectionC", @@ -1422,7 +1422,7 @@ }, ", { topItems: string[]; items: Record[]; }, ", "APMRouteCreateOptions", - ">; } & { \"GET /api/apm/rum-client/services\": ", + ">; } & { \"GET /internal/apm/ux/services\": ", { "pluginId": "@kbn/server-route-repository", "scope": "server", @@ -1430,7 +1430,7 @@ "section": "def-server.ServerRoute", "text": "ServerRoute" }, - "<\"GET /api/apm/rum-client/services\", ", + "<\"GET /internal/apm/ux/services\", ", "TypeC", "<{ query: ", "IntersectionC", @@ -1454,7 +1454,7 @@ }, ", { rumServices: string[]; }, ", "APMRouteCreateOptions", - ">; } & { \"GET /api/apm/rum-client/visitor-breakdown\": ", + ">; } & { \"GET /internal/apm/ux/visitor-breakdown\": ", { "pluginId": "@kbn/server-route-repository", "scope": "server", @@ -1462,7 +1462,7 @@ "section": "def-server.ServerRoute", "text": "ServerRoute" }, - "<\"GET /api/apm/rum-client/visitor-breakdown\", ", + "<\"GET /internal/apm/ux/visitor-breakdown\", ", "TypeC", "<{ query: ", "IntersectionC", @@ -1492,7 +1492,7 @@ }, ", { os: { count: number; name: string; }[]; browsers: { count: number; name: string; }[]; }, ", "APMRouteCreateOptions", - ">; } & { \"GET /api/apm/rum-client/web-core-vitals\": ", + ">; } & { \"GET /internal/apm/ux/web-core-vitals\": ", { "pluginId": "@kbn/server-route-repository", "scope": "server", @@ -1500,7 +1500,7 @@ "section": "def-server.ServerRoute", "text": "ServerRoute" }, - "<\"GET /api/apm/rum-client/web-core-vitals\", ", + "<\"GET /internal/apm/ux/web-core-vitals\", ", "TypeC", "<{ query: ", "IntersectionC", @@ -1530,7 +1530,7 @@ }, ", { coreVitalPages: number; cls: number | null; fid: number | null | undefined; lcp: number | null | undefined; tbt: number; fcp: number | null | undefined; lcpRanks: number[]; fidRanks: number[]; clsRanks: number[]; }, ", "APMRouteCreateOptions", - ">; } & { \"GET /api/apm/rum-client/long-task-metrics\": ", + ">; } & { \"GET /internal/apm/ux/long-task-metrics\": ", { "pluginId": "@kbn/server-route-repository", "scope": "server", @@ -1538,7 +1538,7 @@ "section": "def-server.ServerRoute", "text": "ServerRoute" }, - "<\"GET /api/apm/rum-client/long-task-metrics\", ", + "<\"GET /internal/apm/ux/long-task-metrics\", ", "TypeC", "<{ query: ", "IntersectionC", @@ -1568,7 +1568,7 @@ }, ", { noOfLongTasks: number; sumOfLongTasks: number; longestLongTask: number; }, ", "APMRouteCreateOptions", - ">; } & { \"GET /api/apm/rum-client/url-search\": ", + ">; } & { \"GET /internal/apm/ux/url-search\": ", { "pluginId": "@kbn/server-route-repository", "scope": "server", @@ -1576,7 +1576,7 @@ "section": "def-server.ServerRoute", "text": "ServerRoute" }, - "<\"GET /api/apm/rum-client/url-search\", ", + "<\"GET /internal/apm/ux/url-search\", ", "TypeC", "<{ query: ", "IntersectionC", @@ -1606,7 +1606,7 @@ }, ", { total: number; items: { url: string; count: number; pld: number; }[]; }, ", "APMRouteCreateOptions", - ">; } & { \"GET /api/apm/rum-client/js-errors\": ", + ">; } & { \"GET /internal/apm/ux/js-errors\": ", { "pluginId": "@kbn/server-route-repository", "scope": "server", @@ -1614,7 +1614,7 @@ "section": "def-server.ServerRoute", "text": "ServerRoute" }, - "<\"GET /api/apm/rum-client/js-errors\", ", + "<\"GET /internal/apm/ux/js-errors\", ", "TypeC", "<{ query: ", "IntersectionC", @@ -2478,7 +2478,7 @@ "section": "def-server.APMRouteHandlerResources", "text": "APMRouteHandlerResources" }, - ", { currentPeriod: { x: number; y: number; }[]; previousPeriod: { x: number; y: number | null | undefined; }[]; }, ", + ", { currentPeriod: { x: number; y: number | null; }[]; previousPeriod: { x: number; y: number | null | undefined; }[]; }, ", "APMRouteCreateOptions", ">; } & { \"GET /internal/apm/services/{serviceName}/service_overview_instances/main_statistics\": ", { @@ -3456,7 +3456,7 @@ "section": "def-server.APMRouteHandlerResources", "text": "APMRouteHandlerResources" }, - ", { noHits: boolean; traceSamples: { transactionId: string; traceId: string; }[]; }, ", + ", { traceSamples: { transactionId: string; traceId: string; }[]; }, ", "APMRouteCreateOptions", ">; } & { \"GET /internal/apm/services/{serviceName}/transaction/charts/breakdown\": ", { @@ -3580,9 +3580,9 @@ "section": "def-server.APMRouteHandlerResources", "text": "APMRouteHandlerResources" }, - ", { currentPeriod: { noHits: boolean; transactionErrorRate: ", + ", { currentPeriod: { timeseries: ", "Coordinate", - "[]; average: number | null; }; previousPeriod: { transactionErrorRate: { x: number; y: number | null | undefined; }[]; noHits: boolean; average: number | null; }; }, ", + "[]; average: number | null; }; previousPeriod: { timeseries: { x: number; y: number | null | undefined; }[]; average: number | null; }; }, ", "APMRouteCreateOptions", ">; } & { \"GET /internal/apm/alerts/chart_preview/transaction_error_rate\": ", { @@ -4832,7 +4832,7 @@ "section": "def-server.APMRouteHandlerResources", "text": "APMRouteHandlerResources" }, - ", { currentTimeseries: { x: number; y: number; }[]; comparisonTimeseries: { x: number; y: number; }[] | null; }, ", + ", { currentTimeseries: { x: number; y: number | null; }[]; comparisonTimeseries: { x: number; y: number | null; }[] | null; }, ", "APMRouteCreateOptions", ">; } & { \"GET /internal/apm/backends/charts/error_rate\": ", { diff --git a/docs/development/core/public/kibana-plugin-core-public.app.deeplinks.md b/docs/development/core/public/kibana-plugin-core-public.app.deeplinks.md index 8186996b63fe..d9f76fb38a55 100644 --- a/docs/development/core/public/kibana-plugin-core-public.app.deeplinks.md +++ b/docs/development/core/public/kibana-plugin-core-public.app.deeplinks.md @@ -44,6 +44,5 @@ core.application.register({ ], mount: () => { ... } }) - ``` diff --git a/docs/development/core/public/kibana-plugin-core-public.app.exactroute.md b/docs/development/core/public/kibana-plugin-core-public.app.exactroute.md index eb050b62c7d4..71f6352ec006 100644 --- a/docs/development/core/public/kibana-plugin-core-public.app.exactroute.md +++ b/docs/development/core/public/kibana-plugin-core-public.app.exactroute.md @@ -25,6 +25,5 @@ core.application.register({ // '[basePath]/app/my_app' will be matched // '[basePath]/app/my_app/some/path' will not be matched - ``` diff --git a/docs/development/core/public/kibana-plugin-core-public.app.md b/docs/development/core/public/kibana-plugin-core-public.app.md index d79a12a83367..7af32efcb9c1 100644 --- a/docs/development/core/public/kibana-plugin-core-public.app.md +++ b/docs/development/core/public/kibana-plugin-core-public.app.md @@ -10,24 +10,25 @@ ```typescript export interface App extends AppNavOptions ``` +Extends: AppNavOptions ## Properties | Property | Type | Description | | --- | --- | --- | -| [appRoute](./kibana-plugin-core-public.app.approute.md) | string | Override the application's routing path from /app/${id}. Must be unique across registered applications. Should not include the base path from HTTP. | -| [capabilities](./kibana-plugin-core-public.app.capabilities.md) | Partial<Capabilities> | Custom capabilities defined by the app. | -| [category](./kibana-plugin-core-public.app.category.md) | AppCategory | The category definition of the product See [AppCategory](./kibana-plugin-core-public.appcategory.md) See DEFAULT\_APP\_CATEGORIES for more reference | -| [chromeless](./kibana-plugin-core-public.app.chromeless.md) | boolean | Hide the UI chrome when the application is mounted. Defaults to false. Takes precedence over chrome service visibility settings. | -| [deepLinks](./kibana-plugin-core-public.app.deeplinks.md) | AppDeepLink[] | Input type for registering secondary in-app locations for an application.Deep links must include at least one of path or deepLinks. A deep link that does not have a path represents a topological level in the application's hierarchy, but does not have a destination URL that is user-accessible. | -| [defaultPath](./kibana-plugin-core-public.app.defaultpath.md) | string | Allow to define the default path a user should be directed to when navigating to the app. When defined, this value will be used as a default for the path option when calling [navigateToApp](./kibana-plugin-core-public.applicationstart.navigatetoapp.md)\`, and will also be appended to the [application navLink](./kibana-plugin-core-public.chromenavlink.md) in the navigation bar. | -| [exactRoute](./kibana-plugin-core-public.app.exactroute.md) | boolean | If set to true, the application's route will only be checked against an exact match. Defaults to false. | -| [id](./kibana-plugin-core-public.app.id.md) | string | The unique identifier of the application | -| [keywords](./kibana-plugin-core-public.app.keywords.md) | string[] | Optional keywords to match with in deep links search. Omit if this part of the hierarchy does not have a page URL. | -| [mount](./kibana-plugin-core-public.app.mount.md) | AppMount<HistoryLocationState> | A mount function called when the user navigates to this app's route. | -| [navLinkStatus](./kibana-plugin-core-public.app.navlinkstatus.md) | AppNavLinkStatus | The initial status of the application's navLink. Defaulting to visible if status is accessible and hidden if status is inaccessible See [AppNavLinkStatus](./kibana-plugin-core-public.appnavlinkstatus.md) | -| [searchable](./kibana-plugin-core-public.app.searchable.md) | boolean | The initial flag to determine if the application is searchable in the global search. Defaulting to true if navLinkStatus is visible or omitted. | -| [status](./kibana-plugin-core-public.app.status.md) | AppStatus | The initial status of the application. Defaulting to accessible | -| [title](./kibana-plugin-core-public.app.title.md) | string | The title of the application. | -| [updater$](./kibana-plugin-core-public.app.updater_.md) | Observable<AppUpdater> | An [AppUpdater](./kibana-plugin-core-public.appupdater.md) observable that can be used to update the application [AppUpdatableFields](./kibana-plugin-core-public.appupdatablefields.md) at runtime. | +| [appRoute?](./kibana-plugin-core-public.app.approute.md) | string | (Optional) Override the application's routing path from /app/${id}. Must be unique across registered applications. Should not include the base path from HTTP. | +| [capabilities?](./kibana-plugin-core-public.app.capabilities.md) | Partial<Capabilities> | (Optional) Custom capabilities defined by the app. | +| [category?](./kibana-plugin-core-public.app.category.md) | AppCategory | (Optional) The category definition of the product See [AppCategory](./kibana-plugin-core-public.appcategory.md) See DEFAULT\_APP\_CATEGORIES for more reference | +| [chromeless?](./kibana-plugin-core-public.app.chromeless.md) | boolean | (Optional) Hide the UI chrome when the application is mounted. Defaults to false. Takes precedence over chrome service visibility settings. | +| [deepLinks?](./kibana-plugin-core-public.app.deeplinks.md) | AppDeepLink\[\] | (Optional) Input type for registering secondary in-app locations for an application.Deep links must include at least one of path or deepLinks. A deep link that does not have a path represents a topological level in the application's hierarchy, but does not have a destination URL that is user-accessible. | +| [defaultPath?](./kibana-plugin-core-public.app.defaultpath.md) | string | (Optional) Allow to define the default path a user should be directed to when navigating to the app. When defined, this value will be used as a default for the path option when calling [navigateToApp](./kibana-plugin-core-public.applicationstart.navigatetoapp.md)\`, and will also be appended to the [application navLink](./kibana-plugin-core-public.chromenavlink.md) in the navigation bar. | +| [exactRoute?](./kibana-plugin-core-public.app.exactroute.md) | boolean | (Optional) If set to true, the application's route will only be checked against an exact match. Defaults to false. | +| [id](./kibana-plugin-core-public.app.id.md) | string | The unique identifier of the application | +| [keywords?](./kibana-plugin-core-public.app.keywords.md) | string\[\] | (Optional) Optional keywords to match with in deep links search. Omit if this part of the hierarchy does not have a page URL. | +| [mount](./kibana-plugin-core-public.app.mount.md) | AppMount<HistoryLocationState> | A mount function called when the user navigates to this app's route. | +| [navLinkStatus?](./kibana-plugin-core-public.app.navlinkstatus.md) | AppNavLinkStatus | (Optional) The initial status of the application's navLink. Defaulting to visible if status is accessible and hidden if status is inaccessible See [AppNavLinkStatus](./kibana-plugin-core-public.appnavlinkstatus.md) | +| [searchable?](./kibana-plugin-core-public.app.searchable.md) | boolean | (Optional) The initial flag to determine if the application is searchable in the global search. Defaulting to true if navLinkStatus is visible or omitted. | +| [status?](./kibana-plugin-core-public.app.status.md) | AppStatus | (Optional) The initial status of the application. Defaulting to accessible | +| [title](./kibana-plugin-core-public.app.title.md) | string | The title of the application. | +| [updater$?](./kibana-plugin-core-public.app.updater_.md) | Observable<AppUpdater> | (Optional) An [AppUpdater](./kibana-plugin-core-public.appupdater.md) observable that can be used to update the application [AppUpdatableFields](./kibana-plugin-core-public.appupdatablefields.md) at runtime. | diff --git a/docs/development/core/public/kibana-plugin-core-public.app.updater_.md b/docs/development/core/public/kibana-plugin-core-public.app.updater_.md index 67acccbd0296..e6789a38f12f 100644 --- a/docs/development/core/public/kibana-plugin-core-public.app.updater_.md +++ b/docs/development/core/public/kibana-plugin-core-public.app.updater_.md @@ -39,6 +39,5 @@ export class MyPlugin implements Plugin { navLinkStatus: AppNavLinkStatus.disabled, }) } - ``` diff --git a/docs/development/core/public/kibana-plugin-core-public.appcategory.md b/docs/development/core/public/kibana-plugin-core-public.appcategory.md index b0ec377e165b..40c714b51b8b 100644 --- a/docs/development/core/public/kibana-plugin-core-public.appcategory.md +++ b/docs/development/core/public/kibana-plugin-core-public.appcategory.md @@ -16,9 +16,9 @@ export interface AppCategory | Property | Type | Description | | --- | --- | --- | -| [ariaLabel](./kibana-plugin-core-public.appcategory.arialabel.md) | string | If the visual label isn't appropriate for screen readers, can override it here | -| [euiIconType](./kibana-plugin-core-public.appcategory.euiicontype.md) | string | Define an icon to be used for the category If the category is only 1 item, and no icon is defined, will default to the product icon Defaults to initials if no icon is defined | -| [id](./kibana-plugin-core-public.appcategory.id.md) | string | Unique identifier for the categories | -| [label](./kibana-plugin-core-public.appcategory.label.md) | string | Label used for category name. Also used as aria-label if one isn't set. | -| [order](./kibana-plugin-core-public.appcategory.order.md) | number | The order that categories will be sorted in Prefer large steps between categories to allow for further editing (Default categories are in steps of 1000) | +| [ariaLabel?](./kibana-plugin-core-public.appcategory.arialabel.md) | string | (Optional) If the visual label isn't appropriate for screen readers, can override it here | +| [euiIconType?](./kibana-plugin-core-public.appcategory.euiicontype.md) | string | (Optional) Define an icon to be used for the category If the category is only 1 item, and no icon is defined, will default to the product icon Defaults to initials if no icon is defined | +| [id](./kibana-plugin-core-public.appcategory.id.md) | string | Unique identifier for the categories | +| [label](./kibana-plugin-core-public.appcategory.label.md) | string | Label used for category name. Also used as aria-label if one isn't set. | +| [order?](./kibana-plugin-core-public.appcategory.order.md) | number | (Optional) The order that categories will be sorted in Prefer large steps between categories to allow for further editing (Default categories are in steps of 1000) | diff --git a/docs/development/core/public/kibana-plugin-core-public.appleaveconfirmaction.md b/docs/development/core/public/kibana-plugin-core-public.appleaveconfirmaction.md index 8650cd986894..e44fe49c27c8 100644 --- a/docs/development/core/public/kibana-plugin-core-public.appleaveconfirmaction.md +++ b/docs/development/core/public/kibana-plugin-core-public.appleaveconfirmaction.md @@ -18,8 +18,8 @@ export interface AppLeaveConfirmAction | Property | Type | Description | | --- | --- | --- | -| [callback](./kibana-plugin-core-public.appleaveconfirmaction.callback.md) | () => void | | -| [text](./kibana-plugin-core-public.appleaveconfirmaction.text.md) | string | | -| [title](./kibana-plugin-core-public.appleaveconfirmaction.title.md) | string | | -| [type](./kibana-plugin-core-public.appleaveconfirmaction.type.md) | AppLeaveActionType.confirm | | +| [callback?](./kibana-plugin-core-public.appleaveconfirmaction.callback.md) | () => void | (Optional) | +| [text](./kibana-plugin-core-public.appleaveconfirmaction.text.md) | string | | +| [title?](./kibana-plugin-core-public.appleaveconfirmaction.title.md) | string | (Optional) | +| [type](./kibana-plugin-core-public.appleaveconfirmaction.type.md) | AppLeaveActionType.confirm | | diff --git a/docs/development/core/public/kibana-plugin-core-public.appleavedefaultaction.md b/docs/development/core/public/kibana-plugin-core-public.appleavedefaultaction.md index f6df1c0516bd..5d0e0d2a216e 100644 --- a/docs/development/core/public/kibana-plugin-core-public.appleavedefaultaction.md +++ b/docs/development/core/public/kibana-plugin-core-public.appleavedefaultaction.md @@ -18,5 +18,5 @@ export interface AppLeaveDefaultAction | Property | Type | Description | | --- | --- | --- | -| [type](./kibana-plugin-core-public.appleavedefaultaction.type.md) | AppLeaveActionType.default | | +| [type](./kibana-plugin-core-public.appleavedefaultaction.type.md) | AppLeaveActionType.default | | diff --git a/docs/development/core/public/kibana-plugin-core-public.applicationsetup.register.md b/docs/development/core/public/kibana-plugin-core-public.applicationsetup.register.md index 6f4ecdc855df..e53b28e88d6e 100644 --- a/docs/development/core/public/kibana-plugin-core-public.applicationsetup.register.md +++ b/docs/development/core/public/kibana-plugin-core-public.applicationsetup.register.md @@ -16,9 +16,9 @@ register(app: App): void; | Parameter | Type | Description | | --- | --- | --- | -| app | App<HistoryLocationState> | an [App](./kibana-plugin-core-public.app.md) | +| app | App<HistoryLocationState> | an [App](./kibana-plugin-core-public.app.md) | Returns: -`void` +void diff --git a/docs/development/core/public/kibana-plugin-core-public.applicationsetup.registerappupdater.md b/docs/development/core/public/kibana-plugin-core-public.applicationsetup.registerappupdater.md index 88800913364f..6e8203fd6819 100644 --- a/docs/development/core/public/kibana-plugin-core-public.applicationsetup.registerappupdater.md +++ b/docs/development/core/public/kibana-plugin-core-public.applicationsetup.registerappupdater.md @@ -18,11 +18,11 @@ registerAppUpdater(appUpdater$: Observable): void; | Parameter | Type | Description | | --- | --- | --- | -| appUpdater$ | Observable<AppUpdater> | | +| appUpdater$ | Observable<AppUpdater> | | Returns: -`void` +void ## Example @@ -42,6 +42,5 @@ export class MyPlugin implements Plugin { ); } } - ``` diff --git a/docs/development/core/public/kibana-plugin-core-public.applicationstart.geturlforapp.md b/docs/development/core/public/kibana-plugin-core-public.applicationstart.geturlforapp.md index 6229aeb9238e..8bc89f617e15 100644 --- a/docs/development/core/public/kibana-plugin-core-public.applicationstart.geturlforapp.md +++ b/docs/development/core/public/kibana-plugin-core-public.applicationstart.geturlforapp.md @@ -24,10 +24,10 @@ getUrlForApp(appId: string, options?: { | Parameter | Type | Description | | --- | --- | --- | -| appId | string | | -| options | {
path?: string;
absolute?: boolean;
deepLinkId?: string;
} | | +| appId | string | | +| options | { path?: string; absolute?: boolean; deepLinkId?: string; } | | Returns: -`string` +string diff --git a/docs/development/core/public/kibana-plugin-core-public.applicationstart.md b/docs/development/core/public/kibana-plugin-core-public.applicationstart.md index 993234d4c6e0..cadf0f91b01d 100644 --- a/docs/development/core/public/kibana-plugin-core-public.applicationstart.md +++ b/docs/development/core/public/kibana-plugin-core-public.applicationstart.md @@ -15,9 +15,9 @@ export interface ApplicationStart | Property | Type | Description | | --- | --- | --- | -| [applications$](./kibana-plugin-core-public.applicationstart.applications_.md) | Observable<ReadonlyMap<string, PublicAppInfo>> | Observable emitting the list of currently registered apps and their associated status. | -| [capabilities](./kibana-plugin-core-public.applicationstart.capabilities.md) | RecursiveReadonly<Capabilities> | Gets the read-only capabilities. | -| [currentAppId$](./kibana-plugin-core-public.applicationstart.currentappid_.md) | Observable<string | undefined> | An observable that emits the current application id and each subsequent id update. | +| [applications$](./kibana-plugin-core-public.applicationstart.applications_.md) | Observable<ReadonlyMap<string, PublicAppInfo>> | Observable emitting the list of currently registered apps and their associated status. | +| [capabilities](./kibana-plugin-core-public.applicationstart.capabilities.md) | RecursiveReadonly<Capabilities> | Gets the read-only capabilities. | +| [currentAppId$](./kibana-plugin-core-public.applicationstart.currentappid_.md) | Observable<string \| undefined> | An observable that emits the current application id and each subsequent id update. | ## Methods diff --git a/docs/development/core/public/kibana-plugin-core-public.applicationstart.navigatetoapp.md b/docs/development/core/public/kibana-plugin-core-public.applicationstart.navigatetoapp.md index e1f08c7b3813..a6f87209148f 100644 --- a/docs/development/core/public/kibana-plugin-core-public.applicationstart.navigatetoapp.md +++ b/docs/development/core/public/kibana-plugin-core-public.applicationstart.navigatetoapp.md @@ -16,10 +16,10 @@ navigateToApp(appId: string, options?: NavigateToAppOptions): Promise; | Parameter | Type | Description | | --- | --- | --- | -| appId | string | | -| options | NavigateToAppOptions | navigation options | +| appId | string | | +| options | NavigateToAppOptions | navigation options | Returns: -`Promise` +Promise<void> diff --git a/docs/development/core/public/kibana-plugin-core-public.applicationstart.navigatetourl.md b/docs/development/core/public/kibana-plugin-core-public.applicationstart.navigatetourl.md index 8639394cbc42..9e6644e2b1ca 100644 --- a/docs/development/core/public/kibana-plugin-core-public.applicationstart.navigatetourl.md +++ b/docs/development/core/public/kibana-plugin-core-public.applicationstart.navigatetourl.md @@ -22,11 +22,11 @@ navigateToUrl(url: string): Promise; | Parameter | Type | Description | | --- | --- | --- | -| url | string | an absolute URL, an absolute path or a relative path, to navigate to. | +| url | string | an absolute URL, an absolute path or a relative path, to navigate to. | Returns: -`Promise` +Promise<void> ## Example @@ -45,6 +45,5 @@ application.navigateToUrl('/app/discover/some-path') // does not include the cur application.navigateToUrl('/base-path/s/my-space/app/unknown-app/some-path') // unknown application application.navigateToUrl('../discover') // resolve to `/base-path/s/my-space/discover` which is not a path of a known app. application.navigateToUrl('../../other-space/discover') // resolve to `/base-path/s/other-space/discover` which is not within the current basePath. - ``` diff --git a/docs/development/core/public/kibana-plugin-core-public.appmountparameters.appbasepath.md b/docs/development/core/public/kibana-plugin-core-public.appmountparameters.appbasepath.md index b9ebcec6fa8e..fd16c78d4cbb 100644 --- a/docs/development/core/public/kibana-plugin-core-public.appmountparameters.appbasepath.md +++ b/docs/development/core/public/kibana-plugin-core-public.appmountparameters.appbasepath.md @@ -35,7 +35,6 @@ export class MyPlugin implements Plugin { }); } } - ``` ```ts @@ -58,6 +57,5 @@ export renderApp = ({ appBasePath, element }: AppMountParameters) => { return () => ReactDOM.unmountComponentAtNode(element); } - ``` diff --git a/docs/development/core/public/kibana-plugin-core-public.appmountparameters.history.md b/docs/development/core/public/kibana-plugin-core-public.appmountparameters.history.md index 84f2c2564bfd..c22267eadbe2 100644 --- a/docs/development/core/public/kibana-plugin-core-public.appmountparameters.history.md +++ b/docs/development/core/public/kibana-plugin-core-public.appmountparameters.history.md @@ -30,7 +30,6 @@ export class MyPlugin implements Plugin { }); } } - ``` ```ts @@ -52,6 +51,5 @@ export renderApp = ({ element, history }: AppMountParameters) => { return () => ReactDOM.unmountComponentAtNode(element); } - ``` diff --git a/docs/development/core/public/kibana-plugin-core-public.appmountparameters.md b/docs/development/core/public/kibana-plugin-core-public.appmountparameters.md index f6c57603bedd..d32faa55a5f8 100644 --- a/docs/development/core/public/kibana-plugin-core-public.appmountparameters.md +++ b/docs/development/core/public/kibana-plugin-core-public.appmountparameters.md @@ -15,9 +15,9 @@ export interface AppMountParameters | Property | Type | Description | | --- | --- | --- | -| [appBasePath](./kibana-plugin-core-public.appmountparameters.appbasepath.md) | string | The route path for configuring navigation to the application. This string should not include the base path from HTTP. | -| [element](./kibana-plugin-core-public.appmountparameters.element.md) | HTMLElement | The container element to render the application into. | -| [history](./kibana-plugin-core-public.appmountparameters.history.md) | ScopedHistory<HistoryLocationState> | A scoped history instance for your application. Should be used to wire up your applications Router. | -| [onAppLeave](./kibana-plugin-core-public.appmountparameters.onappleave.md) | (handler: AppLeaveHandler) => void | A function that can be used to register a handler that will be called when the user is leaving the current application, allowing to prompt a confirmation message before actually changing the page.This will be called either when the user goes to another application, or when trying to close the tab or manually changing the url. | -| [setHeaderActionMenu](./kibana-plugin-core-public.appmountparameters.setheaderactionmenu.md) | (menuMount: MountPoint | undefined) => void | A function that can be used to set the mount point used to populate the application action container in the chrome header.Calling the handler multiple time will erase the current content of the action menu with the mount from the latest call. Calling the handler with undefined will unmount the current mount point. Calling the handler after the application has been unmounted will have no effect. | +| [appBasePath](./kibana-plugin-core-public.appmountparameters.appbasepath.md) | string | The route path for configuring navigation to the application. This string should not include the base path from HTTP. | +| [element](./kibana-plugin-core-public.appmountparameters.element.md) | HTMLElement | The container element to render the application into. | +| [history](./kibana-plugin-core-public.appmountparameters.history.md) | ScopedHistory<HistoryLocationState> | A scoped history instance for your application. Should be used to wire up your applications Router. | +| [onAppLeave](./kibana-plugin-core-public.appmountparameters.onappleave.md) | (handler: AppLeaveHandler) => void | A function that can be used to register a handler that will be called when the user is leaving the current application, allowing to prompt a confirmation message before actually changing the page.This will be called either when the user goes to another application, or when trying to close the tab or manually changing the url. | +| [setHeaderActionMenu](./kibana-plugin-core-public.appmountparameters.setheaderactionmenu.md) | (menuMount: MountPoint \| undefined) => void | A function that can be used to set the mount point used to populate the application action container in the chrome header.Calling the handler multiple time will erase the current content of the action menu with the mount from the latest call. Calling the handler with undefined will unmount the current mount point. Calling the handler after the application has been unmounted will have no effect. | diff --git a/docs/development/core/public/kibana-plugin-core-public.appmountparameters.onappleave.md b/docs/development/core/public/kibana-plugin-core-public.appmountparameters.onappleave.md index e64e40a49e44..fa75e3e4084a 100644 --- a/docs/development/core/public/kibana-plugin-core-public.appmountparameters.onappleave.md +++ b/docs/development/core/public/kibana-plugin-core-public.appmountparameters.onappleave.md @@ -41,6 +41,5 @@ export renderApp = ({ element, history, onAppLeave }: AppMountParameters) => { }); return renderApp({ element, history }); } - ``` diff --git a/docs/development/core/public/kibana-plugin-core-public.appmountparameters.setheaderactionmenu.md b/docs/development/core/public/kibana-plugin-core-public.appmountparameters.setheaderactionmenu.md index ca9cee64bb1f..715e1ba4bf29 100644 --- a/docs/development/core/public/kibana-plugin-core-public.appmountparameters.setheaderactionmenu.md +++ b/docs/development/core/public/kibana-plugin-core-public.appmountparameters.setheaderactionmenu.md @@ -34,6 +34,5 @@ export renderApp = ({ element, history, setHeaderActionMenu }: AppMountParameter }) return renderApp({ element, history }); } - ``` diff --git a/docs/development/core/public/kibana-plugin-core-public.appnavoptions.md b/docs/development/core/public/kibana-plugin-core-public.appnavoptions.md index cb5ae936988d..c6c583b7a909 100644 --- a/docs/development/core/public/kibana-plugin-core-public.appnavoptions.md +++ b/docs/development/core/public/kibana-plugin-core-public.appnavoptions.md @@ -16,8 +16,8 @@ export interface AppNavOptions | Property | Type | Description | | --- | --- | --- | -| [euiIconType](./kibana-plugin-core-public.appnavoptions.euiicontype.md) | string | A EUI iconType that will be used for the app's icon. This icon takes precedence over the icon property. | -| [icon](./kibana-plugin-core-public.appnavoptions.icon.md) | string | A URL to an image file used as an icon. Used as a fallback if euiIconType is not provided. | -| [order](./kibana-plugin-core-public.appnavoptions.order.md) | number | An ordinal used to sort nav links relative to one another for display. | -| [tooltip](./kibana-plugin-core-public.appnavoptions.tooltip.md) | string | A tooltip shown when hovering over app link. | +| [euiIconType?](./kibana-plugin-core-public.appnavoptions.euiicontype.md) | string | (Optional) A EUI iconType that will be used for the app's icon. This icon takes precedence over the icon property. | +| [icon?](./kibana-plugin-core-public.appnavoptions.icon.md) | string | (Optional) A URL to an image file used as an icon. Used as a fallback if euiIconType is not provided. | +| [order?](./kibana-plugin-core-public.appnavoptions.order.md) | number | (Optional) An ordinal used to sort nav links relative to one another for display. | +| [tooltip?](./kibana-plugin-core-public.appnavoptions.tooltip.md) | string | (Optional) A tooltip shown when hovering over app link. | diff --git a/docs/development/core/public/kibana-plugin-core-public.asyncplugin.md b/docs/development/core/public/kibana-plugin-core-public.asyncplugin.md index cf315e1fd337..cb9559dddc68 100644 --- a/docs/development/core/public/kibana-plugin-core-public.asyncplugin.md +++ b/docs/development/core/public/kibana-plugin-core-public.asyncplugin.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Asynchronous lifecycles are deprecated, and should be migrated to sync [plugin](./kibana-plugin-core-public.plugin.md) +> Asynchronous lifecycles are deprecated, and should be migrated to sync > A plugin with asynchronous lifecycle methods. @@ -23,5 +23,5 @@ export interface AsyncPlugin(Optional) | diff --git a/docs/development/core/public/kibana-plugin-core-public.asyncplugin.setup.md b/docs/development/core/public/kibana-plugin-core-public.asyncplugin.setup.md index 54507b44cdd7..67a5dad22a0a 100644 --- a/docs/development/core/public/kibana-plugin-core-public.asyncplugin.setup.md +++ b/docs/development/core/public/kibana-plugin-core-public.asyncplugin.setup.md @@ -14,10 +14,10 @@ setup(core: CoreSetup, plugins: TPluginsSetup): TSetup | | Parameter | Type | Description | | --- | --- | --- | -| core | CoreSetup<TPluginsStart, TStart> | | -| plugins | TPluginsSetup | | +| core | CoreSetup<TPluginsStart, TStart> | | +| plugins | TPluginsSetup | | Returns: -`TSetup | Promise` +TSetup \| Promise<TSetup> diff --git a/docs/development/core/public/kibana-plugin-core-public.asyncplugin.start.md b/docs/development/core/public/kibana-plugin-core-public.asyncplugin.start.md index f16d3c46bf84..89554a1afaf1 100644 --- a/docs/development/core/public/kibana-plugin-core-public.asyncplugin.start.md +++ b/docs/development/core/public/kibana-plugin-core-public.asyncplugin.start.md @@ -14,10 +14,10 @@ start(core: CoreStart, plugins: TPluginsStart): TStart | Promise; | Parameter | Type | Description | | --- | --- | --- | -| core | CoreStart | | -| plugins | TPluginsStart | | +| core | CoreStart | | +| plugins | TPluginsStart | | Returns: -`TStart | Promise` +TStart \| Promise<TStart> diff --git a/docs/development/core/public/kibana-plugin-core-public.asyncplugin.stop.md b/docs/development/core/public/kibana-plugin-core-public.asyncplugin.stop.md index f809f75783c2..3fb7504879cf 100644 --- a/docs/development/core/public/kibana-plugin-core-public.asyncplugin.stop.md +++ b/docs/development/core/public/kibana-plugin-core-public.asyncplugin.stop.md @@ -11,5 +11,5 @@ stop?(): void; ``` Returns: -`void` +void diff --git a/docs/development/core/public/kibana-plugin-core-public.capabilities.md b/docs/development/core/public/kibana-plugin-core-public.capabilities.md index 077899a4847d..e908bd554d88 100644 --- a/docs/development/core/public/kibana-plugin-core-public.capabilities.md +++ b/docs/development/core/public/kibana-plugin-core-public.capabilities.md @@ -16,7 +16,7 @@ export interface Capabilities | Property | Type | Description | | --- | --- | --- | -| [catalogue](./kibana-plugin-core-public.capabilities.catalogue.md) | Record<string, boolean> | Catalogue capabilities. Catalogue entries drive the visibility of the Kibana homepage options. | -| [management](./kibana-plugin-core-public.capabilities.management.md) | {
[sectionId: string]: Record<string, boolean>;
} | Management section capabilities. | -| [navLinks](./kibana-plugin-core-public.capabilities.navlinks.md) | Record<string, boolean> | Navigation link capabilities. | +| [catalogue](./kibana-plugin-core-public.capabilities.catalogue.md) | Record<string, boolean> | Catalogue capabilities. Catalogue entries drive the visibility of the Kibana homepage options. | +| [management](./kibana-plugin-core-public.capabilities.management.md) | { \[sectionId: string\]: Record<string, boolean>; } | Management section capabilities. | +| [navLinks](./kibana-plugin-core-public.capabilities.navlinks.md) | Record<string, boolean> | Navigation link capabilities. | diff --git a/docs/development/core/public/kibana-plugin-core-public.chromebadge.md b/docs/development/core/public/kibana-plugin-core-public.chromebadge.md index 0af3e5f36755..e2e4d1910fdd 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromebadge.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromebadge.md @@ -15,7 +15,7 @@ export interface ChromeBadge | Property | Type | Description | | --- | --- | --- | -| [iconType](./kibana-plugin-core-public.chromebadge.icontype.md) | IconType | | -| [text](./kibana-plugin-core-public.chromebadge.text.md) | string | | -| [tooltip](./kibana-plugin-core-public.chromebadge.tooltip.md) | string | | +| [iconType?](./kibana-plugin-core-public.chromebadge.icontype.md) | IconType | (Optional) | +| [text](./kibana-plugin-core-public.chromebadge.text.md) | string | | +| [tooltip](./kibana-plugin-core-public.chromebadge.tooltip.md) | string | | diff --git a/docs/development/core/public/kibana-plugin-core-public.chromedoctitle.change.md b/docs/development/core/public/kibana-plugin-core-public.chromedoctitle.change.md index aa44f38df15a..cf31d16cae0e 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromedoctitle.change.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromedoctitle.change.md @@ -16,11 +16,11 @@ change(newTitle: string | string[]): void; | Parameter | Type | Description | | --- | --- | --- | -| newTitle | string | string[] | | +| newTitle | string \| string\[\] | The new title to set, either a string or string array | Returns: -`void` +void ## Example @@ -29,6 +29,5 @@ How to change the title of the document ```ts chrome.docTitle.change('My application title') chrome.docTitle.change(['My application', 'My section']) - ``` diff --git a/docs/development/core/public/kibana-plugin-core-public.chromedoctitle.md b/docs/development/core/public/kibana-plugin-core-public.chromedoctitle.md index 5a6ab40d52d7..48e04b648e8d 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromedoctitle.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromedoctitle.md @@ -18,7 +18,6 @@ How to change the title of the document ```ts chrome.docTitle.change('My application') - ``` ## Example 2 @@ -27,7 +26,6 @@ How to reset the title of the document to it's initial value ```ts chrome.docTitle.reset() - ``` ## Methods diff --git a/docs/development/core/public/kibana-plugin-core-public.chromedoctitle.reset.md b/docs/development/core/public/kibana-plugin-core-public.chromedoctitle.reset.md index ac38db8d2893..e11635fd6d3f 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromedoctitle.reset.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromedoctitle.reset.md @@ -13,5 +13,5 @@ reset(): void; ``` Returns: -`void` +void diff --git a/docs/development/core/public/kibana-plugin-core-public.chromehelpextension.md b/docs/development/core/public/kibana-plugin-core-public.chromehelpextension.md index d90a9bf70486..07fda8d926a2 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromehelpextension.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromehelpextension.md @@ -15,7 +15,7 @@ export interface ChromeHelpExtension | Property | Type | Description | | --- | --- | --- | -| [appName](./kibana-plugin-core-public.chromehelpextension.appname.md) | string | Provide your plugin's name to create a header for separation | -| [content](./kibana-plugin-core-public.chromehelpextension.content.md) | (element: HTMLDivElement) => () => void | Custom content to occur below the list of links | -| [links](./kibana-plugin-core-public.chromehelpextension.links.md) | ChromeHelpExtensionMenuLink[] | Creates unified links for sending users to documentation, GitHub, Discuss, or a custom link/button | +| [appName](./kibana-plugin-core-public.chromehelpextension.appname.md) | string | Provide your plugin's name to create a header for separation | +| [content?](./kibana-plugin-core-public.chromehelpextension.content.md) | (element: HTMLDivElement) => () => void | (Optional) Custom content to occur below the list of links | +| [links?](./kibana-plugin-core-public.chromehelpextension.links.md) | ChromeHelpExtensionMenuLink\[\] | (Optional) Creates unified links for sending users to documentation, GitHub, Discuss, or a custom link/button | diff --git a/docs/development/core/public/kibana-plugin-core-public.chromehelpextensionmenucustomlink.md b/docs/development/core/public/kibana-plugin-core-public.chromehelpextensionmenucustomlink.md index ff4978e69df6..daf724c72c23 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromehelpextensionmenucustomlink.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromehelpextensionmenucustomlink.md @@ -10,12 +10,13 @@ ```typescript export interface ChromeHelpExtensionMenuCustomLink extends ChromeHelpExtensionLinkBase ``` +Extends: ChromeHelpExtensionLinkBase ## Properties | Property | Type | Description | | --- | --- | --- | -| [content](./kibana-plugin-core-public.chromehelpextensionmenucustomlink.content.md) | React.ReactNode | Content of the button (in lieu of children) | -| [href](./kibana-plugin-core-public.chromehelpextensionmenucustomlink.href.md) | string | URL of the link | -| [linkType](./kibana-plugin-core-public.chromehelpextensionmenucustomlink.linktype.md) | 'custom' | Extend EuiButtonEmpty to provide extra functionality | +| [content](./kibana-plugin-core-public.chromehelpextensionmenucustomlink.content.md) | React.ReactNode | Content of the button (in lieu of children) | +| [href](./kibana-plugin-core-public.chromehelpextensionmenucustomlink.href.md) | string | URL of the link | +| [linkType](./kibana-plugin-core-public.chromehelpextensionmenucustomlink.linktype.md) | 'custom' | Extend EuiButtonEmpty to provide extra functionality | diff --git a/docs/development/core/public/kibana-plugin-core-public.chromehelpextensionmenudiscusslink.md b/docs/development/core/public/kibana-plugin-core-public.chromehelpextensionmenudiscusslink.md index a73f6daad28c..3dc32fcb6d87 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromehelpextensionmenudiscusslink.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromehelpextensionmenudiscusslink.md @@ -10,11 +10,12 @@ ```typescript export interface ChromeHelpExtensionMenuDiscussLink extends ChromeHelpExtensionLinkBase ``` +Extends: ChromeHelpExtensionLinkBase ## Properties | Property | Type | Description | | --- | --- | --- | -| [href](./kibana-plugin-core-public.chromehelpextensionmenudiscusslink.href.md) | string | URL to discuss page. i.e. https://discuss.elastic.co/c/${appName} | -| [linkType](./kibana-plugin-core-public.chromehelpextensionmenudiscusslink.linktype.md) | 'discuss' | Creates a generic give feedback link with comment icon | +| [href](./kibana-plugin-core-public.chromehelpextensionmenudiscusslink.href.md) | string | URL to discuss page. i.e. https://discuss.elastic.co/c/${appName} | +| [linkType](./kibana-plugin-core-public.chromehelpextensionmenudiscusslink.linktype.md) | 'discuss' | Creates a generic give feedback link with comment icon | diff --git a/docs/development/core/public/kibana-plugin-core-public.chromehelpextensionmenudocumentationlink.md b/docs/development/core/public/kibana-plugin-core-public.chromehelpextensionmenudocumentationlink.md index fab49d06d477..d20b513b1c55 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromehelpextensionmenudocumentationlink.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromehelpextensionmenudocumentationlink.md @@ -10,11 +10,12 @@ ```typescript export interface ChromeHelpExtensionMenuDocumentationLink extends ChromeHelpExtensionLinkBase ``` +Extends: ChromeHelpExtensionLinkBase ## Properties | Property | Type | Description | | --- | --- | --- | -| [href](./kibana-plugin-core-public.chromehelpextensionmenudocumentationlink.href.md) | string | URL to documentation page. i.e. ${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/${appName}.html, | -| [linkType](./kibana-plugin-core-public.chromehelpextensionmenudocumentationlink.linktype.md) | 'documentation' | Creates a deep-link to app-specific documentation | +| [href](./kibana-plugin-core-public.chromehelpextensionmenudocumentationlink.href.md) | string | URL to documentation page. i.e. ${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/${appName}.html, | +| [linkType](./kibana-plugin-core-public.chromehelpextensionmenudocumentationlink.linktype.md) | 'documentation' | Creates a deep-link to app-specific documentation | diff --git a/docs/development/core/public/kibana-plugin-core-public.chromehelpextensionmenugithublink.md b/docs/development/core/public/kibana-plugin-core-public.chromehelpextensionmenugithublink.md index ca9ceecffa6f..56eee43d2690 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromehelpextensionmenugithublink.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromehelpextensionmenugithublink.md @@ -10,12 +10,13 @@ ```typescript export interface ChromeHelpExtensionMenuGitHubLink extends ChromeHelpExtensionLinkBase ``` +Extends: ChromeHelpExtensionLinkBase ## Properties | Property | Type | Description | | --- | --- | --- | -| [labels](./kibana-plugin-core-public.chromehelpextensionmenugithublink.labels.md) | string[] | Include at least one app-specific label to be applied to the new github issue | -| [linkType](./kibana-plugin-core-public.chromehelpextensionmenugithublink.linktype.md) | 'github' | Creates a link to a new github issue in the Kibana repo | -| [title](./kibana-plugin-core-public.chromehelpextensionmenugithublink.title.md) | string | Provides initial text for the title of the issue | +| [labels](./kibana-plugin-core-public.chromehelpextensionmenugithublink.labels.md) | string\[\] | Include at least one app-specific label to be applied to the new github issue | +| [linkType](./kibana-plugin-core-public.chromehelpextensionmenugithublink.linktype.md) | 'github' | Creates a link to a new github issue in the Kibana repo | +| [title?](./kibana-plugin-core-public.chromehelpextensionmenugithublink.title.md) | string | (Optional) Provides initial text for the title of the issue | diff --git a/docs/development/core/public/kibana-plugin-core-public.chromenavcontrol.md b/docs/development/core/public/kibana-plugin-core-public.chromenavcontrol.md index 0fad08fdbce8..c0371078c28a 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromenavcontrol.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromenavcontrol.md @@ -15,6 +15,6 @@ export interface ChromeNavControl | Property | Type | Description | | --- | --- | --- | -| [mount](./kibana-plugin-core-public.chromenavcontrol.mount.md) | MountPoint | | -| [order](./kibana-plugin-core-public.chromenavcontrol.order.md) | number | | +| [mount](./kibana-plugin-core-public.chromenavcontrol.mount.md) | MountPoint | | +| [order?](./kibana-plugin-core-public.chromenavcontrol.order.md) | number | (Optional) | diff --git a/docs/development/core/public/kibana-plugin-core-public.chromenavcontrols.md b/docs/development/core/public/kibana-plugin-core-public.chromenavcontrols.md index 47365782599e..72018d46428a 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromenavcontrols.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromenavcontrols.md @@ -23,7 +23,6 @@ chrome.navControls.registerLeft({ return () => ReactDOM.unmountComponentAtNode(targetDomElement); } }) - ``` ## Methods diff --git a/docs/development/core/public/kibana-plugin-core-public.chromenavcontrols.registercenter.md b/docs/development/core/public/kibana-plugin-core-public.chromenavcontrols.registercenter.md index 2f921050e58d..68b243bf47f8 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromenavcontrols.registercenter.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromenavcontrols.registercenter.md @@ -16,9 +16,9 @@ registerCenter(navControl: ChromeNavControl): void; | Parameter | Type | Description | | --- | --- | --- | -| navControl | ChromeNavControl | | +| navControl | ChromeNavControl | | Returns: -`void` +void diff --git a/docs/development/core/public/kibana-plugin-core-public.chromenavcontrols.registerleft.md b/docs/development/core/public/kibana-plugin-core-public.chromenavcontrols.registerleft.md index 514c44bd9d71..ee0789c285f0 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromenavcontrols.registerleft.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromenavcontrols.registerleft.md @@ -16,9 +16,9 @@ registerLeft(navControl: ChromeNavControl): void; | Parameter | Type | Description | | --- | --- | --- | -| navControl | ChromeNavControl | | +| navControl | ChromeNavControl | | Returns: -`void` +void diff --git a/docs/development/core/public/kibana-plugin-core-public.chromenavcontrols.registerright.md b/docs/development/core/public/kibana-plugin-core-public.chromenavcontrols.registerright.md index eb56e0e38c6c..9091736c62ee 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromenavcontrols.registerright.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromenavcontrols.registerright.md @@ -16,9 +16,9 @@ registerRight(navControl: ChromeNavControl): void; | Parameter | Type | Description | | --- | --- | --- | -| navControl | ChromeNavControl | | +| navControl | ChromeNavControl | | Returns: -`void` +void diff --git a/docs/development/core/public/kibana-plugin-core-public.chromenavlink.md b/docs/development/core/public/kibana-plugin-core-public.chromenavlink.md index c7dd461617e3..964f4d4b86aa 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromenavlink.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromenavlink.md @@ -15,16 +15,16 @@ export interface ChromeNavLink | Property | Type | Description | | --- | --- | --- | -| [baseUrl](./kibana-plugin-core-public.chromenavlink.baseurl.md) | string | The base route used to open the root of an application. | -| [category](./kibana-plugin-core-public.chromenavlink.category.md) | AppCategory | The category the app lives in | -| [disabled](./kibana-plugin-core-public.chromenavlink.disabled.md) | boolean | Disables a link from being clickable. | -| [euiIconType](./kibana-plugin-core-public.chromenavlink.euiicontype.md) | string | A EUI iconType that will be used for the app's icon. This icon takes precedence over the icon property. | -| [hidden](./kibana-plugin-core-public.chromenavlink.hidden.md) | boolean | Hides a link from the navigation. | -| [href](./kibana-plugin-core-public.chromenavlink.href.md) | string | Settled state between url, baseUrl, and active | -| [icon](./kibana-plugin-core-public.chromenavlink.icon.md) | string | A URL to an image file used as an icon. Used as a fallback if euiIconType is not provided. | -| [id](./kibana-plugin-core-public.chromenavlink.id.md) | string | A unique identifier for looking up links. | -| [order](./kibana-plugin-core-public.chromenavlink.order.md) | number | An ordinal used to sort nav links relative to one another for display. | -| [title](./kibana-plugin-core-public.chromenavlink.title.md) | string | The title of the application. | -| [tooltip](./kibana-plugin-core-public.chromenavlink.tooltip.md) | string | A tooltip shown when hovering over an app link. | -| [url](./kibana-plugin-core-public.chromenavlink.url.md) | string | The route used to open the default path and the deep links of an application. | +| [baseUrl](./kibana-plugin-core-public.chromenavlink.baseurl.md) | string | The base route used to open the root of an application. | +| [category?](./kibana-plugin-core-public.chromenavlink.category.md) | AppCategory | (Optional) The category the app lives in | +| [disabled?](./kibana-plugin-core-public.chromenavlink.disabled.md) | boolean | (Optional) Disables a link from being clickable. | +| [euiIconType?](./kibana-plugin-core-public.chromenavlink.euiicontype.md) | string | (Optional) A EUI iconType that will be used for the app's icon. This icon takes precedence over the icon property. | +| [hidden?](./kibana-plugin-core-public.chromenavlink.hidden.md) | boolean | (Optional) Hides a link from the navigation. | +| [href](./kibana-plugin-core-public.chromenavlink.href.md) | string | Settled state between url, baseUrl, and active | +| [icon?](./kibana-plugin-core-public.chromenavlink.icon.md) | string | (Optional) A URL to an image file used as an icon. Used as a fallback if euiIconType is not provided. | +| [id](./kibana-plugin-core-public.chromenavlink.id.md) | string | A unique identifier for looking up links. | +| [order?](./kibana-plugin-core-public.chromenavlink.order.md) | number | (Optional) An ordinal used to sort nav links relative to one another for display. | +| [title](./kibana-plugin-core-public.chromenavlink.title.md) | string | The title of the application. | +| [tooltip?](./kibana-plugin-core-public.chromenavlink.tooltip.md) | string | (Optional) A tooltip shown when hovering over an app link. | +| [url](./kibana-plugin-core-public.chromenavlink.url.md) | string | The route used to open the default path and the deep links of an application. | diff --git a/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.enableforcedappswitchernavigation.md b/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.enableforcedappswitchernavigation.md index b65ad2b17c1e..4f9b6aaada5d 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.enableforcedappswitchernavigation.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.enableforcedappswitchernavigation.md @@ -13,7 +13,7 @@ enableForcedAppSwitcherNavigation(): void; ``` Returns: -`void` +void ## Remarks diff --git a/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.get.md b/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.get.md index f616f99f639e..796d99b9b0e0 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.get.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.get.md @@ -16,9 +16,9 @@ get(id: string): ChromeNavLink | undefined; | Parameter | Type | Description | | --- | --- | --- | -| id | string | | +| id | string | | Returns: -`ChromeNavLink | undefined` +ChromeNavLink \| undefined diff --git a/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.getall.md b/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.getall.md index 94a7b25160af..08d5707fe325 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.getall.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.getall.md @@ -13,5 +13,5 @@ getAll(): Array>; ``` Returns: -`Array>` +Array<Readonly<ChromeNavLink>> diff --git a/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.getforceappswitchernavigation_.md b/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.getforceappswitchernavigation_.md index ded2c8c08ba4..3b87790c3729 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.getforceappswitchernavigation_.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.getforceappswitchernavigation_.md @@ -13,5 +13,5 @@ getForceAppSwitcherNavigation$(): Observable; ``` Returns: -`Observable` +Observable<boolean> diff --git a/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.getnavlinks_.md b/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.getnavlinks_.md index d93b4381271e..8ee5c0fb8308 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.getnavlinks_.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.getnavlinks_.md @@ -13,5 +13,5 @@ getNavLinks$(): Observable>>; ``` Returns: -`Observable>>` +Observable<Array<Readonly<ChromeNavLink>>> diff --git a/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.has.md b/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.has.md index abef76582cef..dfaae86a9d89 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.has.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.has.md @@ -16,9 +16,9 @@ has(id: string): boolean; | Parameter | Type | Description | | --- | --- | --- | -| id | string | | +| id | string | | Returns: -`boolean` +boolean diff --git a/docs/development/core/public/kibana-plugin-core-public.chromerecentlyaccessed.add.md b/docs/development/core/public/kibana-plugin-core-public.chromerecentlyaccessed.add.md index 329105394e41..5c99c6bf7fbc 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromerecentlyaccessed.add.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromerecentlyaccessed.add.md @@ -16,19 +16,18 @@ add(link: string, label: string, id: string): void; | Parameter | Type | Description | | --- | --- | --- | -| link | string | | -| label | string | | -| id | string | | +| link | string | a relative URL to the resource (not including the ) | +| label | string | the label to display in the UI | +| id | string | a unique string used to de-duplicate the recently accessed list. | Returns: -`void` +void ## Example ```js chrome.recentlyAccessed.add('/app/map/1234', 'Map 1234', '1234'); - ``` diff --git a/docs/development/core/public/kibana-plugin-core-public.chromerecentlyaccessed.get.md b/docs/development/core/public/kibana-plugin-core-public.chromerecentlyaccessed.get.md index b0d66e25d1fe..da696737b3bb 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromerecentlyaccessed.get.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromerecentlyaccessed.get.md @@ -13,13 +13,12 @@ get(): ChromeRecentlyAccessedHistoryItem[]; ``` Returns: -`ChromeRecentlyAccessedHistoryItem[]` +ChromeRecentlyAccessedHistoryItem\[\] ## Example ```js chrome.recentlyAccessed.get().forEach(console.log); - ``` diff --git a/docs/development/core/public/kibana-plugin-core-public.chromerecentlyaccessed.get_.md b/docs/development/core/public/kibana-plugin-core-public.chromerecentlyaccessed.get_.md index da53c6535b25..4655289642f9 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromerecentlyaccessed.get_.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromerecentlyaccessed.get_.md @@ -13,13 +13,12 @@ get$(): Observable; ``` Returns: -`Observable` +Observable<ChromeRecentlyAccessedHistoryItem\[\]> ## Example ```js chrome.recentlyAccessed.get$().subscribe(console.log); - ``` diff --git a/docs/development/core/public/kibana-plugin-core-public.chromerecentlyaccessedhistoryitem.md b/docs/development/core/public/kibana-plugin-core-public.chromerecentlyaccessedhistoryitem.md index e07492f883e5..3b67b41d37a3 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromerecentlyaccessedhistoryitem.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromerecentlyaccessedhistoryitem.md @@ -15,7 +15,7 @@ export interface ChromeRecentlyAccessedHistoryItem | Property | Type | Description | | --- | --- | --- | -| [id](./kibana-plugin-core-public.chromerecentlyaccessedhistoryitem.id.md) | string | | -| [label](./kibana-plugin-core-public.chromerecentlyaccessedhistoryitem.label.md) | string | | -| [link](./kibana-plugin-core-public.chromerecentlyaccessedhistoryitem.link.md) | string | | +| [id](./kibana-plugin-core-public.chromerecentlyaccessedhistoryitem.id.md) | string | | +| [label](./kibana-plugin-core-public.chromerecentlyaccessedhistoryitem.label.md) | string | | +| [link](./kibana-plugin-core-public.chromerecentlyaccessedhistoryitem.link.md) | string | | diff --git a/docs/development/core/public/kibana-plugin-core-public.chromestart.getbadge_.md b/docs/development/core/public/kibana-plugin-core-public.chromestart.getbadge_.md index 586a61a9f214..d3dc459bae9d 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromestart.getbadge_.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromestart.getbadge_.md @@ -13,5 +13,5 @@ getBadge$(): Observable; ``` Returns: -`Observable` +Observable<ChromeBadge \| undefined> diff --git a/docs/development/core/public/kibana-plugin-core-public.chromestart.getbreadcrumbs_.md b/docs/development/core/public/kibana-plugin-core-public.chromestart.getbreadcrumbs_.md index 155f3423d69e..c4d3751549b1 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromestart.getbreadcrumbs_.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromestart.getbreadcrumbs_.md @@ -13,5 +13,5 @@ getBreadcrumbs$(): Observable; ``` Returns: -`Observable` +Observable<ChromeBreadcrumb\[\]> diff --git a/docs/development/core/public/kibana-plugin-core-public.chromestart.getbreadcrumbsappendextension_.md b/docs/development/core/public/kibana-plugin-core-public.chromestart.getbreadcrumbsappendextension_.md index dfe25c5c9e42..21c12514debe 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromestart.getbreadcrumbsappendextension_.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromestart.getbreadcrumbsappendextension_.md @@ -13,5 +13,5 @@ getBreadcrumbsAppendExtension$(): ObservableReturns: -`Observable` +Observable<ChromeBreadcrumbsAppendExtension \| undefined> diff --git a/docs/development/core/public/kibana-plugin-core-public.chromestart.getcustomnavlink_.md b/docs/development/core/public/kibana-plugin-core-public.chromestart.getcustomnavlink_.md index 64805eefbfea..59346a409562 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromestart.getcustomnavlink_.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromestart.getcustomnavlink_.md @@ -13,5 +13,5 @@ getCustomNavLink$(): Observable | undefined>; ``` Returns: -`Observable | undefined>` +Observable<Partial<ChromeNavLink> \| undefined> diff --git a/docs/development/core/public/kibana-plugin-core-public.chromestart.gethelpextension_.md b/docs/development/core/public/kibana-plugin-core-public.chromestart.gethelpextension_.md index 90c42a98bd60..052bbe2630f7 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromestart.gethelpextension_.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromestart.gethelpextension_.md @@ -13,5 +13,5 @@ getHelpExtension$(): Observable; ``` Returns: -`Observable` +Observable<ChromeHelpExtension \| undefined> diff --git a/docs/development/core/public/kibana-plugin-core-public.chromestart.getisnavdrawerlocked_.md b/docs/development/core/public/kibana-plugin-core-public.chromestart.getisnavdrawerlocked_.md index 78a4442a651e..12aa71366aaa 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromestart.getisnavdrawerlocked_.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromestart.getisnavdrawerlocked_.md @@ -13,5 +13,5 @@ getIsNavDrawerLocked$(): Observable; ``` Returns: -`Observable` +Observable<boolean> diff --git a/docs/development/core/public/kibana-plugin-core-public.chromestart.getisvisible_.md b/docs/development/core/public/kibana-plugin-core-public.chromestart.getisvisible_.md index b6204a191390..70a9c832926e 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromestart.getisvisible_.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromestart.getisvisible_.md @@ -13,5 +13,5 @@ getIsVisible$(): Observable; ``` Returns: -`Observable` +Observable<boolean> diff --git a/docs/development/core/public/kibana-plugin-core-public.chromestart.hasheaderbanner_.md b/docs/development/core/public/kibana-plugin-core-public.chromestart.hasheaderbanner_.md index 6ce0671eb523..66dd1e2562f5 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromestart.hasheaderbanner_.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromestart.hasheaderbanner_.md @@ -13,5 +13,5 @@ hasHeaderBanner$(): Observable; ``` Returns: -`Observable` +Observable<boolean> diff --git a/docs/development/core/public/kibana-plugin-core-public.chromestart.md b/docs/development/core/public/kibana-plugin-core-public.chromestart.md index ffc77dd653c0..3e672fbc14d7 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromestart.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromestart.md @@ -22,7 +22,6 @@ How to add a recently accessed item to the sidebar: ```ts core.chrome.recentlyAccessed.add('/app/map/1234', 'Map 1234', '1234'); - ``` ## Example 2 @@ -34,17 +33,16 @@ core.chrome.setHelpExtension(elem => { ReactDOM.render(, elem); return () => ReactDOM.unmountComponentAtNode(elem); }); - ``` ## Properties | Property | Type | Description | | --- | --- | --- | -| [docTitle](./kibana-plugin-core-public.chromestart.doctitle.md) | ChromeDocTitle | APIs for accessing and updating the document title. | -| [navControls](./kibana-plugin-core-public.chromestart.navcontrols.md) | ChromeNavControls | [APIs](./kibana-plugin-core-public.chromenavcontrols.md) for registering new controls to be displayed in the navigation bar. | -| [navLinks](./kibana-plugin-core-public.chromestart.navlinks.md) | ChromeNavLinks | [APIs](./kibana-plugin-core-public.chromenavlinks.md) for manipulating nav links. | -| [recentlyAccessed](./kibana-plugin-core-public.chromestart.recentlyaccessed.md) | ChromeRecentlyAccessed | [APIs](./kibana-plugin-core-public.chromerecentlyaccessed.md) for recently accessed history. | +| [docTitle](./kibana-plugin-core-public.chromestart.doctitle.md) | ChromeDocTitle | APIs for accessing and updating the document title. | +| [navControls](./kibana-plugin-core-public.chromestart.navcontrols.md) | ChromeNavControls | [APIs](./kibana-plugin-core-public.chromenavcontrols.md) for registering new controls to be displayed in the navigation bar. | +| [navLinks](./kibana-plugin-core-public.chromestart.navlinks.md) | ChromeNavLinks | [APIs](./kibana-plugin-core-public.chromenavlinks.md) for manipulating nav links. | +| [recentlyAccessed](./kibana-plugin-core-public.chromestart.recentlyaccessed.md) | ChromeRecentlyAccessed | [APIs](./kibana-plugin-core-public.chromerecentlyaccessed.md) for recently accessed history. | ## Methods diff --git a/docs/development/core/public/kibana-plugin-core-public.chromestart.setbadge.md b/docs/development/core/public/kibana-plugin-core-public.chromestart.setbadge.md index 52e807658d23..7e974b139d14 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromestart.setbadge.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromestart.setbadge.md @@ -16,9 +16,9 @@ setBadge(badge?: ChromeBadge): void; | Parameter | Type | Description | | --- | --- | --- | -| badge | ChromeBadge | | +| badge | ChromeBadge | | Returns: -`void` +void diff --git a/docs/development/core/public/kibana-plugin-core-public.chromestart.setbreadcrumbs.md b/docs/development/core/public/kibana-plugin-core-public.chromestart.setbreadcrumbs.md index 80a1514ef765..f44e3e6cfd56 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromestart.setbreadcrumbs.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromestart.setbreadcrumbs.md @@ -16,9 +16,9 @@ setBreadcrumbs(newBreadcrumbs: ChromeBreadcrumb[]): void; | Parameter | Type | Description | | --- | --- | --- | -| newBreadcrumbs | ChromeBreadcrumb[] | | +| newBreadcrumbs | ChromeBreadcrumb\[\] | | Returns: -`void` +void diff --git a/docs/development/core/public/kibana-plugin-core-public.chromestart.setbreadcrumbsappendextension.md b/docs/development/core/public/kibana-plugin-core-public.chromestart.setbreadcrumbsappendextension.md index 02adb9b4d325..b8fa965f2726 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromestart.setbreadcrumbsappendextension.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromestart.setbreadcrumbsappendextension.md @@ -16,9 +16,9 @@ setBreadcrumbsAppendExtension(breadcrumbsAppendExtension?: ChromeBreadcrumbsAppe | Parameter | Type | Description | | --- | --- | --- | -| breadcrumbsAppendExtension | ChromeBreadcrumbsAppendExtension | | +| breadcrumbsAppendExtension | ChromeBreadcrumbsAppendExtension | | Returns: -`void` +void diff --git a/docs/development/core/public/kibana-plugin-core-public.chromestart.setcustomnavlink.md b/docs/development/core/public/kibana-plugin-core-public.chromestart.setcustomnavlink.md index adfb57f9c5ff..7b100a25a4b2 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromestart.setcustomnavlink.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromestart.setcustomnavlink.md @@ -16,9 +16,9 @@ setCustomNavLink(newCustomNavLink?: Partial): void; | Parameter | Type | Description | | --- | --- | --- | -| newCustomNavLink | Partial<ChromeNavLink> | | +| newCustomNavLink | Partial<ChromeNavLink> | | Returns: -`void` +void diff --git a/docs/development/core/public/kibana-plugin-core-public.chromestart.setheaderbanner.md b/docs/development/core/public/kibana-plugin-core-public.chromestart.setheaderbanner.md index 02a2fa65ed47..75f711c0bf10 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromestart.setheaderbanner.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromestart.setheaderbanner.md @@ -16,11 +16,11 @@ setHeaderBanner(headerBanner?: ChromeUserBanner): void; | Parameter | Type | Description | | --- | --- | --- | -| headerBanner | ChromeUserBanner | | +| headerBanner | ChromeUserBanner | | Returns: -`void` +void ## Remarks diff --git a/docs/development/core/public/kibana-plugin-core-public.chromestart.sethelpextension.md b/docs/development/core/public/kibana-plugin-core-public.chromestart.sethelpextension.md index c03cf2e9203b..c2bc691349f3 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromestart.sethelpextension.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromestart.sethelpextension.md @@ -16,9 +16,9 @@ setHelpExtension(helpExtension?: ChromeHelpExtension): void; | Parameter | Type | Description | | --- | --- | --- | -| helpExtension | ChromeHelpExtension | | +| helpExtension | ChromeHelpExtension | | Returns: -`void` +void diff --git a/docs/development/core/public/kibana-plugin-core-public.chromestart.sethelpsupporturl.md b/docs/development/core/public/kibana-plugin-core-public.chromestart.sethelpsupporturl.md index a08c54c1f37c..baeb37a89ca4 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromestart.sethelpsupporturl.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromestart.sethelpsupporturl.md @@ -16,9 +16,9 @@ setHelpSupportUrl(url: string): void; | Parameter | Type | Description | | --- | --- | --- | -| url | string | | +| url | string | The updated support URL | Returns: -`void` +void diff --git a/docs/development/core/public/kibana-plugin-core-public.chromestart.setisvisible.md b/docs/development/core/public/kibana-plugin-core-public.chromestart.setisvisible.md index 76e2dc666fc8..9c8cc737bea4 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromestart.setisvisible.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromestart.setisvisible.md @@ -16,9 +16,9 @@ setIsVisible(isVisible: boolean): void; | Parameter | Type | Description | | --- | --- | --- | -| isVisible | boolean | | +| isVisible | boolean | | Returns: -`void` +void diff --git a/docs/development/core/public/kibana-plugin-core-public.chromeuserbanner.md b/docs/development/core/public/kibana-plugin-core-public.chromeuserbanner.md index 8617c5c4d2b1..0417197ab55f 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromeuserbanner.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromeuserbanner.md @@ -15,5 +15,5 @@ export interface ChromeUserBanner | Property | Type | Description | | --- | --- | --- | -| [content](./kibana-plugin-core-public.chromeuserbanner.content.md) | MountPoint<HTMLDivElement> | | +| [content](./kibana-plugin-core-public.chromeuserbanner.content.md) | MountPoint<HTMLDivElement> | | diff --git a/docs/development/core/public/kibana-plugin-core-public.coresetup.md b/docs/development/core/public/kibana-plugin-core-public.coresetup.md index 5d2288120da0..18af0c7ea585 100644 --- a/docs/development/core/public/kibana-plugin-core-public.coresetup.md +++ b/docs/development/core/public/kibana-plugin-core-public.coresetup.md @@ -16,11 +16,11 @@ export interface CoreSetupApplicationSetup | [ApplicationSetup](./kibana-plugin-core-public.applicationsetup.md) | -| [fatalErrors](./kibana-plugin-core-public.coresetup.fatalerrors.md) | FatalErrorsSetup | [FatalErrorsSetup](./kibana-plugin-core-public.fatalerrorssetup.md) | -| [getStartServices](./kibana-plugin-core-public.coresetup.getstartservices.md) | StartServicesAccessor<TPluginsStart, TStart> | [StartServicesAccessor](./kibana-plugin-core-public.startservicesaccessor.md) | -| [http](./kibana-plugin-core-public.coresetup.http.md) | HttpSetup | [HttpSetup](./kibana-plugin-core-public.httpsetup.md) | -| [injectedMetadata](./kibana-plugin-core-public.coresetup.injectedmetadata.md) | {
getInjectedVar: (name: string, defaultValue?: any) => unknown;
} | exposed temporarily until https://github.com/elastic/kibana/issues/41990 done use \*only\* to retrieve config values. There is no way to set injected values in the new platform. | -| [notifications](./kibana-plugin-core-public.coresetup.notifications.md) | NotificationsSetup | [NotificationsSetup](./kibana-plugin-core-public.notificationssetup.md) | -| [uiSettings](./kibana-plugin-core-public.coresetup.uisettings.md) | IUiSettingsClient | [IUiSettingsClient](./kibana-plugin-core-public.iuisettingsclient.md) | +| [application](./kibana-plugin-core-public.coresetup.application.md) | ApplicationSetup | [ApplicationSetup](./kibana-plugin-core-public.applicationsetup.md) | +| [fatalErrors](./kibana-plugin-core-public.coresetup.fatalerrors.md) | FatalErrorsSetup | [FatalErrorsSetup](./kibana-plugin-core-public.fatalerrorssetup.md) | +| [getStartServices](./kibana-plugin-core-public.coresetup.getstartservices.md) | StartServicesAccessor<TPluginsStart, TStart> | [StartServicesAccessor](./kibana-plugin-core-public.startservicesaccessor.md) | +| [http](./kibana-plugin-core-public.coresetup.http.md) | HttpSetup | [HttpSetup](./kibana-plugin-core-public.httpsetup.md) | +| [injectedMetadata](./kibana-plugin-core-public.coresetup.injectedmetadata.md) | { getInjectedVar: (name: string, defaultValue?: any) => unknown; } | exposed temporarily until https://github.com/elastic/kibana/issues/41990 done use \*only\* to retrieve config values. There is no way to set injected values in the new platform. | +| [notifications](./kibana-plugin-core-public.coresetup.notifications.md) | NotificationsSetup | [NotificationsSetup](./kibana-plugin-core-public.notificationssetup.md) | +| [uiSettings](./kibana-plugin-core-public.coresetup.uisettings.md) | IUiSettingsClient | [IUiSettingsClient](./kibana-plugin-core-public.iuisettingsclient.md) | diff --git a/docs/development/core/public/kibana-plugin-core-public.corestart.md b/docs/development/core/public/kibana-plugin-core-public.corestart.md index 6ad9adca53ef..e0f6a6878241 100644 --- a/docs/development/core/public/kibana-plugin-core-public.corestart.md +++ b/docs/development/core/public/kibana-plugin-core-public.corestart.md @@ -16,16 +16,16 @@ export interface CoreStart | Property | Type | Description | | --- | --- | --- | -| [application](./kibana-plugin-core-public.corestart.application.md) | ApplicationStart | [ApplicationStart](./kibana-plugin-core-public.applicationstart.md) | -| [chrome](./kibana-plugin-core-public.corestart.chrome.md) | ChromeStart | [ChromeStart](./kibana-plugin-core-public.chromestart.md) | -| [deprecations](./kibana-plugin-core-public.corestart.deprecations.md) | DeprecationsServiceStart | [DeprecationsServiceStart](./kibana-plugin-core-public.deprecationsservicestart.md) | -| [docLinks](./kibana-plugin-core-public.corestart.doclinks.md) | DocLinksStart | [DocLinksStart](./kibana-plugin-core-public.doclinksstart.md) | -| [fatalErrors](./kibana-plugin-core-public.corestart.fatalerrors.md) | FatalErrorsStart | [FatalErrorsStart](./kibana-plugin-core-public.fatalerrorsstart.md) | -| [http](./kibana-plugin-core-public.corestart.http.md) | HttpStart | [HttpStart](./kibana-plugin-core-public.httpstart.md) | -| [i18n](./kibana-plugin-core-public.corestart.i18n.md) | I18nStart | [I18nStart](./kibana-plugin-core-public.i18nstart.md) | -| [injectedMetadata](./kibana-plugin-core-public.corestart.injectedmetadata.md) | {
getInjectedVar: (name: string, defaultValue?: any) => unknown;
} | exposed temporarily until https://github.com/elastic/kibana/issues/41990 done use \*only\* to retrieve config values. There is no way to set injected values in the new platform. | -| [notifications](./kibana-plugin-core-public.corestart.notifications.md) | NotificationsStart | [NotificationsStart](./kibana-plugin-core-public.notificationsstart.md) | -| [overlays](./kibana-plugin-core-public.corestart.overlays.md) | OverlayStart | [OverlayStart](./kibana-plugin-core-public.overlaystart.md) | -| [savedObjects](./kibana-plugin-core-public.corestart.savedobjects.md) | SavedObjectsStart | [SavedObjectsStart](./kibana-plugin-core-public.savedobjectsstart.md) | -| [uiSettings](./kibana-plugin-core-public.corestart.uisettings.md) | IUiSettingsClient | [IUiSettingsClient](./kibana-plugin-core-public.iuisettingsclient.md) | +| [application](./kibana-plugin-core-public.corestart.application.md) | ApplicationStart | [ApplicationStart](./kibana-plugin-core-public.applicationstart.md) | +| [chrome](./kibana-plugin-core-public.corestart.chrome.md) | ChromeStart | [ChromeStart](./kibana-plugin-core-public.chromestart.md) | +| [deprecations](./kibana-plugin-core-public.corestart.deprecations.md) | DeprecationsServiceStart | [DeprecationsServiceStart](./kibana-plugin-core-public.deprecationsservicestart.md) | +| [docLinks](./kibana-plugin-core-public.corestart.doclinks.md) | DocLinksStart | [DocLinksStart](./kibana-plugin-core-public.doclinksstart.md) | +| [fatalErrors](./kibana-plugin-core-public.corestart.fatalerrors.md) | FatalErrorsStart | [FatalErrorsStart](./kibana-plugin-core-public.fatalerrorsstart.md) | +| [http](./kibana-plugin-core-public.corestart.http.md) | HttpStart | [HttpStart](./kibana-plugin-core-public.httpstart.md) | +| [i18n](./kibana-plugin-core-public.corestart.i18n.md) | I18nStart | [I18nStart](./kibana-plugin-core-public.i18nstart.md) | +| [injectedMetadata](./kibana-plugin-core-public.corestart.injectedmetadata.md) | { getInjectedVar: (name: string, defaultValue?: any) => unknown; } | exposed temporarily until https://github.com/elastic/kibana/issues/41990 done use \*only\* to retrieve config values. There is no way to set injected values in the new platform. | +| [notifications](./kibana-plugin-core-public.corestart.notifications.md) | NotificationsStart | [NotificationsStart](./kibana-plugin-core-public.notificationsstart.md) | +| [overlays](./kibana-plugin-core-public.corestart.overlays.md) | OverlayStart | [OverlayStart](./kibana-plugin-core-public.overlaystart.md) | +| [savedObjects](./kibana-plugin-core-public.corestart.savedobjects.md) | SavedObjectsStart | [SavedObjectsStart](./kibana-plugin-core-public.savedobjectsstart.md) | +| [uiSettings](./kibana-plugin-core-public.corestart.uisettings.md) | IUiSettingsClient | [IUiSettingsClient](./kibana-plugin-core-public.iuisettingsclient.md) | diff --git a/docs/development/core/public/kibana-plugin-core-public.deprecationsservicestart.md b/docs/development/core/public/kibana-plugin-core-public.deprecationsservicestart.md index 0d2c963ec554..bfc1d78f4d04 100644 --- a/docs/development/core/public/kibana-plugin-core-public.deprecationsservicestart.md +++ b/docs/development/core/public/kibana-plugin-core-public.deprecationsservicestart.md @@ -16,8 +16,8 @@ export interface DeprecationsServiceStart | Property | Type | Description | | --- | --- | --- | -| [getAllDeprecations](./kibana-plugin-core-public.deprecationsservicestart.getalldeprecations.md) | () => Promise<DomainDeprecationDetails[]> | Grabs deprecations details for all domains. | -| [getDeprecations](./kibana-plugin-core-public.deprecationsservicestart.getdeprecations.md) | (domainId: string) => Promise<DomainDeprecationDetails[]> | Grabs deprecations for a specific domain. | -| [isDeprecationResolvable](./kibana-plugin-core-public.deprecationsservicestart.isdeprecationresolvable.md) | (details: DomainDeprecationDetails) => boolean | Returns a boolean if the provided deprecation can be automatically resolvable. | -| [resolveDeprecation](./kibana-plugin-core-public.deprecationsservicestart.resolvedeprecation.md) | (details: DomainDeprecationDetails) => Promise<ResolveDeprecationResponse> | Calls the correctiveActions.api to automatically resolve the depprecation. | +| [getAllDeprecations](./kibana-plugin-core-public.deprecationsservicestart.getalldeprecations.md) | () => Promise<DomainDeprecationDetails\[\]> | Grabs deprecations details for all domains. | +| [getDeprecations](./kibana-plugin-core-public.deprecationsservicestart.getdeprecations.md) | (domainId: string) => Promise<DomainDeprecationDetails\[\]> | Grabs deprecations for a specific domain. | +| [isDeprecationResolvable](./kibana-plugin-core-public.deprecationsservicestart.isdeprecationresolvable.md) | (details: DomainDeprecationDetails) => boolean | Returns a boolean if the provided deprecation can be automatically resolvable. | +| [resolveDeprecation](./kibana-plugin-core-public.deprecationsservicestart.resolvedeprecation.md) | (details: DomainDeprecationDetails) => Promise<ResolveDeprecationResponse> | Calls the correctiveActions.api to automatically resolve the depprecation. | diff --git a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.links.md b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.links.md index 59d1f13ed89f..37524daa39c5 100644 --- a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.links.md +++ b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.links.md @@ -89,6 +89,7 @@ readonly links: { readonly range: string; readonly significant_terms: string; readonly terms: string; + readonly terms_doc_count_error: string; readonly avg: string; readonly avg_bucket: string; readonly max_bucket: string; diff --git a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md index 788f0b9de821..a1363b7a519d 100644 --- a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md +++ b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md @@ -15,7 +15,7 @@ export interface DocLinksStart | Property | Type | Description | | --- | --- | --- | -| [DOC\_LINK\_VERSION](./kibana-plugin-core-public.doclinksstart.doc_link_version.md) | string | | -| [ELASTIC\_WEBSITE\_URL](./kibana-plugin-core-public.doclinksstart.elastic_website_url.md) | string | | -| [links](./kibana-plugin-core-public.doclinksstart.links.md) | {
readonly settings: string;
readonly elasticStackGetStarted: string;
readonly apm: {
readonly kibanaSettings: string;
readonly supportedServiceMaps: string;
readonly customLinks: string;
readonly droppedTransactionSpans: string;
readonly upgrading: string;
readonly metaData: string;
};
readonly canvas: {
readonly guide: string;
};
readonly dashboard: {
readonly guide: string;
readonly drilldowns: string;
readonly drilldownsTriggerPicker: string;
readonly urlDrilldownTemplateSyntax: string;
readonly urlDrilldownVariables: string;
};
readonly discover: Record<string, string>;
readonly filebeat: {
readonly base: string;
readonly installation: string;
readonly configuration: string;
readonly elasticsearchOutput: string;
readonly elasticsearchModule: string;
readonly startup: string;
readonly exportedFields: string;
readonly suricataModule: string;
readonly zeekModule: string;
};
readonly auditbeat: {
readonly base: string;
readonly auditdModule: string;
readonly systemModule: string;
};
readonly metricbeat: {
readonly base: string;
readonly configure: string;
readonly httpEndpoint: string;
readonly install: string;
readonly start: string;
};
readonly enterpriseSearch: {
readonly base: string;
readonly appSearchBase: string;
readonly workplaceSearchBase: string;
};
readonly heartbeat: {
readonly base: string;
};
readonly libbeat: {
readonly getStarted: string;
};
readonly logstash: {
readonly base: string;
};
readonly functionbeat: {
readonly base: string;
};
readonly winlogbeat: {
readonly base: string;
};
readonly aggs: {
readonly composite: string;
readonly composite_missing_bucket: string;
readonly date_histogram: string;
readonly date_range: string;
readonly date_format_pattern: string;
readonly filter: string;
readonly filters: string;
readonly geohash_grid: string;
readonly histogram: string;
readonly ip_range: string;
readonly range: string;
readonly significant_terms: string;
readonly terms: string;
readonly avg: string;
readonly avg_bucket: string;
readonly max_bucket: string;
readonly min_bucket: string;
readonly sum_bucket: string;
readonly cardinality: string;
readonly count: string;
readonly cumulative_sum: string;
readonly derivative: string;
readonly geo_bounds: string;
readonly geo_centroid: string;
readonly max: string;
readonly median: string;
readonly min: string;
readonly moving_avg: string;
readonly percentile_ranks: string;
readonly serial_diff: string;
readonly std_dev: string;
readonly sum: string;
readonly top_hits: string;
};
readonly runtimeFields: {
readonly overview: string;
readonly mapping: string;
};
readonly scriptedFields: {
readonly scriptFields: string;
readonly scriptAggs: string;
readonly painless: string;
readonly painlessApi: string;
readonly painlessLangSpec: string;
readonly painlessSyntax: string;
readonly painlessWalkthrough: string;
readonly luceneExpressions: string;
};
readonly search: {
readonly sessions: string;
readonly sessionLimits: string;
};
readonly indexPatterns: {
readonly introduction: string;
readonly fieldFormattersNumber: string;
readonly fieldFormattersString: string;
readonly runtimeFields: string;
};
readonly addData: string;
readonly kibana: string;
readonly upgradeAssistant: string;
readonly rollupJobs: string;
readonly elasticsearch: Record<string, string>;
readonly siem: {
readonly privileges: string;
readonly guide: string;
readonly gettingStarted: string;
readonly ml: string;
readonly ruleChangeLog: string;
readonly detectionsReq: string;
readonly networkMap: string;
readonly troubleshootGaps: string;
};
readonly securitySolution: {
readonly trustedApps: string;
};
readonly query: {
readonly eql: string;
readonly kueryQuerySyntax: string;
readonly luceneQuerySyntax: string;
readonly percolate: string;
readonly queryDsl: string;
readonly autocompleteChanges: string;
};
readonly date: {
readonly dateMath: string;
readonly dateMathIndexNames: string;
};
readonly management: Record<string, string>;
readonly ml: Record<string, string>;
readonly transforms: Record<string, string>;
readonly visualize: Record<string, string>;
readonly apis: Readonly<{
bulkIndexAlias: string;
byteSizeUnits: string;
createAutoFollowPattern: string;
createFollower: string;
createIndex: string;
createSnapshotLifecyclePolicy: string;
createRoleMapping: string;
createRoleMappingTemplates: string;
createRollupJobsRequest: string;
createApiKey: string;
createPipeline: string;
createTransformRequest: string;
cronExpressions: string;
executeWatchActionModes: string;
indexExists: string;
openIndex: string;
putComponentTemplate: string;
painlessExecute: string;
painlessExecuteAPIContexts: string;
putComponentTemplateMetadata: string;
putSnapshotLifecyclePolicy: string;
putIndexTemplateV1: string;
putWatch: string;
simulatePipeline: string;
timeUnits: string;
updateTransform: string;
}>;
readonly observability: Readonly<{
guide: string;
infrastructureThreshold: string;
logsThreshold: string;
metricsThreshold: string;
monitorStatus: string;
monitorUptime: string;
tlsCertificate: string;
uptimeDurationAnomaly: string;
}>;
readonly alerting: Record<string, string>;
readonly maps: Record<string, string>;
readonly monitoring: Record<string, string>;
readonly security: Readonly<{
apiKeyServiceSettings: string;
clusterPrivileges: string;
elasticsearchSettings: string;
elasticsearchEnableSecurity: string;
elasticsearchEnableApiKeys: string;
indicesPrivileges: string;
kibanaTLS: string;
kibanaPrivileges: string;
mappingRoles: string;
mappingRolesFieldRules: string;
runAsPrivilege: string;
}>;
readonly spaces: Readonly<{
kibanaLegacyUrlAliases: string;
kibanaDisableLegacyUrlAliasesApi: string;
}>;
readonly watcher: Record<string, string>;
readonly ccs: Record<string, string>;
readonly plugins: Record<string, string>;
readonly snapshotRestore: Record<string, string>;
readonly ingest: Record<string, string>;
readonly fleet: Readonly<{
datastreamsILM: string;
beatsAgentComparison: string;
guide: string;
fleetServer: string;
fleetServerAddFleetServer: string;
settings: string;
settingsFleetServerHostSettings: string;
troubleshooting: string;
elasticAgent: string;
datastreams: string;
datastreamsNamingScheme: string;
installElasticAgent: string;
upgradeElasticAgent: string;
upgradeElasticAgent712lower: string;
learnMoreBlog: string;
apiKeysLearnMore: string;
}>;
readonly ecs: {
readonly guide: string;
};
readonly clients: {
readonly guide: string;
readonly goOverview: string;
readonly javaIndex: string;
readonly jsIntro: string;
readonly netGuide: string;
readonly perlGuide: string;
readonly phpGuide: string;
readonly pythonGuide: string;
readonly rubyOverview: string;
readonly rustGuide: string;
};
readonly endpoints: {
readonly troubleshooting: string;
};
} | | +| [DOC\_LINK\_VERSION](./kibana-plugin-core-public.doclinksstart.doc_link_version.md) | string | | +| [ELASTIC\_WEBSITE\_URL](./kibana-plugin-core-public.doclinksstart.elastic_website_url.md) | string | | +| [links](./kibana-plugin-core-public.doclinksstart.links.md) | { readonly settings: string; readonly elasticStackGetStarted: string; readonly upgrade: { readonly upgradingElasticStack: string; }; readonly apm: { readonly kibanaSettings: string; readonly supportedServiceMaps: string; readonly customLinks: string; readonly droppedTransactionSpans: string; readonly upgrading: string; readonly metaData: string; }; readonly canvas: { readonly guide: string; }; readonly dashboard: { readonly guide: string; readonly drilldowns: string; readonly drilldownsTriggerPicker: string; readonly urlDrilldownTemplateSyntax: string; readonly urlDrilldownVariables: string; }; readonly discover: Record<string, string>; readonly filebeat: { readonly base: string; readonly installation: string; readonly configuration: string; readonly elasticsearchOutput: string; readonly elasticsearchModule: string; readonly startup: string; readonly exportedFields: string; readonly suricataModule: string; readonly zeekModule: string; }; readonly auditbeat: { readonly base: string; readonly auditdModule: string; readonly systemModule: string; }; readonly metricbeat: { readonly base: string; readonly configure: string; readonly httpEndpoint: string; readonly install: string; readonly start: string; }; readonly enterpriseSearch: { readonly base: string; readonly appSearchBase: string; readonly workplaceSearchBase: string; }; readonly heartbeat: { readonly base: string; }; readonly libbeat: { readonly getStarted: string; }; readonly logstash: { readonly base: string; }; readonly functionbeat: { readonly base: string; }; readonly winlogbeat: { readonly base: string; }; readonly aggs: { readonly composite: string; readonly composite\_missing\_bucket: string; readonly date\_histogram: string; readonly date\_range: string; readonly date\_format\_pattern: string; readonly filter: string; readonly filters: string; readonly geohash\_grid: string; readonly histogram: string; readonly ip\_range: string; readonly range: string; readonly significant\_terms: string; readonly terms: string; readonly terms\_doc\_count\_error: string; readonly avg: string; readonly avg\_bucket: string; readonly max\_bucket: string; readonly min\_bucket: string; readonly sum\_bucket: string; readonly cardinality: string; readonly count: string; readonly cumulative\_sum: string; readonly derivative: string; readonly geo\_bounds: string; readonly geo\_centroid: string; readonly max: string; readonly median: string; readonly min: string; readonly moving\_avg: string; readonly percentile\_ranks: string; readonly serial\_diff: string; readonly std\_dev: string; readonly sum: string; readonly top\_hits: string; }; readonly runtimeFields: { readonly overview: string; readonly mapping: string; }; readonly scriptedFields: { readonly scriptFields: string; readonly scriptAggs: string; readonly painless: string; readonly painlessApi: string; readonly painlessLangSpec: string; readonly painlessSyntax: string; readonly painlessWalkthrough: string; readonly luceneExpressions: string; }; readonly search: { readonly sessions: string; readonly sessionLimits: string; }; readonly indexPatterns: { readonly introduction: string; readonly fieldFormattersNumber: string; readonly fieldFormattersString: string; readonly runtimeFields: string; }; readonly addData: string; readonly kibana: string; readonly upgradeAssistant: { readonly overview: string; readonly batchReindex: string; readonly remoteReindex: string; }; readonly rollupJobs: string; readonly elasticsearch: Record<string, string>; readonly siem: { readonly privileges: string; readonly guide: string; readonly gettingStarted: string; readonly ml: string; readonly ruleChangeLog: string; readonly detectionsReq: string; readonly networkMap: string; readonly troubleshootGaps: string; }; readonly securitySolution: { readonly trustedApps: string; }; readonly query: { readonly eql: string; readonly kueryQuerySyntax: string; readonly luceneQuerySyntax: string; readonly percolate: string; readonly queryDsl: string; readonly autocompleteChanges: string; }; readonly date: { readonly dateMath: string; readonly dateMathIndexNames: string; }; readonly management: Record<string, string>; readonly ml: Record<string, string>; readonly transforms: Record<string, string>; readonly visualize: Record<string, string>; readonly apis: Readonly<{ bulkIndexAlias: string; byteSizeUnits: string; createAutoFollowPattern: string; createFollower: string; createIndex: string; createSnapshotLifecyclePolicy: string; createRoleMapping: string; createRoleMappingTemplates: string; createRollupJobsRequest: string; createApiKey: string; createPipeline: string; createTransformRequest: string; cronExpressions: string; executeWatchActionModes: string; indexExists: string; openIndex: string; putComponentTemplate: string; painlessExecute: string; painlessExecuteAPIContexts: string; putComponentTemplateMetadata: string; putSnapshotLifecyclePolicy: string; putIndexTemplateV1: string; putWatch: string; simulatePipeline: string; timeUnits: string; updateTransform: string; }>; readonly observability: Readonly<{ guide: string; infrastructureThreshold: string; logsThreshold: string; metricsThreshold: string; monitorStatus: string; monitorUptime: string; tlsCertificate: string; uptimeDurationAnomaly: string; }>; readonly alerting: Record<string, string>; readonly maps: Record<string, string>; readonly monitoring: Record<string, string>; readonly security: Readonly<{ apiKeyServiceSettings: string; clusterPrivileges: string; elasticsearchSettings: string; elasticsearchEnableSecurity: string; elasticsearchEnableApiKeys: string; indicesPrivileges: string; kibanaTLS: string; kibanaPrivileges: string; mappingRoles: string; mappingRolesFieldRules: string; runAsPrivilege: string; }>; readonly spaces: Readonly<{ kibanaLegacyUrlAliases: string; kibanaDisableLegacyUrlAliasesApi: string; }>; readonly watcher: Record<string, string>; readonly ccs: Record<string, string>; readonly plugins: Record<string, string>; readonly snapshotRestore: Record<string, string>; readonly ingest: Record<string, string>; readonly fleet: Readonly<{ datastreamsILM: string; beatsAgentComparison: string; guide: string; fleetServer: string; fleetServerAddFleetServer: string; settings: string; settingsFleetServerHostSettings: string; settingsFleetServerProxySettings: string; troubleshooting: string; elasticAgent: string; datastreams: string; datastreamsNamingScheme: string; installElasticAgent: string; upgradeElasticAgent: string; upgradeElasticAgent712lower: string; learnMoreBlog: string; apiKeysLearnMore: string; onPremRegistry: string; }>; readonly ecs: { readonly guide: string; }; readonly clients: { readonly guide: string; readonly goOverview: string; readonly javaIndex: string; readonly jsIntro: string; readonly netGuide: string; readonly perlGuide: string; readonly phpGuide: string; readonly pythonGuide: string; readonly rubyOverview: string; readonly rustGuide: string; }; readonly endpoints: { readonly troubleshooting: string; }; } | | diff --git a/docs/development/core/public/kibana-plugin-core-public.errortoastoptions.md b/docs/development/core/public/kibana-plugin-core-public.errortoastoptions.md index dc256e6f5bc0..c2bddc58d9c3 100644 --- a/docs/development/core/public/kibana-plugin-core-public.errortoastoptions.md +++ b/docs/development/core/public/kibana-plugin-core-public.errortoastoptions.md @@ -11,11 +11,12 @@ Options available for [IToasts](./kibana-plugin-core-public.itoasts.md) error AP ```typescript export interface ErrorToastOptions extends ToastOptions ``` +Extends: ToastOptions ## Properties | Property | Type | Description | | --- | --- | --- | -| [title](./kibana-plugin-core-public.errortoastoptions.title.md) | string | The title of the toast and the dialog when expanding the message. | -| [toastMessage](./kibana-plugin-core-public.errortoastoptions.toastmessage.md) | string | The message to be shown in the toast. If this is not specified the error's message will be shown in the toast instead. Overwriting that message can be used to provide more user-friendly toasts. If you specify this, the error message will still be shown in the detailed error modal. | +| [title](./kibana-plugin-core-public.errortoastoptions.title.md) | string | The title of the toast and the dialog when expanding the message. | +| [toastMessage?](./kibana-plugin-core-public.errortoastoptions.toastmessage.md) | string | (Optional) The message to be shown in the toast. If this is not specified the error's message will be shown in the toast instead. Overwriting that message can be used to provide more user-friendly toasts. If you specify this, the error message will still be shown in the detailed error modal. | diff --git a/docs/development/core/public/kibana-plugin-core-public.fatalerrorinfo.md b/docs/development/core/public/kibana-plugin-core-public.fatalerrorinfo.md index 51facf549bd0..9b2803e4f12e 100644 --- a/docs/development/core/public/kibana-plugin-core-public.fatalerrorinfo.md +++ b/docs/development/core/public/kibana-plugin-core-public.fatalerrorinfo.md @@ -16,6 +16,6 @@ export interface FatalErrorInfo | Property | Type | Description | | --- | --- | --- | -| [message](./kibana-plugin-core-public.fatalerrorinfo.message.md) | string | | -| [stack](./kibana-plugin-core-public.fatalerrorinfo.stack.md) | string | undefined | | +| [message](./kibana-plugin-core-public.fatalerrorinfo.message.md) | string | | +| [stack](./kibana-plugin-core-public.fatalerrorinfo.stack.md) | string \| undefined | | diff --git a/docs/development/core/public/kibana-plugin-core-public.fatalerrorssetup.md b/docs/development/core/public/kibana-plugin-core-public.fatalerrorssetup.md index 31abcf13b820..1f27fd52b7e3 100644 --- a/docs/development/core/public/kibana-plugin-core-public.fatalerrorssetup.md +++ b/docs/development/core/public/kibana-plugin-core-public.fatalerrorssetup.md @@ -16,6 +16,6 @@ export interface FatalErrorsSetup | Property | Type | Description | | --- | --- | --- | -| [add](./kibana-plugin-core-public.fatalerrorssetup.add.md) | (error: string | Error, source?: string) => never | Add a new fatal error. This will stop the Kibana Public Core and display a fatal error screen with details about the Kibana build and the error. | -| [get$](./kibana-plugin-core-public.fatalerrorssetup.get_.md) | () => Rx.Observable<FatalErrorInfo> | An Observable that will emit whenever a fatal error is added with add() | +| [add](./kibana-plugin-core-public.fatalerrorssetup.add.md) | (error: string \| Error, source?: string) => never | Add a new fatal error. This will stop the Kibana Public Core and display a fatal error screen with details about the Kibana build and the error. | +| [get$](./kibana-plugin-core-public.fatalerrorssetup.get_.md) | () => Rx.Observable<FatalErrorInfo> | An Observable that will emit whenever a fatal error is added with add() | diff --git a/docs/development/core/public/kibana-plugin-core-public.httpfetchoptions.md b/docs/development/core/public/kibana-plugin-core-public.httpfetchoptions.md index 45a48372b451..9a7f05ab9cd3 100644 --- a/docs/development/core/public/kibana-plugin-core-public.httpfetchoptions.md +++ b/docs/development/core/public/kibana-plugin-core-public.httpfetchoptions.md @@ -11,15 +11,16 @@ All options that may be used with a [HttpHandler](./kibana-plugin-core-public.ht ```typescript export interface HttpFetchOptions extends HttpRequestInit ``` +Extends: HttpRequestInit ## Properties | Property | Type | Description | | --- | --- | --- | -| [asResponse](./kibana-plugin-core-public.httpfetchoptions.asresponse.md) | boolean | When true the return type of [HttpHandler](./kibana-plugin-core-public.httphandler.md) will be an [HttpResponse](./kibana-plugin-core-public.httpresponse.md) with detailed request and response information. When false, the return type will just be the parsed response body. Defaults to false. | -| [asSystemRequest](./kibana-plugin-core-public.httpfetchoptions.assystemrequest.md) | boolean | Whether or not the request should include the "system request" header to differentiate an end user request from Kibana internal request. Can be read on the server-side using KibanaRequest\#isSystemRequest. Defaults to false. | -| [context](./kibana-plugin-core-public.httpfetchoptions.context.md) | KibanaExecutionContext | | -| [headers](./kibana-plugin-core-public.httpfetchoptions.headers.md) | HttpHeadersInit | Headers to send with the request. See [HttpHeadersInit](./kibana-plugin-core-public.httpheadersinit.md). | -| [prependBasePath](./kibana-plugin-core-public.httpfetchoptions.prependbasepath.md) | boolean | Whether or not the request should automatically prepend the basePath. Defaults to true. | -| [query](./kibana-plugin-core-public.httpfetchoptions.query.md) | HttpFetchQuery | The query string for an HTTP request. See [HttpFetchQuery](./kibana-plugin-core-public.httpfetchquery.md). | +| [asResponse?](./kibana-plugin-core-public.httpfetchoptions.asresponse.md) | boolean | (Optional) When true the return type of [HttpHandler](./kibana-plugin-core-public.httphandler.md) will be an [HttpResponse](./kibana-plugin-core-public.httpresponse.md) with detailed request and response information. When false, the return type will just be the parsed response body. Defaults to false. | +| [asSystemRequest?](./kibana-plugin-core-public.httpfetchoptions.assystemrequest.md) | boolean | (Optional) Whether or not the request should include the "system request" header to differentiate an end user request from Kibana internal request. Can be read on the server-side using KibanaRequest\#isSystemRequest. Defaults to false. | +| [context?](./kibana-plugin-core-public.httpfetchoptions.context.md) | KibanaExecutionContext | (Optional) | +| [headers?](./kibana-plugin-core-public.httpfetchoptions.headers.md) | HttpHeadersInit | (Optional) Headers to send with the request. See [HttpHeadersInit](./kibana-plugin-core-public.httpheadersinit.md). | +| [prependBasePath?](./kibana-plugin-core-public.httpfetchoptions.prependbasepath.md) | boolean | (Optional) Whether or not the request should automatically prepend the basePath. Defaults to true. | +| [query?](./kibana-plugin-core-public.httpfetchoptions.query.md) | HttpFetchQuery | (Optional) The query string for an HTTP request. See [HttpFetchQuery](./kibana-plugin-core-public.httpfetchquery.md). | diff --git a/docs/development/core/public/kibana-plugin-core-public.httpfetchoptionswithpath.md b/docs/development/core/public/kibana-plugin-core-public.httpfetchoptionswithpath.md index 37ea559605d3..78155adaf627 100644 --- a/docs/development/core/public/kibana-plugin-core-public.httpfetchoptionswithpath.md +++ b/docs/development/core/public/kibana-plugin-core-public.httpfetchoptionswithpath.md @@ -11,10 +11,11 @@ Similar to [HttpFetchOptions](./kibana-plugin-core-public.httpfetchoptions.md) b ```typescript export interface HttpFetchOptionsWithPath extends HttpFetchOptions ``` +Extends: HttpFetchOptions ## Properties | Property | Type | Description | | --- | --- | --- | -| [path](./kibana-plugin-core-public.httpfetchoptionswithpath.path.md) | string | | +| [path](./kibana-plugin-core-public.httpfetchoptionswithpath.path.md) | string | | diff --git a/docs/development/core/public/kibana-plugin-core-public.httpinterceptor.md b/docs/development/core/public/kibana-plugin-core-public.httpinterceptor.md index 84dd88eff9e4..e1843b1a5298 100644 --- a/docs/development/core/public/kibana-plugin-core-public.httpinterceptor.md +++ b/docs/development/core/public/kibana-plugin-core-public.httpinterceptor.md @@ -16,8 +16,8 @@ export interface HttpInterceptor | Method | Description | | --- | --- | -| [request(fetchOptions, controller)](./kibana-plugin-core-public.httpinterceptor.request.md) | Define an interceptor to be executed before a request is sent. | -| [requestError(httpErrorRequest, controller)](./kibana-plugin-core-public.httpinterceptor.requesterror.md) | Define an interceptor to be executed if a request interceptor throws an error or returns a rejected Promise. | -| [response(httpResponse, controller)](./kibana-plugin-core-public.httpinterceptor.response.md) | Define an interceptor to be executed after a response is received. | -| [responseError(httpErrorResponse, controller)](./kibana-plugin-core-public.httpinterceptor.responseerror.md) | Define an interceptor to be executed if a response interceptor throws an error or returns a rejected Promise. | +| [request(fetchOptions, controller)?](./kibana-plugin-core-public.httpinterceptor.request.md) | (Optional) Define an interceptor to be executed before a request is sent. | +| [requestError(httpErrorRequest, controller)?](./kibana-plugin-core-public.httpinterceptor.requesterror.md) | (Optional) Define an interceptor to be executed if a request interceptor throws an error or returns a rejected Promise. | +| [response(httpResponse, controller)?](./kibana-plugin-core-public.httpinterceptor.response.md) | (Optional) Define an interceptor to be executed after a response is received. | +| [responseError(httpErrorResponse, controller)?](./kibana-plugin-core-public.httpinterceptor.responseerror.md) | (Optional) Define an interceptor to be executed if a response interceptor throws an error or returns a rejected Promise. | diff --git a/docs/development/core/public/kibana-plugin-core-public.httpinterceptor.request.md b/docs/development/core/public/kibana-plugin-core-public.httpinterceptor.request.md index d9051c5f8d72..95181e6d509f 100644 --- a/docs/development/core/public/kibana-plugin-core-public.httpinterceptor.request.md +++ b/docs/development/core/public/kibana-plugin-core-public.httpinterceptor.request.md @@ -16,10 +16,10 @@ request?(fetchOptions: Readonly, controller: IHttpInte | Parameter | Type | Description | | --- | --- | --- | -| fetchOptions | Readonly<HttpFetchOptionsWithPath> | | -| controller | IHttpInterceptController | | +| fetchOptions | Readonly<HttpFetchOptionsWithPath> | | +| controller | IHttpInterceptController | [IHttpInterceptController](./kibana-plugin-core-public.ihttpinterceptcontroller.md) | Returns: -`MaybePromise> | void` +MaybePromise<Partial<HttpFetchOptionsWithPath>> \| void diff --git a/docs/development/core/public/kibana-plugin-core-public.httpinterceptor.requesterror.md b/docs/development/core/public/kibana-plugin-core-public.httpinterceptor.requesterror.md index 16980d67fd81..c2bd14a6d1ea 100644 --- a/docs/development/core/public/kibana-plugin-core-public.httpinterceptor.requesterror.md +++ b/docs/development/core/public/kibana-plugin-core-public.httpinterceptor.requesterror.md @@ -16,10 +16,10 @@ requestError?(httpErrorRequest: HttpInterceptorRequestError, controller: IHttpIn | Parameter | Type | Description | | --- | --- | --- | -| httpErrorRequest | HttpInterceptorRequestError | | -| controller | IHttpInterceptController | | +| httpErrorRequest | HttpInterceptorRequestError | [HttpInterceptorRequestError](./kibana-plugin-core-public.httpinterceptorrequesterror.md) | +| controller | IHttpInterceptController | [IHttpInterceptController](./kibana-plugin-core-public.ihttpinterceptcontroller.md) | Returns: -`MaybePromise> | void` +MaybePromise<Partial<HttpFetchOptionsWithPath>> \| void diff --git a/docs/development/core/public/kibana-plugin-core-public.httpinterceptor.response.md b/docs/development/core/public/kibana-plugin-core-public.httpinterceptor.response.md index 374c6bfe09a9..40cfeffacc0c 100644 --- a/docs/development/core/public/kibana-plugin-core-public.httpinterceptor.response.md +++ b/docs/development/core/public/kibana-plugin-core-public.httpinterceptor.response.md @@ -16,10 +16,10 @@ response?(httpResponse: HttpResponse, controller: IHttpInterceptController): May | Parameter | Type | Description | | --- | --- | --- | -| httpResponse | HttpResponse | | -| controller | IHttpInterceptController | | +| httpResponse | HttpResponse | [HttpResponse](./kibana-plugin-core-public.httpresponse.md) | +| controller | IHttpInterceptController | [IHttpInterceptController](./kibana-plugin-core-public.ihttpinterceptcontroller.md) | Returns: -`MaybePromise | void` +MaybePromise<IHttpResponseInterceptorOverrides> \| void diff --git a/docs/development/core/public/kibana-plugin-core-public.httpinterceptor.responseerror.md b/docs/development/core/public/kibana-plugin-core-public.httpinterceptor.responseerror.md index fa0acd323fd7..d9be2e87761f 100644 --- a/docs/development/core/public/kibana-plugin-core-public.httpinterceptor.responseerror.md +++ b/docs/development/core/public/kibana-plugin-core-public.httpinterceptor.responseerror.md @@ -16,10 +16,10 @@ responseError?(httpErrorResponse: HttpInterceptorResponseError, controller: IHtt | Parameter | Type | Description | | --- | --- | --- | -| httpErrorResponse | HttpInterceptorResponseError | | -| controller | IHttpInterceptController | | +| httpErrorResponse | HttpInterceptorResponseError | [HttpInterceptorResponseError](./kibana-plugin-core-public.httpinterceptorresponseerror.md) | +| controller | IHttpInterceptController | [IHttpInterceptController](./kibana-plugin-core-public.ihttpinterceptcontroller.md) | Returns: -`MaybePromise | void` +MaybePromise<IHttpResponseInterceptorOverrides> \| void diff --git a/docs/development/core/public/kibana-plugin-core-public.httpinterceptorrequesterror.md b/docs/development/core/public/kibana-plugin-core-public.httpinterceptorrequesterror.md index 69eadf43cb87..499bc61ce68a 100644 --- a/docs/development/core/public/kibana-plugin-core-public.httpinterceptorrequesterror.md +++ b/docs/development/core/public/kibana-plugin-core-public.httpinterceptorrequesterror.md @@ -15,6 +15,6 @@ export interface HttpInterceptorRequestError | Property | Type | Description | | --- | --- | --- | -| [error](./kibana-plugin-core-public.httpinterceptorrequesterror.error.md) | Error | | -| [fetchOptions](./kibana-plugin-core-public.httpinterceptorrequesterror.fetchoptions.md) | Readonly<HttpFetchOptionsWithPath> | | +| [error](./kibana-plugin-core-public.httpinterceptorrequesterror.error.md) | Error | | +| [fetchOptions](./kibana-plugin-core-public.httpinterceptorrequesterror.fetchoptions.md) | Readonly<HttpFetchOptionsWithPath> | | diff --git a/docs/development/core/public/kibana-plugin-core-public.httpinterceptorresponseerror.md b/docs/development/core/public/kibana-plugin-core-public.httpinterceptorresponseerror.md index 6d2b8c6ec996..014cebeb3ec4 100644 --- a/docs/development/core/public/kibana-plugin-core-public.httpinterceptorresponseerror.md +++ b/docs/development/core/public/kibana-plugin-core-public.httpinterceptorresponseerror.md @@ -10,11 +10,12 @@ ```typescript export interface HttpInterceptorResponseError extends HttpResponse ``` +Extends: HttpResponse ## Properties | Property | Type | Description | | --- | --- | --- | -| [error](./kibana-plugin-core-public.httpinterceptorresponseerror.error.md) | Error | IHttpFetchError | | -| [request](./kibana-plugin-core-public.httpinterceptorresponseerror.request.md) | Readonly<Request> | | +| [error](./kibana-plugin-core-public.httpinterceptorresponseerror.error.md) | Error \| IHttpFetchError | | +| [request](./kibana-plugin-core-public.httpinterceptorresponseerror.request.md) | Readonly<Request> | | diff --git a/docs/development/core/public/kibana-plugin-core-public.httprequestinit.md b/docs/development/core/public/kibana-plugin-core-public.httprequestinit.md index 496fba97491e..6b0e054ff1eb 100644 --- a/docs/development/core/public/kibana-plugin-core-public.httprequestinit.md +++ b/docs/development/core/public/kibana-plugin-core-public.httprequestinit.md @@ -16,17 +16,17 @@ export interface HttpRequestInit | Property | Type | Description | | --- | --- | --- | -| [body](./kibana-plugin-core-public.httprequestinit.body.md) | BodyInit | null | A BodyInit object or null to set request's body. | -| [cache](./kibana-plugin-core-public.httprequestinit.cache.md) | RequestCache | The cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching. | -| [credentials](./kibana-plugin-core-public.httprequestinit.credentials.md) | RequestCredentials | The credentials mode associated with request, which is a string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL. | -| [headers](./kibana-plugin-core-public.httprequestinit.headers.md) | HttpHeadersInit | [HttpHeadersInit](./kibana-plugin-core-public.httpheadersinit.md) | -| [integrity](./kibana-plugin-core-public.httprequestinit.integrity.md) | string | Subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. | -| [keepalive](./kibana-plugin-core-public.httprequestinit.keepalive.md) | boolean | Whether or not request can outlive the global in which it was created. | -| [method](./kibana-plugin-core-public.httprequestinit.method.md) | string | HTTP method, which is "GET" by default. | -| [mode](./kibana-plugin-core-public.httprequestinit.mode.md) | RequestMode | The mode associated with request, which is a string indicating whether the request will use CORS, or will be restricted to same-origin URLs. | -| [redirect](./kibana-plugin-core-public.httprequestinit.redirect.md) | RequestRedirect | The redirect mode associated with request, which is a string indicating how redirects for the request will be handled during fetching. A request will follow redirects by default. | -| [referrer](./kibana-plugin-core-public.httprequestinit.referrer.md) | string | The referrer of request. Its value can be a same-origin URL if explicitly set in init, the empty string to indicate no referrer, and "about:client" when defaulting to the global's default. This is used during fetching to determine the value of the Referer header of the request being made. | -| [referrerPolicy](./kibana-plugin-core-public.httprequestinit.referrerpolicy.md) | ReferrerPolicy | The referrer policy associated with request. This is used during fetching to compute the value of the request's referrer. | -| [signal](./kibana-plugin-core-public.httprequestinit.signal.md) | AbortSignal | null | Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler. | -| [window](./kibana-plugin-core-public.httprequestinit.window.md) | null | Can only be null. Used to disassociate request from any Window. | +| [body?](./kibana-plugin-core-public.httprequestinit.body.md) | BodyInit \| null | (Optional) A BodyInit object or null to set request's body. | +| [cache?](./kibana-plugin-core-public.httprequestinit.cache.md) | RequestCache | (Optional) The cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching. | +| [credentials?](./kibana-plugin-core-public.httprequestinit.credentials.md) | RequestCredentials | (Optional) The credentials mode associated with request, which is a string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL. | +| [headers?](./kibana-plugin-core-public.httprequestinit.headers.md) | HttpHeadersInit | (Optional) [HttpHeadersInit](./kibana-plugin-core-public.httpheadersinit.md) | +| [integrity?](./kibana-plugin-core-public.httprequestinit.integrity.md) | string | (Optional) Subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. | +| [keepalive?](./kibana-plugin-core-public.httprequestinit.keepalive.md) | boolean | (Optional) Whether or not request can outlive the global in which it was created. | +| [method?](./kibana-plugin-core-public.httprequestinit.method.md) | string | (Optional) HTTP method, which is "GET" by default. | +| [mode?](./kibana-plugin-core-public.httprequestinit.mode.md) | RequestMode | (Optional) The mode associated with request, which is a string indicating whether the request will use CORS, or will be restricted to same-origin URLs. | +| [redirect?](./kibana-plugin-core-public.httprequestinit.redirect.md) | RequestRedirect | (Optional) The redirect mode associated with request, which is a string indicating how redirects for the request will be handled during fetching. A request will follow redirects by default. | +| [referrer?](./kibana-plugin-core-public.httprequestinit.referrer.md) | string | (Optional) The referrer of request. Its value can be a same-origin URL if explicitly set in init, the empty string to indicate no referrer, and "about:client" when defaulting to the global's default. This is used during fetching to determine the value of the Referer header of the request being made. | +| [referrerPolicy?](./kibana-plugin-core-public.httprequestinit.referrerpolicy.md) | ReferrerPolicy | (Optional) The referrer policy associated with request. This is used during fetching to compute the value of the request's referrer. | +| [signal?](./kibana-plugin-core-public.httprequestinit.signal.md) | AbortSignal \| null | (Optional) Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler. | +| [window?](./kibana-plugin-core-public.httprequestinit.window.md) | null | (Optional) Can only be null. Used to disassociate request from any Window. | diff --git a/docs/development/core/public/kibana-plugin-core-public.httpresponse.md b/docs/development/core/public/kibana-plugin-core-public.httpresponse.md index dcbfa556da65..c0a3644ecaf2 100644 --- a/docs/development/core/public/kibana-plugin-core-public.httpresponse.md +++ b/docs/development/core/public/kibana-plugin-core-public.httpresponse.md @@ -15,8 +15,8 @@ export interface HttpResponse | Property | Type | Description | | --- | --- | --- | -| [body](./kibana-plugin-core-public.httpresponse.body.md) | TResponseBody | Parsed body received, may be undefined if there was an error. | -| [fetchOptions](./kibana-plugin-core-public.httpresponse.fetchoptions.md) | Readonly<HttpFetchOptionsWithPath> | The original [HttpFetchOptionsWithPath](./kibana-plugin-core-public.httpfetchoptionswithpath.md) used to send this request. | -| [request](./kibana-plugin-core-public.httpresponse.request.md) | Readonly<Request> | Raw request sent to Kibana server. | -| [response](./kibana-plugin-core-public.httpresponse.response.md) | Readonly<Response> | Raw response received, may be undefined if there was an error. | +| [body?](./kibana-plugin-core-public.httpresponse.body.md) | TResponseBody | (Optional) Parsed body received, may be undefined if there was an error. | +| [fetchOptions](./kibana-plugin-core-public.httpresponse.fetchoptions.md) | Readonly<HttpFetchOptionsWithPath> | The original [HttpFetchOptionsWithPath](./kibana-plugin-core-public.httpfetchoptionswithpath.md) used to send this request. | +| [request](./kibana-plugin-core-public.httpresponse.request.md) | Readonly<Request> | Raw request sent to Kibana server. | +| [response?](./kibana-plugin-core-public.httpresponse.response.md) | Readonly<Response> | (Optional) Raw response received, may be undefined if there was an error. | diff --git a/docs/development/core/public/kibana-plugin-core-public.httpsetup.addloadingcountsource.md b/docs/development/core/public/kibana-plugin-core-public.httpsetup.addloadingcountsource.md index 71746b7b1b73..7962772dbaa5 100644 --- a/docs/development/core/public/kibana-plugin-core-public.httpsetup.addloadingcountsource.md +++ b/docs/development/core/public/kibana-plugin-core-public.httpsetup.addloadingcountsource.md @@ -16,9 +16,9 @@ addLoadingCountSource(countSource$: Observable): void; | Parameter | Type | Description | | --- | --- | --- | -| countSource$ | Observable<number> | | +| countSource$ | Observable<number> | an Observable to subscribe to for loading count updates. | Returns: -`void` +void diff --git a/docs/development/core/public/kibana-plugin-core-public.httpsetup.getloadingcount_.md b/docs/development/core/public/kibana-plugin-core-public.httpsetup.getloadingcount_.md index d60826f3ce5f..e10278470f54 100644 --- a/docs/development/core/public/kibana-plugin-core-public.httpsetup.getloadingcount_.md +++ b/docs/development/core/public/kibana-plugin-core-public.httpsetup.getloadingcount_.md @@ -13,5 +13,5 @@ getLoadingCount$(): Observable; ``` Returns: -`Observable` +Observable<number> diff --git a/docs/development/core/public/kibana-plugin-core-public.httpsetup.intercept.md b/docs/development/core/public/kibana-plugin-core-public.httpsetup.intercept.md index d774d9896a92..27962d3c3867 100644 --- a/docs/development/core/public/kibana-plugin-core-public.httpsetup.intercept.md +++ b/docs/development/core/public/kibana-plugin-core-public.httpsetup.intercept.md @@ -16,11 +16,11 @@ intercept(interceptor: HttpInterceptor): () => void; | Parameter | Type | Description | | --- | --- | --- | -| interceptor | HttpInterceptor | | +| interceptor | HttpInterceptor | a [HttpInterceptor](./kibana-plugin-core-public.httpinterceptor.md) | Returns: -`() => void` +() => void a function for removing the attached interceptor. diff --git a/docs/development/core/public/kibana-plugin-core-public.httpsetup.md b/docs/development/core/public/kibana-plugin-core-public.httpsetup.md index a921110018c7..2d8116b0eeba 100644 --- a/docs/development/core/public/kibana-plugin-core-public.httpsetup.md +++ b/docs/development/core/public/kibana-plugin-core-public.httpsetup.md @@ -15,17 +15,17 @@ export interface HttpSetup | Property | Type | Description | | --- | --- | --- | -| [anonymousPaths](./kibana-plugin-core-public.httpsetup.anonymouspaths.md) | IAnonymousPaths | APIs for denoting certain paths for not requiring authentication | -| [basePath](./kibana-plugin-core-public.httpsetup.basepath.md) | IBasePath | APIs for manipulating the basePath on URL segments. See [IBasePath](./kibana-plugin-core-public.ibasepath.md) | -| [delete](./kibana-plugin-core-public.httpsetup.delete.md) | HttpHandler | Makes an HTTP request with the DELETE method. See [HttpHandler](./kibana-plugin-core-public.httphandler.md) for options. | -| [externalUrl](./kibana-plugin-core-public.httpsetup.externalurl.md) | IExternalUrl | | -| [fetch](./kibana-plugin-core-public.httpsetup.fetch.md) | HttpHandler | Makes an HTTP request. Defaults to a GET request unless overridden. See [HttpHandler](./kibana-plugin-core-public.httphandler.md) for options. | -| [get](./kibana-plugin-core-public.httpsetup.get.md) | HttpHandler | Makes an HTTP request with the GET method. See [HttpHandler](./kibana-plugin-core-public.httphandler.md) for options. | -| [head](./kibana-plugin-core-public.httpsetup.head.md) | HttpHandler | Makes an HTTP request with the HEAD method. See [HttpHandler](./kibana-plugin-core-public.httphandler.md) for options. | -| [options](./kibana-plugin-core-public.httpsetup.options.md) | HttpHandler | Makes an HTTP request with the OPTIONS method. See [HttpHandler](./kibana-plugin-core-public.httphandler.md) for options. | -| [patch](./kibana-plugin-core-public.httpsetup.patch.md) | HttpHandler | Makes an HTTP request with the PATCH method. See [HttpHandler](./kibana-plugin-core-public.httphandler.md) for options. | -| [post](./kibana-plugin-core-public.httpsetup.post.md) | HttpHandler | Makes an HTTP request with the POST method. See [HttpHandler](./kibana-plugin-core-public.httphandler.md) for options. | -| [put](./kibana-plugin-core-public.httpsetup.put.md) | HttpHandler | Makes an HTTP request with the PUT method. See [HttpHandler](./kibana-plugin-core-public.httphandler.md) for options. | +| [anonymousPaths](./kibana-plugin-core-public.httpsetup.anonymouspaths.md) | IAnonymousPaths | APIs for denoting certain paths for not requiring authentication | +| [basePath](./kibana-plugin-core-public.httpsetup.basepath.md) | IBasePath | APIs for manipulating the basePath on URL segments. See [IBasePath](./kibana-plugin-core-public.ibasepath.md) | +| [delete](./kibana-plugin-core-public.httpsetup.delete.md) | HttpHandler | Makes an HTTP request with the DELETE method. See [HttpHandler](./kibana-plugin-core-public.httphandler.md) for options. | +| [externalUrl](./kibana-plugin-core-public.httpsetup.externalurl.md) | IExternalUrl | | +| [fetch](./kibana-plugin-core-public.httpsetup.fetch.md) | HttpHandler | Makes an HTTP request. Defaults to a GET request unless overridden. See [HttpHandler](./kibana-plugin-core-public.httphandler.md) for options. | +| [get](./kibana-plugin-core-public.httpsetup.get.md) | HttpHandler | Makes an HTTP request with the GET method. See [HttpHandler](./kibana-plugin-core-public.httphandler.md) for options. | +| [head](./kibana-plugin-core-public.httpsetup.head.md) | HttpHandler | Makes an HTTP request with the HEAD method. See [HttpHandler](./kibana-plugin-core-public.httphandler.md) for options. | +| [options](./kibana-plugin-core-public.httpsetup.options.md) | HttpHandler | Makes an HTTP request with the OPTIONS method. See [HttpHandler](./kibana-plugin-core-public.httphandler.md) for options. | +| [patch](./kibana-plugin-core-public.httpsetup.patch.md) | HttpHandler | Makes an HTTP request with the PATCH method. See [HttpHandler](./kibana-plugin-core-public.httphandler.md) for options. | +| [post](./kibana-plugin-core-public.httpsetup.post.md) | HttpHandler | Makes an HTTP request with the POST method. See [HttpHandler](./kibana-plugin-core-public.httphandler.md) for options. | +| [put](./kibana-plugin-core-public.httpsetup.put.md) | HttpHandler | Makes an HTTP request with the PUT method. See [HttpHandler](./kibana-plugin-core-public.httphandler.md) for options. | ## Methods diff --git a/docs/development/core/public/kibana-plugin-core-public.i18nstart.md b/docs/development/core/public/kibana-plugin-core-public.i18nstart.md index 5aff9d69c459..586f5797abe6 100644 --- a/docs/development/core/public/kibana-plugin-core-public.i18nstart.md +++ b/docs/development/core/public/kibana-plugin-core-public.i18nstart.md @@ -16,5 +16,5 @@ export interface I18nStart | Property | Type | Description | | --- | --- | --- | -| [Context](./kibana-plugin-core-public.i18nstart.context.md) | ({ children }: {
children: React.ReactNode;
}) => JSX.Element | React Context provider required as the topmost component for any i18n-compatible React tree. | +| [Context](./kibana-plugin-core-public.i18nstart.context.md) | ({ children }: { children: React.ReactNode; }) => JSX.Element | React Context provider required as the topmost component for any i18n-compatible React tree. | diff --git a/docs/development/core/public/kibana-plugin-core-public.ianonymouspaths.isanonymous.md b/docs/development/core/public/kibana-plugin-core-public.ianonymouspaths.isanonymous.md index 179b4e0e8663..115285c84ea7 100644 --- a/docs/development/core/public/kibana-plugin-core-public.ianonymouspaths.isanonymous.md +++ b/docs/development/core/public/kibana-plugin-core-public.ianonymouspaths.isanonymous.md @@ -16,9 +16,9 @@ isAnonymous(path: string): boolean; | Parameter | Type | Description | | --- | --- | --- | -| path | string | | +| path | string | | Returns: -`boolean` +boolean diff --git a/docs/development/core/public/kibana-plugin-core-public.ianonymouspaths.register.md b/docs/development/core/public/kibana-plugin-core-public.ianonymouspaths.register.md index 5188ffd24f7f..bfcc0f6decd5 100644 --- a/docs/development/core/public/kibana-plugin-core-public.ianonymouspaths.register.md +++ b/docs/development/core/public/kibana-plugin-core-public.ianonymouspaths.register.md @@ -16,9 +16,9 @@ register(path: string): void; | Parameter | Type | Description | | --- | --- | --- | -| path | string | | +| path | string | | Returns: -`void` +void diff --git a/docs/development/core/public/kibana-plugin-core-public.ibasepath.md b/docs/development/core/public/kibana-plugin-core-public.ibasepath.md index 3afce9fee2a7..72a863f7d515 100644 --- a/docs/development/core/public/kibana-plugin-core-public.ibasepath.md +++ b/docs/development/core/public/kibana-plugin-core-public.ibasepath.md @@ -16,9 +16,9 @@ export interface IBasePath | Property | Type | Description | | --- | --- | --- | -| [get](./kibana-plugin-core-public.ibasepath.get.md) | () => string | Gets the basePath string. | -| [prepend](./kibana-plugin-core-public.ibasepath.prepend.md) | (url: string) => string | Prepends path with the basePath. | -| [publicBaseUrl](./kibana-plugin-core-public.ibasepath.publicbaseurl.md) | string | The server's publicly exposed base URL, if configured. Includes protocol, host, port (optional) and the [IBasePath.serverBasePath](./kibana-plugin-core-public.ibasepath.serverbasepath.md). | -| [remove](./kibana-plugin-core-public.ibasepath.remove.md) | (url: string) => string | Removes the prepended basePath from the path. | -| [serverBasePath](./kibana-plugin-core-public.ibasepath.serverbasepath.md) | string | Returns the server's root basePath as configured, without any namespace prefix.See for getting the basePath value for a specific request | +| [get](./kibana-plugin-core-public.ibasepath.get.md) | () => string | Gets the basePath string. | +| [prepend](./kibana-plugin-core-public.ibasepath.prepend.md) | (url: string) => string | Prepends path with the basePath. | +| [publicBaseUrl?](./kibana-plugin-core-public.ibasepath.publicbaseurl.md) | string | (Optional) The server's publicly exposed base URL, if configured. Includes protocol, host, port (optional) and the [IBasePath.serverBasePath](./kibana-plugin-core-public.ibasepath.serverbasepath.md). | +| [remove](./kibana-plugin-core-public.ibasepath.remove.md) | (url: string) => string | Removes the prepended basePath from the path. | +| [serverBasePath](./kibana-plugin-core-public.ibasepath.serverbasepath.md) | string | Returns the server's root basePath as configured, without any namespace prefix.See for getting the basePath value for a specific request | diff --git a/docs/development/core/public/kibana-plugin-core-public.iexternalurl.validateurl.md b/docs/development/core/public/kibana-plugin-core-public.iexternalurl.validateurl.md index 466d7cfebf54..24140effc45d 100644 --- a/docs/development/core/public/kibana-plugin-core-public.iexternalurl.validateurl.md +++ b/docs/development/core/public/kibana-plugin-core-public.iexternalurl.validateurl.md @@ -18,9 +18,9 @@ validateUrl(relativeOrAbsoluteUrl: string): URL | null; | Parameter | Type | Description | | --- | --- | --- | -| relativeOrAbsoluteUrl | string | | +| relativeOrAbsoluteUrl | string | | Returns: -`URL | null` +URL \| null diff --git a/docs/development/core/public/kibana-plugin-core-public.iexternalurlpolicy.host.md b/docs/development/core/public/kibana-plugin-core-public.iexternalurlpolicy.host.md index 842d86db45d7..1d3c9fc9bbaf 100644 --- a/docs/development/core/public/kibana-plugin-core-public.iexternalurlpolicy.host.md +++ b/docs/development/core/public/kibana-plugin-core-public.iexternalurlpolicy.host.md @@ -19,6 +19,5 @@ host?: string; // allows access to all of google.com, using any protocol. allow: true, host: 'google.com' - ``` diff --git a/docs/development/core/public/kibana-plugin-core-public.iexternalurlpolicy.md b/docs/development/core/public/kibana-plugin-core-public.iexternalurlpolicy.md index 3a1e57146097..6623fec18d97 100644 --- a/docs/development/core/public/kibana-plugin-core-public.iexternalurlpolicy.md +++ b/docs/development/core/public/kibana-plugin-core-public.iexternalurlpolicy.md @@ -16,7 +16,7 @@ export interface IExternalUrlPolicy | Property | Type | Description | | --- | --- | --- | -| [allow](./kibana-plugin-core-public.iexternalurlpolicy.allow.md) | boolean | Indicates if this policy allows or denies access to the described destination. | -| [host](./kibana-plugin-core-public.iexternalurlpolicy.host.md) | string | Optional host describing the external destination. May be combined with protocol. | -| [protocol](./kibana-plugin-core-public.iexternalurlpolicy.protocol.md) | string | Optional protocol describing the external destination. May be combined with host. | +| [allow](./kibana-plugin-core-public.iexternalurlpolicy.allow.md) | boolean | Indicates if this policy allows or denies access to the described destination. | +| [host?](./kibana-plugin-core-public.iexternalurlpolicy.host.md) | string | (Optional) Optional host describing the external destination. May be combined with protocol. | +| [protocol?](./kibana-plugin-core-public.iexternalurlpolicy.protocol.md) | string | (Optional) Optional protocol describing the external destination. May be combined with host. | diff --git a/docs/development/core/public/kibana-plugin-core-public.iexternalurlpolicy.protocol.md b/docs/development/core/public/kibana-plugin-core-public.iexternalurlpolicy.protocol.md index ac73412b6e14..6b6f8b9638bb 100644 --- a/docs/development/core/public/kibana-plugin-core-public.iexternalurlpolicy.protocol.md +++ b/docs/development/core/public/kibana-plugin-core-public.iexternalurlpolicy.protocol.md @@ -19,6 +19,5 @@ protocol?: string; // allows access to all destinations over the `https` protocol. allow: true, protocol: 'https' - ``` diff --git a/docs/development/core/public/kibana-plugin-core-public.ihttpfetcherror.md b/docs/development/core/public/kibana-plugin-core-public.ihttpfetcherror.md index 8c21d1636711..9aaae1be7202 100644 --- a/docs/development/core/public/kibana-plugin-core-public.ihttpfetcherror.md +++ b/docs/development/core/public/kibana-plugin-core-public.ihttpfetcherror.md @@ -10,15 +10,16 @@ ```typescript export interface IHttpFetchError extends Error ``` +Extends: Error ## Properties | Property | Type | Description | | --- | --- | --- | -| [body](./kibana-plugin-core-public.ihttpfetcherror.body.md) | TResponseBody | | -| [name](./kibana-plugin-core-public.ihttpfetcherror.name.md) | string | | -| [req](./kibana-plugin-core-public.ihttpfetcherror.req.md) | Request | | -| [request](./kibana-plugin-core-public.ihttpfetcherror.request.md) | Request | | -| [res](./kibana-plugin-core-public.ihttpfetcherror.res.md) | Response | | -| [response](./kibana-plugin-core-public.ihttpfetcherror.response.md) | Response | | +| [body?](./kibana-plugin-core-public.ihttpfetcherror.body.md) | TResponseBody | (Optional) | +| [name](./kibana-plugin-core-public.ihttpfetcherror.name.md) | string | | +| [req](./kibana-plugin-core-public.ihttpfetcherror.req.md) | Request | | +| [request](./kibana-plugin-core-public.ihttpfetcherror.request.md) | Request | | +| [res?](./kibana-plugin-core-public.ihttpfetcherror.res.md) | Response | (Optional) | +| [response?](./kibana-plugin-core-public.ihttpfetcherror.response.md) | Response | (Optional) | diff --git a/docs/development/core/public/kibana-plugin-core-public.ihttpinterceptcontroller.halt.md b/docs/development/core/public/kibana-plugin-core-public.ihttpinterceptcontroller.halt.md index 012805d22ba4..b982e4dbac8a 100644 --- a/docs/development/core/public/kibana-plugin-core-public.ihttpinterceptcontroller.halt.md +++ b/docs/development/core/public/kibana-plugin-core-public.ihttpinterceptcontroller.halt.md @@ -13,5 +13,5 @@ halt(): void; ``` Returns: -`void` +void diff --git a/docs/development/core/public/kibana-plugin-core-public.ihttpinterceptcontroller.md b/docs/development/core/public/kibana-plugin-core-public.ihttpinterceptcontroller.md index 5b720fda34f4..15a66ef569e7 100644 --- a/docs/development/core/public/kibana-plugin-core-public.ihttpinterceptcontroller.md +++ b/docs/development/core/public/kibana-plugin-core-public.ihttpinterceptcontroller.md @@ -16,7 +16,7 @@ export interface IHttpInterceptController | Property | Type | Description | | --- | --- | --- | -| [halted](./kibana-plugin-core-public.ihttpinterceptcontroller.halted.md) | boolean | Whether or not this chain has been halted. | +| [halted](./kibana-plugin-core-public.ihttpinterceptcontroller.halted.md) | boolean | Whether or not this chain has been halted. | ## Methods diff --git a/docs/development/core/public/kibana-plugin-core-public.ihttpresponseinterceptoroverrides.md b/docs/development/core/public/kibana-plugin-core-public.ihttpresponseinterceptoroverrides.md index 4b55cec8f3a2..57a4555cd6da 100644 --- a/docs/development/core/public/kibana-plugin-core-public.ihttpresponseinterceptoroverrides.md +++ b/docs/development/core/public/kibana-plugin-core-public.ihttpresponseinterceptoroverrides.md @@ -16,6 +16,6 @@ export interface IHttpResponseInterceptorOverrides | Property | Type | Description | | --- | --- | --- | -| [body](./kibana-plugin-core-public.ihttpresponseinterceptoroverrides.body.md) | TResponseBody | Parsed body received, may be undefined if there was an error. | -| [response](./kibana-plugin-core-public.ihttpresponseinterceptoroverrides.response.md) | Readonly<Response> | Raw response received, may be undefined if there was an error. | +| [body?](./kibana-plugin-core-public.ihttpresponseinterceptoroverrides.body.md) | TResponseBody | (Optional) Parsed body received, may be undefined if there was an error. | +| [response?](./kibana-plugin-core-public.ihttpresponseinterceptoroverrides.response.md) | Readonly<Response> | (Optional) Raw response received, may be undefined if there was an error. | diff --git a/docs/development/core/public/kibana-plugin-core-public.iuisettingsclient.md b/docs/development/core/public/kibana-plugin-core-public.iuisettingsclient.md index d6f3b3186b54..5d2429a799fe 100644 --- a/docs/development/core/public/kibana-plugin-core-public.iuisettingsclient.md +++ b/docs/development/core/public/kibana-plugin-core-public.iuisettingsclient.md @@ -16,15 +16,15 @@ export interface IUiSettingsClient | Property | Type | Description | | --- | --- | --- | -| [get](./kibana-plugin-core-public.iuisettingsclient.get.md) | <T = any>(key: string, defaultOverride?: T) => T | Gets the value for a specific uiSetting. If this setting has no user-defined value then the defaultOverride parameter is returned (and parsed if setting is of type "json" or "number). If the parameter is not defined and the key is not registered by any plugin then an error is thrown, otherwise reads the default value defined by a plugin. | -| [get$](./kibana-plugin-core-public.iuisettingsclient.get_.md) | <T = any>(key: string, defaultOverride?: T) => Observable<T> | Gets an observable of the current value for a config key, and all updates to that config key in the future. Providing a defaultOverride argument behaves the same as it does in \#get() | -| [getAll](./kibana-plugin-core-public.iuisettingsclient.getall.md) | () => Readonly<Record<string, PublicUiSettingsParams & UserProvidedValues>> | Gets the metadata about all uiSettings, including the type, default value, and user value for each key. | -| [getUpdate$](./kibana-plugin-core-public.iuisettingsclient.getupdate_.md) | <T = any>() => Observable<{
key: string;
newValue: T;
oldValue: T;
}> | Returns an Observable that notifies subscribers of each update to the uiSettings, including the key, newValue, and oldValue of the setting that changed. | -| [getUpdateErrors$](./kibana-plugin-core-public.iuisettingsclient.getupdateerrors_.md) | () => Observable<Error> | Returns an Observable that notifies subscribers of each error while trying to update the settings, containing the actual Error class. | -| [isCustom](./kibana-plugin-core-public.iuisettingsclient.iscustom.md) | (key: string) => boolean | Returns true if the setting wasn't registered by any plugin, but was either added directly via set(), or is an unknown setting found in the uiSettings saved object | -| [isDeclared](./kibana-plugin-core-public.iuisettingsclient.isdeclared.md) | (key: string) => boolean | Returns true if the key is a "known" uiSetting, meaning it is either registered by any plugin or was previously added as a custom setting via the set() method. | -| [isDefault](./kibana-plugin-core-public.iuisettingsclient.isdefault.md) | (key: string) => boolean | Returns true if the setting has no user-defined value or is unknown | -| [isOverridden](./kibana-plugin-core-public.iuisettingsclient.isoverridden.md) | (key: string) => boolean | Shows whether the uiSettings value set by the user. | -| [remove](./kibana-plugin-core-public.iuisettingsclient.remove.md) | (key: string) => Promise<boolean> | Removes the user-defined value for a setting, causing it to revert to the default. This method behaves the same as calling set(key, null), including the synchronization, custom setting, and error behavior of that method. | -| [set](./kibana-plugin-core-public.iuisettingsclient.set.md) | (key: string, value: any) => Promise<boolean> | Sets the value for a uiSetting. If the setting is not registered by any plugin it will be stored as a custom setting. The new value will be synchronously available via the get() method and sent to the server in the background. If the request to the server fails then a updateErrors$ will be notified and the setting will be reverted to its value before set() was called. | +| [get](./kibana-plugin-core-public.iuisettingsclient.get.md) | <T = any>(key: string, defaultOverride?: T) => T | Gets the value for a specific uiSetting. If this setting has no user-defined value then the defaultOverride parameter is returned (and parsed if setting is of type "json" or "number). If the parameter is not defined and the key is not registered by any plugin then an error is thrown, otherwise reads the default value defined by a plugin. | +| [get$](./kibana-plugin-core-public.iuisettingsclient.get_.md) | <T = any>(key: string, defaultOverride?: T) => Observable<T> | Gets an observable of the current value for a config key, and all updates to that config key in the future. Providing a defaultOverride argument behaves the same as it does in \#get() | +| [getAll](./kibana-plugin-core-public.iuisettingsclient.getall.md) | () => Readonly<Record<string, PublicUiSettingsParams & UserProvidedValues>> | Gets the metadata about all uiSettings, including the type, default value, and user value for each key. | +| [getUpdate$](./kibana-plugin-core-public.iuisettingsclient.getupdate_.md) | <T = any>() => Observable<{ key: string; newValue: T; oldValue: T; }> | Returns an Observable that notifies subscribers of each update to the uiSettings, including the key, newValue, and oldValue of the setting that changed. | +| [getUpdateErrors$](./kibana-plugin-core-public.iuisettingsclient.getupdateerrors_.md) | () => Observable<Error> | Returns an Observable that notifies subscribers of each error while trying to update the settings, containing the actual Error class. | +| [isCustom](./kibana-plugin-core-public.iuisettingsclient.iscustom.md) | (key: string) => boolean | Returns true if the setting wasn't registered by any plugin, but was either added directly via set(), or is an unknown setting found in the uiSettings saved object | +| [isDeclared](./kibana-plugin-core-public.iuisettingsclient.isdeclared.md) | (key: string) => boolean | Returns true if the key is a "known" uiSetting, meaning it is either registered by any plugin or was previously added as a custom setting via the set() method. | +| [isDefault](./kibana-plugin-core-public.iuisettingsclient.isdefault.md) | (key: string) => boolean | Returns true if the setting has no user-defined value or is unknown | +| [isOverridden](./kibana-plugin-core-public.iuisettingsclient.isoverridden.md) | (key: string) => boolean | Shows whether the uiSettings value set by the user. | +| [remove](./kibana-plugin-core-public.iuisettingsclient.remove.md) | (key: string) => Promise<boolean> | Removes the user-defined value for a setting, causing it to revert to the default. This method behaves the same as calling set(key, null), including the synchronization, custom setting, and error behavior of that method. | +| [set](./kibana-plugin-core-public.iuisettingsclient.set.md) | (key: string, value: any) => Promise<boolean> | Sets the value for a uiSetting. If the setting is not registered by any plugin it will be stored as a custom setting. The new value will be synchronously available via the get() method and sent to the server in the background. If the request to the server fails then a updateErrors$ will be notified and the setting will be reverted to its value before set() was called. | diff --git a/docs/development/core/public/kibana-plugin-core-public.md b/docs/development/core/public/kibana-plugin-core-public.md index a32dceafd74a..dee77e899415 100644 --- a/docs/development/core/public/kibana-plugin-core-public.md +++ b/docs/development/core/public/kibana-plugin-core-public.md @@ -6,7 +6,7 @@ The Kibana Core APIs for client-side plugins. -A plugin's `public/index` file must contain a named import, `plugin`, that implements [PluginInitializer](./kibana-plugin-core-public.plugininitializer.md) which returns an object that implements [Plugin](./kibana-plugin-core-public.plugin.md). +A plugin's `public/index` file must contain a named import, `plugin`, that implements [PluginInitializer](./kibana-plugin-core-public.plugininitializer.md) which returns an object that implements . The plugin integrates with the core system via lifecycle events: `setup`, `start`, and `stop`. In each lifecycle method, the plugin will receive the corresponding core services available (either [CoreSetup](./kibana-plugin-core-public.coresetup.md) or [CoreStart](./kibana-plugin-core-public.corestart.md)) and any interfaces returned by dependency plugins' lifecycle method. Anything returned by the plugin's lifecycle method will be exposed to downstream dependencies when their corresponding lifecycle methods are invoked. @@ -94,7 +94,7 @@ The plugin integrates with the core system via lifecycle events: `setup` | [OverlayModalStart](./kibana-plugin-core-public.overlaymodalstart.md) | APIs to open and manage modal dialogs. | | [OverlayRef](./kibana-plugin-core-public.overlayref.md) | Returned by [OverlayStart](./kibana-plugin-core-public.overlaystart.md) methods for closing a mounted overlay. | | [OverlayStart](./kibana-plugin-core-public.overlaystart.md) | | -| [Plugin](./kibana-plugin-core-public.plugin.md) | The interface that should be returned by a PluginInitializer. | +| [Plugin\_2](./kibana-plugin-core-public.plugin_2.md) | The interface that should be returned by a PluginInitializer. | | [PluginInitializerContext](./kibana-plugin-core-public.plugininitializercontext.md) | The available core services passed to a PluginInitializer | | [ResolvedSimpleSavedObject](./kibana-plugin-core-public.resolvedsimplesavedobject.md) | This interface is a very simple wrapper for SavedObjects resolved from the server with the [SavedObjectsClient](./kibana-plugin-core-public.savedobjectsclient.md). | | [ResponseErrorBody](./kibana-plugin-core-public.responseerrorbody.md) | | diff --git a/docs/development/core/public/kibana-plugin-core-public.navigatetoappoptions.md b/docs/development/core/public/kibana-plugin-core-public.navigatetoappoptions.md index 7b01bab056d8..c8ec5bdaf8c0 100644 --- a/docs/development/core/public/kibana-plugin-core-public.navigatetoappoptions.md +++ b/docs/development/core/public/kibana-plugin-core-public.navigatetoappoptions.md @@ -16,9 +16,9 @@ export interface NavigateToAppOptions | Property | Type | Description | | --- | --- | --- | -| [deepLinkId](./kibana-plugin-core-public.navigatetoappoptions.deeplinkid.md) | string | optional [deep link](./kibana-plugin-core-public.app.deeplinks.md) id inside the application to navigate to. If an additional [path](./kibana-plugin-core-public.navigatetoappoptions.path.md) is defined it will be appended to the deep link path. | -| [openInNewTab](./kibana-plugin-core-public.navigatetoappoptions.openinnewtab.md) | boolean | if true, will open the app in new tab, will share session information via window.open if base | -| [path](./kibana-plugin-core-public.navigatetoappoptions.path.md) | string | optional path inside application to deep link to. If undefined, will use [the app's default path](./kibana-plugin-core-public.app.defaultpath.md) as default. | -| [replace](./kibana-plugin-core-public.navigatetoappoptions.replace.md) | boolean | if true, will not create a new history entry when navigating (using replace instead of push) | -| [state](./kibana-plugin-core-public.navigatetoappoptions.state.md) | unknown | optional state to forward to the application | +| [deepLinkId?](./kibana-plugin-core-public.navigatetoappoptions.deeplinkid.md) | string | (Optional) optional [deep link](./kibana-plugin-core-public.app.deeplinks.md) id inside the application to navigate to. If an additional [path](./kibana-plugin-core-public.navigatetoappoptions.path.md) is defined it will be appended to the deep link path. | +| [openInNewTab?](./kibana-plugin-core-public.navigatetoappoptions.openinnewtab.md) | boolean | (Optional) if true, will open the app in new tab, will share session information via window.open if base | +| [path?](./kibana-plugin-core-public.navigatetoappoptions.path.md) | string | (Optional) optional path inside application to deep link to. If undefined, will use [the app's default path](./kibana-plugin-core-public.app.defaultpath.md) as default. | +| [replace?](./kibana-plugin-core-public.navigatetoappoptions.replace.md) | boolean | (Optional) if true, will not create a new history entry when navigating (using replace instead of push) | +| [state?](./kibana-plugin-core-public.navigatetoappoptions.state.md) | unknown | (Optional) optional state to forward to the application | diff --git a/docs/development/core/public/kibana-plugin-core-public.notificationssetup.md b/docs/development/core/public/kibana-plugin-core-public.notificationssetup.md index fb78fb055a79..efaeafa1afb1 100644 --- a/docs/development/core/public/kibana-plugin-core-public.notificationssetup.md +++ b/docs/development/core/public/kibana-plugin-core-public.notificationssetup.md @@ -15,5 +15,5 @@ export interface NotificationsSetup | Property | Type | Description | | --- | --- | --- | -| [toasts](./kibana-plugin-core-public.notificationssetup.toasts.md) | ToastsSetup | [ToastsSetup](./kibana-plugin-core-public.toastssetup.md) | +| [toasts](./kibana-plugin-core-public.notificationssetup.toasts.md) | ToastsSetup | [ToastsSetup](./kibana-plugin-core-public.toastssetup.md) | diff --git a/docs/development/core/public/kibana-plugin-core-public.notificationsstart.md b/docs/development/core/public/kibana-plugin-core-public.notificationsstart.md index 9b1f6e62400f..0e77badd5123 100644 --- a/docs/development/core/public/kibana-plugin-core-public.notificationsstart.md +++ b/docs/development/core/public/kibana-plugin-core-public.notificationsstart.md @@ -15,5 +15,5 @@ export interface NotificationsStart | Property | Type | Description | | --- | --- | --- | -| [toasts](./kibana-plugin-core-public.notificationsstart.toasts.md) | ToastsStart | [ToastsStart](./kibana-plugin-core-public.toastsstart.md) | +| [toasts](./kibana-plugin-core-public.notificationsstart.toasts.md) | ToastsStart | [ToastsStart](./kibana-plugin-core-public.toastsstart.md) | diff --git a/docs/development/core/public/kibana-plugin-core-public.overlaybannersstart.add.md b/docs/development/core/public/kibana-plugin-core-public.overlaybannersstart.add.md index 4cedda4e8092..fd3ce0b3a429 100644 --- a/docs/development/core/public/kibana-plugin-core-public.overlaybannersstart.add.md +++ b/docs/development/core/public/kibana-plugin-core-public.overlaybannersstart.add.md @@ -16,12 +16,12 @@ add(mount: MountPoint, priority?: number): string; | Parameter | Type | Description | | --- | --- | --- | -| mount | MountPoint | | -| priority | number | | +| mount | MountPoint | [MountPoint](./kibana-plugin-core-public.mountpoint.md) | +| priority | number | optional priority order to display this banner. Higher priority values are shown first. | Returns: -`string` +string a unique identifier for the given banner to be used with [OverlayBannersStart.remove()](./kibana-plugin-core-public.overlaybannersstart.remove.md) and [OverlayBannersStart.replace()](./kibana-plugin-core-public.overlaybannersstart.replace.md) diff --git a/docs/development/core/public/kibana-plugin-core-public.overlaybannersstart.getcomponent.md b/docs/development/core/public/kibana-plugin-core-public.overlaybannersstart.getcomponent.md index dc167f4f8fb8..b5f0ab1d0129 100644 --- a/docs/development/core/public/kibana-plugin-core-public.overlaybannersstart.getcomponent.md +++ b/docs/development/core/public/kibana-plugin-core-public.overlaybannersstart.getcomponent.md @@ -11,5 +11,5 @@ getComponent(): JSX.Element; ``` Returns: -`JSX.Element` +JSX.Element diff --git a/docs/development/core/public/kibana-plugin-core-public.overlaybannersstart.remove.md b/docs/development/core/public/kibana-plugin-core-public.overlaybannersstart.remove.md index 2c69506afb61..ce1e3ee08bd5 100644 --- a/docs/development/core/public/kibana-plugin-core-public.overlaybannersstart.remove.md +++ b/docs/development/core/public/kibana-plugin-core-public.overlaybannersstart.remove.md @@ -16,11 +16,11 @@ remove(id: string): boolean; | Parameter | Type | Description | | --- | --- | --- | -| id | string | | +| id | string | the unique identifier for the banner returned by [OverlayBannersStart.add()](./kibana-plugin-core-public.overlaybannersstart.add.md) | Returns: -`boolean` +boolean if the banner was found or not diff --git a/docs/development/core/public/kibana-plugin-core-public.overlaybannersstart.replace.md b/docs/development/core/public/kibana-plugin-core-public.overlaybannersstart.replace.md index 1112d781bae4..ea16c739cc84 100644 --- a/docs/development/core/public/kibana-plugin-core-public.overlaybannersstart.replace.md +++ b/docs/development/core/public/kibana-plugin-core-public.overlaybannersstart.replace.md @@ -16,13 +16,13 @@ replace(id: string | undefined, mount: MountPoint, priority?: number): string; | Parameter | Type | Description | | --- | --- | --- | -| id | string | undefined | | -| mount | MountPoint | | -| priority | number | | +| id | string \| undefined | the unique identifier for the banner returned by [OverlayBannersStart.add()](./kibana-plugin-core-public.overlaybannersstart.add.md) | +| mount | MountPoint | [MountPoint](./kibana-plugin-core-public.mountpoint.md) | +| priority | number | optional priority order to display this banner. Higher priority values are shown first. | Returns: -`string` +string a new identifier for the given banner to be used with [OverlayBannersStart.remove()](./kibana-plugin-core-public.overlaybannersstart.remove.md) and [OverlayBannersStart.replace()](./kibana-plugin-core-public.overlaybannersstart.replace.md) diff --git a/docs/development/core/public/kibana-plugin-core-public.overlayflyoutopenoptions.md b/docs/development/core/public/kibana-plugin-core-public.overlayflyoutopenoptions.md index 611b2206bccd..defbf79b0ffe 100644 --- a/docs/development/core/public/kibana-plugin-core-public.overlayflyoutopenoptions.md +++ b/docs/development/core/public/kibana-plugin-core-public.overlayflyoutopenoptions.md @@ -15,14 +15,14 @@ export interface OverlayFlyoutOpenOptions | Property | Type | Description | | --- | --- | --- | -| ["aria-label"](./kibana-plugin-core-public.overlayflyoutopenoptions._aria-label_.md) | string | | -| ["data-test-subj"](./kibana-plugin-core-public.overlayflyoutopenoptions._data-test-subj_.md) | string | | -| [className](./kibana-plugin-core-public.overlayflyoutopenoptions.classname.md) | string | | -| [closeButtonAriaLabel](./kibana-plugin-core-public.overlayflyoutopenoptions.closebuttonarialabel.md) | string | | -| [hideCloseButton](./kibana-plugin-core-public.overlayflyoutopenoptions.hideclosebutton.md) | boolean | | -| [maskProps](./kibana-plugin-core-public.overlayflyoutopenoptions.maskprops.md) | EuiOverlayMaskProps | | -| [maxWidth](./kibana-plugin-core-public.overlayflyoutopenoptions.maxwidth.md) | boolean | number | string | | -| [onClose](./kibana-plugin-core-public.overlayflyoutopenoptions.onclose.md) | (flyout: OverlayRef) => void | EuiFlyout onClose handler. If provided the consumer is responsible for calling flyout.close() to close the flyout; | -| [ownFocus](./kibana-plugin-core-public.overlayflyoutopenoptions.ownfocus.md) | boolean | | -| [size](./kibana-plugin-core-public.overlayflyoutopenoptions.size.md) | EuiFlyoutSize | | +| ["aria-label"?](./kibana-plugin-core-public.overlayflyoutopenoptions._aria-label_.md) | string | (Optional) | +| ["data-test-subj"?](./kibana-plugin-core-public.overlayflyoutopenoptions._data-test-subj_.md) | string | (Optional) | +| [className?](./kibana-plugin-core-public.overlayflyoutopenoptions.classname.md) | string | (Optional) | +| [closeButtonAriaLabel?](./kibana-plugin-core-public.overlayflyoutopenoptions.closebuttonarialabel.md) | string | (Optional) | +| [hideCloseButton?](./kibana-plugin-core-public.overlayflyoutopenoptions.hideclosebutton.md) | boolean | (Optional) | +| [maskProps?](./kibana-plugin-core-public.overlayflyoutopenoptions.maskprops.md) | EuiOverlayMaskProps | (Optional) | +| [maxWidth?](./kibana-plugin-core-public.overlayflyoutopenoptions.maxwidth.md) | boolean \| number \| string | (Optional) | +| [onClose?](./kibana-plugin-core-public.overlayflyoutopenoptions.onclose.md) | (flyout: OverlayRef) => void | (Optional) EuiFlyout onClose handler. If provided the consumer is responsible for calling flyout.close() to close the flyout; | +| [ownFocus?](./kibana-plugin-core-public.overlayflyoutopenoptions.ownfocus.md) | boolean | (Optional) | +| [size?](./kibana-plugin-core-public.overlayflyoutopenoptions.size.md) | EuiFlyoutSize | (Optional) | diff --git a/docs/development/core/public/kibana-plugin-core-public.overlayflyoutstart.open.md b/docs/development/core/public/kibana-plugin-core-public.overlayflyoutstart.open.md index 1f740410ca28..94290eb91f94 100644 --- a/docs/development/core/public/kibana-plugin-core-public.overlayflyoutstart.open.md +++ b/docs/development/core/public/kibana-plugin-core-public.overlayflyoutstart.open.md @@ -16,10 +16,10 @@ open(mount: MountPoint, options?: OverlayFlyoutOpenOptions): OverlayRef; | Parameter | Type | Description | | --- | --- | --- | -| mount | MountPoint | | -| options | OverlayFlyoutOpenOptions | | +| mount | MountPoint | [MountPoint](./kibana-plugin-core-public.mountpoint.md) - Mounts the children inside a flyout panel | +| options | OverlayFlyoutOpenOptions | [OverlayFlyoutOpenOptions](./kibana-plugin-core-public.overlayflyoutopenoptions.md) - options for the flyout [OverlayRef](./kibana-plugin-core-public.overlayref.md) A reference to the opened flyout panel. | Returns: -`OverlayRef` +OverlayRef diff --git a/docs/development/core/public/kibana-plugin-core-public.overlaymodalconfirmoptions.md b/docs/development/core/public/kibana-plugin-core-public.overlaymodalconfirmoptions.md index 83405a151a37..2f672e551ba5 100644 --- a/docs/development/core/public/kibana-plugin-core-public.overlaymodalconfirmoptions.md +++ b/docs/development/core/public/kibana-plugin-core-public.overlaymodalconfirmoptions.md @@ -15,13 +15,13 @@ export interface OverlayModalConfirmOptions | Property | Type | Description | | --- | --- | --- | -| ["data-test-subj"](./kibana-plugin-core-public.overlaymodalconfirmoptions._data-test-subj_.md) | string | | -| [buttonColor](./kibana-plugin-core-public.overlaymodalconfirmoptions.buttoncolor.md) | EuiConfirmModalProps['buttonColor'] | | -| [cancelButtonText](./kibana-plugin-core-public.overlaymodalconfirmoptions.cancelbuttontext.md) | string | | -| [className](./kibana-plugin-core-public.overlaymodalconfirmoptions.classname.md) | string | | -| [closeButtonAriaLabel](./kibana-plugin-core-public.overlaymodalconfirmoptions.closebuttonarialabel.md) | string | | -| [confirmButtonText](./kibana-plugin-core-public.overlaymodalconfirmoptions.confirmbuttontext.md) | string | | -| [defaultFocusedButton](./kibana-plugin-core-public.overlaymodalconfirmoptions.defaultfocusedbutton.md) | EuiConfirmModalProps['defaultFocusedButton'] | | -| [maxWidth](./kibana-plugin-core-public.overlaymodalconfirmoptions.maxwidth.md) | boolean | number | string | Sets the max-width of the modal. Set to true to use the default (euiBreakpoints 'm'), set to false to not restrict the width, set to a number for a custom width in px, set to a string for a custom width in custom measurement. | -| [title](./kibana-plugin-core-public.overlaymodalconfirmoptions.title.md) | string | | +| ["data-test-subj"?](./kibana-plugin-core-public.overlaymodalconfirmoptions._data-test-subj_.md) | string | (Optional) | +| [buttonColor?](./kibana-plugin-core-public.overlaymodalconfirmoptions.buttoncolor.md) | EuiConfirmModalProps\['buttonColor'\] | (Optional) | +| [cancelButtonText?](./kibana-plugin-core-public.overlaymodalconfirmoptions.cancelbuttontext.md) | string | (Optional) | +| [className?](./kibana-plugin-core-public.overlaymodalconfirmoptions.classname.md) | string | (Optional) | +| [closeButtonAriaLabel?](./kibana-plugin-core-public.overlaymodalconfirmoptions.closebuttonarialabel.md) | string | (Optional) | +| [confirmButtonText?](./kibana-plugin-core-public.overlaymodalconfirmoptions.confirmbuttontext.md) | string | (Optional) | +| [defaultFocusedButton?](./kibana-plugin-core-public.overlaymodalconfirmoptions.defaultfocusedbutton.md) | EuiConfirmModalProps\['defaultFocusedButton'\] | (Optional) | +| [maxWidth?](./kibana-plugin-core-public.overlaymodalconfirmoptions.maxwidth.md) | boolean \| number \| string | (Optional) Sets the max-width of the modal. Set to true to use the default (euiBreakpoints 'm'), set to false to not restrict the width, set to a number for a custom width in px, set to a string for a custom width in custom measurement. | +| [title?](./kibana-plugin-core-public.overlaymodalconfirmoptions.title.md) | string | (Optional) | diff --git a/docs/development/core/public/kibana-plugin-core-public.overlaymodalopenoptions.md b/docs/development/core/public/kibana-plugin-core-public.overlaymodalopenoptions.md index 5307a8357a81..5fc978ea2626 100644 --- a/docs/development/core/public/kibana-plugin-core-public.overlaymodalopenoptions.md +++ b/docs/development/core/public/kibana-plugin-core-public.overlaymodalopenoptions.md @@ -15,8 +15,8 @@ export interface OverlayModalOpenOptions | Property | Type | Description | | --- | --- | --- | -| ["data-test-subj"](./kibana-plugin-core-public.overlaymodalopenoptions._data-test-subj_.md) | string | | -| [className](./kibana-plugin-core-public.overlaymodalopenoptions.classname.md) | string | | -| [closeButtonAriaLabel](./kibana-plugin-core-public.overlaymodalopenoptions.closebuttonarialabel.md) | string | | -| [maxWidth](./kibana-plugin-core-public.overlaymodalopenoptions.maxwidth.md) | boolean | number | string | | +| ["data-test-subj"?](./kibana-plugin-core-public.overlaymodalopenoptions._data-test-subj_.md) | string | (Optional) | +| [className?](./kibana-plugin-core-public.overlaymodalopenoptions.classname.md) | string | (Optional) | +| [closeButtonAriaLabel?](./kibana-plugin-core-public.overlaymodalopenoptions.closebuttonarialabel.md) | string | (Optional) | +| [maxWidth?](./kibana-plugin-core-public.overlaymodalopenoptions.maxwidth.md) | boolean \| number \| string | (Optional) | diff --git a/docs/development/core/public/kibana-plugin-core-public.overlaymodalstart.open.md b/docs/development/core/public/kibana-plugin-core-public.overlaymodalstart.open.md index 1c6b82e37a62..35bfa406b4d1 100644 --- a/docs/development/core/public/kibana-plugin-core-public.overlaymodalstart.open.md +++ b/docs/development/core/public/kibana-plugin-core-public.overlaymodalstart.open.md @@ -16,10 +16,10 @@ open(mount: MountPoint, options?: OverlayModalOpenOptions): OverlayRef; | Parameter | Type | Description | | --- | --- | --- | -| mount | MountPoint | | -| options | OverlayModalOpenOptions | | +| mount | MountPoint | [MountPoint](./kibana-plugin-core-public.mountpoint.md) - Mounts the children inside the modal | +| options | OverlayModalOpenOptions | [OverlayModalOpenOptions](./kibana-plugin-core-public.overlaymodalopenoptions.md) - options for the modal [OverlayRef](./kibana-plugin-core-public.overlayref.md) A reference to the opened modal. | Returns: -`OverlayRef` +OverlayRef diff --git a/docs/development/core/public/kibana-plugin-core-public.overlaymodalstart.openconfirm.md b/docs/development/core/public/kibana-plugin-core-public.overlaymodalstart.openconfirm.md index b0052c0f6460..056f512de87b 100644 --- a/docs/development/core/public/kibana-plugin-core-public.overlaymodalstart.openconfirm.md +++ b/docs/development/core/public/kibana-plugin-core-public.overlaymodalstart.openconfirm.md @@ -16,10 +16,10 @@ openConfirm(message: MountPoint | string, options?: OverlayModalConfirmOptions): | Parameter | Type | Description | | --- | --- | --- | -| message | MountPoint | string | | -| options | OverlayModalConfirmOptions | | +| message | MountPoint \| string | [MountPoint](./kibana-plugin-core-public.mountpoint.md) - string or mountpoint to be used a the confirm message body | +| options | OverlayModalConfirmOptions | [OverlayModalConfirmOptions](./kibana-plugin-core-public.overlaymodalconfirmoptions.md) - options for the confirm modal | Returns: -`Promise` +Promise<boolean> diff --git a/docs/development/core/public/kibana-plugin-core-public.overlayref.close.md b/docs/development/core/public/kibana-plugin-core-public.overlayref.close.md index 656afa64e549..454723f6ffd0 100644 --- a/docs/development/core/public/kibana-plugin-core-public.overlayref.close.md +++ b/docs/development/core/public/kibana-plugin-core-public.overlayref.close.md @@ -13,5 +13,5 @@ close(): Promise; ``` Returns: -`Promise` +Promise<void> diff --git a/docs/development/core/public/kibana-plugin-core-public.overlayref.md b/docs/development/core/public/kibana-plugin-core-public.overlayref.md index 0fc76057d039..da11e284f285 100644 --- a/docs/development/core/public/kibana-plugin-core-public.overlayref.md +++ b/docs/development/core/public/kibana-plugin-core-public.overlayref.md @@ -16,7 +16,7 @@ export interface OverlayRef | Property | Type | Description | | --- | --- | --- | -| [onClose](./kibana-plugin-core-public.overlayref.onclose.md) | Promise<void> | A Promise that will resolve once this overlay is closed.Overlays can close from user interaction, calling close() on the overlay reference or another overlay replacing yours via openModal or openFlyout. | +| [onClose](./kibana-plugin-core-public.overlayref.onclose.md) | Promise<void> | A Promise that will resolve once this overlay is closed.Overlays can close from user interaction, calling close() on the overlay reference or another overlay replacing yours via openModal or openFlyout. | ## Methods diff --git a/docs/development/core/public/kibana-plugin-core-public.overlaystart.md b/docs/development/core/public/kibana-plugin-core-public.overlaystart.md index 2cc4d89dda64..3bbdd4ab9b91 100644 --- a/docs/development/core/public/kibana-plugin-core-public.overlaystart.md +++ b/docs/development/core/public/kibana-plugin-core-public.overlaystart.md @@ -15,8 +15,8 @@ export interface OverlayStart | Property | Type | Description | | --- | --- | --- | -| [banners](./kibana-plugin-core-public.overlaystart.banners.md) | OverlayBannersStart | [OverlayBannersStart](./kibana-plugin-core-public.overlaybannersstart.md) | -| [openConfirm](./kibana-plugin-core-public.overlaystart.openconfirm.md) | OverlayModalStart['openConfirm'] | | -| [openFlyout](./kibana-plugin-core-public.overlaystart.openflyout.md) | OverlayFlyoutStart['open'] | | -| [openModal](./kibana-plugin-core-public.overlaystart.openmodal.md) | OverlayModalStart['open'] | | +| [banners](./kibana-plugin-core-public.overlaystart.banners.md) | OverlayBannersStart | [OverlayBannersStart](./kibana-plugin-core-public.overlaybannersstart.md) | +| [openConfirm](./kibana-plugin-core-public.overlaystart.openconfirm.md) | OverlayModalStart\['openConfirm'\] | | +| [openFlyout](./kibana-plugin-core-public.overlaystart.openflyout.md) | OverlayFlyoutStart\['open'\] | | +| [openModal](./kibana-plugin-core-public.overlaystart.openmodal.md) | OverlayModalStart\['open'\] | | diff --git a/docs/development/core/public/kibana-plugin-core-public.plugin.md b/docs/development/core/public/kibana-plugin-core-public.plugin_2.md similarity index 56% rename from docs/development/core/public/kibana-plugin-core-public.plugin.md rename to docs/development/core/public/kibana-plugin-core-public.plugin_2.md index 4de46ae55797..da8cef9b83cc 100644 --- a/docs/development/core/public/kibana-plugin-core-public.plugin.md +++ b/docs/development/core/public/kibana-plugin-core-public.plugin_2.md @@ -1,8 +1,8 @@ -[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [Plugin](./kibana-plugin-core-public.plugin.md) +[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [Plugin\_2](./kibana-plugin-core-public.plugin_2.md) -## Plugin interface +## Plugin\_2 interface The interface that should be returned by a `PluginInitializer`. @@ -16,7 +16,7 @@ export interface Plugin(Optional) | diff --git a/docs/development/core/public/kibana-plugin-core-public.plugin.setup.md b/docs/development/core/public/kibana-plugin-core-public.plugin_2.setup.md similarity index 56% rename from docs/development/core/public/kibana-plugin-core-public.plugin.setup.md rename to docs/development/core/public/kibana-plugin-core-public.plugin_2.setup.md index 232851cd342c..5ebb5a1a7481 100644 --- a/docs/development/core/public/kibana-plugin-core-public.plugin.setup.md +++ b/docs/development/core/public/kibana-plugin-core-public.plugin_2.setup.md @@ -1,8 +1,8 @@ -[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [Plugin](./kibana-plugin-core-public.plugin.md) > [setup](./kibana-plugin-core-public.plugin.setup.md) +[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [Plugin\_2](./kibana-plugin-core-public.plugin_2.md) > [setup](./kibana-plugin-core-public.plugin_2.setup.md) -## Plugin.setup() method +## Plugin\_2.setup() method Signature: @@ -14,10 +14,10 @@ setup(core: CoreSetup, plugins: TPluginsSetup): TSetup; | Parameter | Type | Description | | --- | --- | --- | -| core | CoreSetup<TPluginsStart, TStart> | | -| plugins | TPluginsSetup | | +| core | CoreSetup<TPluginsStart, TStart> | | +| plugins | TPluginsSetup | | Returns: -`TSetup` +TSetup diff --git a/docs/development/core/public/kibana-plugin-core-public.plugin.start.md b/docs/development/core/public/kibana-plugin-core-public.plugin_2.start.md similarity index 57% rename from docs/development/core/public/kibana-plugin-core-public.plugin.start.md rename to docs/development/core/public/kibana-plugin-core-public.plugin_2.start.md index ec5ed211a9d2..f4979ee033aa 100644 --- a/docs/development/core/public/kibana-plugin-core-public.plugin.start.md +++ b/docs/development/core/public/kibana-plugin-core-public.plugin_2.start.md @@ -1,8 +1,8 @@ -[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [Plugin](./kibana-plugin-core-public.plugin.md) > [start](./kibana-plugin-core-public.plugin.start.md) +[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [Plugin\_2](./kibana-plugin-core-public.plugin_2.md) > [start](./kibana-plugin-core-public.plugin_2.start.md) -## Plugin.start() method +## Plugin\_2.start() method Signature: @@ -14,10 +14,10 @@ start(core: CoreStart, plugins: TPluginsStart): TStart; | Parameter | Type | Description | | --- | --- | --- | -| core | CoreStart | | -| plugins | TPluginsStart | | +| core | CoreStart | | +| plugins | TPluginsStart | | Returns: -`TStart` +TStart diff --git a/docs/development/core/public/kibana-plugin-core-public.plugin.stop.md b/docs/development/core/public/kibana-plugin-core-public.plugin_2.stop.md similarity index 56% rename from docs/development/core/public/kibana-plugin-core-public.plugin.stop.md rename to docs/development/core/public/kibana-plugin-core-public.plugin_2.stop.md index b509d1ae2534..69532f2d0e09 100644 --- a/docs/development/core/public/kibana-plugin-core-public.plugin.stop.md +++ b/docs/development/core/public/kibana-plugin-core-public.plugin_2.stop.md @@ -1,8 +1,8 @@ -[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [Plugin](./kibana-plugin-core-public.plugin.md) > [stop](./kibana-plugin-core-public.plugin.stop.md) +[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [Plugin\_2](./kibana-plugin-core-public.plugin_2.md) > [stop](./kibana-plugin-core-public.plugin_2.stop.md) -## Plugin.stop() method +## Plugin\_2.stop() method Signature: @@ -11,5 +11,5 @@ stop?(): void; ``` Returns: -`void` +void diff --git a/docs/development/core/public/kibana-plugin-core-public.plugininitializercontext.md b/docs/development/core/public/kibana-plugin-core-public.plugininitializercontext.md index 422bf5a71cdd..3304b4bf3def 100644 --- a/docs/development/core/public/kibana-plugin-core-public.plugininitializercontext.md +++ b/docs/development/core/public/kibana-plugin-core-public.plugininitializercontext.md @@ -16,7 +16,7 @@ export interface PluginInitializerContext | Property | Type | Description | | --- | --- | --- | -| [config](./kibana-plugin-core-public.plugininitializercontext.config.md) | {
get: <T extends object = ConfigSchema>() => T;
} | | -| [env](./kibana-plugin-core-public.plugininitializercontext.env.md) | {
mode: Readonly<EnvironmentMode>;
packageInfo: Readonly<PackageInfo>;
} | | -| [opaqueId](./kibana-plugin-core-public.plugininitializercontext.opaqueid.md) | PluginOpaqueId | A symbol used to identify this plugin in the system. Needed when registering handlers or context providers. | +| [config](./kibana-plugin-core-public.plugininitializercontext.config.md) | { get: <T extends object = ConfigSchema>() => T; } | | +| [env](./kibana-plugin-core-public.plugininitializercontext.env.md) | { mode: Readonly<EnvironmentMode>; packageInfo: Readonly<PackageInfo>; } | | +| [opaqueId](./kibana-plugin-core-public.plugininitializercontext.opaqueid.md) | PluginOpaqueId | A symbol used to identify this plugin in the system. Needed when registering handlers or context providers. | diff --git a/docs/development/core/public/kibana-plugin-core-public.resolvedsimplesavedobject.md b/docs/development/core/public/kibana-plugin-core-public.resolvedsimplesavedobject.md index 4936598c5879..2844bd97db7f 100644 --- a/docs/development/core/public/kibana-plugin-core-public.resolvedsimplesavedobject.md +++ b/docs/development/core/public/kibana-plugin-core-public.resolvedsimplesavedobject.md @@ -16,7 +16,7 @@ export interface ResolvedSimpleSavedObject | Property | Type | Description | | --- | --- | --- | -| [alias\_target\_id](./kibana-plugin-core-public.resolvedsimplesavedobject.alias_target_id.md) | SavedObjectsResolveResponse['alias_target_id'] | The ID of the object that the legacy URL alias points to. This is only defined when the outcome is 'aliasMatch' or 'conflict'. | -| [outcome](./kibana-plugin-core-public.resolvedsimplesavedobject.outcome.md) | SavedObjectsResolveResponse['outcome'] | The outcome for a successful resolve call is one of the following values:\* 'exactMatch' -- One document exactly matched the given ID. \* 'aliasMatch' -- One document with a legacy URL alias matched the given ID; in this case the saved_object.id field is different than the given ID. \* 'conflict' -- Two documents matched the given ID, one was an exact match and another with a legacy URL alias; in this case the saved_object object is the exact match, and the saved_object.id field is the same as the given ID. | -| [saved\_object](./kibana-plugin-core-public.resolvedsimplesavedobject.saved_object.md) | SimpleSavedObject<T> | The saved object that was found. | +| [alias\_target\_id?](./kibana-plugin-core-public.resolvedsimplesavedobject.alias_target_id.md) | SavedObjectsResolveResponse\['alias\_target\_id'\] | (Optional) The ID of the object that the legacy URL alias points to. This is only defined when the outcome is 'aliasMatch' or 'conflict'. | +| [outcome](./kibana-plugin-core-public.resolvedsimplesavedobject.outcome.md) | SavedObjectsResolveResponse\['outcome'\] | The outcome for a successful resolve call is one of the following values:\* 'exactMatch' -- One document exactly matched the given ID. \* 'aliasMatch' -- One document with a legacy URL alias matched the given ID; in this case the saved_object.id field is different than the given ID. \* 'conflict' -- Two documents matched the given ID, one was an exact match and another with a legacy URL alias; in this case the saved_object object is the exact match, and the saved_object.id field is the same as the given ID. | +| [saved\_object](./kibana-plugin-core-public.resolvedsimplesavedobject.saved_object.md) | SimpleSavedObject<T> | The saved object that was found. | diff --git a/docs/development/core/public/kibana-plugin-core-public.responseerrorbody.md b/docs/development/core/public/kibana-plugin-core-public.responseerrorbody.md index 8a990909fac3..5bc910369101 100644 --- a/docs/development/core/public/kibana-plugin-core-public.responseerrorbody.md +++ b/docs/development/core/public/kibana-plugin-core-public.responseerrorbody.md @@ -15,7 +15,7 @@ export interface ResponseErrorBody | Property | Type | Description | | --- | --- | --- | -| [attributes](./kibana-plugin-core-public.responseerrorbody.attributes.md) | Record<string, unknown> | | -| [message](./kibana-plugin-core-public.responseerrorbody.message.md) | string | | -| [statusCode](./kibana-plugin-core-public.responseerrorbody.statuscode.md) | number | | +| [attributes?](./kibana-plugin-core-public.responseerrorbody.attributes.md) | Record<string, unknown> | (Optional) | +| [message](./kibana-plugin-core-public.responseerrorbody.message.md) | string | | +| [statusCode](./kibana-plugin-core-public.responseerrorbody.statuscode.md) | number | | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobject.md b/docs/development/core/public/kibana-plugin-core-public.savedobject.md index 26f472b74126..283a96001330 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobject.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobject.md @@ -14,15 +14,15 @@ export interface SavedObject | Property | Type | Description | | --- | --- | --- | -| [attributes](./kibana-plugin-core-public.savedobject.attributes.md) | T | The data for a Saved Object is stored as an object in the attributes property. | -| [coreMigrationVersion](./kibana-plugin-core-public.savedobject.coremigrationversion.md) | string | A semver value that is used when upgrading objects between Kibana versions. | -| [error](./kibana-plugin-core-public.savedobject.error.md) | SavedObjectError | | -| [id](./kibana-plugin-core-public.savedobject.id.md) | string | The ID of this Saved Object, guaranteed to be unique for all objects of the same type | -| [migrationVersion](./kibana-plugin-core-public.savedobject.migrationversion.md) | SavedObjectsMigrationVersion | Information about the migrations that have been applied to this SavedObject. When Kibana starts up, KibanaMigrator detects outdated documents and migrates them based on this value. For each migration that has been applied, the plugin's name is used as a key and the latest migration version as the value. | -| [namespaces](./kibana-plugin-core-public.savedobject.namespaces.md) | string[] | Space(s) that this saved object exists in. This attribute is not used for "global" saved object types which are registered with namespaceType: 'agnostic'. | -| [originId](./kibana-plugin-core-public.savedobject.originid.md) | string | The ID of the saved object this originated from. This is set if this object's id was regenerated; that can happen during migration from a legacy single-namespace type, or during import. It is only set during migration or create operations. This is used during import to ensure that ID regeneration is deterministic, so saved objects will be overwritten if they are imported multiple times into a given space. | -| [references](./kibana-plugin-core-public.savedobject.references.md) | SavedObjectReference[] | A reference to another saved object. | -| [type](./kibana-plugin-core-public.savedobject.type.md) | string | The type of Saved Object. Each plugin can define it's own custom Saved Object types. | -| [updated\_at](./kibana-plugin-core-public.savedobject.updated_at.md) | string | Timestamp of the last time this document had been updated. | -| [version](./kibana-plugin-core-public.savedobject.version.md) | string | An opaque version number which changes on each successful write operation. Can be used for implementing optimistic concurrency control. | +| [attributes](./kibana-plugin-core-public.savedobject.attributes.md) | T | The data for a Saved Object is stored as an object in the attributes property. | +| [coreMigrationVersion?](./kibana-plugin-core-public.savedobject.coremigrationversion.md) | string | (Optional) A semver value that is used when upgrading objects between Kibana versions. | +| [error?](./kibana-plugin-core-public.savedobject.error.md) | SavedObjectError | (Optional) | +| [id](./kibana-plugin-core-public.savedobject.id.md) | string | The ID of this Saved Object, guaranteed to be unique for all objects of the same type | +| [migrationVersion?](./kibana-plugin-core-public.savedobject.migrationversion.md) | SavedObjectsMigrationVersion | (Optional) Information about the migrations that have been applied to this SavedObject. When Kibana starts up, KibanaMigrator detects outdated documents and migrates them based on this value. For each migration that has been applied, the plugin's name is used as a key and the latest migration version as the value. | +| [namespaces?](./kibana-plugin-core-public.savedobject.namespaces.md) | string\[\] | (Optional) Space(s) that this saved object exists in. This attribute is not used for "global" saved object types which are registered with namespaceType: 'agnostic'. | +| [originId?](./kibana-plugin-core-public.savedobject.originid.md) | string | (Optional) The ID of the saved object this originated from. This is set if this object's id was regenerated; that can happen during migration from a legacy single-namespace type, or during import. It is only set during migration or create operations. This is used during import to ensure that ID regeneration is deterministic, so saved objects will be overwritten if they are imported multiple times into a given space. | +| [references](./kibana-plugin-core-public.savedobject.references.md) | SavedObjectReference\[\] | A reference to another saved object. | +| [type](./kibana-plugin-core-public.savedobject.type.md) | string | The type of Saved Object. Each plugin can define it's own custom Saved Object types. | +| [updated\_at?](./kibana-plugin-core-public.savedobject.updated_at.md) | string | (Optional) Timestamp of the last time this document had been updated. | +| [version?](./kibana-plugin-core-public.savedobject.version.md) | string | (Optional) An opaque version number which changes on each successful write operation. Can be used for implementing optimistic concurrency control. | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjecterror.md b/docs/development/core/public/kibana-plugin-core-public.savedobjecterror.md index 2117cea433b5..f6e8874b212b 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjecterror.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjecterror.md @@ -14,8 +14,8 @@ export interface SavedObjectError | Property | Type | Description | | --- | --- | --- | -| [error](./kibana-plugin-core-public.savedobjecterror.error.md) | string | | -| [message](./kibana-plugin-core-public.savedobjecterror.message.md) | string | | -| [metadata](./kibana-plugin-core-public.savedobjecterror.metadata.md) | Record<string, unknown> | | -| [statusCode](./kibana-plugin-core-public.savedobjecterror.statuscode.md) | number | | +| [error](./kibana-plugin-core-public.savedobjecterror.error.md) | string | | +| [message](./kibana-plugin-core-public.savedobjecterror.message.md) | string | | +| [metadata?](./kibana-plugin-core-public.savedobjecterror.metadata.md) | Record<string, unknown> | (Optional) | +| [statusCode](./kibana-plugin-core-public.savedobjecterror.statuscode.md) | number | | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectreference.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectreference.md index 410ab23f0b60..e63ba254602d 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectreference.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectreference.md @@ -16,7 +16,7 @@ export interface SavedObjectReference | Property | Type | Description | | --- | --- | --- | -| [id](./kibana-plugin-core-public.savedobjectreference.id.md) | string | | -| [name](./kibana-plugin-core-public.savedobjectreference.name.md) | string | | -| [type](./kibana-plugin-core-public.savedobjectreference.type.md) | string | | +| [id](./kibana-plugin-core-public.savedobjectreference.id.md) | string | | +| [name](./kibana-plugin-core-public.savedobjectreference.name.md) | string | | +| [type](./kibana-plugin-core-public.savedobjectreference.type.md) | string | | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectreferencewithcontext.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectreferencewithcontext.md index a79fa96695e3..39e14607d861 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectreferencewithcontext.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectreferencewithcontext.md @@ -16,10 +16,10 @@ export interface SavedObjectReferenceWithContext | Property | Type | Description | | --- | --- | --- | -| [id](./kibana-plugin-core-public.savedobjectreferencewithcontext.id.md) | string | The ID of the referenced object | -| [inboundReferences](./kibana-plugin-core-public.savedobjectreferencewithcontext.inboundreferences.md) | Array<{
type: string;
id: string;
name: string;
}> | References to this object; note that this does not contain \_all inbound references everywhere for this object\_, it only contains inbound references for the scope of this operation | -| [isMissing](./kibana-plugin-core-public.savedobjectreferencewithcontext.ismissing.md) | boolean | Whether or not this object or reference is missing | -| [spaces](./kibana-plugin-core-public.savedobjectreferencewithcontext.spaces.md) | string[] | The space(s) that the referenced object exists in | -| [spacesWithMatchingAliases](./kibana-plugin-core-public.savedobjectreferencewithcontext.spaceswithmatchingaliases.md) | string[] | The space(s) that legacy URL aliases matching this type/id exist in | -| [type](./kibana-plugin-core-public.savedobjectreferencewithcontext.type.md) | string | The type of the referenced object | +| [id](./kibana-plugin-core-public.savedobjectreferencewithcontext.id.md) | string | The ID of the referenced object | +| [inboundReferences](./kibana-plugin-core-public.savedobjectreferencewithcontext.inboundreferences.md) | Array<{ type: string; id: string; name: string; }> | References to this object; note that this does not contain \_all inbound references everywhere for this object\_, it only contains inbound references for the scope of this operation | +| [isMissing?](./kibana-plugin-core-public.savedobjectreferencewithcontext.ismissing.md) | boolean | (Optional) Whether or not this object or reference is missing | +| [spaces](./kibana-plugin-core-public.savedobjectreferencewithcontext.spaces.md) | string\[\] | The space(s) that the referenced object exists in | +| [spacesWithMatchingAliases?](./kibana-plugin-core-public.savedobjectreferencewithcontext.spaceswithmatchingaliases.md) | string\[\] | (Optional) The space(s) that legacy URL aliases matching this type/id exist in | +| [type](./kibana-plugin-core-public.savedobjectreferencewithcontext.type.md) | string | The type of the referenced object | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsbaseoptions.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsbaseoptions.md index 838d8fb1979a..f86d3b5afc04 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsbaseoptions.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsbaseoptions.md @@ -15,5 +15,5 @@ export interface SavedObjectsBaseOptions | Property | Type | Description | | --- | --- | --- | -| [namespace](./kibana-plugin-core-public.savedobjectsbaseoptions.namespace.md) | string | Specify the namespace for this operation | +| [namespace?](./kibana-plugin-core-public.savedobjectsbaseoptions.namespace.md) | string | (Optional) Specify the namespace for this operation | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsbatchresponse.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsbatchresponse.md index 155183600870..3926231db17b 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsbatchresponse.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsbatchresponse.md @@ -15,5 +15,5 @@ export interface SavedObjectsBatchResponse | Property | Type | Description | | --- | --- | --- | -| [savedObjects](./kibana-plugin-core-public.savedobjectsbatchresponse.savedobjects.md) | Array<SimpleSavedObject<T>> | | +| [savedObjects](./kibana-plugin-core-public.savedobjectsbatchresponse.savedobjects.md) | Array<SimpleSavedObject<T>> | | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkcreateobject.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkcreateobject.md index 20d137819a90..f9ff61859b1a 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkcreateobject.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkcreateobject.md @@ -9,11 +9,12 @@ ```typescript export interface SavedObjectsBulkCreateObject extends SavedObjectsCreateOptions ``` +Extends: SavedObjectsCreateOptions ## Properties | Property | Type | Description | | --- | --- | --- | -| [attributes](./kibana-plugin-core-public.savedobjectsbulkcreateobject.attributes.md) | T | | -| [type](./kibana-plugin-core-public.savedobjectsbulkcreateobject.type.md) | string | | +| [attributes](./kibana-plugin-core-public.savedobjectsbulkcreateobject.attributes.md) | T | | +| [type](./kibana-plugin-core-public.savedobjectsbulkcreateobject.type.md) | string | | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkcreateoptions.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkcreateoptions.md index 02e659bd858f..ada12c064e0a 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkcreateoptions.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkcreateoptions.md @@ -15,5 +15,5 @@ export interface SavedObjectsBulkCreateOptions | Property | Type | Description | | --- | --- | --- | -| [overwrite](./kibana-plugin-core-public.savedobjectsbulkcreateoptions.overwrite.md) | boolean | If a document with the given id already exists, overwrite it's contents (default=false). | +| [overwrite?](./kibana-plugin-core-public.savedobjectsbulkcreateoptions.overwrite.md) | boolean | (Optional) If a document with the given id already exists, overwrite it's contents (default=false). | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkresolveobject.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkresolveobject.md index 8ca5da9d7db4..fbff3d3bd8f2 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkresolveobject.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkresolveobject.md @@ -15,6 +15,6 @@ export interface SavedObjectsBulkResolveObject | Property | Type | Description | | --- | --- | --- | -| [id](./kibana-plugin-core-public.savedobjectsbulkresolveobject.id.md) | string | | -| [type](./kibana-plugin-core-public.savedobjectsbulkresolveobject.type.md) | string | | +| [id](./kibana-plugin-core-public.savedobjectsbulkresolveobject.id.md) | string | | +| [type](./kibana-plugin-core-public.savedobjectsbulkresolveobject.type.md) | string | | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkresolveresponse.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkresolveresponse.md index 36a92d02b8aa..e34bf6fe3261 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkresolveresponse.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkresolveresponse.md @@ -15,5 +15,5 @@ export interface SavedObjectsBulkResolveResponse | Property | Type | Description | | --- | --- | --- | -| [resolved\_objects](./kibana-plugin-core-public.savedobjectsbulkresolveresponse.resolved_objects.md) | Array<SavedObjectsResolveResponse<T>> | | +| [resolved\_objects](./kibana-plugin-core-public.savedobjectsbulkresolveresponse.resolved_objects.md) | Array<SavedObjectsResolveResponse<T>> | | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkupdateobject.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkupdateobject.md index fd6572f2c0cb..f28d99cb110c 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkupdateobject.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkupdateobject.md @@ -15,9 +15,9 @@ export interface SavedObjectsBulkUpdateObject | Property | Type | Description | | --- | --- | --- | -| [attributes](./kibana-plugin-core-public.savedobjectsbulkupdateobject.attributes.md) | T | | -| [id](./kibana-plugin-core-public.savedobjectsbulkupdateobject.id.md) | string | | -| [references](./kibana-plugin-core-public.savedobjectsbulkupdateobject.references.md) | SavedObjectReference[] | | -| [type](./kibana-plugin-core-public.savedobjectsbulkupdateobject.type.md) | string | | -| [version](./kibana-plugin-core-public.savedobjectsbulkupdateobject.version.md) | string | | +| [attributes](./kibana-plugin-core-public.savedobjectsbulkupdateobject.attributes.md) | T | | +| [id](./kibana-plugin-core-public.savedobjectsbulkupdateobject.id.md) | string | | +| [references?](./kibana-plugin-core-public.savedobjectsbulkupdateobject.references.md) | SavedObjectReference\[\] | (Optional) | +| [type](./kibana-plugin-core-public.savedobjectsbulkupdateobject.type.md) | string | | +| [version?](./kibana-plugin-core-public.savedobjectsbulkupdateobject.version.md) | string | (Optional) | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkupdateoptions.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkupdateoptions.md index 35cc72baa0ef..a2cdd3eb801e 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkupdateoptions.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkupdateoptions.md @@ -15,5 +15,5 @@ export interface SavedObjectsBulkUpdateOptions | Property | Type | Description | | --- | --- | --- | -| [namespace](./kibana-plugin-core-public.savedobjectsbulkupdateoptions.namespace.md) | string | | +| [namespace?](./kibana-plugin-core-public.savedobjectsbulkupdateoptions.namespace.md) | string | (Optional) | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsclient.bulkupdate.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsclient.bulkupdate.md index 05c84d9c2719..0e3bfb2bd896 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsclient.bulkupdate.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsclient.bulkupdate.md @@ -16,11 +16,11 @@ bulkUpdate(objects?: SavedObjectsBulkUpdateObject[]): PromiseSavedObjectsBulkUpdateObject[] | | +| objects | SavedObjectsBulkUpdateObject\[\] | \[{ type, id, attributes, options: { version, references } }\] | Returns: -`Promise>` +Promise<SavedObjectsBatchResponse<unknown>> The result of the update operation containing both failed and updated saved objects. diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsclient.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsclient.md index 1a630ebe8c9a..d18d680feffd 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsclient.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsclient.md @@ -20,14 +20,14 @@ The constructor for this class is marked as internal. Third-party code should no | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [bulkCreate](./kibana-plugin-core-public.savedobjectsclient.bulkcreate.md) | | (objects?: SavedObjectsBulkCreateObject[], options?: SavedObjectsBulkCreateOptions) => Promise<SavedObjectsBatchResponse<unknown>> | Creates multiple documents at once | -| [bulkGet](./kibana-plugin-core-public.savedobjectsclient.bulkget.md) | | (objects?: Array<{
id: string;
type: string;
}>) => Promise<SavedObjectsBatchResponse<unknown>> | Returns an array of objects by id | -| [bulkResolve](./kibana-plugin-core-public.savedobjectsclient.bulkresolve.md) | | <T = unknown>(objects?: Array<{
id: string;
type: string;
}>) => Promise<{
resolved_objects: ResolvedSimpleSavedObject<T>[];
}> | Resolves an array of objects by id, using any legacy URL aliases if they exist | -| [create](./kibana-plugin-core-public.savedobjectsclient.create.md) | | <T = unknown>(type: string, attributes: T, options?: SavedObjectsCreateOptions) => Promise<SimpleSavedObject<T>> | Persists an object | -| [delete](./kibana-plugin-core-public.savedobjectsclient.delete.md) | | (type: string, id: string, options?: SavedObjectsDeleteOptions | undefined) => ReturnType<SavedObjectsApi['delete']> | Deletes an object | -| [find](./kibana-plugin-core-public.savedobjectsclient.find.md) | | <T = unknown, A = unknown>(options: SavedObjectsFindOptions) => Promise<SavedObjectsFindResponsePublic<T, unknown>> | Search for objects | -| [get](./kibana-plugin-core-public.savedobjectsclient.get.md) | | <T = unknown>(type: string, id: string) => Promise<SimpleSavedObject<T>> | Fetches a single object | -| [resolve](./kibana-plugin-core-public.savedobjectsclient.resolve.md) | | <T = unknown>(type: string, id: string) => Promise<ResolvedSimpleSavedObject<T>> | Resolves a single object | +| [bulkCreate](./kibana-plugin-core-public.savedobjectsclient.bulkcreate.md) | | (objects?: SavedObjectsBulkCreateObject\[\], options?: SavedObjectsBulkCreateOptions) => Promise<SavedObjectsBatchResponse<unknown>> | Creates multiple documents at once | +| [bulkGet](./kibana-plugin-core-public.savedobjectsclient.bulkget.md) | | (objects?: Array<{ id: string; type: string; }>) => Promise<SavedObjectsBatchResponse<unknown>> | Returns an array of objects by id | +| [bulkResolve](./kibana-plugin-core-public.savedobjectsclient.bulkresolve.md) | | <T = unknown>(objects?: Array<{ id: string; type: string; }>) => Promise<{ resolved\_objects: ResolvedSimpleSavedObject<T>\[\]; }> | Resolves an array of objects by id, using any legacy URL aliases if they exist | +| [create](./kibana-plugin-core-public.savedobjectsclient.create.md) | | <T = unknown>(type: string, attributes: T, options?: SavedObjectsCreateOptions) => Promise<SimpleSavedObject<T>> | Persists an object | +| [delete](./kibana-plugin-core-public.savedobjectsclient.delete.md) | | (type: string, id: string, options?: SavedObjectsDeleteOptions \| undefined) => ReturnType<SavedObjectsApi\['delete'\]> | Deletes an object | +| [find](./kibana-plugin-core-public.savedobjectsclient.find.md) | | <T = unknown, A = unknown>(options: SavedObjectsFindOptions) => Promise<SavedObjectsFindResponsePublic<T, unknown>> | Search for objects | +| [get](./kibana-plugin-core-public.savedobjectsclient.get.md) | | <T = unknown>(type: string, id: string) => Promise<SimpleSavedObject<T>> | Fetches a single object | +| [resolve](./kibana-plugin-core-public.savedobjectsclient.resolve.md) | | <T = unknown>(type: string, id: string) => Promise<ResolvedSimpleSavedObject<T>> | Resolves a single object | ## Methods diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsclient.update.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsclient.update.md index a5847d6a2619..dec84fb58bf5 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsclient.update.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsclient.update.md @@ -16,13 +16,13 @@ update(type: string, id: string, attributes: T, { version, referenc | Parameter | Type | Description | | --- | --- | --- | -| type | string | | -| id | string | | -| attributes | T | | -| { version, references, upsert } | SavedObjectsUpdateOptions | | +| type | string | | +| id | string | | +| attributes | T | | +| { version, references, upsert } | SavedObjectsUpdateOptions | | Returns: -`Promise>` +Promise<SimpleSavedObject<T>> diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectscollectmultinamespacereferencesresponse.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectscollectmultinamespacereferencesresponse.md index a6e0a274008a..a356850fa1ad 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectscollectmultinamespacereferencesresponse.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectscollectmultinamespacereferencesresponse.md @@ -16,5 +16,5 @@ export interface SavedObjectsCollectMultiNamespaceReferencesResponse | Property | Type | Description | | --- | --- | --- | -| [objects](./kibana-plugin-core-public.savedobjectscollectmultinamespacereferencesresponse.objects.md) | SavedObjectReferenceWithContext[] | | +| [objects](./kibana-plugin-core-public.savedobjectscollectmultinamespacereferencesresponse.objects.md) | SavedObjectReferenceWithContext\[\] | | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectscreateoptions.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectscreateoptions.md index a039b9f5b4fe..835a9e87a1db 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectscreateoptions.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectscreateoptions.md @@ -15,9 +15,9 @@ export interface SavedObjectsCreateOptions | Property | Type | Description | | --- | --- | --- | -| [coreMigrationVersion](./kibana-plugin-core-public.savedobjectscreateoptions.coremigrationversion.md) | string | A semver value that is used when upgrading objects between Kibana versions. | -| [id](./kibana-plugin-core-public.savedobjectscreateoptions.id.md) | string | (Not recommended) Specify an id instead of having the saved objects service generate one for you. | -| [migrationVersion](./kibana-plugin-core-public.savedobjectscreateoptions.migrationversion.md) | SavedObjectsMigrationVersion | Information about the migrations that have been applied to this SavedObject. When Kibana starts up, KibanaMigrator detects outdated documents and migrates them based on this value. For each migration that has been applied, the plugin's name is used as a key and the latest migration version as the value. | -| [overwrite](./kibana-plugin-core-public.savedobjectscreateoptions.overwrite.md) | boolean | If a document with the given id already exists, overwrite it's contents (default=false). | -| [references](./kibana-plugin-core-public.savedobjectscreateoptions.references.md) | SavedObjectReference[] | | +| [coreMigrationVersion?](./kibana-plugin-core-public.savedobjectscreateoptions.coremigrationversion.md) | string | (Optional) A semver value that is used when upgrading objects between Kibana versions. | +| [id?](./kibana-plugin-core-public.savedobjectscreateoptions.id.md) | string | (Optional) (Not recommended) Specify an id instead of having the saved objects service generate one for you. | +| [migrationVersion?](./kibana-plugin-core-public.savedobjectscreateoptions.migrationversion.md) | SavedObjectsMigrationVersion | (Optional) Information about the migrations that have been applied to this SavedObject. When Kibana starts up, KibanaMigrator detects outdated documents and migrates them based on this value. For each migration that has been applied, the plugin's name is used as a key and the latest migration version as the value. | +| [overwrite?](./kibana-plugin-core-public.savedobjectscreateoptions.overwrite.md) | boolean | (Optional) If a document with the given id already exists, overwrite it's contents (default=false). | +| [references?](./kibana-plugin-core-public.savedobjectscreateoptions.references.md) | SavedObjectReference\[\] | (Optional) | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsfindoptions.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsfindoptions.md index 706408f81f02..f42991147630 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsfindoptions.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsfindoptions.md @@ -15,22 +15,22 @@ export interface SavedObjectsFindOptions | Property | Type | Description | | --- | --- | --- | -| [defaultSearchOperator](./kibana-plugin-core-public.savedobjectsfindoptions.defaultsearchoperator.md) | 'AND' | 'OR' | The search operator to use with the provided filter. Defaults to OR | -| [fields](./kibana-plugin-core-public.savedobjectsfindoptions.fields.md) | string[] | An array of fields to include in the results | -| [filter](./kibana-plugin-core-public.savedobjectsfindoptions.filter.md) | string | KueryNode | | -| [hasReference](./kibana-plugin-core-public.savedobjectsfindoptions.hasreference.md) | SavedObjectsFindOptionsReference | SavedObjectsFindOptionsReference[] | Search for documents having a reference to the specified objects. Use hasReferenceOperator to specify the operator to use when searching for multiple references. | -| [hasReferenceOperator](./kibana-plugin-core-public.savedobjectsfindoptions.hasreferenceoperator.md) | 'AND' | 'OR' | The operator to use when searching by multiple references using the hasReference option. Defaults to OR | -| [namespaces](./kibana-plugin-core-public.savedobjectsfindoptions.namespaces.md) | string[] | | -| [page](./kibana-plugin-core-public.savedobjectsfindoptions.page.md) | number | | -| [perPage](./kibana-plugin-core-public.savedobjectsfindoptions.perpage.md) | number | | -| [pit](./kibana-plugin-core-public.savedobjectsfindoptions.pit.md) | SavedObjectsPitParams | Search against a specific Point In Time (PIT) that you've opened with . | -| [preference](./kibana-plugin-core-public.savedobjectsfindoptions.preference.md) | string | An optional ES preference value to be used for the query \* | -| [rootSearchFields](./kibana-plugin-core-public.savedobjectsfindoptions.rootsearchfields.md) | string[] | The fields to perform the parsed query against. Unlike the searchFields argument, these are expected to be root fields and will not be modified. If used in conjunction with searchFields, both are concatenated together. | -| [search](./kibana-plugin-core-public.savedobjectsfindoptions.search.md) | string | Search documents using the Elasticsearch Simple Query String syntax. See Elasticsearch Simple Query String query argument for more information | -| [searchAfter](./kibana-plugin-core-public.savedobjectsfindoptions.searchafter.md) | estypes.Id[] | Use the sort values from the previous page to retrieve the next page of results. | -| [searchFields](./kibana-plugin-core-public.savedobjectsfindoptions.searchfields.md) | string[] | The fields to perform the parsed query against. See Elasticsearch Simple Query String fields argument for more information | -| [sortField](./kibana-plugin-core-public.savedobjectsfindoptions.sortfield.md) | string | | -| [sortOrder](./kibana-plugin-core-public.savedobjectsfindoptions.sortorder.md) | estypes.SearchSortOrder | | -| [type](./kibana-plugin-core-public.savedobjectsfindoptions.type.md) | string | string[] | | -| [typeToNamespacesMap](./kibana-plugin-core-public.savedobjectsfindoptions.typetonamespacesmap.md) | Map<string, string[] | undefined> | This map defines each type to search for, and the namespace(s) to search for the type in; this is only intended to be used by a saved object client wrapper. If this is defined, it supersedes the type and namespaces fields when building the Elasticsearch query. Any types that are not included in this map will be excluded entirely. If a type is included but its value is undefined, the operation will search for that type in the Default namespace. | +| [defaultSearchOperator?](./kibana-plugin-core-public.savedobjectsfindoptions.defaultsearchoperator.md) | 'AND' \| 'OR' | (Optional) The search operator to use with the provided filter. Defaults to OR | +| [fields?](./kibana-plugin-core-public.savedobjectsfindoptions.fields.md) | string\[\] | (Optional) An array of fields to include in the results | +| [filter?](./kibana-plugin-core-public.savedobjectsfindoptions.filter.md) | string \| KueryNode | (Optional) | +| [hasReference?](./kibana-plugin-core-public.savedobjectsfindoptions.hasreference.md) | SavedObjectsFindOptionsReference \| SavedObjectsFindOptionsReference\[\] | (Optional) Search for documents having a reference to the specified objects. Use hasReferenceOperator to specify the operator to use when searching for multiple references. | +| [hasReferenceOperator?](./kibana-plugin-core-public.savedobjectsfindoptions.hasreferenceoperator.md) | 'AND' \| 'OR' | (Optional) The operator to use when searching by multiple references using the hasReference option. Defaults to OR | +| [namespaces?](./kibana-plugin-core-public.savedobjectsfindoptions.namespaces.md) | string\[\] | (Optional) | +| [page?](./kibana-plugin-core-public.savedobjectsfindoptions.page.md) | number | (Optional) | +| [perPage?](./kibana-plugin-core-public.savedobjectsfindoptions.perpage.md) | number | (Optional) | +| [pit?](./kibana-plugin-core-public.savedobjectsfindoptions.pit.md) | SavedObjectsPitParams | (Optional) Search against a specific Point In Time (PIT) that you've opened with . | +| [preference?](./kibana-plugin-core-public.savedobjectsfindoptions.preference.md) | string | (Optional) An optional ES preference value to be used for the query \* | +| [rootSearchFields?](./kibana-plugin-core-public.savedobjectsfindoptions.rootsearchfields.md) | string\[\] | (Optional) The fields to perform the parsed query against. Unlike the searchFields argument, these are expected to be root fields and will not be modified. If used in conjunction with searchFields, both are concatenated together. | +| [search?](./kibana-plugin-core-public.savedobjectsfindoptions.search.md) | string | (Optional) Search documents using the Elasticsearch Simple Query String syntax. See Elasticsearch Simple Query String query argument for more information | +| [searchAfter?](./kibana-plugin-core-public.savedobjectsfindoptions.searchafter.md) | estypes.Id\[\] | (Optional) Use the sort values from the previous page to retrieve the next page of results. | +| [searchFields?](./kibana-plugin-core-public.savedobjectsfindoptions.searchfields.md) | string\[\] | (Optional) The fields to perform the parsed query against. See Elasticsearch Simple Query String fields argument for more information | +| [sortField?](./kibana-plugin-core-public.savedobjectsfindoptions.sortfield.md) | string | (Optional) | +| [sortOrder?](./kibana-plugin-core-public.savedobjectsfindoptions.sortorder.md) | estypes.SearchSortOrder | (Optional) | +| [type](./kibana-plugin-core-public.savedobjectsfindoptions.type.md) | string \| string\[\] | | +| [typeToNamespacesMap?](./kibana-plugin-core-public.savedobjectsfindoptions.typetonamespacesmap.md) | Map<string, string\[\] \| undefined> | (Optional) This map defines each type to search for, and the namespace(s) to search for the type in; this is only intended to be used by a saved object client wrapper. If this is defined, it supersedes the type and namespaces fields when building the Elasticsearch query. Any types that are not included in this map will be excluded entirely. If a type is included but its value is undefined, the operation will search for that type in the Default namespace. | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsfindoptionsreference.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsfindoptionsreference.md index cdfefd01e6f8..cab03bf71393 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsfindoptionsreference.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsfindoptionsreference.md @@ -15,6 +15,6 @@ export interface SavedObjectsFindOptionsReference | Property | Type | Description | | --- | --- | --- | -| [id](./kibana-plugin-core-public.savedobjectsfindoptionsreference.id.md) | string | | -| [type](./kibana-plugin-core-public.savedobjectsfindoptionsreference.type.md) | string | | +| [id](./kibana-plugin-core-public.savedobjectsfindoptionsreference.id.md) | string | | +| [type](./kibana-plugin-core-public.savedobjectsfindoptionsreference.type.md) | string | | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsfindresponsepublic.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsfindresponsepublic.md index 6f2276194f05..dd26960a9576 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsfindresponsepublic.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsfindresponsepublic.md @@ -13,13 +13,14 @@ Return type of the Saved Objects `find()` method. ```typescript export interface SavedObjectsFindResponsePublic extends SavedObjectsBatchResponse ``` +Extends: SavedObjectsBatchResponse<T> ## Properties | Property | Type | Description | | --- | --- | --- | -| [aggregations](./kibana-plugin-core-public.savedobjectsfindresponsepublic.aggregations.md) | A | | -| [page](./kibana-plugin-core-public.savedobjectsfindresponsepublic.page.md) | number | | -| [perPage](./kibana-plugin-core-public.savedobjectsfindresponsepublic.perpage.md) | number | | -| [total](./kibana-plugin-core-public.savedobjectsfindresponsepublic.total.md) | number | | +| [aggregations?](./kibana-plugin-core-public.savedobjectsfindresponsepublic.aggregations.md) | A | (Optional) | +| [page](./kibana-plugin-core-public.savedobjectsfindresponsepublic.page.md) | number | | +| [perPage](./kibana-plugin-core-public.savedobjectsfindresponsepublic.perpage.md) | number | | +| [total](./kibana-plugin-core-public.savedobjectsfindresponsepublic.total.md) | number | | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportactionrequiredwarning.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportactionrequiredwarning.md index 2ecce7233aa5..fe148fdc2ff1 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportactionrequiredwarning.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportactionrequiredwarning.md @@ -18,8 +18,8 @@ export interface SavedObjectsImportActionRequiredWarning | Property | Type | Description | | --- | --- | --- | -| [actionPath](./kibana-plugin-core-public.savedobjectsimportactionrequiredwarning.actionpath.md) | string | The path (without the basePath) that the user should be redirect to address this warning. | -| [buttonLabel](./kibana-plugin-core-public.savedobjectsimportactionrequiredwarning.buttonlabel.md) | string | An optional label to use for the link button. If unspecified, a default label will be used. | -| [message](./kibana-plugin-core-public.savedobjectsimportactionrequiredwarning.message.md) | string | The translated message to display to the user. | -| [type](./kibana-plugin-core-public.savedobjectsimportactionrequiredwarning.type.md) | 'action_required' | | +| [actionPath](./kibana-plugin-core-public.savedobjectsimportactionrequiredwarning.actionpath.md) | string | The path (without the basePath) that the user should be redirect to address this warning. | +| [buttonLabel?](./kibana-plugin-core-public.savedobjectsimportactionrequiredwarning.buttonlabel.md) | string | (Optional) An optional label to use for the link button. If unspecified, a default label will be used. | +| [message](./kibana-plugin-core-public.savedobjectsimportactionrequiredwarning.message.md) | string | The translated message to display to the user. | +| [type](./kibana-plugin-core-public.savedobjectsimportactionrequiredwarning.type.md) | 'action\_required' | | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportambiguousconflicterror.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportambiguousconflicterror.md index 76dfacf132f0..2d136bb870de 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportambiguousconflicterror.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportambiguousconflicterror.md @@ -16,6 +16,6 @@ export interface SavedObjectsImportAmbiguousConflictError | Property | Type | Description | | --- | --- | --- | -| [destinations](./kibana-plugin-core-public.savedobjectsimportambiguousconflicterror.destinations.md) | Array<{
id: string;
title?: string;
updatedAt?: string;
}> | | -| [type](./kibana-plugin-core-public.savedobjectsimportambiguousconflicterror.type.md) | 'ambiguous_conflict' | | +| [destinations](./kibana-plugin-core-public.savedobjectsimportambiguousconflicterror.destinations.md) | Array<{ id: string; title?: string; updatedAt?: string; }> | | +| [type](./kibana-plugin-core-public.savedobjectsimportambiguousconflicterror.type.md) | 'ambiguous\_conflict' | | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportconflicterror.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportconflicterror.md index b0320b05ecad..57737986ba4c 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportconflicterror.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportconflicterror.md @@ -16,6 +16,6 @@ export interface SavedObjectsImportConflictError | Property | Type | Description | | --- | --- | --- | -| [destinationId](./kibana-plugin-core-public.savedobjectsimportconflicterror.destinationid.md) | string | | -| [type](./kibana-plugin-core-public.savedobjectsimportconflicterror.type.md) | 'conflict' | | +| [destinationId?](./kibana-plugin-core-public.savedobjectsimportconflicterror.destinationid.md) | string | (Optional) | +| [type](./kibana-plugin-core-public.savedobjectsimportconflicterror.type.md) | 'conflict' | | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportfailure.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportfailure.md index f9219c9037e0..be1a20b3c71a 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportfailure.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportfailure.md @@ -16,10 +16,10 @@ export interface SavedObjectsImportFailure | Property | Type | Description | | --- | --- | --- | -| [error](./kibana-plugin-core-public.savedobjectsimportfailure.error.md) | SavedObjectsImportConflictError | SavedObjectsImportAmbiguousConflictError | SavedObjectsImportUnsupportedTypeError | SavedObjectsImportMissingReferencesError | SavedObjectsImportUnknownError | | -| [id](./kibana-plugin-core-public.savedobjectsimportfailure.id.md) | string | | -| [meta](./kibana-plugin-core-public.savedobjectsimportfailure.meta.md) | {
title?: string;
icon?: string;
} | | -| [overwrite](./kibana-plugin-core-public.savedobjectsimportfailure.overwrite.md) | boolean | If overwrite is specified, an attempt was made to overwrite an existing object. | -| [title](./kibana-plugin-core-public.savedobjectsimportfailure.title.md) | string | | -| [type](./kibana-plugin-core-public.savedobjectsimportfailure.type.md) | string | | +| [error](./kibana-plugin-core-public.savedobjectsimportfailure.error.md) | SavedObjectsImportConflictError \| SavedObjectsImportAmbiguousConflictError \| SavedObjectsImportUnsupportedTypeError \| SavedObjectsImportMissingReferencesError \| SavedObjectsImportUnknownError | | +| [id](./kibana-plugin-core-public.savedobjectsimportfailure.id.md) | string | | +| [meta](./kibana-plugin-core-public.savedobjectsimportfailure.meta.md) | { title?: string; icon?: string; } | | +| [overwrite?](./kibana-plugin-core-public.savedobjectsimportfailure.overwrite.md) | boolean | (Optional) If overwrite is specified, an attempt was made to overwrite an existing object. | +| [title?](./kibana-plugin-core-public.savedobjectsimportfailure.title.md) | string | (Optional) | +| [type](./kibana-plugin-core-public.savedobjectsimportfailure.type.md) | string | | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportmissingreferenceserror.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportmissingreferenceserror.md index 1fea85ea239d..6c03ab263084 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportmissingreferenceserror.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportmissingreferenceserror.md @@ -16,6 +16,6 @@ export interface SavedObjectsImportMissingReferencesError | Property | Type | Description | | --- | --- | --- | -| [references](./kibana-plugin-core-public.savedobjectsimportmissingreferenceserror.references.md) | Array<{
type: string;
id: string;
}> | | -| [type](./kibana-plugin-core-public.savedobjectsimportmissingreferenceserror.type.md) | 'missing_references' | | +| [references](./kibana-plugin-core-public.savedobjectsimportmissingreferenceserror.references.md) | Array<{ type: string; id: string; }> | | +| [type](./kibana-plugin-core-public.savedobjectsimportmissingreferenceserror.type.md) | 'missing\_references' | | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportresponse.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportresponse.md index 3be800498a9b..5b6139723a10 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportresponse.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportresponse.md @@ -16,9 +16,9 @@ export interface SavedObjectsImportResponse | Property | Type | Description | | --- | --- | --- | -| [errors](./kibana-plugin-core-public.savedobjectsimportresponse.errors.md) | SavedObjectsImportFailure[] | | -| [success](./kibana-plugin-core-public.savedobjectsimportresponse.success.md) | boolean | | -| [successCount](./kibana-plugin-core-public.savedobjectsimportresponse.successcount.md) | number | | -| [successResults](./kibana-plugin-core-public.savedobjectsimportresponse.successresults.md) | SavedObjectsImportSuccess[] | | -| [warnings](./kibana-plugin-core-public.savedobjectsimportresponse.warnings.md) | SavedObjectsImportWarning[] | | +| [errors?](./kibana-plugin-core-public.savedobjectsimportresponse.errors.md) | SavedObjectsImportFailure\[\] | (Optional) | +| [success](./kibana-plugin-core-public.savedobjectsimportresponse.success.md) | boolean | | +| [successCount](./kibana-plugin-core-public.savedobjectsimportresponse.successcount.md) | number | | +| [successResults?](./kibana-plugin-core-public.savedobjectsimportresponse.successresults.md) | SavedObjectsImportSuccess\[\] | (Optional) | +| [warnings](./kibana-plugin-core-public.savedobjectsimportresponse.warnings.md) | SavedObjectsImportWarning\[\] | | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportretry.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportretry.md index b0bda93ef8b7..80a3145ae7e5 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportretry.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportretry.md @@ -16,11 +16,11 @@ export interface SavedObjectsImportRetry | Property | Type | Description | | --- | --- | --- | -| [createNewCopy](./kibana-plugin-core-public.savedobjectsimportretry.createnewcopy.md) | boolean | If createNewCopy is specified, the new object has a new (undefined) origin ID. This is only needed for the case where createNewCopies mode is disabled and ambiguous source conflicts are detected. | -| [destinationId](./kibana-plugin-core-public.savedobjectsimportretry.destinationid.md) | string | The object ID that will be created or overwritten. If not specified, the id field will be used. | -| [id](./kibana-plugin-core-public.savedobjectsimportretry.id.md) | string | | -| [ignoreMissingReferences](./kibana-plugin-core-public.savedobjectsimportretry.ignoremissingreferences.md) | boolean | If ignoreMissingReferences is specified, reference validation will be skipped for this object. | -| [overwrite](./kibana-plugin-core-public.savedobjectsimportretry.overwrite.md) | boolean | | -| [replaceReferences](./kibana-plugin-core-public.savedobjectsimportretry.replacereferences.md) | Array<{
type: string;
from: string;
to: string;
}> | | -| [type](./kibana-plugin-core-public.savedobjectsimportretry.type.md) | string | | +| [createNewCopy?](./kibana-plugin-core-public.savedobjectsimportretry.createnewcopy.md) | boolean | (Optional) If createNewCopy is specified, the new object has a new (undefined) origin ID. This is only needed for the case where createNewCopies mode is disabled and ambiguous source conflicts are detected. | +| [destinationId?](./kibana-plugin-core-public.savedobjectsimportretry.destinationid.md) | string | (Optional) The object ID that will be created or overwritten. If not specified, the id field will be used. | +| [id](./kibana-plugin-core-public.savedobjectsimportretry.id.md) | string | | +| [ignoreMissingReferences?](./kibana-plugin-core-public.savedobjectsimportretry.ignoremissingreferences.md) | boolean | (Optional) If ignoreMissingReferences is specified, reference validation will be skipped for this object. | +| [overwrite](./kibana-plugin-core-public.savedobjectsimportretry.overwrite.md) | boolean | | +| [replaceReferences](./kibana-plugin-core-public.savedobjectsimportretry.replacereferences.md) | Array<{ type: string; from: string; to: string; }> | | +| [type](./kibana-plugin-core-public.savedobjectsimportretry.type.md) | string | | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportsimplewarning.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportsimplewarning.md index 4d6d984777c8..304779a1589f 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportsimplewarning.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportsimplewarning.md @@ -16,6 +16,6 @@ export interface SavedObjectsImportSimpleWarning | Property | Type | Description | | --- | --- | --- | -| [message](./kibana-plugin-core-public.savedobjectsimportsimplewarning.message.md) | string | The translated message to display to the user | -| [type](./kibana-plugin-core-public.savedobjectsimportsimplewarning.type.md) | 'simple' | | +| [message](./kibana-plugin-core-public.savedobjectsimportsimplewarning.message.md) | string | The translated message to display to the user | +| [type](./kibana-plugin-core-public.savedobjectsimportsimplewarning.type.md) | 'simple' | | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportsuccess.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportsuccess.md index 4872deb5ee0d..57ca4b7a787f 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportsuccess.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportsuccess.md @@ -16,10 +16,10 @@ export interface SavedObjectsImportSuccess | Property | Type | Description | | --- | --- | --- | -| [createNewCopy](./kibana-plugin-core-public.savedobjectsimportsuccess.createnewcopy.md) | boolean | | -| [destinationId](./kibana-plugin-core-public.savedobjectsimportsuccess.destinationid.md) | string | If destinationId is specified, the new object has a new ID that is different from the import ID. | -| [id](./kibana-plugin-core-public.savedobjectsimportsuccess.id.md) | string | | -| [meta](./kibana-plugin-core-public.savedobjectsimportsuccess.meta.md) | {
title?: string;
icon?: string;
} | | -| [overwrite](./kibana-plugin-core-public.savedobjectsimportsuccess.overwrite.md) | boolean | If overwrite is specified, this object overwrote an existing one (or will do so, in the case of a pending resolution). | -| [type](./kibana-plugin-core-public.savedobjectsimportsuccess.type.md) | string | | +| [createNewCopy?](./kibana-plugin-core-public.savedobjectsimportsuccess.createnewcopy.md) | boolean | (Optional) | +| [destinationId?](./kibana-plugin-core-public.savedobjectsimportsuccess.destinationid.md) | string | (Optional) If destinationId is specified, the new object has a new ID that is different from the import ID. | +| [id](./kibana-plugin-core-public.savedobjectsimportsuccess.id.md) | string | | +| [meta](./kibana-plugin-core-public.savedobjectsimportsuccess.meta.md) | { title?: string; icon?: string; } | | +| [overwrite?](./kibana-plugin-core-public.savedobjectsimportsuccess.overwrite.md) | boolean | (Optional) If overwrite is specified, this object overwrote an existing one (or will do so, in the case of a pending resolution). | +| [type](./kibana-plugin-core-public.savedobjectsimportsuccess.type.md) | string | | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportunknownerror.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportunknownerror.md index 8ed3369d50d7..fc78e04dee8a 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportunknownerror.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportunknownerror.md @@ -16,7 +16,7 @@ export interface SavedObjectsImportUnknownError | Property | Type | Description | | --- | --- | --- | -| [message](./kibana-plugin-core-public.savedobjectsimportunknownerror.message.md) | string | | -| [statusCode](./kibana-plugin-core-public.savedobjectsimportunknownerror.statuscode.md) | number | | -| [type](./kibana-plugin-core-public.savedobjectsimportunknownerror.type.md) | 'unknown' | | +| [message](./kibana-plugin-core-public.savedobjectsimportunknownerror.message.md) | string | | +| [statusCode](./kibana-plugin-core-public.savedobjectsimportunknownerror.statuscode.md) | number | | +| [type](./kibana-plugin-core-public.savedobjectsimportunknownerror.type.md) | 'unknown' | | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportunsupportedtypeerror.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportunsupportedtypeerror.md index afd5ae311008..de805f05a12e 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportunsupportedtypeerror.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsimportunsupportedtypeerror.md @@ -16,5 +16,5 @@ export interface SavedObjectsImportUnsupportedTypeError | Property | Type | Description | | --- | --- | --- | -| [type](./kibana-plugin-core-public.savedobjectsimportunsupportedtypeerror.type.md) | 'unsupported_type' | | +| [type](./kibana-plugin-core-public.savedobjectsimportunsupportedtypeerror.type.md) | 'unsupported\_type' | | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsresolveresponse.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsresolveresponse.md index cdc79d8ac363..6364493a9ef0 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsresolveresponse.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsresolveresponse.md @@ -15,7 +15,7 @@ export interface SavedObjectsResolveResponse | Property | Type | Description | | --- | --- | --- | -| [alias\_target\_id](./kibana-plugin-core-public.savedobjectsresolveresponse.alias_target_id.md) | string | The ID of the object that the legacy URL alias points to. This is only defined when the outcome is 'aliasMatch' or 'conflict'. | -| [outcome](./kibana-plugin-core-public.savedobjectsresolveresponse.outcome.md) | 'exactMatch' | 'aliasMatch' | 'conflict' | The outcome for a successful resolve call is one of the following values:\* 'exactMatch' -- One document exactly matched the given ID. \* 'aliasMatch' -- One document with a legacy URL alias matched the given ID; in this case the saved_object.id field is different than the given ID. \* 'conflict' -- Two documents matched the given ID, one was an exact match and another with a legacy URL alias; in this case the saved_object object is the exact match, and the saved_object.id field is the same as the given ID. | -| [saved\_object](./kibana-plugin-core-public.savedobjectsresolveresponse.saved_object.md) | SavedObject<T> | The saved object that was found. | +| [alias\_target\_id?](./kibana-plugin-core-public.savedobjectsresolveresponse.alias_target_id.md) | string | (Optional) The ID of the object that the legacy URL alias points to. This is only defined when the outcome is 'aliasMatch' or 'conflict'. | +| [outcome](./kibana-plugin-core-public.savedobjectsresolveresponse.outcome.md) | 'exactMatch' \| 'aliasMatch' \| 'conflict' | The outcome for a successful resolve call is one of the following values:\* 'exactMatch' -- One document exactly matched the given ID. \* 'aliasMatch' -- One document with a legacy URL alias matched the given ID; in this case the saved_object.id field is different than the given ID. \* 'conflict' -- Two documents matched the given ID, one was an exact match and another with a legacy URL alias; in this case the saved_object object is the exact match, and the saved_object.id field is the same as the given ID. | +| [saved\_object](./kibana-plugin-core-public.savedobjectsresolveresponse.saved_object.md) | SavedObject<T> | The saved object that was found. | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsstart.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsstart.md index 0aa47301e8eb..0ce0da309afb 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsstart.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsstart.md @@ -15,5 +15,5 @@ export interface SavedObjectsStart | Property | Type | Description | | --- | --- | --- | -| [client](./kibana-plugin-core-public.savedobjectsstart.client.md) | SavedObjectsClientContract | [SavedObjectsClient](./kibana-plugin-core-public.savedobjectsclient.md) | +| [client](./kibana-plugin-core-public.savedobjectsstart.client.md) | SavedObjectsClientContract | [SavedObjectsClient](./kibana-plugin-core-public.savedobjectsclient.md) | diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsupdateoptions.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsupdateoptions.md index d9cc801148d9..4a9b85e7b67e 100644 --- a/docs/development/core/public/kibana-plugin-core-public.savedobjectsupdateoptions.md +++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsupdateoptions.md @@ -15,7 +15,7 @@ export interface SavedObjectsUpdateOptions | Property | Type | Description | | --- | --- | --- | -| [references](./kibana-plugin-core-public.savedobjectsupdateoptions.references.md) | SavedObjectReference[] | | -| [upsert](./kibana-plugin-core-public.savedobjectsupdateoptions.upsert.md) | Attributes | | -| [version](./kibana-plugin-core-public.savedobjectsupdateoptions.version.md) | string | | +| [references?](./kibana-plugin-core-public.savedobjectsupdateoptions.references.md) | SavedObjectReference\[\] | (Optional) | +| [upsert?](./kibana-plugin-core-public.savedobjectsupdateoptions.upsert.md) | Attributes | (Optional) | +| [version?](./kibana-plugin-core-public.savedobjectsupdateoptions.version.md) | string | (Optional) | diff --git a/docs/development/core/public/kibana-plugin-core-public.scopedhistory._constructor_.md b/docs/development/core/public/kibana-plugin-core-public.scopedhistory._constructor_.md index 2cf647086b3e..32b0950aa106 100644 --- a/docs/development/core/public/kibana-plugin-core-public.scopedhistory._constructor_.md +++ b/docs/development/core/public/kibana-plugin-core-public.scopedhistory._constructor_.md @@ -16,6 +16,6 @@ constructor(parentHistory: History, basePath: string); | Parameter | Type | Description | | --- | --- | --- | -| parentHistory | History | | -| basePath | string | | +| parentHistory | History | | +| basePath | string | | diff --git a/docs/development/core/public/kibana-plugin-core-public.scopedhistory.md b/docs/development/core/public/kibana-plugin-core-public.scopedhistory.md index 15ed4e74c4dc..0d04fc3d6a86 100644 --- a/docs/development/core/public/kibana-plugin-core-public.scopedhistory.md +++ b/docs/development/core/public/kibana-plugin-core-public.scopedhistory.md @@ -15,6 +15,7 @@ The [createSubHistory](./kibana-plugin-core-public.scopedhistory.createsubhistor ```typescript export declare class ScopedHistory implements History ``` +Implements: History<HistoryLocationState> ## Constructors @@ -26,16 +27,16 @@ export declare class ScopedHistory implements Hi | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [action](./kibana-plugin-core-public.scopedhistory.action.md) | | Action | The last action dispatched on the history stack. | -| [block](./kibana-plugin-core-public.scopedhistory.block.md) | | (prompt?: string | boolean | History.TransitionPromptHook<HistoryLocationState> | undefined) => UnregisterCallback | Add a block prompt requesting user confirmation when navigating away from the current page. | -| [createHref](./kibana-plugin-core-public.scopedhistory.createhref.md) | | (location: LocationDescriptorObject<HistoryLocationState>, { prependBasePath }?: {
prependBasePath?: boolean | undefined;
}) => Href | Creates an href (string) to the location. If prependBasePath is true (default), it will prepend the location's path with the scoped history basePath. | -| [createSubHistory](./kibana-plugin-core-public.scopedhistory.createsubhistory.md) | | <SubHistoryLocationState = unknown>(basePath: string) => ScopedHistory<SubHistoryLocationState> | Creates a ScopedHistory for a subpath of this ScopedHistory. Useful for applications that may have sub-apps that do not need access to the containing application's history. | -| [go](./kibana-plugin-core-public.scopedhistory.go.md) | | (n: number) => void | Send the user forward or backwards in the history stack. | -| [goBack](./kibana-plugin-core-public.scopedhistory.goback.md) | | () => void | Send the user one location back in the history stack. Equivalent to calling [ScopedHistory.go(-1)](./kibana-plugin-core-public.scopedhistory.go.md). If no more entries are available backwards, this is a no-op. | -| [goForward](./kibana-plugin-core-public.scopedhistory.goforward.md) | | () => void | Send the user one location forward in the history stack. Equivalent to calling [ScopedHistory.go(1)](./kibana-plugin-core-public.scopedhistory.go.md). If no more entries are available forwards, this is a no-op. | -| [length](./kibana-plugin-core-public.scopedhistory.length.md) | | number | The number of entries in the history stack, including all entries forwards and backwards from the current location. | -| [listen](./kibana-plugin-core-public.scopedhistory.listen.md) | | (listener: (location: Location<HistoryLocationState>, action: Action) => void) => UnregisterCallback | Adds a listener for location updates. | -| [location](./kibana-plugin-core-public.scopedhistory.location.md) | | Location<HistoryLocationState> | The current location of the history stack. | -| [push](./kibana-plugin-core-public.scopedhistory.push.md) | | (pathOrLocation: Path | LocationDescriptorObject<HistoryLocationState>, state?: HistoryLocationState | undefined) => void | Pushes a new location onto the history stack. If there are forward entries in the stack, they will be removed. | -| [replace](./kibana-plugin-core-public.scopedhistory.replace.md) | | (pathOrLocation: Path | LocationDescriptorObject<HistoryLocationState>, state?: HistoryLocationState | undefined) => void | Replaces the current location in the history stack. Does not remove forward or backward entries. | +| [action](./kibana-plugin-core-public.scopedhistory.action.md) | | Action | The last action dispatched on the history stack. | +| [block](./kibana-plugin-core-public.scopedhistory.block.md) | | (prompt?: string \| boolean \| History.TransitionPromptHook<HistoryLocationState> \| undefined) => UnregisterCallback | Add a block prompt requesting user confirmation when navigating away from the current page. | +| [createHref](./kibana-plugin-core-public.scopedhistory.createhref.md) | | (location: LocationDescriptorObject<HistoryLocationState>, { prependBasePath }?: { prependBasePath?: boolean \| undefined; }) => Href | Creates an href (string) to the location. If prependBasePath is true (default), it will prepend the location's path with the scoped history basePath. | +| [createSubHistory](./kibana-plugin-core-public.scopedhistory.createsubhistory.md) | | <SubHistoryLocationState = unknown>(basePath: string) => ScopedHistory<SubHistoryLocationState> | Creates a ScopedHistory for a subpath of this ScopedHistory. Useful for applications that may have sub-apps that do not need access to the containing application's history. | +| [go](./kibana-plugin-core-public.scopedhistory.go.md) | | (n: number) => void | Send the user forward or backwards in the history stack. | +| [goBack](./kibana-plugin-core-public.scopedhistory.goback.md) | | () => void | Send the user one location back in the history stack. Equivalent to calling [ScopedHistory.go(-1)](./kibana-plugin-core-public.scopedhistory.go.md). If no more entries are available backwards, this is a no-op. | +| [goForward](./kibana-plugin-core-public.scopedhistory.goforward.md) | | () => void | Send the user one location forward in the history stack. Equivalent to calling [ScopedHistory.go(1)](./kibana-plugin-core-public.scopedhistory.go.md). If no more entries are available forwards, this is a no-op. | +| [length](./kibana-plugin-core-public.scopedhistory.length.md) | | number | The number of entries in the history stack, including all entries forwards and backwards from the current location. | +| [listen](./kibana-plugin-core-public.scopedhistory.listen.md) | | (listener: (location: Location<HistoryLocationState>, action: Action) => void) => UnregisterCallback | Adds a listener for location updates. | +| [location](./kibana-plugin-core-public.scopedhistory.location.md) | | Location<HistoryLocationState> | The current location of the history stack. | +| [push](./kibana-plugin-core-public.scopedhistory.push.md) | | (pathOrLocation: Path \| LocationDescriptorObject<HistoryLocationState>, state?: HistoryLocationState \| undefined) => void | Pushes a new location onto the history stack. If there are forward entries in the stack, they will be removed. | +| [replace](./kibana-plugin-core-public.scopedhistory.replace.md) | | (pathOrLocation: Path \| LocationDescriptorObject<HistoryLocationState>, state?: HistoryLocationState \| undefined) => void | Replaces the current location in the history stack. Does not remove forward or backward entries. | diff --git a/docs/development/core/public/kibana-plugin-core-public.simplesavedobject._constructor_.md b/docs/development/core/public/kibana-plugin-core-public.simplesavedobject._constructor_.md index c73a3a200cc2..f53b6e529286 100644 --- a/docs/development/core/public/kibana-plugin-core-public.simplesavedobject._constructor_.md +++ b/docs/development/core/public/kibana-plugin-core-public.simplesavedobject._constructor_.md @@ -16,6 +16,6 @@ constructor(client: SavedObjectsClientContract, { id, type, version, attributes, | Parameter | Type | Description | | --- | --- | --- | -| client | SavedObjectsClientContract | | -| { id, type, version, attributes, error, references, migrationVersion, coreMigrationVersion, namespaces, } | SavedObjectType<T> | | +| client | SavedObjectsClientContract | | +| { id, type, version, attributes, error, references, migrationVersion, coreMigrationVersion, namespaces, } | SavedObjectType<T> | | diff --git a/docs/development/core/public/kibana-plugin-core-public.simplesavedobject.delete.md b/docs/development/core/public/kibana-plugin-core-public.simplesavedobject.delete.md index 909ff2e7d343..cb848bff5643 100644 --- a/docs/development/core/public/kibana-plugin-core-public.simplesavedobject.delete.md +++ b/docs/development/core/public/kibana-plugin-core-public.simplesavedobject.delete.md @@ -11,5 +11,5 @@ delete(): Promise<{}>; ``` Returns: -`Promise<{}>` +Promise<{}> diff --git a/docs/development/core/public/kibana-plugin-core-public.simplesavedobject.get.md b/docs/development/core/public/kibana-plugin-core-public.simplesavedobject.get.md index caa9ab9857a6..9a9c27d78c06 100644 --- a/docs/development/core/public/kibana-plugin-core-public.simplesavedobject.get.md +++ b/docs/development/core/public/kibana-plugin-core-public.simplesavedobject.get.md @@ -14,9 +14,9 @@ get(key: string): any; | Parameter | Type | Description | | --- | --- | --- | -| key | string | | +| key | string | | Returns: -`any` +any diff --git a/docs/development/core/public/kibana-plugin-core-public.simplesavedobject.has.md b/docs/development/core/public/kibana-plugin-core-public.simplesavedobject.has.md index 960a7b6cfd16..acd0ff02c7d2 100644 --- a/docs/development/core/public/kibana-plugin-core-public.simplesavedobject.has.md +++ b/docs/development/core/public/kibana-plugin-core-public.simplesavedobject.has.md @@ -14,9 +14,9 @@ has(key: string): boolean; | Parameter | Type | Description | | --- | --- | --- | -| key | string | | +| key | string | | Returns: -`boolean` +boolean diff --git a/docs/development/core/public/kibana-plugin-core-public.simplesavedobject.md b/docs/development/core/public/kibana-plugin-core-public.simplesavedobject.md index e15a4d4ea6d0..2aac93f9b5bc 100644 --- a/docs/development/core/public/kibana-plugin-core-public.simplesavedobject.md +++ b/docs/development/core/public/kibana-plugin-core-public.simplesavedobject.md @@ -24,15 +24,15 @@ export declare class SimpleSavedObject | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [\_version](./kibana-plugin-core-public.simplesavedobject._version.md) | | SavedObjectType<T>['version'] | | -| [attributes](./kibana-plugin-core-public.simplesavedobject.attributes.md) | | T | | -| [coreMigrationVersion](./kibana-plugin-core-public.simplesavedobject.coremigrationversion.md) | | SavedObjectType<T>['coreMigrationVersion'] | | -| [error](./kibana-plugin-core-public.simplesavedobject.error.md) | | SavedObjectType<T>['error'] | | -| [id](./kibana-plugin-core-public.simplesavedobject.id.md) | | SavedObjectType<T>['id'] | | -| [migrationVersion](./kibana-plugin-core-public.simplesavedobject.migrationversion.md) | | SavedObjectType<T>['migrationVersion'] | | -| [namespaces](./kibana-plugin-core-public.simplesavedobject.namespaces.md) | | SavedObjectType<T>['namespaces'] | Space(s) that this saved object exists in. This attribute is not used for "global" saved object types which are registered with namespaceType: 'agnostic'. | -| [references](./kibana-plugin-core-public.simplesavedobject.references.md) | | SavedObjectType<T>['references'] | | -| [type](./kibana-plugin-core-public.simplesavedobject.type.md) | | SavedObjectType<T>['type'] | | +| [\_version?](./kibana-plugin-core-public.simplesavedobject._version.md) | | SavedObjectType<T>\['version'\] | (Optional) | +| [attributes](./kibana-plugin-core-public.simplesavedobject.attributes.md) | | T | | +| [coreMigrationVersion](./kibana-plugin-core-public.simplesavedobject.coremigrationversion.md) | | SavedObjectType<T>\['coreMigrationVersion'\] | | +| [error](./kibana-plugin-core-public.simplesavedobject.error.md) | | SavedObjectType<T>\['error'\] | | +| [id](./kibana-plugin-core-public.simplesavedobject.id.md) | | SavedObjectType<T>\['id'\] | | +| [migrationVersion](./kibana-plugin-core-public.simplesavedobject.migrationversion.md) | | SavedObjectType<T>\['migrationVersion'\] | | +| [namespaces](./kibana-plugin-core-public.simplesavedobject.namespaces.md) | | SavedObjectType<T>\['namespaces'\] | Space(s) that this saved object exists in. This attribute is not used for "global" saved object types which are registered with namespaceType: 'agnostic'. | +| [references](./kibana-plugin-core-public.simplesavedobject.references.md) | | SavedObjectType<T>\['references'\] | | +| [type](./kibana-plugin-core-public.simplesavedobject.type.md) | | SavedObjectType<T>\['type'\] | | ## Methods diff --git a/docs/development/core/public/kibana-plugin-core-public.simplesavedobject.save.md b/docs/development/core/public/kibana-plugin-core-public.simplesavedobject.save.md index c985c714b9c5..fdd262c70d4e 100644 --- a/docs/development/core/public/kibana-plugin-core-public.simplesavedobject.save.md +++ b/docs/development/core/public/kibana-plugin-core-public.simplesavedobject.save.md @@ -11,5 +11,5 @@ save(): Promise>; ``` Returns: -`Promise>` +Promise<SimpleSavedObject<T>> diff --git a/docs/development/core/public/kibana-plugin-core-public.simplesavedobject.set.md b/docs/development/core/public/kibana-plugin-core-public.simplesavedobject.set.md index 09549e92b6a0..e3a6621f520b 100644 --- a/docs/development/core/public/kibana-plugin-core-public.simplesavedobject.set.md +++ b/docs/development/core/public/kibana-plugin-core-public.simplesavedobject.set.md @@ -14,10 +14,10 @@ set(key: string, value: any): T; | Parameter | Type | Description | | --- | --- | --- | -| key | string | | -| value | any | | +| key | string | | +| value | any | | Returns: -`T` +T diff --git a/docs/development/core/public/kibana-plugin-core-public.toastoptions.md b/docs/development/core/public/kibana-plugin-core-public.toastoptions.md index 0d85c482c228..c140a2e52b03 100644 --- a/docs/development/core/public/kibana-plugin-core-public.toastoptions.md +++ b/docs/development/core/public/kibana-plugin-core-public.toastoptions.md @@ -16,5 +16,5 @@ export interface ToastOptions | Property | Type | Description | | --- | --- | --- | -| [toastLifeTimeMs](./kibana-plugin-core-public.toastoptions.toastlifetimems.md) | number | How long should the toast remain on screen. | +| [toastLifeTimeMs?](./kibana-plugin-core-public.toastoptions.toastlifetimems.md) | number | (Optional) How long should the toast remain on screen. | diff --git a/docs/development/core/public/kibana-plugin-core-public.toastsapi._constructor_.md b/docs/development/core/public/kibana-plugin-core-public.toastsapi._constructor_.md index 71faf9a13b64..c50cc4d6469e 100644 --- a/docs/development/core/public/kibana-plugin-core-public.toastsapi._constructor_.md +++ b/docs/development/core/public/kibana-plugin-core-public.toastsapi._constructor_.md @@ -18,5 +18,5 @@ constructor(deps: { | Parameter | Type | Description | | --- | --- | --- | -| deps | {
uiSettings: IUiSettingsClient;
} | | +| deps | { uiSettings: IUiSettingsClient; } | | diff --git a/docs/development/core/public/kibana-plugin-core-public.toastsapi.add.md b/docs/development/core/public/kibana-plugin-core-public.toastsapi.add.md index 8cd3829c6f6a..7bee5af0c3be 100644 --- a/docs/development/core/public/kibana-plugin-core-public.toastsapi.add.md +++ b/docs/development/core/public/kibana-plugin-core-public.toastsapi.add.md @@ -16,11 +16,11 @@ add(toastOrTitle: ToastInput): Toast; | Parameter | Type | Description | | --- | --- | --- | -| toastOrTitle | ToastInput | a [ToastInput](./kibana-plugin-core-public.toastinput.md) | +| toastOrTitle | ToastInput | a [ToastInput](./kibana-plugin-core-public.toastinput.md) | Returns: -`Toast` +Toast a [Toast](./kibana-plugin-core-public.toast.md) diff --git a/docs/development/core/public/kibana-plugin-core-public.toastsapi.adddanger.md b/docs/development/core/public/kibana-plugin-core-public.toastsapi.adddanger.md index 420100a1209a..f73a84996ff9 100644 --- a/docs/development/core/public/kibana-plugin-core-public.toastsapi.adddanger.md +++ b/docs/development/core/public/kibana-plugin-core-public.toastsapi.adddanger.md @@ -16,12 +16,12 @@ addDanger(toastOrTitle: ToastInput, options?: ToastOptions): Toast; | Parameter | Type | Description | | --- | --- | --- | -| toastOrTitle | ToastInput | a [ToastInput](./kibana-plugin-core-public.toastinput.md) | -| options | ToastOptions | a [ToastOptions](./kibana-plugin-core-public.toastoptions.md) | +| toastOrTitle | ToastInput | a [ToastInput](./kibana-plugin-core-public.toastinput.md) | +| options | ToastOptions | a [ToastOptions](./kibana-plugin-core-public.toastoptions.md) | Returns: -`Toast` +Toast a [Toast](./kibana-plugin-core-public.toast.md) diff --git a/docs/development/core/public/kibana-plugin-core-public.toastsapi.adderror.md b/docs/development/core/public/kibana-plugin-core-public.toastsapi.adderror.md index e5f851a22566..c1520ea392f7 100644 --- a/docs/development/core/public/kibana-plugin-core-public.toastsapi.adderror.md +++ b/docs/development/core/public/kibana-plugin-core-public.toastsapi.adderror.md @@ -16,12 +16,12 @@ addError(error: Error, options: ErrorToastOptions): Toast; | Parameter | Type | Description | | --- | --- | --- | -| error | Error | an Error instance. | -| options | ErrorToastOptions | [ErrorToastOptions](./kibana-plugin-core-public.errortoastoptions.md) | +| error | Error | an Error instance. | +| options | ErrorToastOptions | [ErrorToastOptions](./kibana-plugin-core-public.errortoastoptions.md) | Returns: -`Toast` +Toast a [Toast](./kibana-plugin-core-public.toast.md) diff --git a/docs/development/core/public/kibana-plugin-core-public.toastsapi.addinfo.md b/docs/development/core/public/kibana-plugin-core-public.toastsapi.addinfo.md index 76508d26b4ae..702948266315 100644 --- a/docs/development/core/public/kibana-plugin-core-public.toastsapi.addinfo.md +++ b/docs/development/core/public/kibana-plugin-core-public.toastsapi.addinfo.md @@ -16,12 +16,12 @@ addInfo(toastOrTitle: ToastInput, options?: ToastOptions): Toast; | Parameter | Type | Description | | --- | --- | --- | -| toastOrTitle | ToastInput | a [ToastInput](./kibana-plugin-core-public.toastinput.md) | -| options | ToastOptions | a [ToastOptions](./kibana-plugin-core-public.toastoptions.md) | +| toastOrTitle | ToastInput | a [ToastInput](./kibana-plugin-core-public.toastinput.md) | +| options | ToastOptions | a [ToastOptions](./kibana-plugin-core-public.toastoptions.md) | Returns: -`Toast` +Toast a [Toast](./kibana-plugin-core-public.toast.md) diff --git a/docs/development/core/public/kibana-plugin-core-public.toastsapi.addsuccess.md b/docs/development/core/public/kibana-plugin-core-public.toastsapi.addsuccess.md index c79f48042514..b9cf4da3b43a 100644 --- a/docs/development/core/public/kibana-plugin-core-public.toastsapi.addsuccess.md +++ b/docs/development/core/public/kibana-plugin-core-public.toastsapi.addsuccess.md @@ -16,12 +16,12 @@ addSuccess(toastOrTitle: ToastInput, options?: ToastOptions): Toast; | Parameter | Type | Description | | --- | --- | --- | -| toastOrTitle | ToastInput | a [ToastInput](./kibana-plugin-core-public.toastinput.md) | -| options | ToastOptions | a [ToastOptions](./kibana-plugin-core-public.toastoptions.md) | +| toastOrTitle | ToastInput | a [ToastInput](./kibana-plugin-core-public.toastinput.md) | +| options | ToastOptions | a [ToastOptions](./kibana-plugin-core-public.toastoptions.md) | Returns: -`Toast` +Toast a [Toast](./kibana-plugin-core-public.toast.md) diff --git a/docs/development/core/public/kibana-plugin-core-public.toastsapi.addwarning.md b/docs/development/core/public/kibana-plugin-core-public.toastsapi.addwarning.md index 6154af148332..790af0d26220 100644 --- a/docs/development/core/public/kibana-plugin-core-public.toastsapi.addwarning.md +++ b/docs/development/core/public/kibana-plugin-core-public.toastsapi.addwarning.md @@ -16,12 +16,12 @@ addWarning(toastOrTitle: ToastInput, options?: ToastOptions): Toast; | Parameter | Type | Description | | --- | --- | --- | -| toastOrTitle | ToastInput | a [ToastInput](./kibana-plugin-core-public.toastinput.md) | -| options | ToastOptions | a [ToastOptions](./kibana-plugin-core-public.toastoptions.md) | +| toastOrTitle | ToastInput | a [ToastInput](./kibana-plugin-core-public.toastinput.md) | +| options | ToastOptions | a [ToastOptions](./kibana-plugin-core-public.toastoptions.md) | Returns: -`Toast` +Toast a [Toast](./kibana-plugin-core-public.toast.md) diff --git a/docs/development/core/public/kibana-plugin-core-public.toastsapi.get_.md b/docs/development/core/public/kibana-plugin-core-public.toastsapi.get_.md index 90b32a8b48e5..275d30fd54e0 100644 --- a/docs/development/core/public/kibana-plugin-core-public.toastsapi.get_.md +++ b/docs/development/core/public/kibana-plugin-core-public.toastsapi.get_.md @@ -13,5 +13,5 @@ get$(): Rx.Observable; ``` Returns: -`Rx.Observable` +Rx.Observable<Toast\[\]> diff --git a/docs/development/core/public/kibana-plugin-core-public.toastsapi.md b/docs/development/core/public/kibana-plugin-core-public.toastsapi.md index ca4c08989128..4d7f9dcacfa6 100644 --- a/docs/development/core/public/kibana-plugin-core-public.toastsapi.md +++ b/docs/development/core/public/kibana-plugin-core-public.toastsapi.md @@ -11,6 +11,7 @@ Methods for adding and removing global toast messages. ```typescript export declare class ToastsApi implements IToasts ``` +Implements: IToasts ## Constructors diff --git a/docs/development/core/public/kibana-plugin-core-public.toastsapi.remove.md b/docs/development/core/public/kibana-plugin-core-public.toastsapi.remove.md index 360fb9452282..aeac9f46b790 100644 --- a/docs/development/core/public/kibana-plugin-core-public.toastsapi.remove.md +++ b/docs/development/core/public/kibana-plugin-core-public.toastsapi.remove.md @@ -16,9 +16,9 @@ remove(toastOrId: Toast | string): void; | Parameter | Type | Description | | --- | --- | --- | -| toastOrId | Toast | string | a [Toast](./kibana-plugin-core-public.toast.md) returned by [ToastsApi.add()](./kibana-plugin-core-public.toastsapi.add.md) or its id | +| toastOrId | Toast \| string | a [Toast](./kibana-plugin-core-public.toast.md) returned by [ToastsApi.add()](./kibana-plugin-core-public.toastsapi.add.md) or its id | Returns: -`void` +void diff --git a/docs/development/core/public/kibana-plugin-core-public.uisettingsparams.md b/docs/development/core/public/kibana-plugin-core-public.uisettingsparams.md index 54d1a6612f4b..325ce96f36ca 100644 --- a/docs/development/core/public/kibana-plugin-core-public.uisettingsparams.md +++ b/docs/development/core/public/kibana-plugin-core-public.uisettingsparams.md @@ -16,18 +16,18 @@ export interface UiSettingsParams | Property | Type | Description | | --- | --- | --- | -| [category](./kibana-plugin-core-public.uisettingsparams.category.md) | string[] | used to group the configured setting in the UI | -| [deprecation](./kibana-plugin-core-public.uisettingsparams.deprecation.md) | DeprecationSettings | optional deprecation information. Used to generate a deprecation warning. | -| [description](./kibana-plugin-core-public.uisettingsparams.description.md) | string | description provided to a user in UI | -| [metric](./kibana-plugin-core-public.uisettingsparams.metric.md) | {
type: UiCounterMetricType;
name: string;
} | Metric to track once this property changes | -| [name](./kibana-plugin-core-public.uisettingsparams.name.md) | string | title in the UI | -| [optionLabels](./kibana-plugin-core-public.uisettingsparams.optionlabels.md) | Record<string, string> | text labels for 'select' type UI element | -| [options](./kibana-plugin-core-public.uisettingsparams.options.md) | string[] | array of permitted values for this setting | -| [order](./kibana-plugin-core-public.uisettingsparams.order.md) | number | index of the settings within its category (ascending order, smallest will be displayed first). Used for ordering in the UI. settings without order defined will be displayed last and ordered by name | -| [readonly](./kibana-plugin-core-public.uisettingsparams.readonly.md) | boolean | a flag indicating that value cannot be changed | -| [requiresPageReload](./kibana-plugin-core-public.uisettingsparams.requirespagereload.md) | boolean | a flag indicating whether new value applying requires page reloading | -| [schema](./kibana-plugin-core-public.uisettingsparams.schema.md) | Type<T> | | -| [sensitive](./kibana-plugin-core-public.uisettingsparams.sensitive.md) | boolean | a flag indicating that value might contain user sensitive data. used by telemetry to mask the value of the setting when sent. | -| [type](./kibana-plugin-core-public.uisettingsparams.type.md) | UiSettingsType | defines a type of UI element [UiSettingsType](./kibana-plugin-core-public.uisettingstype.md) | -| [value](./kibana-plugin-core-public.uisettingsparams.value.md) | T | default value to fall back to if a user doesn't provide any | +| [category?](./kibana-plugin-core-public.uisettingsparams.category.md) | string\[\] | (Optional) used to group the configured setting in the UI | +| [deprecation?](./kibana-plugin-core-public.uisettingsparams.deprecation.md) | DeprecationSettings | (Optional) optional deprecation information. Used to generate a deprecation warning. | +| [description?](./kibana-plugin-core-public.uisettingsparams.description.md) | string | (Optional) description provided to a user in UI | +| [metric?](./kibana-plugin-core-public.uisettingsparams.metric.md) | { type: UiCounterMetricType; name: string; } | (Optional) Metric to track once this property changes | +| [name?](./kibana-plugin-core-public.uisettingsparams.name.md) | string | (Optional) title in the UI | +| [optionLabels?](./kibana-plugin-core-public.uisettingsparams.optionlabels.md) | Record<string, string> | (Optional) text labels for 'select' type UI element | +| [options?](./kibana-plugin-core-public.uisettingsparams.options.md) | string\[\] | (Optional) array of permitted values for this setting | +| [order?](./kibana-plugin-core-public.uisettingsparams.order.md) | number | (Optional) index of the settings within its category (ascending order, smallest will be displayed first). Used for ordering in the UI. settings without order defined will be displayed last and ordered by name | +| [readonly?](./kibana-plugin-core-public.uisettingsparams.readonly.md) | boolean | (Optional) a flag indicating that value cannot be changed | +| [requiresPageReload?](./kibana-plugin-core-public.uisettingsparams.requirespagereload.md) | boolean | (Optional) a flag indicating whether new value applying requires page reloading | +| [schema](./kibana-plugin-core-public.uisettingsparams.schema.md) | Type<T> | | +| [sensitive?](./kibana-plugin-core-public.uisettingsparams.sensitive.md) | boolean | (Optional) a flag indicating that value might contain user sensitive data. used by telemetry to mask the value of the setting when sent. | +| [type?](./kibana-plugin-core-public.uisettingsparams.type.md) | UiSettingsType | (Optional) defines a type of UI element [UiSettingsType](./kibana-plugin-core-public.uisettingstype.md) | +| [value?](./kibana-plugin-core-public.uisettingsparams.value.md) | T | (Optional) default value to fall back to if a user doesn't provide any | diff --git a/docs/development/core/public/kibana-plugin-core-public.userprovidedvalues.md b/docs/development/core/public/kibana-plugin-core-public.userprovidedvalues.md index e59a75500f55..eb8f0124c334 100644 --- a/docs/development/core/public/kibana-plugin-core-public.userprovidedvalues.md +++ b/docs/development/core/public/kibana-plugin-core-public.userprovidedvalues.md @@ -16,6 +16,6 @@ export interface UserProvidedValues | Property | Type | Description | | --- | --- | --- | -| [isOverridden](./kibana-plugin-core-public.userprovidedvalues.isoverridden.md) | boolean | | -| [userValue](./kibana-plugin-core-public.userprovidedvalues.uservalue.md) | T | | +| [isOverridden?](./kibana-plugin-core-public.userprovidedvalues.isoverridden.md) | boolean | (Optional) | +| [userValue?](./kibana-plugin-core-public.userprovidedvalues.uservalue.md) | T | (Optional) | diff --git a/docs/development/core/server/kibana-plugin-core-server.appcategory.md b/docs/development/core/server/kibana-plugin-core-server.appcategory.md index a761bf4e5b39..ca5e8b354d45 100644 --- a/docs/development/core/server/kibana-plugin-core-server.appcategory.md +++ b/docs/development/core/server/kibana-plugin-core-server.appcategory.md @@ -16,9 +16,9 @@ export interface AppCategory | Property | Type | Description | | --- | --- | --- | -| [ariaLabel](./kibana-plugin-core-server.appcategory.arialabel.md) | string | If the visual label isn't appropriate for screen readers, can override it here | -| [euiIconType](./kibana-plugin-core-server.appcategory.euiicontype.md) | string | Define an icon to be used for the category If the category is only 1 item, and no icon is defined, will default to the product icon Defaults to initials if no icon is defined | -| [id](./kibana-plugin-core-server.appcategory.id.md) | string | Unique identifier for the categories | -| [label](./kibana-plugin-core-server.appcategory.label.md) | string | Label used for category name. Also used as aria-label if one isn't set. | -| [order](./kibana-plugin-core-server.appcategory.order.md) | number | The order that categories will be sorted in Prefer large steps between categories to allow for further editing (Default categories are in steps of 1000) | +| [ariaLabel?](./kibana-plugin-core-server.appcategory.arialabel.md) | string | (Optional) If the visual label isn't appropriate for screen readers, can override it here | +| [euiIconType?](./kibana-plugin-core-server.appcategory.euiicontype.md) | string | (Optional) Define an icon to be used for the category If the category is only 1 item, and no icon is defined, will default to the product icon Defaults to initials if no icon is defined | +| [id](./kibana-plugin-core-server.appcategory.id.md) | string | Unique identifier for the categories | +| [label](./kibana-plugin-core-server.appcategory.label.md) | string | Label used for category name. Also used as aria-label if one isn't set. | +| [order?](./kibana-plugin-core-server.appcategory.order.md) | number | (Optional) The order that categories will be sorted in Prefer large steps between categories to allow for further editing (Default categories are in steps of 1000) | diff --git a/docs/development/core/server/kibana-plugin-core-server.asyncplugin.md b/docs/development/core/server/kibana-plugin-core-server.asyncplugin.md index 1ad1d87220b7..c5c664e07f29 100644 --- a/docs/development/core/server/kibana-plugin-core-server.asyncplugin.md +++ b/docs/development/core/server/kibana-plugin-core-server.asyncplugin.md @@ -6,7 +6,7 @@ > Warning: This API is now obsolete. > -> Asynchronous lifecycles are deprecated, and should be migrated to sync [plugin](./kibana-plugin-core-server.plugin.md) +> Asynchronous lifecycles are deprecated, and should be migrated to sync > A plugin with asynchronous lifecycle methods. @@ -23,5 +23,5 @@ export interface AsyncPlugin(Optional) | diff --git a/docs/development/core/server/kibana-plugin-core-server.asyncplugin.setup.md b/docs/development/core/server/kibana-plugin-core-server.asyncplugin.setup.md index 1d033b7b88b0..73752d6c9bd2 100644 --- a/docs/development/core/server/kibana-plugin-core-server.asyncplugin.setup.md +++ b/docs/development/core/server/kibana-plugin-core-server.asyncplugin.setup.md @@ -14,10 +14,10 @@ setup(core: CoreSetup, plugins: TPluginsSetup): TSetup | Promise; | Parameter | Type | Description | | --- | --- | --- | -| core | CoreSetup | | -| plugins | TPluginsSetup | | +| core | CoreSetup | | +| plugins | TPluginsSetup | | Returns: -`TSetup | Promise` +TSetup \| Promise<TSetup> diff --git a/docs/development/core/server/kibana-plugin-core-server.asyncplugin.start.md b/docs/development/core/server/kibana-plugin-core-server.asyncplugin.start.md index 3cce90f01603..98cf74341062 100644 --- a/docs/development/core/server/kibana-plugin-core-server.asyncplugin.start.md +++ b/docs/development/core/server/kibana-plugin-core-server.asyncplugin.start.md @@ -14,10 +14,10 @@ start(core: CoreStart, plugins: TPluginsStart): TStart | Promise; | Parameter | Type | Description | | --- | --- | --- | -| core | CoreStart | | -| plugins | TPluginsStart | | +| core | CoreStart | | +| plugins | TPluginsStart | | Returns: -`TStart | Promise` +TStart \| Promise<TStart> diff --git a/docs/development/core/server/kibana-plugin-core-server.asyncplugin.stop.md b/docs/development/core/server/kibana-plugin-core-server.asyncplugin.stop.md index 9272fc2c4eba..80c554f34334 100644 --- a/docs/development/core/server/kibana-plugin-core-server.asyncplugin.stop.md +++ b/docs/development/core/server/kibana-plugin-core-server.asyncplugin.stop.md @@ -11,5 +11,5 @@ stop?(): void; ``` Returns: -`void` +void diff --git a/docs/development/core/server/kibana-plugin-core-server.authenticated.md b/docs/development/core/server/kibana-plugin-core-server.authenticated.md index ffbf94292601..90b480d4a026 100644 --- a/docs/development/core/server/kibana-plugin-core-server.authenticated.md +++ b/docs/development/core/server/kibana-plugin-core-server.authenticated.md @@ -10,10 +10,11 @@ ```typescript export interface Authenticated extends AuthResultParams ``` +Extends: AuthResultParams ## Properties | Property | Type | Description | | --- | --- | --- | -| [type](./kibana-plugin-core-server.authenticated.type.md) | AuthResultType.authenticated | | +| [type](./kibana-plugin-core-server.authenticated.type.md) | AuthResultType.authenticated | | diff --git a/docs/development/core/server/kibana-plugin-core-server.authnothandled.md b/docs/development/core/server/kibana-plugin-core-server.authnothandled.md index c1eaa6899135..297f60e4bd8a 100644 --- a/docs/development/core/server/kibana-plugin-core-server.authnothandled.md +++ b/docs/development/core/server/kibana-plugin-core-server.authnothandled.md @@ -15,5 +15,5 @@ export interface AuthNotHandled | Property | Type | Description | | --- | --- | --- | -| [type](./kibana-plugin-core-server.authnothandled.type.md) | AuthResultType.notHandled | | +| [type](./kibana-plugin-core-server.authnothandled.type.md) | AuthResultType.notHandled | | diff --git a/docs/development/core/server/kibana-plugin-core-server.authredirected.md b/docs/development/core/server/kibana-plugin-core-server.authredirected.md index 7b5a4d60fb0b..4da08e49056f 100644 --- a/docs/development/core/server/kibana-plugin-core-server.authredirected.md +++ b/docs/development/core/server/kibana-plugin-core-server.authredirected.md @@ -10,10 +10,11 @@ ```typescript export interface AuthRedirected extends AuthRedirectedParams ``` +Extends: AuthRedirectedParams ## Properties | Property | Type | Description | | --- | --- | --- | -| [type](./kibana-plugin-core-server.authredirected.type.md) | AuthResultType.redirected | | +| [type](./kibana-plugin-core-server.authredirected.type.md) | AuthResultType.redirected | | diff --git a/docs/development/core/server/kibana-plugin-core-server.authredirectedparams.md b/docs/development/core/server/kibana-plugin-core-server.authredirectedparams.md index 2e1f04ef4efc..2f6ef7c6f6ba 100644 --- a/docs/development/core/server/kibana-plugin-core-server.authredirectedparams.md +++ b/docs/development/core/server/kibana-plugin-core-server.authredirectedparams.md @@ -16,5 +16,5 @@ export interface AuthRedirectedParams | Property | Type | Description | | --- | --- | --- | -| [headers](./kibana-plugin-core-server.authredirectedparams.headers.md) | {
location: string;
} & ResponseHeaders | Headers to attach for auth redirect. Must include "location" header | +| [headers](./kibana-plugin-core-server.authredirectedparams.headers.md) | { location: string; } & ResponseHeaders | Headers to attach for auth redirect. Must include "location" header | diff --git a/docs/development/core/server/kibana-plugin-core-server.authresultparams.md b/docs/development/core/server/kibana-plugin-core-server.authresultparams.md index db4ead393c04..7e907a9bf7a7 100644 --- a/docs/development/core/server/kibana-plugin-core-server.authresultparams.md +++ b/docs/development/core/server/kibana-plugin-core-server.authresultparams.md @@ -16,7 +16,7 @@ export interface AuthResultParams | Property | Type | Description | | --- | --- | --- | -| [requestHeaders](./kibana-plugin-core-server.authresultparams.requestheaders.md) | AuthHeaders | Auth specific headers to attach to a request object. Used to perform a request to Elasticsearch on behalf of an authenticated user. | -| [responseHeaders](./kibana-plugin-core-server.authresultparams.responseheaders.md) | AuthHeaders | Auth specific headers to attach to a response object. Used to send back authentication mechanism related headers to a client when needed. | -| [state](./kibana-plugin-core-server.authresultparams.state.md) | Record<string, any> | Data to associate with an incoming request. Any downstream plugin may get access to the data. | +| [requestHeaders?](./kibana-plugin-core-server.authresultparams.requestheaders.md) | AuthHeaders | (Optional) Auth specific headers to attach to a request object. Used to perform a request to Elasticsearch on behalf of an authenticated user. | +| [responseHeaders?](./kibana-plugin-core-server.authresultparams.responseheaders.md) | AuthHeaders | (Optional) Auth specific headers to attach to a response object. Used to send back authentication mechanism related headers to a client when needed. | +| [state?](./kibana-plugin-core-server.authresultparams.state.md) | Record<string, any> | (Optional) Data to associate with an incoming request. Any downstream plugin may get access to the data. | diff --git a/docs/development/core/server/kibana-plugin-core-server.authtoolkit.md b/docs/development/core/server/kibana-plugin-core-server.authtoolkit.md index 5f8b98ab2e89..24b561d04bbb 100644 --- a/docs/development/core/server/kibana-plugin-core-server.authtoolkit.md +++ b/docs/development/core/server/kibana-plugin-core-server.authtoolkit.md @@ -16,7 +16,7 @@ export interface AuthToolkit | Property | Type | Description | | --- | --- | --- | -| [authenticated](./kibana-plugin-core-server.authtoolkit.authenticated.md) | (data?: AuthResultParams) => AuthResult | Authentication is successful with given credentials, allow request to pass through | -| [notHandled](./kibana-plugin-core-server.authtoolkit.nothandled.md) | () => AuthResult | User has no credentials. Allows user to access a resource when authRequired is 'optional' Rejects a request when authRequired: true | -| [redirected](./kibana-plugin-core-server.authtoolkit.redirected.md) | (headers: {
location: string;
} & ResponseHeaders) => AuthResult | Redirects user to another location to complete authentication when authRequired: true Allows user to access a resource without redirection when authRequired: 'optional' | +| [authenticated](./kibana-plugin-core-server.authtoolkit.authenticated.md) | (data?: AuthResultParams) => AuthResult | Authentication is successful with given credentials, allow request to pass through | +| [notHandled](./kibana-plugin-core-server.authtoolkit.nothandled.md) | () => AuthResult | User has no credentials. Allows user to access a resource when authRequired is 'optional' Rejects a request when authRequired: true | +| [redirected](./kibana-plugin-core-server.authtoolkit.redirected.md) | (headers: { location: string; } & ResponseHeaders) => AuthResult | Redirects user to another location to complete authentication when authRequired: true Allows user to access a resource without redirection when authRequired: 'optional' | diff --git a/docs/development/core/server/kibana-plugin-core-server.basedeprecationdetails.md b/docs/development/core/server/kibana-plugin-core-server.basedeprecationdetails.md index 3e4786506235..bcd96e35295a 100644 --- a/docs/development/core/server/kibana-plugin-core-server.basedeprecationdetails.md +++ b/docs/development/core/server/kibana-plugin-core-server.basedeprecationdetails.md @@ -16,11 +16,11 @@ export interface BaseDeprecationDetails | Property | Type | Description | | --- | --- | --- | -| [correctiveActions](./kibana-plugin-core-server.basedeprecationdetails.correctiveactions.md) | {
api?: {
path: string;
method: 'POST' | 'PUT';
body?: {
[key: string]: any;
};
omitContextFromBody?: boolean;
};
manualSteps: string[];
} | corrective action needed to fix this deprecation. | -| [deprecationType](./kibana-plugin-core-server.basedeprecationdetails.deprecationtype.md) | 'config' | 'feature' | (optional) Used to identify between different deprecation types. Example use case: in Upgrade Assistant, we may want to allow the user to sort by deprecation type or show each type in a separate tab.Feel free to add new types if necessary. Predefined types are necessary to reduce having similar definitions with different keywords across kibana deprecations. | -| [documentationUrl](./kibana-plugin-core-server.basedeprecationdetails.documentationurl.md) | string | (optional) link to the documentation for more details on the deprecation. | -| [level](./kibana-plugin-core-server.basedeprecationdetails.level.md) | 'warning' | 'critical' | 'fetch_error' | levels: - warning: will not break deployment upon upgrade - critical: needs to be addressed before upgrade. - fetch\_error: Deprecations service failed to grab the deprecation details for the domain. | -| [message](./kibana-plugin-core-server.basedeprecationdetails.message.md) | string | The description message to be displayed for the deprecation. Check the README for writing deprecations in src/core/server/deprecations/README.mdx | -| [requireRestart](./kibana-plugin-core-server.basedeprecationdetails.requirerestart.md) | boolean | (optional) specify the fix for this deprecation requires a full kibana restart. | -| [title](./kibana-plugin-core-server.basedeprecationdetails.title.md) | string | The title of the deprecation. Check the README for writing deprecations in src/core/server/deprecations/README.mdx | +| [correctiveActions](./kibana-plugin-core-server.basedeprecationdetails.correctiveactions.md) | { api?: { path: string; method: 'POST' \| 'PUT'; body?: { \[key: string\]: any; }; omitContextFromBody?: boolean; }; manualSteps: string\[\]; } | corrective action needed to fix this deprecation. | +| [deprecationType?](./kibana-plugin-core-server.basedeprecationdetails.deprecationtype.md) | 'config' \| 'feature' | (Optional) (optional) Used to identify between different deprecation types. Example use case: in Upgrade Assistant, we may want to allow the user to sort by deprecation type or show each type in a separate tab.Feel free to add new types if necessary. Predefined types are necessary to reduce having similar definitions with different keywords across kibana deprecations. | +| [documentationUrl?](./kibana-plugin-core-server.basedeprecationdetails.documentationurl.md) | string | (Optional) (optional) link to the documentation for more details on the deprecation. | +| [level](./kibana-plugin-core-server.basedeprecationdetails.level.md) | 'warning' \| 'critical' \| 'fetch\_error' | levels: - warning: will not break deployment upon upgrade - critical: needs to be addressed before upgrade. - fetch\_error: Deprecations service failed to grab the deprecation details for the domain. | +| [message](./kibana-plugin-core-server.basedeprecationdetails.message.md) | string | The description message to be displayed for the deprecation. Check the README for writing deprecations in src/core/server/deprecations/README.mdx | +| [requireRestart?](./kibana-plugin-core-server.basedeprecationdetails.requirerestart.md) | boolean | (Optional) (optional) specify the fix for this deprecation requires a full kibana restart. | +| [title](./kibana-plugin-core-server.basedeprecationdetails.title.md) | string | The title of the deprecation. Check the README for writing deprecations in src/core/server/deprecations/README.mdx | diff --git a/docs/development/core/server/kibana-plugin-core-server.basepath.md b/docs/development/core/server/kibana-plugin-core-server.basepath.md index f4bac88cd85f..4fae861cf165 100644 --- a/docs/development/core/server/kibana-plugin-core-server.basepath.md +++ b/docs/development/core/server/kibana-plugin-core-server.basepath.md @@ -20,10 +20,10 @@ The constructor for this class is marked as internal. Third-party code should no | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [get](./kibana-plugin-core-server.basepath.get.md) | | (request: KibanaRequest) => string | returns basePath value, specific for an incoming request. | -| [prepend](./kibana-plugin-core-server.basepath.prepend.md) | | (path: string) => string | Prepends path with the basePath. | -| [publicBaseUrl](./kibana-plugin-core-server.basepath.publicbaseurl.md) | | string | The server's publicly exposed base URL, if configured. Includes protocol, host, port (optional) and the [BasePath.serverBasePath](./kibana-plugin-core-server.basepath.serverbasepath.md). | -| [remove](./kibana-plugin-core-server.basepath.remove.md) | | (path: string) => string | Removes the prepended basePath from the path. | -| [serverBasePath](./kibana-plugin-core-server.basepath.serverbasepath.md) | | string | returns the server's basePathSee [BasePath.get](./kibana-plugin-core-server.basepath.get.md) for getting the basePath value for a specific request | -| [set](./kibana-plugin-core-server.basepath.set.md) | | (request: KibanaRequest, requestSpecificBasePath: string) => void | sets basePath value, specific for an incoming request. | +| [get](./kibana-plugin-core-server.basepath.get.md) | | (request: KibanaRequest) => string | returns basePath value, specific for an incoming request. | +| [prepend](./kibana-plugin-core-server.basepath.prepend.md) | | (path: string) => string | Prepends path with the basePath. | +| [publicBaseUrl?](./kibana-plugin-core-server.basepath.publicbaseurl.md) | | string | (Optional) The server's publicly exposed base URL, if configured. Includes protocol, host, port (optional) and the [BasePath.serverBasePath](./kibana-plugin-core-server.basepath.serverbasepath.md). | +| [remove](./kibana-plugin-core-server.basepath.remove.md) | | (path: string) => string | Removes the prepended basePath from the path. | +| [serverBasePath](./kibana-plugin-core-server.basepath.serverbasepath.md) | | string | returns the server's basePathSee [BasePath.get](./kibana-plugin-core-server.basepath.get.md) for getting the basePath value for a specific request | +| [set](./kibana-plugin-core-server.basepath.set.md) | | (request: KibanaRequest, requestSpecificBasePath: string) => void | sets basePath value, specific for an incoming request. | diff --git a/docs/development/core/server/kibana-plugin-core-server.capabilities.md b/docs/development/core/server/kibana-plugin-core-server.capabilities.md index cf47ce4609ea..a5900e96a86b 100644 --- a/docs/development/core/server/kibana-plugin-core-server.capabilities.md +++ b/docs/development/core/server/kibana-plugin-core-server.capabilities.md @@ -16,7 +16,7 @@ export interface Capabilities | Property | Type | Description | | --- | --- | --- | -| [catalogue](./kibana-plugin-core-server.capabilities.catalogue.md) | Record<string, boolean> | Catalogue capabilities. Catalogue entries drive the visibility of the Kibana homepage options. | -| [management](./kibana-plugin-core-server.capabilities.management.md) | {
[sectionId: string]: Record<string, boolean>;
} | Management section capabilities. | -| [navLinks](./kibana-plugin-core-server.capabilities.navlinks.md) | Record<string, boolean> | Navigation link capabilities. | +| [catalogue](./kibana-plugin-core-server.capabilities.catalogue.md) | Record<string, boolean> | Catalogue capabilities. Catalogue entries drive the visibility of the Kibana homepage options. | +| [management](./kibana-plugin-core-server.capabilities.management.md) | { \[sectionId: string\]: Record<string, boolean>; } | Management section capabilities. | +| [navLinks](./kibana-plugin-core-server.capabilities.navlinks.md) | Record<string, boolean> | Navigation link capabilities. | diff --git a/docs/development/core/server/kibana-plugin-core-server.capabilitiessetup.registerprovider.md b/docs/development/core/server/kibana-plugin-core-server.capabilitiessetup.registerprovider.md index 01a6f3562e77..9122f7e0f11e 100644 --- a/docs/development/core/server/kibana-plugin-core-server.capabilitiessetup.registerprovider.md +++ b/docs/development/core/server/kibana-plugin-core-server.capabilitiessetup.registerprovider.md @@ -16,11 +16,11 @@ registerProvider(provider: CapabilitiesProvider): void; | Parameter | Type | Description | | --- | --- | --- | -| provider | CapabilitiesProvider | | +| provider | CapabilitiesProvider | | Returns: -`void` +void ## Example @@ -41,6 +41,5 @@ public setup(core: CoreSetup, deps: {}) { } }); } - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.capabilitiessetup.registerswitcher.md b/docs/development/core/server/kibana-plugin-core-server.capabilitiessetup.registerswitcher.md index 715f15ec812a..c07703c1f365 100644 --- a/docs/development/core/server/kibana-plugin-core-server.capabilitiessetup.registerswitcher.md +++ b/docs/development/core/server/kibana-plugin-core-server.capabilitiessetup.registerswitcher.md @@ -18,11 +18,11 @@ registerSwitcher(switcher: CapabilitiesSwitcher): void; | Parameter | Type | Description | | --- | --- | --- | -| switcher | CapabilitiesSwitcher | | +| switcher | CapabilitiesSwitcher | | Returns: -`void` +void ## Example @@ -54,6 +54,5 @@ public setup(core: CoreSetup, deps: {}) { return {}; // All capabilities will remain unchanged. }); } - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.capabilitiesstart.resolvecapabilities.md b/docs/development/core/server/kibana-plugin-core-server.capabilitiesstart.resolvecapabilities.md index d0e02499c580..a9dc27952606 100644 --- a/docs/development/core/server/kibana-plugin-core-server.capabilitiesstart.resolvecapabilities.md +++ b/docs/development/core/server/kibana-plugin-core-server.capabilitiesstart.resolvecapabilities.md @@ -16,10 +16,10 @@ resolveCapabilities(request: KibanaRequest, options?: ResolveCapabilitiesOptions | Parameter | Type | Description | | --- | --- | --- | -| request | KibanaRequest | | -| options | ResolveCapabilitiesOptions | | +| request | KibanaRequest | | +| options | ResolveCapabilitiesOptions | | Returns: -`Promise` +Promise<Capabilities> diff --git a/docs/development/core/server/kibana-plugin-core-server.configdeprecationdetails.md b/docs/development/core/server/kibana-plugin-core-server.configdeprecationdetails.md index d1ccbb0b6164..6065d1fc1889 100644 --- a/docs/development/core/server/kibana-plugin-core-server.configdeprecationdetails.md +++ b/docs/development/core/server/kibana-plugin-core-server.configdeprecationdetails.md @@ -10,11 +10,12 @@ ```typescript export interface ConfigDeprecationDetails extends BaseDeprecationDetails ``` +Extends: BaseDeprecationDetails ## Properties | Property | Type | Description | | --- | --- | --- | -| [configPath](./kibana-plugin-core-server.configdeprecationdetails.configpath.md) | string | | -| [deprecationType](./kibana-plugin-core-server.configdeprecationdetails.deprecationtype.md) | 'config' | | +| [configPath](./kibana-plugin-core-server.configdeprecationdetails.configpath.md) | string | | +| [deprecationType](./kibana-plugin-core-server.configdeprecationdetails.deprecationtype.md) | 'config' | | diff --git a/docs/development/core/server/kibana-plugin-core-server.contextsetup.createcontextcontainer.md b/docs/development/core/server/kibana-plugin-core-server.contextsetup.createcontextcontainer.md index 0d12fc16af42..5e60dd7e2ffd 100644 --- a/docs/development/core/server/kibana-plugin-core-server.contextsetup.createcontextcontainer.md +++ b/docs/development/core/server/kibana-plugin-core-server.contextsetup.createcontextcontainer.md @@ -13,5 +13,5 @@ createContextContainer(): IContextContainer; ``` Returns: -`IContextContainer` +IContextContainer diff --git a/docs/development/core/server/kibana-plugin-core-server.contextsetup.md b/docs/development/core/server/kibana-plugin-core-server.contextsetup.md index df3ee924fbcc..a15adccc9771 100644 --- a/docs/development/core/server/kibana-plugin-core-server.contextsetup.md +++ b/docs/development/core/server/kibana-plugin-core-server.contextsetup.md @@ -68,7 +68,6 @@ class MyPlugin { } } } - ``` ## Example @@ -127,7 +126,6 @@ class VizRenderingPlugin { }; } } - ``` ## Methods diff --git a/docs/development/core/server/kibana-plugin-core-server.corepreboot.md b/docs/development/core/server/kibana-plugin-core-server.corepreboot.md index 475b5f109d58..3ac97d2ca3b3 100644 --- a/docs/development/core/server/kibana-plugin-core-server.corepreboot.md +++ b/docs/development/core/server/kibana-plugin-core-server.corepreboot.md @@ -16,7 +16,7 @@ export interface CorePreboot | Property | Type | Description | | --- | --- | --- | -| [elasticsearch](./kibana-plugin-core-server.corepreboot.elasticsearch.md) | ElasticsearchServicePreboot | [ElasticsearchServicePreboot](./kibana-plugin-core-server.elasticsearchservicepreboot.md) | -| [http](./kibana-plugin-core-server.corepreboot.http.md) | HttpServicePreboot | [HttpServicePreboot](./kibana-plugin-core-server.httpservicepreboot.md) | -| [preboot](./kibana-plugin-core-server.corepreboot.preboot.md) | PrebootServicePreboot | [PrebootServicePreboot](./kibana-plugin-core-server.prebootservicepreboot.md) | +| [elasticsearch](./kibana-plugin-core-server.corepreboot.elasticsearch.md) | ElasticsearchServicePreboot | [ElasticsearchServicePreboot](./kibana-plugin-core-server.elasticsearchservicepreboot.md) | +| [http](./kibana-plugin-core-server.corepreboot.http.md) | HttpServicePreboot | [HttpServicePreboot](./kibana-plugin-core-server.httpservicepreboot.md) | +| [preboot](./kibana-plugin-core-server.corepreboot.preboot.md) | PrebootServicePreboot | [PrebootServicePreboot](./kibana-plugin-core-server.prebootservicepreboot.md) | diff --git a/docs/development/core/server/kibana-plugin-core-server.coresetup.md b/docs/development/core/server/kibana-plugin-core-server.coresetup.md index b03101b4d9fe..f4a8ece97e01 100644 --- a/docs/development/core/server/kibana-plugin-core-server.coresetup.md +++ b/docs/development/core/server/kibana-plugin-core-server.coresetup.md @@ -16,17 +16,17 @@ export interface CoreSetupCapabilitiesSetup | [CapabilitiesSetup](./kibana-plugin-core-server.capabilitiessetup.md) | -| [context](./kibana-plugin-core-server.coresetup.context.md) | ContextSetup | [ContextSetup](./kibana-plugin-core-server.contextsetup.md) | -| [deprecations](./kibana-plugin-core-server.coresetup.deprecations.md) | DeprecationsServiceSetup | [DeprecationsServiceSetup](./kibana-plugin-core-server.deprecationsservicesetup.md) | -| [elasticsearch](./kibana-plugin-core-server.coresetup.elasticsearch.md) | ElasticsearchServiceSetup | [ElasticsearchServiceSetup](./kibana-plugin-core-server.elasticsearchservicesetup.md) | -| [executionContext](./kibana-plugin-core-server.coresetup.executioncontext.md) | ExecutionContextSetup | [ExecutionContextSetup](./kibana-plugin-core-server.executioncontextsetup.md) | -| [getStartServices](./kibana-plugin-core-server.coresetup.getstartservices.md) | StartServicesAccessor<TPluginsStart, TStart> | [StartServicesAccessor](./kibana-plugin-core-server.startservicesaccessor.md) | -| [http](./kibana-plugin-core-server.coresetup.http.md) | HttpServiceSetup & {
resources: HttpResources;
} | [HttpServiceSetup](./kibana-plugin-core-server.httpservicesetup.md) | -| [i18n](./kibana-plugin-core-server.coresetup.i18n.md) | I18nServiceSetup | [I18nServiceSetup](./kibana-plugin-core-server.i18nservicesetup.md) | -| [logging](./kibana-plugin-core-server.coresetup.logging.md) | LoggingServiceSetup | [LoggingServiceSetup](./kibana-plugin-core-server.loggingservicesetup.md) | -| [metrics](./kibana-plugin-core-server.coresetup.metrics.md) | MetricsServiceSetup | [MetricsServiceSetup](./kibana-plugin-core-server.metricsservicesetup.md) | -| [savedObjects](./kibana-plugin-core-server.coresetup.savedobjects.md) | SavedObjectsServiceSetup | [SavedObjectsServiceSetup](./kibana-plugin-core-server.savedobjectsservicesetup.md) | -| [status](./kibana-plugin-core-server.coresetup.status.md) | StatusServiceSetup | [StatusServiceSetup](./kibana-plugin-core-server.statusservicesetup.md) | -| [uiSettings](./kibana-plugin-core-server.coresetup.uisettings.md) | UiSettingsServiceSetup | [UiSettingsServiceSetup](./kibana-plugin-core-server.uisettingsservicesetup.md) | +| [capabilities](./kibana-plugin-core-server.coresetup.capabilities.md) | CapabilitiesSetup | [CapabilitiesSetup](./kibana-plugin-core-server.capabilitiessetup.md) | +| [context](./kibana-plugin-core-server.coresetup.context.md) | ContextSetup | [ContextSetup](./kibana-plugin-core-server.contextsetup.md) | +| [deprecations](./kibana-plugin-core-server.coresetup.deprecations.md) | DeprecationsServiceSetup | [DeprecationsServiceSetup](./kibana-plugin-core-server.deprecationsservicesetup.md) | +| [elasticsearch](./kibana-plugin-core-server.coresetup.elasticsearch.md) | ElasticsearchServiceSetup | [ElasticsearchServiceSetup](./kibana-plugin-core-server.elasticsearchservicesetup.md) | +| [executionContext](./kibana-plugin-core-server.coresetup.executioncontext.md) | ExecutionContextSetup | [ExecutionContextSetup](./kibana-plugin-core-server.executioncontextsetup.md) | +| [getStartServices](./kibana-plugin-core-server.coresetup.getstartservices.md) | StartServicesAccessor<TPluginsStart, TStart> | [StartServicesAccessor](./kibana-plugin-core-server.startservicesaccessor.md) | +| [http](./kibana-plugin-core-server.coresetup.http.md) | HttpServiceSetup & { resources: HttpResources; } | [HttpServiceSetup](./kibana-plugin-core-server.httpservicesetup.md) | +| [i18n](./kibana-plugin-core-server.coresetup.i18n.md) | I18nServiceSetup | [I18nServiceSetup](./kibana-plugin-core-server.i18nservicesetup.md) | +| [logging](./kibana-plugin-core-server.coresetup.logging.md) | LoggingServiceSetup | [LoggingServiceSetup](./kibana-plugin-core-server.loggingservicesetup.md) | +| [metrics](./kibana-plugin-core-server.coresetup.metrics.md) | MetricsServiceSetup | [MetricsServiceSetup](./kibana-plugin-core-server.metricsservicesetup.md) | +| [savedObjects](./kibana-plugin-core-server.coresetup.savedobjects.md) | SavedObjectsServiceSetup | [SavedObjectsServiceSetup](./kibana-plugin-core-server.savedobjectsservicesetup.md) | +| [status](./kibana-plugin-core-server.coresetup.status.md) | StatusServiceSetup | [StatusServiceSetup](./kibana-plugin-core-server.statusservicesetup.md) | +| [uiSettings](./kibana-plugin-core-server.coresetup.uisettings.md) | UiSettingsServiceSetup | [UiSettingsServiceSetup](./kibana-plugin-core-server.uisettingsservicesetup.md) | diff --git a/docs/development/core/server/kibana-plugin-core-server.corestart.md b/docs/development/core/server/kibana-plugin-core-server.corestart.md index d7aaba9149cf..8a4a9b2c33f4 100644 --- a/docs/development/core/server/kibana-plugin-core-server.corestart.md +++ b/docs/development/core/server/kibana-plugin-core-server.corestart.md @@ -16,11 +16,11 @@ export interface CoreStart | Property | Type | Description | | --- | --- | --- | -| [capabilities](./kibana-plugin-core-server.corestart.capabilities.md) | CapabilitiesStart | [CapabilitiesStart](./kibana-plugin-core-server.capabilitiesstart.md) | -| [elasticsearch](./kibana-plugin-core-server.corestart.elasticsearch.md) | ElasticsearchServiceStart | [ElasticsearchServiceStart](./kibana-plugin-core-server.elasticsearchservicestart.md) | -| [executionContext](./kibana-plugin-core-server.corestart.executioncontext.md) | ExecutionContextStart | [ExecutionContextStart](./kibana-plugin-core-server.executioncontextstart.md) | -| [http](./kibana-plugin-core-server.corestart.http.md) | HttpServiceStart | [HttpServiceStart](./kibana-plugin-core-server.httpservicestart.md) | -| [metrics](./kibana-plugin-core-server.corestart.metrics.md) | MetricsServiceStart | [MetricsServiceStart](./kibana-plugin-core-server.metricsservicestart.md) | -| [savedObjects](./kibana-plugin-core-server.corestart.savedobjects.md) | SavedObjectsServiceStart | [SavedObjectsServiceStart](./kibana-plugin-core-server.savedobjectsservicestart.md) | -| [uiSettings](./kibana-plugin-core-server.corestart.uisettings.md) | UiSettingsServiceStart | [UiSettingsServiceStart](./kibana-plugin-core-server.uisettingsservicestart.md) | +| [capabilities](./kibana-plugin-core-server.corestart.capabilities.md) | CapabilitiesStart | [CapabilitiesStart](./kibana-plugin-core-server.capabilitiesstart.md) | +| [elasticsearch](./kibana-plugin-core-server.corestart.elasticsearch.md) | ElasticsearchServiceStart | [ElasticsearchServiceStart](./kibana-plugin-core-server.elasticsearchservicestart.md) | +| [executionContext](./kibana-plugin-core-server.corestart.executioncontext.md) | ExecutionContextStart | [ExecutionContextStart](./kibana-plugin-core-server.executioncontextstart.md) | +| [http](./kibana-plugin-core-server.corestart.http.md) | HttpServiceStart | [HttpServiceStart](./kibana-plugin-core-server.httpservicestart.md) | +| [metrics](./kibana-plugin-core-server.corestart.metrics.md) | MetricsServiceStart | [MetricsServiceStart](./kibana-plugin-core-server.metricsservicestart.md) | +| [savedObjects](./kibana-plugin-core-server.corestart.savedobjects.md) | SavedObjectsServiceStart | [SavedObjectsServiceStart](./kibana-plugin-core-server.savedobjectsservicestart.md) | +| [uiSettings](./kibana-plugin-core-server.corestart.uisettings.md) | UiSettingsServiceStart | [UiSettingsServiceStart](./kibana-plugin-core-server.uisettingsservicestart.md) | diff --git a/docs/development/core/server/kibana-plugin-core-server.corestatus.md b/docs/development/core/server/kibana-plugin-core-server.corestatus.md index 3fde86a18c58..8d44ab49dfcb 100644 --- a/docs/development/core/server/kibana-plugin-core-server.corestatus.md +++ b/docs/development/core/server/kibana-plugin-core-server.corestatus.md @@ -16,6 +16,6 @@ export interface CoreStatus | Property | Type | Description | | --- | --- | --- | -| [elasticsearch](./kibana-plugin-core-server.corestatus.elasticsearch.md) | ServiceStatus | | -| [savedObjects](./kibana-plugin-core-server.corestatus.savedobjects.md) | ServiceStatus | | +| [elasticsearch](./kibana-plugin-core-server.corestatus.elasticsearch.md) | ServiceStatus | | +| [savedObjects](./kibana-plugin-core-server.corestatus.savedobjects.md) | ServiceStatus | | diff --git a/docs/development/core/server/kibana-plugin-core-server.countresponse.md b/docs/development/core/server/kibana-plugin-core-server.countresponse.md index f8664f4878f4..53793dc87bf3 100644 --- a/docs/development/core/server/kibana-plugin-core-server.countresponse.md +++ b/docs/development/core/server/kibana-plugin-core-server.countresponse.md @@ -15,6 +15,6 @@ export interface CountResponse | Property | Type | Description | | --- | --- | --- | -| [\_shards](./kibana-plugin-core-server.countresponse._shards.md) | ShardsInfo | | -| [count](./kibana-plugin-core-server.countresponse.count.md) | number | | +| [\_shards](./kibana-plugin-core-server.countresponse._shards.md) | ShardsInfo | | +| [count](./kibana-plugin-core-server.countresponse.count.md) | number | | diff --git a/docs/development/core/server/kibana-plugin-core-server.cspconfig.__private_.md b/docs/development/core/server/kibana-plugin-core-server.cspconfig.__private_.md deleted file mode 100644 index 217066481d33..000000000000 --- a/docs/development/core/server/kibana-plugin-core-server.cspconfig.__private_.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [CspConfig](./kibana-plugin-core-server.cspconfig.md) > ["\#private"](./kibana-plugin-core-server.cspconfig.__private_.md) - -## CspConfig."\#private" property - -Signature: - -```typescript -#private; -``` diff --git a/docs/development/core/server/kibana-plugin-core-server.cspconfig.md b/docs/development/core/server/kibana-plugin-core-server.cspconfig.md index 46f24dfda673..3d2f4bb68374 100644 --- a/docs/development/core/server/kibana-plugin-core-server.cspconfig.md +++ b/docs/development/core/server/kibana-plugin-core-server.cspconfig.md @@ -11,6 +11,7 @@ CSP configuration for use in Kibana. ```typescript export declare class CspConfig implements ICspConfig ``` +Implements: ICspConfig ## Remarks @@ -20,10 +21,9 @@ The constructor for this class is marked as internal. Third-party code should no | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| ["\#private"](./kibana-plugin-core-server.cspconfig.__private_.md) | | | | -| [DEFAULT](./kibana-plugin-core-server.cspconfig.default.md) | static | CspConfig | | -| [disableEmbedding](./kibana-plugin-core-server.cspconfig.disableembedding.md) | | boolean | | -| [header](./kibana-plugin-core-server.cspconfig.header.md) | | string | | -| [strict](./kibana-plugin-core-server.cspconfig.strict.md) | | boolean | | -| [warnLegacyBrowsers](./kibana-plugin-core-server.cspconfig.warnlegacybrowsers.md) | | boolean | | +| [DEFAULT](./kibana-plugin-core-server.cspconfig.default.md) | static | CspConfig | | +| [disableEmbedding](./kibana-plugin-core-server.cspconfig.disableembedding.md) | | boolean | | +| [header](./kibana-plugin-core-server.cspconfig.header.md) | | string | | +| [strict](./kibana-plugin-core-server.cspconfig.strict.md) | | boolean | | +| [warnLegacyBrowsers](./kibana-plugin-core-server.cspconfig.warnlegacybrowsers.md) | | boolean | | diff --git a/docs/development/core/server/kibana-plugin-core-server.customhttpresponseoptions.md b/docs/development/core/server/kibana-plugin-core-server.customhttpresponseoptions.md index 82089c831d71..84cb55f5c105 100644 --- a/docs/development/core/server/kibana-plugin-core-server.customhttpresponseoptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.customhttpresponseoptions.md @@ -16,8 +16,8 @@ export interface CustomHttpResponseOptionsT | HTTP message to send to the client | -| [bypassErrorFormat](./kibana-plugin-core-server.customhttpresponseoptions.bypasserrorformat.md) | boolean | Bypass the default error formatting | -| [headers](./kibana-plugin-core-server.customhttpresponseoptions.headers.md) | ResponseHeaders | HTTP Headers with additional information about response | -| [statusCode](./kibana-plugin-core-server.customhttpresponseoptions.statuscode.md) | number | | +| [body?](./kibana-plugin-core-server.customhttpresponseoptions.body.md) | T | (Optional) HTTP message to send to the client | +| [bypassErrorFormat?](./kibana-plugin-core-server.customhttpresponseoptions.bypasserrorformat.md) | boolean | (Optional) Bypass the default error formatting | +| [headers?](./kibana-plugin-core-server.customhttpresponseoptions.headers.md) | ResponseHeaders | (Optional) HTTP Headers with additional information about response | +| [statusCode](./kibana-plugin-core-server.customhttpresponseoptions.statuscode.md) | number | | diff --git a/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse.md b/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse.md index e8ac7d2fd8ec..fe6712ea3b61 100644 --- a/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse.md +++ b/docs/development/core/server/kibana-plugin-core-server.deletedocumentresponse.md @@ -15,12 +15,12 @@ export interface DeleteDocumentResponse | Property | Type | Description | | --- | --- | --- | -| [\_id](./kibana-plugin-core-server.deletedocumentresponse._id.md) | string | | -| [\_index](./kibana-plugin-core-server.deletedocumentresponse._index.md) | string | | -| [\_shards](./kibana-plugin-core-server.deletedocumentresponse._shards.md) | ShardsResponse | | -| [\_type](./kibana-plugin-core-server.deletedocumentresponse._type.md) | string | | -| [\_version](./kibana-plugin-core-server.deletedocumentresponse._version.md) | number | | -| [error](./kibana-plugin-core-server.deletedocumentresponse.error.md) | {
type: string;
} | | -| [found](./kibana-plugin-core-server.deletedocumentresponse.found.md) | boolean | | -| [result](./kibana-plugin-core-server.deletedocumentresponse.result.md) | string | | +| [\_id](./kibana-plugin-core-server.deletedocumentresponse._id.md) | string | | +| [\_index](./kibana-plugin-core-server.deletedocumentresponse._index.md) | string | | +| [\_shards](./kibana-plugin-core-server.deletedocumentresponse._shards.md) | ShardsResponse | | +| [\_type](./kibana-plugin-core-server.deletedocumentresponse._type.md) | string | | +| [\_version](./kibana-plugin-core-server.deletedocumentresponse._version.md) | number | | +| [error?](./kibana-plugin-core-server.deletedocumentresponse.error.md) | { type: string; } | (Optional) | +| [found](./kibana-plugin-core-server.deletedocumentresponse.found.md) | boolean | | +| [result](./kibana-plugin-core-server.deletedocumentresponse.result.md) | string | | diff --git a/docs/development/core/server/kibana-plugin-core-server.deprecationsclient.md b/docs/development/core/server/kibana-plugin-core-server.deprecationsclient.md index 920dc820f7f8..0e724e251b26 100644 --- a/docs/development/core/server/kibana-plugin-core-server.deprecationsclient.md +++ b/docs/development/core/server/kibana-plugin-core-server.deprecationsclient.md @@ -16,5 +16,5 @@ export interface DeprecationsClient | Property | Type | Description | | --- | --- | --- | -| [getAllDeprecations](./kibana-plugin-core-server.deprecationsclient.getalldeprecations.md) | () => Promise<DomainDeprecationDetails[]> | | +| [getAllDeprecations](./kibana-plugin-core-server.deprecationsclient.getalldeprecations.md) | () => Promise<DomainDeprecationDetails\[\]> | | diff --git a/docs/development/core/server/kibana-plugin-core-server.deprecationsettings.md b/docs/development/core/server/kibana-plugin-core-server.deprecationsettings.md index 90fd8192b544..917ca933d63a 100644 --- a/docs/development/core/server/kibana-plugin-core-server.deprecationsettings.md +++ b/docs/development/core/server/kibana-plugin-core-server.deprecationsettings.md @@ -16,6 +16,6 @@ export interface DeprecationSettings | Property | Type | Description | | --- | --- | --- | -| [docLinksKey](./kibana-plugin-core-server.deprecationsettings.doclinkskey.md) | string | Key to documentation links | -| [message](./kibana-plugin-core-server.deprecationsettings.message.md) | string | Deprecation message | +| [docLinksKey](./kibana-plugin-core-server.deprecationsettings.doclinkskey.md) | string | Key to documentation links | +| [message](./kibana-plugin-core-server.deprecationsettings.message.md) | string | Deprecation message | diff --git a/docs/development/core/server/kibana-plugin-core-server.deprecationsservicesetup.md b/docs/development/core/server/kibana-plugin-core-server.deprecationsservicesetup.md index 7b2cbdecd146..1fcefeea9b0b 100644 --- a/docs/development/core/server/kibana-plugin-core-server.deprecationsservicesetup.md +++ b/docs/development/core/server/kibana-plugin-core-server.deprecationsservicesetup.md @@ -75,12 +75,11 @@ export class Plugin() { core.deprecations.registerDeprecations({ getDeprecations }); } } - ``` ## Properties | Property | Type | Description | | --- | --- | --- | -| [registerDeprecations](./kibana-plugin-core-server.deprecationsservicesetup.registerdeprecations.md) | (deprecationContext: RegisterDeprecationsConfig) => void | | +| [registerDeprecations](./kibana-plugin-core-server.deprecationsservicesetup.registerdeprecations.md) | (deprecationContext: RegisterDeprecationsConfig) => void | | diff --git a/docs/development/core/server/kibana-plugin-core-server.discoveredplugin.md b/docs/development/core/server/kibana-plugin-core-server.discoveredplugin.md index 042f2d148561..cf98a0cd68db 100644 --- a/docs/development/core/server/kibana-plugin-core-server.discoveredplugin.md +++ b/docs/development/core/server/kibana-plugin-core-server.discoveredplugin.md @@ -16,10 +16,10 @@ export interface DiscoveredPlugin | Property | Type | Description | | --- | --- | --- | -| [configPath](./kibana-plugin-core-server.discoveredplugin.configpath.md) | ConfigPath | Root configuration path used by the plugin, defaults to "id" in snake\_case format. | -| [id](./kibana-plugin-core-server.discoveredplugin.id.md) | PluginName | Identifier of the plugin. | -| [optionalPlugins](./kibana-plugin-core-server.discoveredplugin.optionalplugins.md) | readonly PluginName[] | An optional list of the other plugins that if installed and enabled \*\*may be\*\* leveraged by this plugin for some additional functionality but otherwise are not required for this plugin to work properly. | -| [requiredBundles](./kibana-plugin-core-server.discoveredplugin.requiredbundles.md) | readonly PluginName[] | List of plugin ids that this plugin's UI code imports modules from that are not in requiredPlugins. | -| [requiredPlugins](./kibana-plugin-core-server.discoveredplugin.requiredplugins.md) | readonly PluginName[] | An optional list of the other plugins that \*\*must be\*\* installed and enabled for this plugin to function properly. | -| [type](./kibana-plugin-core-server.discoveredplugin.type.md) | PluginType | Type of the plugin, defaults to standard. | +| [configPath](./kibana-plugin-core-server.discoveredplugin.configpath.md) | ConfigPath | Root configuration path used by the plugin, defaults to "id" in snake\_case format. | +| [id](./kibana-plugin-core-server.discoveredplugin.id.md) | PluginName | Identifier of the plugin. | +| [optionalPlugins](./kibana-plugin-core-server.discoveredplugin.optionalplugins.md) | readonly PluginName\[\] | An optional list of the other plugins that if installed and enabled \*\*may be\*\* leveraged by this plugin for some additional functionality but otherwise are not required for this plugin to work properly. | +| [requiredBundles](./kibana-plugin-core-server.discoveredplugin.requiredbundles.md) | readonly PluginName\[\] | List of plugin ids that this plugin's UI code imports modules from that are not in requiredPlugins. | +| [requiredPlugins](./kibana-plugin-core-server.discoveredplugin.requiredplugins.md) | readonly PluginName\[\] | An optional list of the other plugins that \*\*must be\*\* installed and enabled for this plugin to function properly. | +| [type](./kibana-plugin-core-server.discoveredplugin.type.md) | PluginType | Type of the plugin, defaults to standard. | diff --git a/docs/development/core/server/kibana-plugin-core-server.elasticsearchconfig._constructor_.md b/docs/development/core/server/kibana-plugin-core-server.elasticsearchconfig._constructor_.md index 6661970725f7..a8d9f1183b3e 100644 --- a/docs/development/core/server/kibana-plugin-core-server.elasticsearchconfig._constructor_.md +++ b/docs/development/core/server/kibana-plugin-core-server.elasticsearchconfig._constructor_.md @@ -16,5 +16,5 @@ constructor(rawConfig: ElasticsearchConfigType); | Parameter | Type | Description | | --- | --- | --- | -| rawConfig | ElasticsearchConfigType | | +| rawConfig | ElasticsearchConfigType | | diff --git a/docs/development/core/server/kibana-plugin-core-server.elasticsearchconfig.md b/docs/development/core/server/kibana-plugin-core-server.elasticsearchconfig.md index a9ed614ba755..c75f6377f403 100644 --- a/docs/development/core/server/kibana-plugin-core-server.elasticsearchconfig.md +++ b/docs/development/core/server/kibana-plugin-core-server.elasticsearchconfig.md @@ -22,20 +22,20 @@ export declare class ElasticsearchConfig | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [apiVersion](./kibana-plugin-core-server.elasticsearchconfig.apiversion.md) | | string | Version of the Elasticsearch (6.7, 7.1 or master) client will be connecting to. | -| [customHeaders](./kibana-plugin-core-server.elasticsearchconfig.customheaders.md) | | ElasticsearchConfigType['customHeaders'] | Header names and values to send to Elasticsearch with every request. These headers cannot be overwritten by client-side headers and aren't affected by requestHeadersWhitelist configuration. | -| [healthCheckDelay](./kibana-plugin-core-server.elasticsearchconfig.healthcheckdelay.md) | | Duration | The interval between health check requests Kibana sends to the Elasticsearch. | -| [hosts](./kibana-plugin-core-server.elasticsearchconfig.hosts.md) | | string[] | Hosts that the client will connect to. If sniffing is enabled, this list will be used as seeds to discover the rest of your cluster. | -| [ignoreVersionMismatch](./kibana-plugin-core-server.elasticsearchconfig.ignoreversionmismatch.md) | | boolean | Whether to allow kibana to connect to a non-compatible elasticsearch node. | -| [password](./kibana-plugin-core-server.elasticsearchconfig.password.md) | | string | If Elasticsearch is protected with basic authentication, this setting provides the password that the Kibana server uses to perform its administrative functions. | -| [pingTimeout](./kibana-plugin-core-server.elasticsearchconfig.pingtimeout.md) | | Duration | Timeout after which PING HTTP request will be aborted and retried. | -| [requestHeadersWhitelist](./kibana-plugin-core-server.elasticsearchconfig.requestheaderswhitelist.md) | | string[] | List of Kibana client-side headers to send to Elasticsearch when request scoped cluster client is used. If this is an empty array then \*no\* client-side will be sent. | -| [requestTimeout](./kibana-plugin-core-server.elasticsearchconfig.requesttimeout.md) | | Duration | Timeout after which HTTP request will be aborted and retried. | -| [serviceAccountToken](./kibana-plugin-core-server.elasticsearchconfig.serviceaccounttoken.md) | | string | If Elasticsearch security features are enabled, this setting provides the service account token that the Kibana server users to perform its administrative functions.This is an alternative to specifying a username and password. | -| [shardTimeout](./kibana-plugin-core-server.elasticsearchconfig.shardtimeout.md) | | Duration | Timeout for Elasticsearch to wait for responses from shards. Set to 0 to disable. | -| [sniffInterval](./kibana-plugin-core-server.elasticsearchconfig.sniffinterval.md) | | false | Duration | Interval to perform a sniff operation and make sure the list of nodes is complete. If false then sniffing is disabled. | -| [sniffOnConnectionFault](./kibana-plugin-core-server.elasticsearchconfig.sniffonconnectionfault.md) | | boolean | Specifies whether the client should immediately sniff for a more current list of nodes when a connection dies. | -| [sniffOnStart](./kibana-plugin-core-server.elasticsearchconfig.sniffonstart.md) | | boolean | Specifies whether the client should attempt to detect the rest of the cluster when it is first instantiated. | -| [ssl](./kibana-plugin-core-server.elasticsearchconfig.ssl.md) | | Pick<SslConfigSchema, Exclude<keyof SslConfigSchema, 'certificateAuthorities' | 'keystore' | 'truststore'>> & {
certificateAuthorities?: string[];
} | Set of settings configure SSL connection between Kibana and Elasticsearch that are required when xpack.ssl.verification_mode in Elasticsearch is set to either certificate or full. | -| [username](./kibana-plugin-core-server.elasticsearchconfig.username.md) | | string | If Elasticsearch is protected with basic authentication, this setting provides the username that the Kibana server uses to perform its administrative functions. Cannot be used in conjunction with serviceAccountToken. | +| [apiVersion](./kibana-plugin-core-server.elasticsearchconfig.apiversion.md) | | string | Version of the Elasticsearch (6.7, 7.1 or master) client will be connecting to. | +| [customHeaders](./kibana-plugin-core-server.elasticsearchconfig.customheaders.md) | | ElasticsearchConfigType\['customHeaders'\] | Header names and values to send to Elasticsearch with every request. These headers cannot be overwritten by client-side headers and aren't affected by requestHeadersWhitelist configuration. | +| [healthCheckDelay](./kibana-plugin-core-server.elasticsearchconfig.healthcheckdelay.md) | | Duration | The interval between health check requests Kibana sends to the Elasticsearch. | +| [hosts](./kibana-plugin-core-server.elasticsearchconfig.hosts.md) | | string\[\] | Hosts that the client will connect to. If sniffing is enabled, this list will be used as seeds to discover the rest of your cluster. | +| [ignoreVersionMismatch](./kibana-plugin-core-server.elasticsearchconfig.ignoreversionmismatch.md) | | boolean | Whether to allow kibana to connect to a non-compatible elasticsearch node. | +| [password?](./kibana-plugin-core-server.elasticsearchconfig.password.md) | | string | (Optional) If Elasticsearch is protected with basic authentication, this setting provides the password that the Kibana server uses to perform its administrative functions. | +| [pingTimeout](./kibana-plugin-core-server.elasticsearchconfig.pingtimeout.md) | | Duration | Timeout after which PING HTTP request will be aborted and retried. | +| [requestHeadersWhitelist](./kibana-plugin-core-server.elasticsearchconfig.requestheaderswhitelist.md) | | string\[\] | List of Kibana client-side headers to send to Elasticsearch when request scoped cluster client is used. If this is an empty array then \*no\* client-side will be sent. | +| [requestTimeout](./kibana-plugin-core-server.elasticsearchconfig.requesttimeout.md) | | Duration | Timeout after which HTTP request will be aborted and retried. | +| [serviceAccountToken?](./kibana-plugin-core-server.elasticsearchconfig.serviceaccounttoken.md) | | string | (Optional) If Elasticsearch security features are enabled, this setting provides the service account token that the Kibana server users to perform its administrative functions.This is an alternative to specifying a username and password. | +| [shardTimeout](./kibana-plugin-core-server.elasticsearchconfig.shardtimeout.md) | | Duration | Timeout for Elasticsearch to wait for responses from shards. Set to 0 to disable. | +| [sniffInterval](./kibana-plugin-core-server.elasticsearchconfig.sniffinterval.md) | | false \| Duration | Interval to perform a sniff operation and make sure the list of nodes is complete. If false then sniffing is disabled. | +| [sniffOnConnectionFault](./kibana-plugin-core-server.elasticsearchconfig.sniffonconnectionfault.md) | | boolean | Specifies whether the client should immediately sniff for a more current list of nodes when a connection dies. | +| [sniffOnStart](./kibana-plugin-core-server.elasticsearchconfig.sniffonstart.md) | | boolean | Specifies whether the client should attempt to detect the rest of the cluster when it is first instantiated. | +| [ssl](./kibana-plugin-core-server.elasticsearchconfig.ssl.md) | | Pick<SslConfigSchema, Exclude<keyof SslConfigSchema, 'certificateAuthorities' \| 'keystore' \| 'truststore'>> & { certificateAuthorities?: string\[\]; } | Set of settings configure SSL connection between Kibana and Elasticsearch that are required when xpack.ssl.verification_mode in Elasticsearch is set to either certificate or full. | +| [username?](./kibana-plugin-core-server.elasticsearchconfig.username.md) | | string | (Optional) If Elasticsearch is protected with basic authentication, this setting provides the username that the Kibana server uses to perform its administrative functions. Cannot be used in conjunction with serviceAccountToken. | diff --git a/docs/development/core/server/kibana-plugin-core-server.elasticsearchconfigpreboot.md b/docs/development/core/server/kibana-plugin-core-server.elasticsearchconfigpreboot.md index bbccea80b672..d7d3e8d70e8d 100644 --- a/docs/development/core/server/kibana-plugin-core-server.elasticsearchconfigpreboot.md +++ b/docs/development/core/server/kibana-plugin-core-server.elasticsearchconfigpreboot.md @@ -16,6 +16,6 @@ export interface ElasticsearchConfigPreboot | Property | Type | Description | | --- | --- | --- | -| [credentialsSpecified](./kibana-plugin-core-server.elasticsearchconfigpreboot.credentialsspecified.md) | boolean | Indicates whether Elasticsearch configuration includes credentials (username, password or serviceAccountToken). | -| [hosts](./kibana-plugin-core-server.elasticsearchconfigpreboot.hosts.md) | string[] | Hosts that the client will connect to. If sniffing is enabled, this list will be used as seeds to discover the rest of your cluster. | +| [credentialsSpecified](./kibana-plugin-core-server.elasticsearchconfigpreboot.credentialsspecified.md) | boolean | Indicates whether Elasticsearch configuration includes credentials (username, password or serviceAccountToken). | +| [hosts](./kibana-plugin-core-server.elasticsearchconfigpreboot.hosts.md) | string\[\] | Hosts that the client will connect to. If sniffing is enabled, this list will be used as seeds to discover the rest of your cluster. | diff --git a/docs/development/core/server/kibana-plugin-core-server.elasticsearcherrordetails.md b/docs/development/core/server/kibana-plugin-core-server.elasticsearcherrordetails.md index 7dbf9e89f9b7..570a161db20e 100644 --- a/docs/development/core/server/kibana-plugin-core-server.elasticsearcherrordetails.md +++ b/docs/development/core/server/kibana-plugin-core-server.elasticsearcherrordetails.md @@ -15,5 +15,5 @@ export interface ElasticsearchErrorDetails | Property | Type | Description | | --- | --- | --- | -| [error](./kibana-plugin-core-server.elasticsearcherrordetails.error.md) | {
type: string;
reason?: string;
} | | +| [error?](./kibana-plugin-core-server.elasticsearcherrordetails.error.md) | { type: string; reason?: string; } | (Optional) | diff --git a/docs/development/core/server/kibana-plugin-core-server.elasticsearchservicepreboot.config.md b/docs/development/core/server/kibana-plugin-core-server.elasticsearchservicepreboot.config.md index 12a32b4544ab..c4284248ea89 100644 --- a/docs/development/core/server/kibana-plugin-core-server.elasticsearchservicepreboot.config.md +++ b/docs/development/core/server/kibana-plugin-core-server.elasticsearchservicepreboot.config.md @@ -17,6 +17,5 @@ readonly config: Readonly; ```js const { hosts, credentialsSpecified } = core.elasticsearch.config; - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.elasticsearchservicepreboot.createclient.md b/docs/development/core/server/kibana-plugin-core-server.elasticsearchservicepreboot.createclient.md index d14e3e4efa40..070cb7905b58 100644 --- a/docs/development/core/server/kibana-plugin-core-server.elasticsearchservicepreboot.createclient.md +++ b/docs/development/core/server/kibana-plugin-core-server.elasticsearchservicepreboot.createclient.md @@ -18,6 +18,5 @@ readonly createClient: (type: string, clientConfig?: PartialReadonly<ElasticsearchConfigPreboot> | A limited set of Elasticsearch configuration entries. | -| [createClient](./kibana-plugin-core-server.elasticsearchservicepreboot.createclient.md) | (type: string, clientConfig?: Partial<ElasticsearchClientConfig>) => ICustomClusterClient | Create application specific Elasticsearch cluster API client with customized config. See [IClusterClient](./kibana-plugin-core-server.iclusterclient.md). | +| [config](./kibana-plugin-core-server.elasticsearchservicepreboot.config.md) | Readonly<ElasticsearchConfigPreboot> | A limited set of Elasticsearch configuration entries. | +| [createClient](./kibana-plugin-core-server.elasticsearchservicepreboot.createclient.md) | (type: string, clientConfig?: Partial<ElasticsearchClientConfig>) => ICustomClusterClient | Create application specific Elasticsearch cluster API client with customized config. See [IClusterClient](./kibana-plugin-core-server.iclusterclient.md). | diff --git a/docs/development/core/server/kibana-plugin-core-server.elasticsearchservicesetup.md b/docs/development/core/server/kibana-plugin-core-server.elasticsearchservicesetup.md index e6a4161674f5..d18620992075 100644 --- a/docs/development/core/server/kibana-plugin-core-server.elasticsearchservicesetup.md +++ b/docs/development/core/server/kibana-plugin-core-server.elasticsearchservicesetup.md @@ -15,5 +15,5 @@ export interface ElasticsearchServiceSetup | Property | Type | Description | | --- | --- | --- | -| [legacy](./kibana-plugin-core-server.elasticsearchservicesetup.legacy.md) | {
readonly config$: Observable<ElasticsearchConfig>;
} | | +| [legacy](./kibana-plugin-core-server.elasticsearchservicesetup.legacy.md) | { readonly config$: Observable<ElasticsearchConfig>; } | | diff --git a/docs/development/core/server/kibana-plugin-core-server.elasticsearchservicestart.client.md b/docs/development/core/server/kibana-plugin-core-server.elasticsearchservicestart.client.md index 591f126c423e..59f302170c53 100644 --- a/docs/development/core/server/kibana-plugin-core-server.elasticsearchservicestart.client.md +++ b/docs/development/core/server/kibana-plugin-core-server.elasticsearchservicestart.client.md @@ -17,6 +17,5 @@ readonly client: IClusterClient; ```js const client = core.elasticsearch.client; - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.elasticsearchservicestart.createclient.md b/docs/development/core/server/kibana-plugin-core-server.elasticsearchservicestart.createclient.md index d4a13812ab53..26930c6f02b3 100644 --- a/docs/development/core/server/kibana-plugin-core-server.elasticsearchservicestart.createclient.md +++ b/docs/development/core/server/kibana-plugin-core-server.elasticsearchservicestart.createclient.md @@ -18,6 +18,5 @@ readonly createClient: (type: string, clientConfig?: PartialIClusterClient | A pre-configured [Elasticsearch client](./kibana-plugin-core-server.iclusterclient.md) | -| [createClient](./kibana-plugin-core-server.elasticsearchservicestart.createclient.md) | (type: string, clientConfig?: Partial<ElasticsearchClientConfig>) => ICustomClusterClient | Create application specific Elasticsearch cluster API client with customized config. See [IClusterClient](./kibana-plugin-core-server.iclusterclient.md). | -| [legacy](./kibana-plugin-core-server.elasticsearchservicestart.legacy.md) | {
readonly config$: Observable<ElasticsearchConfig>;
} | | +| [client](./kibana-plugin-core-server.elasticsearchservicestart.client.md) | IClusterClient | A pre-configured [Elasticsearch client](./kibana-plugin-core-server.iclusterclient.md) | +| [createClient](./kibana-plugin-core-server.elasticsearchservicestart.createclient.md) | (type: string, clientConfig?: Partial<ElasticsearchClientConfig>) => ICustomClusterClient | Create application specific Elasticsearch cluster API client with customized config. See [IClusterClient](./kibana-plugin-core-server.iclusterclient.md). | +| [legacy](./kibana-plugin-core-server.elasticsearchservicestart.legacy.md) | { readonly config$: Observable<ElasticsearchConfig>; } | | diff --git a/docs/development/core/server/kibana-plugin-core-server.elasticsearchstatusmeta.md b/docs/development/core/server/kibana-plugin-core-server.elasticsearchstatusmeta.md index 90aa2f0100d8..82748932c210 100644 --- a/docs/development/core/server/kibana-plugin-core-server.elasticsearchstatusmeta.md +++ b/docs/development/core/server/kibana-plugin-core-server.elasticsearchstatusmeta.md @@ -15,7 +15,7 @@ export interface ElasticsearchStatusMeta | Property | Type | Description | | --- | --- | --- | -| [incompatibleNodes](./kibana-plugin-core-server.elasticsearchstatusmeta.incompatiblenodes.md) | NodesVersionCompatibility['incompatibleNodes'] | | -| [nodesInfoRequestError](./kibana-plugin-core-server.elasticsearchstatusmeta.nodesinforequesterror.md) | NodesVersionCompatibility['nodesInfoRequestError'] | | -| [warningNodes](./kibana-plugin-core-server.elasticsearchstatusmeta.warningnodes.md) | NodesVersionCompatibility['warningNodes'] | | +| [incompatibleNodes](./kibana-plugin-core-server.elasticsearchstatusmeta.incompatiblenodes.md) | NodesVersionCompatibility\['incompatibleNodes'\] | | +| [nodesInfoRequestError?](./kibana-plugin-core-server.elasticsearchstatusmeta.nodesinforequesterror.md) | NodesVersionCompatibility\['nodesInfoRequestError'\] | (Optional) | +| [warningNodes](./kibana-plugin-core-server.elasticsearchstatusmeta.warningnodes.md) | NodesVersionCompatibility\['warningNodes'\] | | diff --git a/docs/development/core/server/kibana-plugin-core-server.errorhttpresponseoptions.md b/docs/development/core/server/kibana-plugin-core-server.errorhttpresponseoptions.md index 8a3a9e3cc29f..3a037e71ac1e 100644 --- a/docs/development/core/server/kibana-plugin-core-server.errorhttpresponseoptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.errorhttpresponseoptions.md @@ -16,6 +16,6 @@ export interface ErrorHttpResponseOptions | Property | Type | Description | | --- | --- | --- | -| [body](./kibana-plugin-core-server.errorhttpresponseoptions.body.md) | ResponseError | HTTP message to send to the client | -| [headers](./kibana-plugin-core-server.errorhttpresponseoptions.headers.md) | ResponseHeaders | HTTP Headers with additional information about response | +| [body?](./kibana-plugin-core-server.errorhttpresponseoptions.body.md) | ResponseError | (Optional) HTTP message to send to the client | +| [headers?](./kibana-plugin-core-server.errorhttpresponseoptions.headers.md) | ResponseHeaders | (Optional) HTTP Headers with additional information about response | diff --git a/docs/development/core/server/kibana-plugin-core-server.eventloopdelaysmonitor.collect.md b/docs/development/core/server/kibana-plugin-core-server.eventloopdelaysmonitor.collect.md index 0e07497baf88..36cb2d2d2094 100644 --- a/docs/development/core/server/kibana-plugin-core-server.eventloopdelaysmonitor.collect.md +++ b/docs/development/core/server/kibana-plugin-core-server.eventloopdelaysmonitor.collect.md @@ -13,7 +13,7 @@ collect(): IntervalHistogram; ``` Returns: -`IntervalHistogram` +IntervalHistogram {IntervalHistogram} diff --git a/docs/development/core/server/kibana-plugin-core-server.eventloopdelaysmonitor.reset.md b/docs/development/core/server/kibana-plugin-core-server.eventloopdelaysmonitor.reset.md index fdba7a79ebda..a65cc7c99842 100644 --- a/docs/development/core/server/kibana-plugin-core-server.eventloopdelaysmonitor.reset.md +++ b/docs/development/core/server/kibana-plugin-core-server.eventloopdelaysmonitor.reset.md @@ -13,5 +13,5 @@ reset(): void; ``` Returns: -`void` +void diff --git a/docs/development/core/server/kibana-plugin-core-server.eventloopdelaysmonitor.stop.md b/docs/development/core/server/kibana-plugin-core-server.eventloopdelaysmonitor.stop.md index 25b61434b006..d63c963b384e 100644 --- a/docs/development/core/server/kibana-plugin-core-server.eventloopdelaysmonitor.stop.md +++ b/docs/development/core/server/kibana-plugin-core-server.eventloopdelaysmonitor.stop.md @@ -13,5 +13,5 @@ stop(): void; ``` Returns: -`void` +void diff --git a/docs/development/core/server/kibana-plugin-core-server.executioncontextsetup.withcontext.md b/docs/development/core/server/kibana-plugin-core-server.executioncontextsetup.withcontext.md index 87da07120301..2bfef6db2f90 100644 --- a/docs/development/core/server/kibana-plugin-core-server.executioncontextsetup.withcontext.md +++ b/docs/development/core/server/kibana-plugin-core-server.executioncontextsetup.withcontext.md @@ -16,10 +16,10 @@ withContext(context: KibanaExecutionContext | undefined, fn: (...args: any[]) | Parameter | Type | Description | | --- | --- | --- | -| context | KibanaExecutionContext | undefined | | -| fn | (...args: any[]) => R | | +| context | KibanaExecutionContext \| undefined | | +| fn | (...args: any\[\]) => R | | Returns: -`R` +R diff --git a/docs/development/core/server/kibana-plugin-core-server.fakerequest.md b/docs/development/core/server/kibana-plugin-core-server.fakerequest.md index 93ab54f9ba75..6b8bfe33d19c 100644 --- a/docs/development/core/server/kibana-plugin-core-server.fakerequest.md +++ b/docs/development/core/server/kibana-plugin-core-server.fakerequest.md @@ -16,5 +16,5 @@ export interface FakeRequest | Property | Type | Description | | --- | --- | --- | -| [headers](./kibana-plugin-core-server.fakerequest.headers.md) | Headers | Headers used for authentication against Elasticsearch | +| [headers](./kibana-plugin-core-server.fakerequest.headers.md) | Headers | Headers used for authentication against Elasticsearch | diff --git a/docs/development/core/server/kibana-plugin-core-server.featuredeprecationdetails.md b/docs/development/core/server/kibana-plugin-core-server.featuredeprecationdetails.md index bed3356e3612..c92f352ce7e5 100644 --- a/docs/development/core/server/kibana-plugin-core-server.featuredeprecationdetails.md +++ b/docs/development/core/server/kibana-plugin-core-server.featuredeprecationdetails.md @@ -10,10 +10,11 @@ ```typescript export interface FeatureDeprecationDetails extends BaseDeprecationDetails ``` +Extends: BaseDeprecationDetails ## Properties | Property | Type | Description | | --- | --- | --- | -| [deprecationType](./kibana-plugin-core-server.featuredeprecationdetails.deprecationtype.md) | 'feature' | undefined | | +| [deprecationType?](./kibana-plugin-core-server.featuredeprecationdetails.deprecationtype.md) | 'feature' \| undefined | (Optional) | diff --git a/docs/development/core/server/kibana-plugin-core-server.getdeprecationscontext.md b/docs/development/core/server/kibana-plugin-core-server.getdeprecationscontext.md index 96dd2ceb524c..236296686685 100644 --- a/docs/development/core/server/kibana-plugin-core-server.getdeprecationscontext.md +++ b/docs/development/core/server/kibana-plugin-core-server.getdeprecationscontext.md @@ -15,6 +15,6 @@ export interface GetDeprecationsContext | Property | Type | Description | | --- | --- | --- | -| [esClient](./kibana-plugin-core-server.getdeprecationscontext.esclient.md) | IScopedClusterClient | | -| [savedObjectsClient](./kibana-plugin-core-server.getdeprecationscontext.savedobjectsclient.md) | SavedObjectsClientContract | | +| [esClient](./kibana-plugin-core-server.getdeprecationscontext.esclient.md) | IScopedClusterClient | | +| [savedObjectsClient](./kibana-plugin-core-server.getdeprecationscontext.savedobjectsclient.md) | SavedObjectsClientContract | | diff --git a/docs/development/core/server/kibana-plugin-core-server.getresponse.md b/docs/development/core/server/kibana-plugin-core-server.getresponse.md index bab3092c6b1f..5068be8a5689 100644 --- a/docs/development/core/server/kibana-plugin-core-server.getresponse.md +++ b/docs/development/core/server/kibana-plugin-core-server.getresponse.md @@ -15,13 +15,13 @@ export interface GetResponse | Property | Type | Description | | --- | --- | --- | -| [\_id](./kibana-plugin-core-server.getresponse._id.md) | string | | -| [\_index](./kibana-plugin-core-server.getresponse._index.md) | string | | -| [\_primary\_term](./kibana-plugin-core-server.getresponse._primary_term.md) | number | | -| [\_routing](./kibana-plugin-core-server.getresponse._routing.md) | string | | -| [\_seq\_no](./kibana-plugin-core-server.getresponse._seq_no.md) | number | | -| [\_source](./kibana-plugin-core-server.getresponse._source.md) | T | | -| [\_type](./kibana-plugin-core-server.getresponse._type.md) | string | | -| [\_version](./kibana-plugin-core-server.getresponse._version.md) | number | | -| [found](./kibana-plugin-core-server.getresponse.found.md) | boolean | | +| [\_id](./kibana-plugin-core-server.getresponse._id.md) | string | | +| [\_index](./kibana-plugin-core-server.getresponse._index.md) | string | | +| [\_primary\_term](./kibana-plugin-core-server.getresponse._primary_term.md) | number | | +| [\_routing?](./kibana-plugin-core-server.getresponse._routing.md) | string | (Optional) | +| [\_seq\_no](./kibana-plugin-core-server.getresponse._seq_no.md) | number | | +| [\_source](./kibana-plugin-core-server.getresponse._source.md) | T | | +| [\_type](./kibana-plugin-core-server.getresponse._type.md) | string | | +| [\_version](./kibana-plugin-core-server.getresponse._version.md) | number | | +| [found](./kibana-plugin-core-server.getresponse.found.md) | boolean | | diff --git a/docs/development/core/server/kibana-plugin-core-server.headers.md b/docs/development/core/server/kibana-plugin-core-server.headers_2.md similarity index 78% rename from docs/development/core/server/kibana-plugin-core-server.headers.md rename to docs/development/core/server/kibana-plugin-core-server.headers_2.md index 5b2c40a81878..398827f2bf3d 100644 --- a/docs/development/core/server/kibana-plugin-core-server.headers.md +++ b/docs/development/core/server/kibana-plugin-core-server.headers_2.md @@ -1,8 +1,8 @@ -[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [Headers](./kibana-plugin-core-server.headers.md) +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [Headers\_2](./kibana-plugin-core-server.headers_2.md) -## Headers type +## Headers\_2 type Http request headers to read. diff --git a/docs/development/core/server/kibana-plugin-core-server.httpauth.md b/docs/development/core/server/kibana-plugin-core-server.httpauth.md index d9d77809570a..4b47be615c79 100644 --- a/docs/development/core/server/kibana-plugin-core-server.httpauth.md +++ b/docs/development/core/server/kibana-plugin-core-server.httpauth.md @@ -15,6 +15,6 @@ export interface HttpAuth | Property | Type | Description | | --- | --- | --- | -| [get](./kibana-plugin-core-server.httpauth.get.md) | GetAuthState | Gets authentication state for a request. Returned by auth interceptor. [GetAuthState](./kibana-plugin-core-server.getauthstate.md) | -| [isAuthenticated](./kibana-plugin-core-server.httpauth.isauthenticated.md) | IsAuthenticated | Returns authentication status for a request. [IsAuthenticated](./kibana-plugin-core-server.isauthenticated.md) | +| [get](./kibana-plugin-core-server.httpauth.get.md) | GetAuthState | Gets authentication state for a request. Returned by auth interceptor. [GetAuthState](./kibana-plugin-core-server.getauthstate.md) | +| [isAuthenticated](./kibana-plugin-core-server.httpauth.isauthenticated.md) | IsAuthenticated | Returns authentication status for a request. [IsAuthenticated](./kibana-plugin-core-server.isauthenticated.md) | diff --git a/docs/development/core/server/kibana-plugin-core-server.httpresources.md b/docs/development/core/server/kibana-plugin-core-server.httpresources.md index 25acffc1a040..0b1854d7cbcd 100644 --- a/docs/development/core/server/kibana-plugin-core-server.httpresources.md +++ b/docs/development/core/server/kibana-plugin-core-server.httpresources.md @@ -16,5 +16,5 @@ export interface HttpResources | Property | Type | Description | | --- | --- | --- | -| [register](./kibana-plugin-core-server.httpresources.register.md) | <P, Q, B, Context extends RequestHandlerContext = RequestHandlerContext>(route: RouteConfig<P, Q, B, 'get'>, handler: HttpResourcesRequestHandler<P, Q, B, Context>) => void | To register a route handler executing passed function to form response. | +| [register](./kibana-plugin-core-server.httpresources.register.md) | <P, Q, B, Context extends RequestHandlerContext = RequestHandlerContext>(route: RouteConfig<P, Q, B, 'get'>, handler: HttpResourcesRequestHandler<P, Q, B, Context>) => void | To register a route handler executing passed function to form response. | diff --git a/docs/development/core/server/kibana-plugin-core-server.httpresourcesrenderoptions.md b/docs/development/core/server/kibana-plugin-core-server.httpresourcesrenderoptions.md index 6563e3c636a9..9fcdc1b33878 100644 --- a/docs/development/core/server/kibana-plugin-core-server.httpresourcesrenderoptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.httpresourcesrenderoptions.md @@ -16,5 +16,5 @@ export interface HttpResourcesRenderOptions | Property | Type | Description | | --- | --- | --- | -| [headers](./kibana-plugin-core-server.httpresourcesrenderoptions.headers.md) | ResponseHeaders | HTTP Headers with additional information about response. | +| [headers?](./kibana-plugin-core-server.httpresourcesrenderoptions.headers.md) | ResponseHeaders | (Optional) HTTP Headers with additional information about response. | diff --git a/docs/development/core/server/kibana-plugin-core-server.httpresourcesservicetoolkit.md b/docs/development/core/server/kibana-plugin-core-server.httpresourcesservicetoolkit.md index 1c221e13f534..05e7af5dcbed 100644 --- a/docs/development/core/server/kibana-plugin-core-server.httpresourcesservicetoolkit.md +++ b/docs/development/core/server/kibana-plugin-core-server.httpresourcesservicetoolkit.md @@ -16,8 +16,8 @@ export interface HttpResourcesServiceToolkit | Property | Type | Description | | --- | --- | --- | -| [renderAnonymousCoreApp](./kibana-plugin-core-server.httpresourcesservicetoolkit.renderanonymouscoreapp.md) | (options?: HttpResourcesRenderOptions) => Promise<IKibanaResponse> | To respond with HTML page bootstrapping Kibana application without retrieving user-specific information. | -| [renderCoreApp](./kibana-plugin-core-server.httpresourcesservicetoolkit.rendercoreapp.md) | (options?: HttpResourcesRenderOptions) => Promise<IKibanaResponse> | To respond with HTML page bootstrapping Kibana application. | -| [renderHtml](./kibana-plugin-core-server.httpresourcesservicetoolkit.renderhtml.md) | (options: HttpResourcesResponseOptions) => IKibanaResponse | To respond with a custom HTML page. | -| [renderJs](./kibana-plugin-core-server.httpresourcesservicetoolkit.renderjs.md) | (options: HttpResourcesResponseOptions) => IKibanaResponse | To respond with a custom JS script file. | +| [renderAnonymousCoreApp](./kibana-plugin-core-server.httpresourcesservicetoolkit.renderanonymouscoreapp.md) | (options?: HttpResourcesRenderOptions) => Promise<IKibanaResponse> | To respond with HTML page bootstrapping Kibana application without retrieving user-specific information. | +| [renderCoreApp](./kibana-plugin-core-server.httpresourcesservicetoolkit.rendercoreapp.md) | (options?: HttpResourcesRenderOptions) => Promise<IKibanaResponse> | To respond with HTML page bootstrapping Kibana application. | +| [renderHtml](./kibana-plugin-core-server.httpresourcesservicetoolkit.renderhtml.md) | (options: HttpResourcesResponseOptions) => IKibanaResponse | To respond with a custom HTML page. | +| [renderJs](./kibana-plugin-core-server.httpresourcesservicetoolkit.renderjs.md) | (options: HttpResourcesResponseOptions) => IKibanaResponse | To respond with a custom JS script file. | diff --git a/docs/development/core/server/kibana-plugin-core-server.httpresponseoptions.md b/docs/development/core/server/kibana-plugin-core-server.httpresponseoptions.md index 497adc6a5ec5..9d10d9124415 100644 --- a/docs/development/core/server/kibana-plugin-core-server.httpresponseoptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.httpresponseoptions.md @@ -16,7 +16,7 @@ export interface HttpResponseOptions | Property | Type | Description | | --- | --- | --- | -| [body](./kibana-plugin-core-server.httpresponseoptions.body.md) | HttpResponsePayload | HTTP message to send to the client | -| [bypassErrorFormat](./kibana-plugin-core-server.httpresponseoptions.bypasserrorformat.md) | boolean | Bypass the default error formatting | -| [headers](./kibana-plugin-core-server.httpresponseoptions.headers.md) | ResponseHeaders | HTTP Headers with additional information about response | +| [body?](./kibana-plugin-core-server.httpresponseoptions.body.md) | HttpResponsePayload | (Optional) HTTP message to send to the client | +| [bypassErrorFormat?](./kibana-plugin-core-server.httpresponseoptions.bypasserrorformat.md) | boolean | (Optional) Bypass the default error formatting | +| [headers?](./kibana-plugin-core-server.httpresponseoptions.headers.md) | ResponseHeaders | (Optional) HTTP Headers with additional information about response | diff --git a/docs/development/core/server/kibana-plugin-core-server.httpserverinfo.md b/docs/development/core/server/kibana-plugin-core-server.httpserverinfo.md index 890bfaa834dc..151cb5d27240 100644 --- a/docs/development/core/server/kibana-plugin-core-server.httpserverinfo.md +++ b/docs/development/core/server/kibana-plugin-core-server.httpserverinfo.md @@ -16,8 +16,8 @@ export interface HttpServerInfo | Property | Type | Description | | --- | --- | --- | -| [hostname](./kibana-plugin-core-server.httpserverinfo.hostname.md) | string | The hostname of the server | -| [name](./kibana-plugin-core-server.httpserverinfo.name.md) | string | The name of the Kibana server | -| [port](./kibana-plugin-core-server.httpserverinfo.port.md) | number | The port the server is listening on | -| [protocol](./kibana-plugin-core-server.httpserverinfo.protocol.md) | 'http' | 'https' | 'socket' | The protocol used by the server | +| [hostname](./kibana-plugin-core-server.httpserverinfo.hostname.md) | string | The hostname of the server | +| [name](./kibana-plugin-core-server.httpserverinfo.name.md) | string | The name of the Kibana server | +| [port](./kibana-plugin-core-server.httpserverinfo.port.md) | number | The port the server is listening on | +| [protocol](./kibana-plugin-core-server.httpserverinfo.protocol.md) | 'http' \| 'https' \| 'socket' | The protocol used by the server | diff --git a/docs/development/core/server/kibana-plugin-core-server.httpservicepreboot.md b/docs/development/core/server/kibana-plugin-core-server.httpservicepreboot.md index ab0fc365fc65..87c62b63014e 100644 --- a/docs/development/core/server/kibana-plugin-core-server.httpservicepreboot.md +++ b/docs/development/core/server/kibana-plugin-core-server.httpservicepreboot.md @@ -23,7 +23,6 @@ const validate = { id: schema.string(), }), }; - ``` - Declare a function to respond to incoming request. The function will receive `request` object containing request details: url, headers, matched route, as well as validated `params`, `query`, `body`. And `response` object instructing HTTP server to create HTTP response with information sent back to the client as the response body, headers, and HTTP status. Any exception raised during the handler call will generate `500 Server error` response and log error details for further investigation. See below for returning custom error responses. @@ -40,7 +39,6 @@ const handler = async (context: RequestHandlerContext, request: KibanaRequest, r headers: { 'content-type': 'application/json' } }); } - ``` \* - Acquire `preboot` [IRouter](./kibana-plugin-core-server.irouter.md) instance and register route handler for GET request to 'path/{id}' path. @@ -65,15 +63,14 @@ httpPreboot.registerRoutes('my-plugin', (router) => { }); }); }); - ``` ## Properties | Property | Type | Description | | --- | --- | --- | -| [basePath](./kibana-plugin-core-server.httpservicepreboot.basepath.md) | IBasePath | Access or manipulate the Kibana base path See [IBasePath](./kibana-plugin-core-server.ibasepath.md). | -| [getServerInfo](./kibana-plugin-core-server.httpservicepreboot.getserverinfo.md) | () => HttpServerInfo | Provides common [information](./kibana-plugin-core-server.httpserverinfo.md) about the running preboot http server. | +| [basePath](./kibana-plugin-core-server.httpservicepreboot.basepath.md) | IBasePath | Access or manipulate the Kibana base path See [IBasePath](./kibana-plugin-core-server.ibasepath.md). | +| [getServerInfo](./kibana-plugin-core-server.httpservicepreboot.getserverinfo.md) | () => HttpServerInfo | Provides common [information](./kibana-plugin-core-server.httpserverinfo.md) about the running preboot http server. | ## Methods diff --git a/docs/development/core/server/kibana-plugin-core-server.httpservicepreboot.registerroutes.md b/docs/development/core/server/kibana-plugin-core-server.httpservicepreboot.registerroutes.md index c188f0ba0ce9..dd90074fad39 100644 --- a/docs/development/core/server/kibana-plugin-core-server.httpservicepreboot.registerroutes.md +++ b/docs/development/core/server/kibana-plugin-core-server.httpservicepreboot.registerroutes.md @@ -16,12 +16,12 @@ registerRoutes(path: string, callback: (router: IRouter) => void): void; | Parameter | Type | Description | | --- | --- | --- | -| path | string | | -| callback | (router: IRouter) => void | | +| path | string | | +| callback | (router: IRouter) => void | | Returns: -`void` +void ## Remarks @@ -35,6 +35,5 @@ registerRoutes('my-plugin', (router) => { // handler is called when '/my-plugin/path' resource is requested with `GET` method router.get({ path: '/path', validate: false }, (context, req, res) => res.ok({ content: 'ok' })); }); - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.httpservicesetup.createrouter.md b/docs/development/core/server/kibana-plugin-core-server.httpservicesetup.createrouter.md index f009dd3fc2b1..7bdc7cd2e4e3 100644 --- a/docs/development/core/server/kibana-plugin-core-server.httpservicesetup.createrouter.md +++ b/docs/development/core/server/kibana-plugin-core-server.httpservicesetup.createrouter.md @@ -23,6 +23,5 @@ Each route can have only one handler function, which is executed when the route const router = createRouter(); // handler is called when '/path' resource is requested with `GET` method router.get({ path: '/path', validate: false }, (context, req, res) => res.ok({ content: 'ok' })); - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.httpservicesetup.md b/docs/development/core/server/kibana-plugin-core-server.httpservicesetup.md index dbc2a516fa17..81ddeaaaa5a1 100644 --- a/docs/development/core/server/kibana-plugin-core-server.httpservicesetup.md +++ b/docs/development/core/server/kibana-plugin-core-server.httpservicesetup.md @@ -18,7 +18,6 @@ To handle an incoming request in your plugin you should: - Create a `Router` ins ```ts const router = httpSetup.createRouter(); - ``` - Use `@kbn/config-schema` package to create a schema to validate the request `params`, `query`, and `body`. Every incoming request will be validated against the created schema. If validation failed, the request is rejected with `400` status and `Bad request` error without calling the route's handler. To opt out of validating the request, specify `false`. @@ -29,7 +28,6 @@ const validate = { id: schema.string(), }), }; - ``` - Declare a function to respond to incoming request. The function will receive `request` object containing request details: url, headers, matched route, as well as validated `params`, `query`, `body`. And `response` object instructing HTTP server to create HTTP response with information sent back to the client as the response body, headers, and HTTP status. Unlike, `hapi` route handler in the Legacy platform, any exception raised during the handler call will generate `500 Server error` response and log error details for further investigation. See below for returning custom error responses. @@ -46,7 +44,6 @@ const handler = async (context: RequestHandlerContext, request: KibanaRequest, r } }); } - ``` - Register route handler for GET request to 'path/{id}' path @@ -74,23 +71,22 @@ async (context, request, response) => { } }); }); - ``` ## Properties | Property | Type | Description | | --- | --- | --- | -| [auth](./kibana-plugin-core-server.httpservicesetup.auth.md) | HttpAuth | Auth status. See [HttpAuth](./kibana-plugin-core-server.httpauth.md) | -| [basePath](./kibana-plugin-core-server.httpservicesetup.basepath.md) | IBasePath | Access or manipulate the Kibana base path See [IBasePath](./kibana-plugin-core-server.ibasepath.md). | -| [createCookieSessionStorageFactory](./kibana-plugin-core-server.httpservicesetup.createcookiesessionstoragefactory.md) | <T>(cookieOptions: SessionStorageCookieOptions<T>) => Promise<SessionStorageFactory<T>> | Creates cookie based session storage factory [SessionStorageFactory](./kibana-plugin-core-server.sessionstoragefactory.md) | -| [createRouter](./kibana-plugin-core-server.httpservicesetup.createrouter.md) | <Context extends RequestHandlerContext = RequestHandlerContext>() => IRouter<Context> | Provides ability to declare a handler function for a particular path and HTTP request method. | -| [csp](./kibana-plugin-core-server.httpservicesetup.csp.md) | ICspConfig | The CSP config used for Kibana. | -| [getServerInfo](./kibana-plugin-core-server.httpservicesetup.getserverinfo.md) | () => HttpServerInfo | Provides common [information](./kibana-plugin-core-server.httpserverinfo.md) about the running http server. | -| [registerAuth](./kibana-plugin-core-server.httpservicesetup.registerauth.md) | (handler: AuthenticationHandler) => void | To define custom authentication and/or authorization mechanism for incoming requests. | -| [registerOnPostAuth](./kibana-plugin-core-server.httpservicesetup.registeronpostauth.md) | (handler: OnPostAuthHandler) => void | To define custom logic after Auth interceptor did make sure a user has access to the requested resource. | -| [registerOnPreAuth](./kibana-plugin-core-server.httpservicesetup.registeronpreauth.md) | (handler: OnPreAuthHandler) => void | To define custom logic to perform for incoming requests before the Auth interceptor performs a check that user has access to requested resources. | -| [registerOnPreResponse](./kibana-plugin-core-server.httpservicesetup.registeronpreresponse.md) | (handler: OnPreResponseHandler) => void | To define custom logic to perform for the server response. | -| [registerOnPreRouting](./kibana-plugin-core-server.httpservicesetup.registeronprerouting.md) | (handler: OnPreRoutingHandler) => void | To define custom logic to perform for incoming requests before server performs a route lookup. | -| [registerRouteHandlerContext](./kibana-plugin-core-server.httpservicesetup.registerroutehandlercontext.md) | <Context extends RequestHandlerContext, ContextName extends keyof Context>(contextName: ContextName, provider: RequestHandlerContextProvider<Context, ContextName>) => RequestHandlerContextContainer | Register a context provider for a route handler. | +| [auth](./kibana-plugin-core-server.httpservicesetup.auth.md) | HttpAuth | Auth status. See [HttpAuth](./kibana-plugin-core-server.httpauth.md) | +| [basePath](./kibana-plugin-core-server.httpservicesetup.basepath.md) | IBasePath | Access or manipulate the Kibana base path See [IBasePath](./kibana-plugin-core-server.ibasepath.md). | +| [createCookieSessionStorageFactory](./kibana-plugin-core-server.httpservicesetup.createcookiesessionstoragefactory.md) | <T>(cookieOptions: SessionStorageCookieOptions<T>) => Promise<SessionStorageFactory<T>> | Creates cookie based session storage factory [SessionStorageFactory](./kibana-plugin-core-server.sessionstoragefactory.md) | +| [createRouter](./kibana-plugin-core-server.httpservicesetup.createrouter.md) | <Context extends RequestHandlerContext = RequestHandlerContext>() => IRouter<Context> | Provides ability to declare a handler function for a particular path and HTTP request method. | +| [csp](./kibana-plugin-core-server.httpservicesetup.csp.md) | ICspConfig | The CSP config used for Kibana. | +| [getServerInfo](./kibana-plugin-core-server.httpservicesetup.getserverinfo.md) | () => HttpServerInfo | Provides common [information](./kibana-plugin-core-server.httpserverinfo.md) about the running http server. | +| [registerAuth](./kibana-plugin-core-server.httpservicesetup.registerauth.md) | (handler: AuthenticationHandler) => void | To define custom authentication and/or authorization mechanism for incoming requests. | +| [registerOnPostAuth](./kibana-plugin-core-server.httpservicesetup.registeronpostauth.md) | (handler: OnPostAuthHandler) => void | To define custom logic after Auth interceptor did make sure a user has access to the requested resource. | +| [registerOnPreAuth](./kibana-plugin-core-server.httpservicesetup.registeronpreauth.md) | (handler: OnPreAuthHandler) => void | To define custom logic to perform for incoming requests before the Auth interceptor performs a check that user has access to requested resources. | +| [registerOnPreResponse](./kibana-plugin-core-server.httpservicesetup.registeronpreresponse.md) | (handler: OnPreResponseHandler) => void | To define custom logic to perform for the server response. | +| [registerOnPreRouting](./kibana-plugin-core-server.httpservicesetup.registeronprerouting.md) | (handler: OnPreRoutingHandler) => void | To define custom logic to perform for incoming requests before server performs a route lookup. | +| [registerRouteHandlerContext](./kibana-plugin-core-server.httpservicesetup.registerroutehandlercontext.md) | <Context extends RequestHandlerContext, ContextName extends keyof Context>(contextName: ContextName, provider: RequestHandlerContextProvider<Context, ContextName>) => RequestHandlerContextContainer | Register a context provider for a route handler. | diff --git a/docs/development/core/server/kibana-plugin-core-server.httpservicesetup.registerroutehandlercontext.md b/docs/development/core/server/kibana-plugin-core-server.httpservicesetup.registerroutehandlercontext.md index df3f80580f6d..c793080305d0 100644 --- a/docs/development/core/server/kibana-plugin-core-server.httpservicesetup.registerroutehandlercontext.md +++ b/docs/development/core/server/kibana-plugin-core-server.httpservicesetup.registerroutehandlercontext.md @@ -37,6 +37,5 @@ registerRouteHandlerContext: HttpAuth | Auth status. See [HttpAuth](./kibana-plugin-core-server.httpauth.md) | -| [basePath](./kibana-plugin-core-server.httpservicestart.basepath.md) | IBasePath | Access or manipulate the Kibana base path See [IBasePath](./kibana-plugin-core-server.ibasepath.md). | -| [getServerInfo](./kibana-plugin-core-server.httpservicestart.getserverinfo.md) | () => HttpServerInfo | Provides common [information](./kibana-plugin-core-server.httpserverinfo.md) about the running http server. | +| [auth](./kibana-plugin-core-server.httpservicestart.auth.md) | HttpAuth | Auth status. See [HttpAuth](./kibana-plugin-core-server.httpauth.md) | +| [basePath](./kibana-plugin-core-server.httpservicestart.basepath.md) | IBasePath | Access or manipulate the Kibana base path See [IBasePath](./kibana-plugin-core-server.ibasepath.md). | +| [getServerInfo](./kibana-plugin-core-server.httpservicestart.getserverinfo.md) | () => HttpServerInfo | Provides common [information](./kibana-plugin-core-server.httpserverinfo.md) about the running http server. | diff --git a/docs/development/core/server/kibana-plugin-core-server.i18nservicesetup.getlocale.md b/docs/development/core/server/kibana-plugin-core-server.i18nservicesetup.getlocale.md index 2fe8e564e7ce..fa98f34c6ac5 100644 --- a/docs/development/core/server/kibana-plugin-core-server.i18nservicesetup.getlocale.md +++ b/docs/development/core/server/kibana-plugin-core-server.i18nservicesetup.getlocale.md @@ -13,5 +13,5 @@ getLocale(): string; ``` Returns: -`string` +string diff --git a/docs/development/core/server/kibana-plugin-core-server.i18nservicesetup.gettranslationfiles.md b/docs/development/core/server/kibana-plugin-core-server.i18nservicesetup.gettranslationfiles.md index 81caed287454..ebdb0babc3af 100644 --- a/docs/development/core/server/kibana-plugin-core-server.i18nservicesetup.gettranslationfiles.md +++ b/docs/development/core/server/kibana-plugin-core-server.i18nservicesetup.gettranslationfiles.md @@ -13,5 +13,5 @@ getTranslationFiles(): string[]; ``` Returns: -`string[]` +string\[\] diff --git a/docs/development/core/server/kibana-plugin-core-server.iclusterclient.md b/docs/development/core/server/kibana-plugin-core-server.iclusterclient.md index f6bacee32253..969a32d96a3a 100644 --- a/docs/development/core/server/kibana-plugin-core-server.iclusterclient.md +++ b/docs/development/core/server/kibana-plugin-core-server.iclusterclient.md @@ -16,6 +16,6 @@ export interface IClusterClient | Property | Type | Description | | --- | --- | --- | -| [asInternalUser](./kibana-plugin-core-server.iclusterclient.asinternaluser.md) | ElasticsearchClient | A [client](./kibana-plugin-core-server.elasticsearchclient.md) to be used to query the ES cluster on behalf of the Kibana internal user | -| [asScoped](./kibana-plugin-core-server.iclusterclient.asscoped.md) | (request: ScopeableRequest) => IScopedClusterClient | Creates a [scoped cluster client](./kibana-plugin-core-server.iscopedclusterclient.md) bound to given [request](./kibana-plugin-core-server.scopeablerequest.md) | +| [asInternalUser](./kibana-plugin-core-server.iclusterclient.asinternaluser.md) | ElasticsearchClient | A [client](./kibana-plugin-core-server.elasticsearchclient.md) to be used to query the ES cluster on behalf of the Kibana internal user | +| [asScoped](./kibana-plugin-core-server.iclusterclient.asscoped.md) | (request: ScopeableRequest) => IScopedClusterClient | Creates a [scoped cluster client](./kibana-plugin-core-server.iscopedclusterclient.md) bound to given [request](./kibana-plugin-core-server.scopeablerequest.md) | diff --git a/docs/development/core/server/kibana-plugin-core-server.icontextcontainer.createhandler.md b/docs/development/core/server/kibana-plugin-core-server.icontextcontainer.createhandler.md index 7d7368426b1c..ac13b86295f6 100644 --- a/docs/development/core/server/kibana-plugin-core-server.icontextcontainer.createhandler.md +++ b/docs/development/core/server/kibana-plugin-core-server.icontextcontainer.createhandler.md @@ -16,12 +16,12 @@ createHandler(pluginOpaqueId: PluginOpaqueId, handler: RequestHandler): (...rest | Parameter | Type | Description | | --- | --- | --- | -| pluginOpaqueId | PluginOpaqueId | The plugin opaque ID for the plugin that registers this handler. | -| handler | RequestHandler | Handler function to pass context object to. | +| pluginOpaqueId | PluginOpaqueId | The plugin opaque ID for the plugin that registers this handler. | +| handler | RequestHandler | Handler function to pass context object to. | Returns: -`(...rest: HandlerParameters) => ShallowPromise>` +(...rest: HandlerParameters<RequestHandler>) => ShallowPromise<ReturnType<RequestHandler>> A function that takes `RequestHandler` parameters, calls `handler` with a new context, and returns a Promise of the `handler` return value. diff --git a/docs/development/core/server/kibana-plugin-core-server.icontextcontainer.md b/docs/development/core/server/kibana-plugin-core-server.icontextcontainer.md index 8b4d3f39e345..99cddecb38d4 100644 --- a/docs/development/core/server/kibana-plugin-core-server.icontextcontainer.md +++ b/docs/development/core/server/kibana-plugin-core-server.icontextcontainer.md @@ -68,7 +68,6 @@ class MyPlugin { } } } - ``` ## Methods diff --git a/docs/development/core/server/kibana-plugin-core-server.icontextcontainer.registercontext.md b/docs/development/core/server/kibana-plugin-core-server.icontextcontainer.registercontext.md index 7f531fa8ba0d..32b177df2b2e 100644 --- a/docs/development/core/server/kibana-plugin-core-server.icontextcontainer.registercontext.md +++ b/docs/development/core/server/kibana-plugin-core-server.icontextcontainer.registercontext.md @@ -16,13 +16,13 @@ registerContextPluginOpaqueId | The plugin opaque ID for the plugin that registers this context. | -| contextName | ContextName | The key of the TContext object this provider supplies the value for. | -| provider | IContextProvider<Context, ContextName> | A [IContextProvider](./kibana-plugin-core-server.icontextprovider.md) to be called each time a new context is created. | +| pluginOpaqueId | PluginOpaqueId | The plugin opaque ID for the plugin that registers this context. | +| contextName | ContextName | The key of the TContext object this provider supplies the value for. | +| provider | IContextProvider<Context, ContextName> | A [IContextProvider](./kibana-plugin-core-server.icontextprovider.md) to be called each time a new context is created. | Returns: -`this` +this The [IContextContainer](./kibana-plugin-core-server.icontextcontainer.md) for method chaining. diff --git a/docs/development/core/server/kibana-plugin-core-server.icspconfig.md b/docs/development/core/server/kibana-plugin-core-server.icspconfig.md index 9da31cdc11e3..d5667900a41e 100644 --- a/docs/development/core/server/kibana-plugin-core-server.icspconfig.md +++ b/docs/development/core/server/kibana-plugin-core-server.icspconfig.md @@ -16,8 +16,8 @@ export interface ICspConfig | Property | Type | Description | | --- | --- | --- | -| [disableEmbedding](./kibana-plugin-core-server.icspconfig.disableembedding.md) | boolean | Whether or not embedding (using iframes) should be allowed by the CSP. If embedding is disabled, a restrictive 'frame-ancestors' rule will be added to the default CSP rules. | -| [header](./kibana-plugin-core-server.icspconfig.header.md) | string | The CSP rules in a formatted directives string for use in a Content-Security-Policy header. | -| [strict](./kibana-plugin-core-server.icspconfig.strict.md) | boolean | Specify whether browsers that do not support CSP should be able to use Kibana. Use true to block and false to allow. | -| [warnLegacyBrowsers](./kibana-plugin-core-server.icspconfig.warnlegacybrowsers.md) | boolean | Specify whether users with legacy browsers should be warned about their lack of Kibana security compliance. | +| [disableEmbedding](./kibana-plugin-core-server.icspconfig.disableembedding.md) | boolean | Whether or not embedding (using iframes) should be allowed by the CSP. If embedding is disabled, a restrictive 'frame-ancestors' rule will be added to the default CSP rules. | +| [header](./kibana-plugin-core-server.icspconfig.header.md) | string | The CSP rules in a formatted directives string for use in a Content-Security-Policy header. | +| [strict](./kibana-plugin-core-server.icspconfig.strict.md) | boolean | Specify whether browsers that do not support CSP should be able to use Kibana. Use true to block and false to allow. | +| [warnLegacyBrowsers](./kibana-plugin-core-server.icspconfig.warnlegacybrowsers.md) | boolean | Specify whether users with legacy browsers should be warned about their lack of Kibana security compliance. | diff --git a/docs/development/core/server/kibana-plugin-core-server.icustomclusterclient.md b/docs/development/core/server/kibana-plugin-core-server.icustomclusterclient.md index 189a50b5d6c2..1c65137d1ddc 100644 --- a/docs/development/core/server/kibana-plugin-core-server.icustomclusterclient.md +++ b/docs/development/core/server/kibana-plugin-core-server.icustomclusterclient.md @@ -11,10 +11,11 @@ See [IClusterClient](./kibana-plugin-core-server.iclusterclient.md) ```typescript export interface ICustomClusterClient extends IClusterClient ``` +Extends: IClusterClient ## Properties | Property | Type | Description | | --- | --- | --- | -| [close](./kibana-plugin-core-server.icustomclusterclient.close.md) | () => Promise<void> | Closes the cluster client. After that client cannot be used and one should create a new client instance to be able to interact with Elasticsearch API. | +| [close](./kibana-plugin-core-server.icustomclusterclient.close.md) | () => Promise<void> | Closes the cluster client. After that client cannot be used and one should create a new client instance to be able to interact with Elasticsearch API. | diff --git a/docs/development/core/server/kibana-plugin-core-server.iexecutioncontextcontainer.tojson.md b/docs/development/core/server/kibana-plugin-core-server.iexecutioncontextcontainer.tojson.md index 6b643f7f72c9..a561e6c31940 100644 --- a/docs/development/core/server/kibana-plugin-core-server.iexecutioncontextcontainer.tojson.md +++ b/docs/development/core/server/kibana-plugin-core-server.iexecutioncontextcontainer.tojson.md @@ -11,5 +11,5 @@ toJSON(): Readonly; ``` Returns: -`Readonly` +Readonly<KibanaExecutionContext> diff --git a/docs/development/core/server/kibana-plugin-core-server.iexecutioncontextcontainer.tostring.md b/docs/development/core/server/kibana-plugin-core-server.iexecutioncontextcontainer.tostring.md index 60f9f499cf36..666da5bef396 100644 --- a/docs/development/core/server/kibana-plugin-core-server.iexecutioncontextcontainer.tostring.md +++ b/docs/development/core/server/kibana-plugin-core-server.iexecutioncontextcontainer.tostring.md @@ -11,5 +11,5 @@ toString(): string; ``` Returns: -`string` +string diff --git a/docs/development/core/server/kibana-plugin-core-server.iexternalurlconfig.md b/docs/development/core/server/kibana-plugin-core-server.iexternalurlconfig.md index 8df4db4aa9b5..b5490a9548dc 100644 --- a/docs/development/core/server/kibana-plugin-core-server.iexternalurlconfig.md +++ b/docs/development/core/server/kibana-plugin-core-server.iexternalurlconfig.md @@ -16,5 +16,5 @@ export interface IExternalUrlConfig | Property | Type | Description | | --- | --- | --- | -| [policy](./kibana-plugin-core-server.iexternalurlconfig.policy.md) | IExternalUrlPolicy[] | A set of policies describing which external urls are allowed. | +| [policy](./kibana-plugin-core-server.iexternalurlconfig.policy.md) | IExternalUrlPolicy\[\] | A set of policies describing which external urls are allowed. | diff --git a/docs/development/core/server/kibana-plugin-core-server.iexternalurlpolicy.host.md b/docs/development/core/server/kibana-plugin-core-server.iexternalurlpolicy.host.md index d1380d9a3784..a549f8050947 100644 --- a/docs/development/core/server/kibana-plugin-core-server.iexternalurlpolicy.host.md +++ b/docs/development/core/server/kibana-plugin-core-server.iexternalurlpolicy.host.md @@ -19,6 +19,5 @@ host?: string; // allows access to all of google.com, using any protocol. allow: true, host: 'google.com' - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.iexternalurlpolicy.md b/docs/development/core/server/kibana-plugin-core-server.iexternalurlpolicy.md index d7fcc1d96bdf..45f7798eaf33 100644 --- a/docs/development/core/server/kibana-plugin-core-server.iexternalurlpolicy.md +++ b/docs/development/core/server/kibana-plugin-core-server.iexternalurlpolicy.md @@ -16,7 +16,7 @@ export interface IExternalUrlPolicy | Property | Type | Description | | --- | --- | --- | -| [allow](./kibana-plugin-core-server.iexternalurlpolicy.allow.md) | boolean | Indicates if this policy allows or denies access to the described destination. | -| [host](./kibana-plugin-core-server.iexternalurlpolicy.host.md) | string | Optional host describing the external destination. May be combined with protocol. | -| [protocol](./kibana-plugin-core-server.iexternalurlpolicy.protocol.md) | string | Optional protocol describing the external destination. May be combined with host. | +| [allow](./kibana-plugin-core-server.iexternalurlpolicy.allow.md) | boolean | Indicates if this policy allows or denies access to the described destination. | +| [host?](./kibana-plugin-core-server.iexternalurlpolicy.host.md) | string | (Optional) Optional host describing the external destination. May be combined with protocol. | +| [protocol?](./kibana-plugin-core-server.iexternalurlpolicy.protocol.md) | string | (Optional) Optional protocol describing the external destination. May be combined with host. | diff --git a/docs/development/core/server/kibana-plugin-core-server.iexternalurlpolicy.protocol.md b/docs/development/core/server/kibana-plugin-core-server.iexternalurlpolicy.protocol.md index 54e5eb5bc68f..86f6e6164de4 100644 --- a/docs/development/core/server/kibana-plugin-core-server.iexternalurlpolicy.protocol.md +++ b/docs/development/core/server/kibana-plugin-core-server.iexternalurlpolicy.protocol.md @@ -19,6 +19,5 @@ protocol?: string; // allows access to all destinations over the `https` protocol. allow: true, protocol: 'https' - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.ikibanaresponse.md b/docs/development/core/server/kibana-plugin-core-server.ikibanaresponse.md index 339ae189f151..c71f5360834e 100644 --- a/docs/development/core/server/kibana-plugin-core-server.ikibanaresponse.md +++ b/docs/development/core/server/kibana-plugin-core-server.ikibanaresponse.md @@ -16,7 +16,7 @@ export interface IKibanaResponseHttpResponseOptions | | -| [payload](./kibana-plugin-core-server.ikibanaresponse.payload.md) | T | | -| [status](./kibana-plugin-core-server.ikibanaresponse.status.md) | number | | +| [options](./kibana-plugin-core-server.ikibanaresponse.options.md) | HttpResponseOptions | | +| [payload?](./kibana-plugin-core-server.ikibanaresponse.payload.md) | T | (Optional) | +| [status](./kibana-plugin-core-server.ikibanaresponse.status.md) | number | | diff --git a/docs/development/core/server/kibana-plugin-core-server.ikibanasocket.getpeercertificate.md b/docs/development/core/server/kibana-plugin-core-server.ikibanasocket.getpeercertificate.md index 79dca660a5f3..9f0dce061bcf 100644 --- a/docs/development/core/server/kibana-plugin-core-server.ikibanasocket.getpeercertificate.md +++ b/docs/development/core/server/kibana-plugin-core-server.ikibanasocket.getpeercertificate.md @@ -14,9 +14,9 @@ getPeerCertificate(detailed: true): DetailedPeerCertificate | null; | Parameter | Type | Description | | --- | --- | --- | -| detailed | true | | +| detailed | true | | Returns: -`DetailedPeerCertificate | null` +DetailedPeerCertificate \| null diff --git a/docs/development/core/server/kibana-plugin-core-server.ikibanasocket.getpeercertificate_1.md b/docs/development/core/server/kibana-plugin-core-server.ikibanasocket.getpeercertificate_1.md index 28c126fc4f73..363fce50251d 100644 --- a/docs/development/core/server/kibana-plugin-core-server.ikibanasocket.getpeercertificate_1.md +++ b/docs/development/core/server/kibana-plugin-core-server.ikibanasocket.getpeercertificate_1.md @@ -14,9 +14,9 @@ getPeerCertificate(detailed: false): PeerCertificate | null; | Parameter | Type | Description | | --- | --- | --- | -| detailed | false | | +| detailed | false | | Returns: -`PeerCertificate | null` +PeerCertificate \| null diff --git a/docs/development/core/server/kibana-plugin-core-server.ikibanasocket.getpeercertificate_2.md b/docs/development/core/server/kibana-plugin-core-server.ikibanasocket.getpeercertificate_2.md index afeb36a9d5f3..24b11b696600 100644 --- a/docs/development/core/server/kibana-plugin-core-server.ikibanasocket.getpeercertificate_2.md +++ b/docs/development/core/server/kibana-plugin-core-server.ikibanasocket.getpeercertificate_2.md @@ -16,11 +16,11 @@ getPeerCertificate(detailed?: boolean): PeerCertificate | DetailedPeerCertificat | Parameter | Type | Description | | --- | --- | --- | -| detailed | boolean | If true; the full chain with issuer property will be returned. | +| detailed | boolean | If true; the full chain with issuer property will be returned. | Returns: -`PeerCertificate | DetailedPeerCertificate | null` +PeerCertificate \| DetailedPeerCertificate \| null An object representing the peer's certificate. diff --git a/docs/development/core/server/kibana-plugin-core-server.ikibanasocket.getprotocol.md b/docs/development/core/server/kibana-plugin-core-server.ikibanasocket.getprotocol.md index 720091174629..d605f2fd21be 100644 --- a/docs/development/core/server/kibana-plugin-core-server.ikibanasocket.getprotocol.md +++ b/docs/development/core/server/kibana-plugin-core-server.ikibanasocket.getprotocol.md @@ -13,5 +13,5 @@ getProtocol(): string | null; ``` Returns: -`string | null` +string \| null diff --git a/docs/development/core/server/kibana-plugin-core-server.ikibanasocket.md b/docs/development/core/server/kibana-plugin-core-server.ikibanasocket.md index 99923aecef8d..bc8f59df9d21 100644 --- a/docs/development/core/server/kibana-plugin-core-server.ikibanasocket.md +++ b/docs/development/core/server/kibana-plugin-core-server.ikibanasocket.md @@ -16,8 +16,8 @@ export interface IKibanaSocket | Property | Type | Description | | --- | --- | --- | -| [authorizationError](./kibana-plugin-core-server.ikibanasocket.authorizationerror.md) | Error | The reason why the peer's certificate has not been verified. This property becomes available only when authorized is false. | -| [authorized](./kibana-plugin-core-server.ikibanasocket.authorized.md) | boolean | Indicates whether or not the peer certificate was signed by one of the specified CAs. When TLS isn't used the value is undefined. | +| [authorizationError?](./kibana-plugin-core-server.ikibanasocket.authorizationerror.md) | Error | (Optional) The reason why the peer's certificate has not been verified. This property becomes available only when authorized is false. | +| [authorized?](./kibana-plugin-core-server.ikibanasocket.authorized.md) | boolean | (Optional) Indicates whether or not the peer certificate was signed by one of the specified CAs. When TLS isn't used the value is undefined. | ## Methods diff --git a/docs/development/core/server/kibana-plugin-core-server.ikibanasocket.renegotiate.md b/docs/development/core/server/kibana-plugin-core-server.ikibanasocket.renegotiate.md index f39d3c08d9f0..b4addde9b317 100644 --- a/docs/development/core/server/kibana-plugin-core-server.ikibanasocket.renegotiate.md +++ b/docs/development/core/server/kibana-plugin-core-server.ikibanasocket.renegotiate.md @@ -19,11 +19,11 @@ renegotiate(options: { | Parameter | Type | Description | | --- | --- | --- | -| options | {
rejectUnauthorized?: boolean;
requestCert?: boolean;
} | The options may contain the following fields: rejectUnauthorized, requestCert (See tls.createServer() for details). | +| options | { rejectUnauthorized?: boolean; requestCert?: boolean; } | The options may contain the following fields: rejectUnauthorized, requestCert (See tls.createServer() for details). | Returns: -`Promise` +Promise<void> A Promise that will be resolved if renegotiation succeeded, or will be rejected if renegotiation failed. diff --git a/docs/development/core/server/kibana-plugin-core-server.intervalhistogram.md b/docs/development/core/server/kibana-plugin-core-server.intervalhistogram.md index d7fb889dce32..39f2d570cd25 100644 --- a/docs/development/core/server/kibana-plugin-core-server.intervalhistogram.md +++ b/docs/development/core/server/kibana-plugin-core-server.intervalhistogram.md @@ -16,12 +16,12 @@ export interface IntervalHistogram | Property | Type | Description | | --- | --- | --- | -| [exceeds](./kibana-plugin-core-server.intervalhistogram.exceeds.md) | number | | -| [fromTimestamp](./kibana-plugin-core-server.intervalhistogram.fromtimestamp.md) | string | | -| [lastUpdatedAt](./kibana-plugin-core-server.intervalhistogram.lastupdatedat.md) | string | | -| [max](./kibana-plugin-core-server.intervalhistogram.max.md) | number | | -| [mean](./kibana-plugin-core-server.intervalhistogram.mean.md) | number | | -| [min](./kibana-plugin-core-server.intervalhistogram.min.md) | number | | -| [percentiles](./kibana-plugin-core-server.intervalhistogram.percentiles.md) | {
50: number;
75: number;
95: number;
99: number;
} | | -| [stddev](./kibana-plugin-core-server.intervalhistogram.stddev.md) | number | | +| [exceeds](./kibana-plugin-core-server.intervalhistogram.exceeds.md) | number | | +| [fromTimestamp](./kibana-plugin-core-server.intervalhistogram.fromtimestamp.md) | string | | +| [lastUpdatedAt](./kibana-plugin-core-server.intervalhistogram.lastupdatedat.md) | string | | +| [max](./kibana-plugin-core-server.intervalhistogram.max.md) | number | | +| [mean](./kibana-plugin-core-server.intervalhistogram.mean.md) | number | | +| [min](./kibana-plugin-core-server.intervalhistogram.min.md) | number | | +| [percentiles](./kibana-plugin-core-server.intervalhistogram.percentiles.md) | { 50: number; 75: number; 95: number; 99: number; } | | +| [stddev](./kibana-plugin-core-server.intervalhistogram.stddev.md) | number | | diff --git a/docs/development/core/server/kibana-plugin-core-server.irenderoptions.md b/docs/development/core/server/kibana-plugin-core-server.irenderoptions.md index 51712a3ea187..b7c43bc77867 100644 --- a/docs/development/core/server/kibana-plugin-core-server.irenderoptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.irenderoptions.md @@ -15,5 +15,5 @@ export interface IRenderOptions | Property | Type | Description | | --- | --- | --- | -| [includeUserSettings](./kibana-plugin-core-server.irenderoptions.includeusersettings.md) | boolean | Set whether to output user settings in the page metadata. true by default. | +| [includeUserSettings?](./kibana-plugin-core-server.irenderoptions.includeusersettings.md) | boolean | (Optional) Set whether to output user settings in the page metadata. true by default. | diff --git a/docs/development/core/server/kibana-plugin-core-server.irouter.md b/docs/development/core/server/kibana-plugin-core-server.irouter.md index a0a27e828f86..a751ea399c5a 100644 --- a/docs/development/core/server/kibana-plugin-core-server.irouter.md +++ b/docs/development/core/server/kibana-plugin-core-server.irouter.md @@ -16,11 +16,11 @@ export interface IRouterRouteRegistrar<'delete', Context> | Register a route handler for DELETE request. | -| [get](./kibana-plugin-core-server.irouter.get.md) | RouteRegistrar<'get', Context> | Register a route handler for GET request. | -| [handleLegacyErrors](./kibana-plugin-core-server.irouter.handlelegacyerrors.md) | RequestHandlerWrapper | Wrap a router handler to catch and converts legacy boom errors to proper custom errors. | -| [patch](./kibana-plugin-core-server.irouter.patch.md) | RouteRegistrar<'patch', Context> | Register a route handler for PATCH request. | -| [post](./kibana-plugin-core-server.irouter.post.md) | RouteRegistrar<'post', Context> | Register a route handler for POST request. | -| [put](./kibana-plugin-core-server.irouter.put.md) | RouteRegistrar<'put', Context> | Register a route handler for PUT request. | -| [routerPath](./kibana-plugin-core-server.irouter.routerpath.md) | string | Resulted path | +| [delete](./kibana-plugin-core-server.irouter.delete.md) | RouteRegistrar<'delete', Context> | Register a route handler for DELETE request. | +| [get](./kibana-plugin-core-server.irouter.get.md) | RouteRegistrar<'get', Context> | Register a route handler for GET request. | +| [handleLegacyErrors](./kibana-plugin-core-server.irouter.handlelegacyerrors.md) | RequestHandlerWrapper | Wrap a router handler to catch and converts legacy boom errors to proper custom errors. | +| [patch](./kibana-plugin-core-server.irouter.patch.md) | RouteRegistrar<'patch', Context> | Register a route handler for PATCH request. | +| [post](./kibana-plugin-core-server.irouter.post.md) | RouteRegistrar<'post', Context> | Register a route handler for POST request. | +| [put](./kibana-plugin-core-server.irouter.put.md) | RouteRegistrar<'put', Context> | Register a route handler for PUT request. | +| [routerPath](./kibana-plugin-core-server.irouter.routerpath.md) | string | Resulted path | diff --git a/docs/development/core/server/kibana-plugin-core-server.isavedobjectspointintimefinder.md b/docs/development/core/server/kibana-plugin-core-server.isavedobjectspointintimefinder.md index 950d6c078654..748ffbdc3c4e 100644 --- a/docs/development/core/server/kibana-plugin-core-server.isavedobjectspointintimefinder.md +++ b/docs/development/core/server/kibana-plugin-core-server.isavedobjectspointintimefinder.md @@ -15,6 +15,6 @@ export interface ISavedObjectsPointInTimeFinder | Property | Type | Description | | --- | --- | --- | -| [close](./kibana-plugin-core-server.isavedobjectspointintimefinder.close.md) | () => Promise<void> | Closes the Point-In-Time associated with this finder instance.Once you have retrieved all of the results you need, it is recommended to call close() to clean up the PIT and prevent Elasticsearch from consuming resources unnecessarily. This is only required if you are done iterating and have not yet paged through all of the results: the PIT will automatically be closed for you once you reach the last page of results, or if the underlying call to find fails for any reason. | -| [find](./kibana-plugin-core-server.isavedobjectspointintimefinder.find.md) | () => AsyncGenerator<SavedObjectsFindResponse<T, A>> | An async generator which wraps calls to savedObjectsClient.find and iterates over multiple pages of results using _pit and search_after. This will open a new Point-In-Time (PIT), and continue paging until a set of results is received that's smaller than the designated perPage size. | +| [close](./kibana-plugin-core-server.isavedobjectspointintimefinder.close.md) | () => Promise<void> | Closes the Point-In-Time associated with this finder instance.Once you have retrieved all of the results you need, it is recommended to call close() to clean up the PIT and prevent Elasticsearch from consuming resources unnecessarily. This is only required if you are done iterating and have not yet paged through all of the results: the PIT will automatically be closed for you once you reach the last page of results, or if the underlying call to find fails for any reason. | +| [find](./kibana-plugin-core-server.isavedobjectspointintimefinder.find.md) | () => AsyncGenerator<SavedObjectsFindResponse<T, A>> | An async generator which wraps calls to savedObjectsClient.find and iterates over multiple pages of results using _pit and search_after. This will open a new Point-In-Time (PIT), and continue paging until a set of results is received that's smaller than the designated perPage size. | diff --git a/docs/development/core/server/kibana-plugin-core-server.iscopedclusterclient.md b/docs/development/core/server/kibana-plugin-core-server.iscopedclusterclient.md index f39db268288a..f0d75f2f08fe 100644 --- a/docs/development/core/server/kibana-plugin-core-server.iscopedclusterclient.md +++ b/docs/development/core/server/kibana-plugin-core-server.iscopedclusterclient.md @@ -16,6 +16,6 @@ export interface IScopedClusterClient | Property | Type | Description | | --- | --- | --- | -| [asCurrentUser](./kibana-plugin-core-server.iscopedclusterclient.ascurrentuser.md) | ElasticsearchClient | A [client](./kibana-plugin-core-server.elasticsearchclient.md) to be used to query the elasticsearch cluster on behalf of the user that initiated the request to the Kibana server. | -| [asInternalUser](./kibana-plugin-core-server.iscopedclusterclient.asinternaluser.md) | ElasticsearchClient | A [client](./kibana-plugin-core-server.elasticsearchclient.md) to be used to query the elasticsearch cluster on behalf of the internal Kibana user. | +| [asCurrentUser](./kibana-plugin-core-server.iscopedclusterclient.ascurrentuser.md) | ElasticsearchClient | A [client](./kibana-plugin-core-server.elasticsearchclient.md) to be used to query the elasticsearch cluster on behalf of the user that initiated the request to the Kibana server. | +| [asInternalUser](./kibana-plugin-core-server.iscopedclusterclient.asinternaluser.md) | ElasticsearchClient | A [client](./kibana-plugin-core-server.elasticsearchclient.md) to be used to query the elasticsearch cluster on behalf of the internal Kibana user. | diff --git a/docs/development/core/server/kibana-plugin-core-server.iuisettingsclient.md b/docs/development/core/server/kibana-plugin-core-server.iuisettingsclient.md index dd4a69c13a2d..ad7819719e14 100644 --- a/docs/development/core/server/kibana-plugin-core-server.iuisettingsclient.md +++ b/docs/development/core/server/kibana-plugin-core-server.iuisettingsclient.md @@ -16,14 +16,14 @@ export interface IUiSettingsClient | Property | Type | Description | | --- | --- | --- | -| [get](./kibana-plugin-core-server.iuisettingsclient.get.md) | <T = any>(key: string) => Promise<T> | Retrieves uiSettings values set by the user with fallbacks to default values if not specified. | -| [getAll](./kibana-plugin-core-server.iuisettingsclient.getall.md) | <T = any>() => Promise<Record<string, T>> | Retrieves a set of all uiSettings values set by the user with fallbacks to default values if not specified. | -| [getRegistered](./kibana-plugin-core-server.iuisettingsclient.getregistered.md) | () => Readonly<Record<string, PublicUiSettingsParams>> | Returns registered uiSettings values [UiSettingsParams](./kibana-plugin-core-server.uisettingsparams.md) | -| [getUserProvided](./kibana-plugin-core-server.iuisettingsclient.getuserprovided.md) | <T = any>() => Promise<Record<string, UserProvidedValues<T>>> | Retrieves a set of all uiSettings values set by the user. | -| [isOverridden](./kibana-plugin-core-server.iuisettingsclient.isoverridden.md) | (key: string) => boolean | Shows whether the uiSettings value set by the user. | -| [isSensitive](./kibana-plugin-core-server.iuisettingsclient.issensitive.md) | (key: string) => boolean | Shows whether the uiSetting is a sensitive value. Used by telemetry to not send sensitive values. | -| [remove](./kibana-plugin-core-server.iuisettingsclient.remove.md) | (key: string) => Promise<void> | Removes uiSettings value by key. | -| [removeMany](./kibana-plugin-core-server.iuisettingsclient.removemany.md) | (keys: string[]) => Promise<void> | Removes multiple uiSettings values by keys. | -| [set](./kibana-plugin-core-server.iuisettingsclient.set.md) | (key: string, value: any) => Promise<void> | Writes uiSettings value and marks it as set by the user. | -| [setMany](./kibana-plugin-core-server.iuisettingsclient.setmany.md) | (changes: Record<string, any>) => Promise<void> | Writes multiple uiSettings values and marks them as set by the user. | +| [get](./kibana-plugin-core-server.iuisettingsclient.get.md) | <T = any>(key: string) => Promise<T> | Retrieves uiSettings values set by the user with fallbacks to default values if not specified. | +| [getAll](./kibana-plugin-core-server.iuisettingsclient.getall.md) | <T = any>() => Promise<Record<string, T>> | Retrieves a set of all uiSettings values set by the user with fallbacks to default values if not specified. | +| [getRegistered](./kibana-plugin-core-server.iuisettingsclient.getregistered.md) | () => Readonly<Record<string, PublicUiSettingsParams>> | Returns registered uiSettings values [UiSettingsParams](./kibana-plugin-core-server.uisettingsparams.md) | +| [getUserProvided](./kibana-plugin-core-server.iuisettingsclient.getuserprovided.md) | <T = any>() => Promise<Record<string, UserProvidedValues<T>>> | Retrieves a set of all uiSettings values set by the user. | +| [isOverridden](./kibana-plugin-core-server.iuisettingsclient.isoverridden.md) | (key: string) => boolean | Shows whether the uiSettings value set by the user. | +| [isSensitive](./kibana-plugin-core-server.iuisettingsclient.issensitive.md) | (key: string) => boolean | Shows whether the uiSetting is a sensitive value. Used by telemetry to not send sensitive values. | +| [remove](./kibana-plugin-core-server.iuisettingsclient.remove.md) | (key: string) => Promise<void> | Removes uiSettings value by key. | +| [removeMany](./kibana-plugin-core-server.iuisettingsclient.removemany.md) | (keys: string\[\]) => Promise<void> | Removes multiple uiSettings values by keys. | +| [set](./kibana-plugin-core-server.iuisettingsclient.set.md) | (key: string, value: any) => Promise<void> | Writes uiSettings value and marks it as set by the user. | +| [setMany](./kibana-plugin-core-server.iuisettingsclient.setmany.md) | (changes: Record<string, any>) => Promise<void> | Writes multiple uiSettings values and marks them as set by the user. | diff --git a/docs/development/core/server/kibana-plugin-core-server.kibanarequest._constructor_.md b/docs/development/core/server/kibana-plugin-core-server.kibanarequest._constructor_.md index b44607c1c413..682d6c87629f 100644 --- a/docs/development/core/server/kibana-plugin-core-server.kibanarequest._constructor_.md +++ b/docs/development/core/server/kibana-plugin-core-server.kibanarequest._constructor_.md @@ -16,9 +16,9 @@ constructor(request: Request, params: Params, query: Query, body: Body, withoutS | Parameter | Type | Description | | --- | --- | --- | -| request | Request | | -| params | Params | | -| query | Query | | -| body | Body | | -| withoutSecretHeaders | boolean | | +| request | Request | | +| params | Params | | +| query | Query | | +| body | Body | | +| withoutSecretHeaders | boolean | | diff --git a/docs/development/core/server/kibana-plugin-core-server.kibanarequest.md b/docs/development/core/server/kibana-plugin-core-server.kibanarequest.md index 4129662acb2b..f4e2dda2d549 100644 --- a/docs/development/core/server/kibana-plugin-core-server.kibanarequest.md +++ b/docs/development/core/server/kibana-plugin-core-server.kibanarequest.md @@ -22,17 +22,17 @@ export declare class KibanaRequest{
isAuthenticated: boolean;
} | | -| [body](./kibana-plugin-core-server.kibanarequest.body.md) | | Body | | -| [events](./kibana-plugin-core-server.kibanarequest.events.md) | | KibanaRequestEvents | Request events [KibanaRequestEvents](./kibana-plugin-core-server.kibanarequestevents.md) | -| [headers](./kibana-plugin-core-server.kibanarequest.headers.md) | | Headers | Readonly copy of incoming request headers. | -| [id](./kibana-plugin-core-server.kibanarequest.id.md) | | string | A identifier to identify this request. | -| [isSystemRequest](./kibana-plugin-core-server.kibanarequest.issystemrequest.md) | | boolean | Whether or not the request is a "system request" rather than an application-level request. Can be set on the client using the HttpFetchOptions#asSystemRequest option. | -| [params](./kibana-plugin-core-server.kibanarequest.params.md) | | Params | | -| [query](./kibana-plugin-core-server.kibanarequest.query.md) | | Query | | -| [rewrittenUrl](./kibana-plugin-core-server.kibanarequest.rewrittenurl.md) | | URL | URL rewritten in onPreRouting request interceptor. | -| [route](./kibana-plugin-core-server.kibanarequest.route.md) | | RecursiveReadonly<KibanaRequestRoute<Method>> | matched route details | -| [socket](./kibana-plugin-core-server.kibanarequest.socket.md) | | IKibanaSocket | [IKibanaSocket](./kibana-plugin-core-server.ikibanasocket.md) | -| [url](./kibana-plugin-core-server.kibanarequest.url.md) | | URL | a WHATWG URL standard object. | -| [uuid](./kibana-plugin-core-server.kibanarequest.uuid.md) | | string | A UUID to identify this request. | +| [auth](./kibana-plugin-core-server.kibanarequest.auth.md) | | { isAuthenticated: boolean; } | | +| [body](./kibana-plugin-core-server.kibanarequest.body.md) | | Body | | +| [events](./kibana-plugin-core-server.kibanarequest.events.md) | | KibanaRequestEvents | Request events [KibanaRequestEvents](./kibana-plugin-core-server.kibanarequestevents.md) | +| [headers](./kibana-plugin-core-server.kibanarequest.headers.md) | | Headers | Readonly copy of incoming request headers. | +| [id](./kibana-plugin-core-server.kibanarequest.id.md) | | string | A identifier to identify this request. | +| [isSystemRequest](./kibana-plugin-core-server.kibanarequest.issystemrequest.md) | | boolean | Whether or not the request is a "system request" rather than an application-level request. Can be set on the client using the HttpFetchOptions#asSystemRequest option. | +| [params](./kibana-plugin-core-server.kibanarequest.params.md) | | Params | | +| [query](./kibana-plugin-core-server.kibanarequest.query.md) | | Query | | +| [rewrittenUrl?](./kibana-plugin-core-server.kibanarequest.rewrittenurl.md) | | URL | (Optional) URL rewritten in onPreRouting request interceptor. | +| [route](./kibana-plugin-core-server.kibanarequest.route.md) | | RecursiveReadonly<KibanaRequestRoute<Method>> | matched route details | +| [socket](./kibana-plugin-core-server.kibanarequest.socket.md) | | IKibanaSocket | [IKibanaSocket](./kibana-plugin-core-server.ikibanasocket.md) | +| [url](./kibana-plugin-core-server.kibanarequest.url.md) | | URL | a WHATWG URL standard object. | +| [uuid](./kibana-plugin-core-server.kibanarequest.uuid.md) | | string | A UUID to identify this request. | diff --git a/docs/development/core/server/kibana-plugin-core-server.kibanarequestevents.md b/docs/development/core/server/kibana-plugin-core-server.kibanarequestevents.md index dfd7efd27cb5..c61e4aeec7c8 100644 --- a/docs/development/core/server/kibana-plugin-core-server.kibanarequestevents.md +++ b/docs/development/core/server/kibana-plugin-core-server.kibanarequestevents.md @@ -16,6 +16,6 @@ export interface KibanaRequestEvents | Property | Type | Description | | --- | --- | --- | -| [aborted$](./kibana-plugin-core-server.kibanarequestevents.aborted_.md) | Observable<void> | Observable that emits once if and when the request has been aborted. | -| [completed$](./kibana-plugin-core-server.kibanarequestevents.completed_.md) | Observable<void> | Observable that emits once if and when the request has been completely handled. | +| [aborted$](./kibana-plugin-core-server.kibanarequestevents.aborted_.md) | Observable<void> | Observable that emits once if and when the request has been aborted. | +| [completed$](./kibana-plugin-core-server.kibanarequestevents.completed_.md) | Observable<void> | Observable that emits once if and when the request has been completely handled. | diff --git a/docs/development/core/server/kibana-plugin-core-server.kibanarequestroute.md b/docs/development/core/server/kibana-plugin-core-server.kibanarequestroute.md index 480b580abc8a..196c352e21f8 100644 --- a/docs/development/core/server/kibana-plugin-core-server.kibanarequestroute.md +++ b/docs/development/core/server/kibana-plugin-core-server.kibanarequestroute.md @@ -16,7 +16,7 @@ export interface KibanaRequestRoute | Property | Type | Description | | --- | --- | --- | -| [method](./kibana-plugin-core-server.kibanarequestroute.method.md) | Method | | -| [options](./kibana-plugin-core-server.kibanarequestroute.options.md) | KibanaRequestRouteOptions<Method> | | -| [path](./kibana-plugin-core-server.kibanarequestroute.path.md) | string | | +| [method](./kibana-plugin-core-server.kibanarequestroute.method.md) | Method | | +| [options](./kibana-plugin-core-server.kibanarequestroute.options.md) | KibanaRequestRouteOptions<Method> | | +| [path](./kibana-plugin-core-server.kibanarequestroute.path.md) | string | | diff --git a/docs/development/core/server/kibana-plugin-core-server.kibanaresponsefactory.md b/docs/development/core/server/kibana-plugin-core-server.kibanaresponsefactory.md index 8ddc0da5f1b2..b2e2b4bc6003 100644 --- a/docs/development/core/server/kibana-plugin-core-server.kibanaresponsefactory.md +++ b/docs/development/core/server/kibana-plugin-core-server.kibanaresponsefactory.md @@ -40,7 +40,6 @@ return response.ok({ body: Buffer.from(...) }); const stream = new Stream.PassThrough(); fs.createReadStream('./file').pipe(stream); return res.ok({ body: stream }); - ``` HTTP headers are configurable via response factory parameter `options` [HttpResponseOptions](./kibana-plugin-core-server.httpresponseoptions.md). @@ -51,7 +50,6 @@ return response.ok({ 'content-type': 'application/json' } }); - ``` 2. Redirection response. Redirection URL is configures via 'Location' header. @@ -62,7 +60,6 @@ return response.redirected({ location: '/new-url', }, }); - ``` 3. Error response. You may pass an error message to the client, where error message can be: - `string` send message text - `Error` send the message text of given Error object. - `{ message: string | Error, attributes: {data: Record, ...} }` - send message text and attach additional error data. @@ -100,7 +97,6 @@ try { }); } - ``` 4. Custom response. `ResponseFactory` may not cover your use case, so you can use the `custom` function to customize the response. @@ -112,6 +108,5 @@ return response.custom({ location: '/created-url' } }) - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.loggercontextconfiginput.md b/docs/development/core/server/kibana-plugin-core-server.loggercontextconfiginput.md index fb6922d839cb..2628d1ada88f 100644 --- a/docs/development/core/server/kibana-plugin-core-server.loggercontextconfiginput.md +++ b/docs/development/core/server/kibana-plugin-core-server.loggercontextconfiginput.md @@ -15,6 +15,6 @@ export interface LoggerContextConfigInput | Property | Type | Description | | --- | --- | --- | -| [appenders](./kibana-plugin-core-server.loggercontextconfiginput.appenders.md) | Record<string, AppenderConfigType> | Map<string, AppenderConfigType> | | -| [loggers](./kibana-plugin-core-server.loggercontextconfiginput.loggers.md) | LoggerConfigType[] | | +| [appenders?](./kibana-plugin-core-server.loggercontextconfiginput.appenders.md) | Record<string, AppenderConfigType> \| Map<string, AppenderConfigType> | (Optional) | +| [loggers?](./kibana-plugin-core-server.loggercontextconfiginput.loggers.md) | LoggerConfigType\[\] | (Optional) | diff --git a/docs/development/core/server/kibana-plugin-core-server.loggingservicesetup.configure.md b/docs/development/core/server/kibana-plugin-core-server.loggingservicesetup.configure.md index 52ab5f109845..022cbb3b7cba 100644 --- a/docs/development/core/server/kibana-plugin-core-server.loggingservicesetup.configure.md +++ b/docs/development/core/server/kibana-plugin-core-server.loggingservicesetup.configure.md @@ -16,11 +16,11 @@ configure(config$: Observable): void; | Parameter | Type | Description | | --- | --- | --- | -| config$ | Observable<LoggerContextConfigInput> | | +| config$ | Observable<LoggerContextConfigInput> | | Returns: -`void` +void ## Remarks @@ -37,6 +37,5 @@ core.logging.configure( loggers: [{ name: 'search', appenders: ['default'] }] }) ) - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.md b/docs/development/core/server/kibana-plugin-core-server.md index f22a0fb8283d..2eed71cc6ece 100644 --- a/docs/development/core/server/kibana-plugin-core-server.md +++ b/docs/development/core/server/kibana-plugin-core-server.md @@ -8,7 +8,7 @@ The Kibana Core APIs for server-side plugins. A plugin requires a `kibana.json` file at it's root directory that follows [the manfiest schema](./kibana-plugin-core-server.pluginmanifest.md) to define static plugin information required to load the plugin. -A plugin's `server/index` file must contain a named import, `plugin`, that implements [PluginInitializer](./kibana-plugin-core-server.plugininitializer.md) which returns an object that implements [Plugin](./kibana-plugin-core-server.plugin.md). +A plugin's `server/index` file must contain a named import, `plugin`, that implements [PluginInitializer](./kibana-plugin-core-server.plugininitializer.md) which returns an object that implements . The plugin integrates with the core system via lifecycle events: `setup`, `start`, and `stop`. In each lifecycle method, the plugin will receive the corresponding core services available (either [CoreSetup](./kibana-plugin-core-server.coresetup.md) or [CoreStart](./kibana-plugin-core-server.corestart.md)) and any interfaces returned by dependency plugins' lifecycle method. Anything returned by the plugin's lifecycle method will be exposed to downstream dependencies when their corresponding lifecycle methods are invoked. @@ -124,7 +124,7 @@ The plugin integrates with the core system via lifecycle events: `setup` | [OpsOsMetrics](./kibana-plugin-core-server.opsosmetrics.md) | OS related metrics | | [OpsProcessMetrics](./kibana-plugin-core-server.opsprocessmetrics.md) | Process related metrics | | [OpsServerMetrics](./kibana-plugin-core-server.opsservermetrics.md) | server related metrics | -| [Plugin](./kibana-plugin-core-server.plugin.md) | The interface that should be returned by a PluginInitializer for a standard plugin. | +| [Plugin\_2](./kibana-plugin-core-server.plugin_2.md) | The interface that should be returned by a PluginInitializer for a standard plugin. | | [PluginConfigDescriptor](./kibana-plugin-core-server.pluginconfigdescriptor.md) | Describes a plugin configuration properties. | | [PluginInitializerContext](./kibana-plugin-core-server.plugininitializercontext.md) | Context that's available to plugins during initialization stage. | | [PluginManifest](./kibana-plugin-core-server.pluginmanifest.md) | Describes the set of required and optional properties plugin can define in its mandatory JSON manifest file. | @@ -259,7 +259,7 @@ The plugin integrates with the core system via lifecycle events: `setup` | [HandlerContextType](./kibana-plugin-core-server.handlercontexttype.md) | Extracts the type of the first argument of a [HandlerFunction](./kibana-plugin-core-server.handlerfunction.md) to represent the type of the context. | | [HandlerFunction](./kibana-plugin-core-server.handlerfunction.md) | A function that accepts a context object and an optional number of additional arguments. Used for the generic types in [IContextContainer](./kibana-plugin-core-server.icontextcontainer.md) | | [HandlerParameters](./kibana-plugin-core-server.handlerparameters.md) | Extracts the types of the additional arguments of a [HandlerFunction](./kibana-plugin-core-server.handlerfunction.md), excluding the [HandlerContextType](./kibana-plugin-core-server.handlercontexttype.md). | -| [Headers](./kibana-plugin-core-server.headers.md) | Http request headers to read. | +| [Headers\_2](./kibana-plugin-core-server.headers_2.md) | Http request headers to read. | | [HttpResourcesRequestHandler](./kibana-plugin-core-server.httpresourcesrequesthandler.md) | Extended version of [RequestHandler](./kibana-plugin-core-server.requesthandler.md) having access to [HttpResourcesServiceToolkit](./kibana-plugin-core-server.httpresourcesservicetoolkit.md) to respond with HTML or JS resources. | | [HttpResourcesResponseOptions](./kibana-plugin-core-server.httpresourcesresponseoptions.md) | HTTP Resources response parameters | | [HttpResponsePayload](./kibana-plugin-core-server.httpresponsepayload.md) | Data send to the client as a response payload. | diff --git a/docs/development/core/server/kibana-plugin-core-server.metricsservicesetup.getopsmetrics_.md b/docs/development/core/server/kibana-plugin-core-server.metricsservicesetup.getopsmetrics_.md index 61107fbf20ad..0db06b231f60 100644 --- a/docs/development/core/server/kibana-plugin-core-server.metricsservicesetup.getopsmetrics_.md +++ b/docs/development/core/server/kibana-plugin-core-server.metricsservicesetup.getopsmetrics_.md @@ -19,6 +19,5 @@ getOpsMetrics$: () => Observable; core.metrics.getOpsMetrics$().subscribe(metrics => { // do something with the metrics }) - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.metricsservicesetup.md b/docs/development/core/server/kibana-plugin-core-server.metricsservicesetup.md index 5fcb1417dea0..d9b05589ab6a 100644 --- a/docs/development/core/server/kibana-plugin-core-server.metricsservicesetup.md +++ b/docs/development/core/server/kibana-plugin-core-server.metricsservicesetup.md @@ -16,6 +16,6 @@ export interface MetricsServiceSetup | Property | Type | Description | | --- | --- | --- | -| [collectionInterval](./kibana-plugin-core-server.metricsservicesetup.collectioninterval.md) | number | Interval metrics are collected in milliseconds | -| [getOpsMetrics$](./kibana-plugin-core-server.metricsservicesetup.getopsmetrics_.md) | () => Observable<OpsMetrics> | Retrieve an observable emitting the [OpsMetrics](./kibana-plugin-core-server.opsmetrics.md) gathered. The observable will emit an initial value during core's start phase, and a new value every fixed interval of time, based on the opts.interval configuration property. | +| [collectionInterval](./kibana-plugin-core-server.metricsservicesetup.collectioninterval.md) | number | Interval metrics are collected in milliseconds | +| [getOpsMetrics$](./kibana-plugin-core-server.metricsservicesetup.getopsmetrics_.md) | () => Observable<OpsMetrics> | Retrieve an observable emitting the [OpsMetrics](./kibana-plugin-core-server.opsmetrics.md) gathered. The observable will emit an initial value during core's start phase, and a new value every fixed interval of time, based on the opts.interval configuration property. | diff --git a/docs/development/core/server/kibana-plugin-core-server.nodesversioncompatibility.md b/docs/development/core/server/kibana-plugin-core-server.nodesversioncompatibility.md index cbdac9d5455b..a282bf4b7b4b 100644 --- a/docs/development/core/server/kibana-plugin-core-server.nodesversioncompatibility.md +++ b/docs/development/core/server/kibana-plugin-core-server.nodesversioncompatibility.md @@ -14,10 +14,10 @@ export interface NodesVersionCompatibility | Property | Type | Description | | --- | --- | --- | -| [incompatibleNodes](./kibana-plugin-core-server.nodesversioncompatibility.incompatiblenodes.md) | NodeInfo[] | | -| [isCompatible](./kibana-plugin-core-server.nodesversioncompatibility.iscompatible.md) | boolean | | -| [kibanaVersion](./kibana-plugin-core-server.nodesversioncompatibility.kibanaversion.md) | string | | -| [message](./kibana-plugin-core-server.nodesversioncompatibility.message.md) | string | | -| [nodesInfoRequestError](./kibana-plugin-core-server.nodesversioncompatibility.nodesinforequesterror.md) | Error | | -| [warningNodes](./kibana-plugin-core-server.nodesversioncompatibility.warningnodes.md) | NodeInfo[] | | +| [incompatibleNodes](./kibana-plugin-core-server.nodesversioncompatibility.incompatiblenodes.md) | NodeInfo\[\] | | +| [isCompatible](./kibana-plugin-core-server.nodesversioncompatibility.iscompatible.md) | boolean | | +| [kibanaVersion](./kibana-plugin-core-server.nodesversioncompatibility.kibanaversion.md) | string | | +| [message?](./kibana-plugin-core-server.nodesversioncompatibility.message.md) | string | (Optional) | +| [nodesInfoRequestError?](./kibana-plugin-core-server.nodesversioncompatibility.nodesinforequesterror.md) | Error | (Optional) | +| [warningNodes](./kibana-plugin-core-server.nodesversioncompatibility.warningnodes.md) | NodeInfo\[\] | | diff --git a/docs/development/core/server/kibana-plugin-core-server.onpostauthtoolkit.md b/docs/development/core/server/kibana-plugin-core-server.onpostauthtoolkit.md index ba9f7d60667a..069f63fe01b7 100644 --- a/docs/development/core/server/kibana-plugin-core-server.onpostauthtoolkit.md +++ b/docs/development/core/server/kibana-plugin-core-server.onpostauthtoolkit.md @@ -16,5 +16,5 @@ export interface OnPostAuthToolkit | Property | Type | Description | | --- | --- | --- | -| [next](./kibana-plugin-core-server.onpostauthtoolkit.next.md) | () => OnPostAuthResult | To pass request to the next handler | +| [next](./kibana-plugin-core-server.onpostauthtoolkit.next.md) | () => OnPostAuthResult | To pass request to the next handler | diff --git a/docs/development/core/server/kibana-plugin-core-server.onpreauthtoolkit.md b/docs/development/core/server/kibana-plugin-core-server.onpreauthtoolkit.md index 8031dbc64fa6..44eed5818c61 100644 --- a/docs/development/core/server/kibana-plugin-core-server.onpreauthtoolkit.md +++ b/docs/development/core/server/kibana-plugin-core-server.onpreauthtoolkit.md @@ -16,5 +16,5 @@ export interface OnPreAuthToolkit | Property | Type | Description | | --- | --- | --- | -| [next](./kibana-plugin-core-server.onpreauthtoolkit.next.md) | () => OnPreAuthResult | To pass request to the next handler | +| [next](./kibana-plugin-core-server.onpreauthtoolkit.next.md) | () => OnPreAuthResult | To pass request to the next handler | diff --git a/docs/development/core/server/kibana-plugin-core-server.onpreresponseextensions.md b/docs/development/core/server/kibana-plugin-core-server.onpreresponseextensions.md index eaaa94b936fd..078ccc38a70c 100644 --- a/docs/development/core/server/kibana-plugin-core-server.onpreresponseextensions.md +++ b/docs/development/core/server/kibana-plugin-core-server.onpreresponseextensions.md @@ -16,5 +16,5 @@ export interface OnPreResponseExtensions | Property | Type | Description | | --- | --- | --- | -| [headers](./kibana-plugin-core-server.onpreresponseextensions.headers.md) | ResponseHeaders | additional headers to attach to the response | +| [headers?](./kibana-plugin-core-server.onpreresponseextensions.headers.md) | ResponseHeaders | (Optional) additional headers to attach to the response | diff --git a/docs/development/core/server/kibana-plugin-core-server.onpreresponseinfo.md b/docs/development/core/server/kibana-plugin-core-server.onpreresponseinfo.md index 3e5c882b2fb2..60f7f39ed30a 100644 --- a/docs/development/core/server/kibana-plugin-core-server.onpreresponseinfo.md +++ b/docs/development/core/server/kibana-plugin-core-server.onpreresponseinfo.md @@ -16,5 +16,5 @@ export interface OnPreResponseInfo | Property | Type | Description | | --- | --- | --- | -| [statusCode](./kibana-plugin-core-server.onpreresponseinfo.statuscode.md) | number | | +| [statusCode](./kibana-plugin-core-server.onpreresponseinfo.statuscode.md) | number | | diff --git a/docs/development/core/server/kibana-plugin-core-server.onpreresponserender.md b/docs/development/core/server/kibana-plugin-core-server.onpreresponserender.md index 0a7ce2d54670..a5afa1a70932 100644 --- a/docs/development/core/server/kibana-plugin-core-server.onpreresponserender.md +++ b/docs/development/core/server/kibana-plugin-core-server.onpreresponserender.md @@ -16,6 +16,6 @@ export interface OnPreResponseRender | Property | Type | Description | | --- | --- | --- | -| [body](./kibana-plugin-core-server.onpreresponserender.body.md) | string | the body to use in the response | -| [headers](./kibana-plugin-core-server.onpreresponserender.headers.md) | ResponseHeaders | additional headers to attach to the response | +| [body](./kibana-plugin-core-server.onpreresponserender.body.md) | string | the body to use in the response | +| [headers?](./kibana-plugin-core-server.onpreresponserender.headers.md) | ResponseHeaders | (Optional) additional headers to attach to the response | diff --git a/docs/development/core/server/kibana-plugin-core-server.onpreresponsetoolkit.md b/docs/development/core/server/kibana-plugin-core-server.onpreresponsetoolkit.md index 14070038132d..197b7b692e73 100644 --- a/docs/development/core/server/kibana-plugin-core-server.onpreresponsetoolkit.md +++ b/docs/development/core/server/kibana-plugin-core-server.onpreresponsetoolkit.md @@ -16,6 +16,6 @@ export interface OnPreResponseToolkit | Property | Type | Description | | --- | --- | --- | -| [next](./kibana-plugin-core-server.onpreresponsetoolkit.next.md) | (responseExtensions?: OnPreResponseExtensions) => OnPreResponseResult | To pass request to the next handler | -| [render](./kibana-plugin-core-server.onpreresponsetoolkit.render.md) | (responseRender: OnPreResponseRender) => OnPreResponseResult | To override the response with a different body | +| [next](./kibana-plugin-core-server.onpreresponsetoolkit.next.md) | (responseExtensions?: OnPreResponseExtensions) => OnPreResponseResult | To pass request to the next handler | +| [render](./kibana-plugin-core-server.onpreresponsetoolkit.render.md) | (responseRender: OnPreResponseRender) => OnPreResponseResult | To override the response with a different body | diff --git a/docs/development/core/server/kibana-plugin-core-server.onpreroutingtoolkit.md b/docs/development/core/server/kibana-plugin-core-server.onpreroutingtoolkit.md index c564896b46a2..e3bdeb3c451c 100644 --- a/docs/development/core/server/kibana-plugin-core-server.onpreroutingtoolkit.md +++ b/docs/development/core/server/kibana-plugin-core-server.onpreroutingtoolkit.md @@ -16,6 +16,6 @@ export interface OnPreRoutingToolkit | Property | Type | Description | | --- | --- | --- | -| [next](./kibana-plugin-core-server.onpreroutingtoolkit.next.md) | () => OnPreRoutingResult | To pass request to the next handler | -| [rewriteUrl](./kibana-plugin-core-server.onpreroutingtoolkit.rewriteurl.md) | (url: string) => OnPreRoutingResult | Rewrite requested resources url before is was authenticated and routed to a handler | +| [next](./kibana-plugin-core-server.onpreroutingtoolkit.next.md) | () => OnPreRoutingResult | To pass request to the next handler | +| [rewriteUrl](./kibana-plugin-core-server.onpreroutingtoolkit.rewriteurl.md) | (url: string) => OnPreRoutingResult | Rewrite requested resources url before is was authenticated and routed to a handler | diff --git a/docs/development/core/server/kibana-plugin-core-server.opsmetrics.md b/docs/development/core/server/kibana-plugin-core-server.opsmetrics.md index 4774215cef07..dcecfd35a8d2 100644 --- a/docs/development/core/server/kibana-plugin-core-server.opsmetrics.md +++ b/docs/development/core/server/kibana-plugin-core-server.opsmetrics.md @@ -16,11 +16,11 @@ export interface OpsMetrics | Property | Type | Description | | --- | --- | --- | -| [collected\_at](./kibana-plugin-core-server.opsmetrics.collected_at.md) | Date | Time metrics were recorded at. | -| [concurrent\_connections](./kibana-plugin-core-server.opsmetrics.concurrent_connections.md) | OpsServerMetrics['concurrent_connections'] | number of current concurrent connections to the server | -| [os](./kibana-plugin-core-server.opsmetrics.os.md) | OpsOsMetrics | OS related metrics | -| [process](./kibana-plugin-core-server.opsmetrics.process.md) | OpsProcessMetrics | Process related metrics. | -| [processes](./kibana-plugin-core-server.opsmetrics.processes.md) | OpsProcessMetrics[] | Process related metrics. Reports an array of objects for each kibana pid. | -| [requests](./kibana-plugin-core-server.opsmetrics.requests.md) | OpsServerMetrics['requests'] | server requests stats | -| [response\_times](./kibana-plugin-core-server.opsmetrics.response_times.md) | OpsServerMetrics['response_times'] | server response time stats | +| [collected\_at](./kibana-plugin-core-server.opsmetrics.collected_at.md) | Date | Time metrics were recorded at. | +| [concurrent\_connections](./kibana-plugin-core-server.opsmetrics.concurrent_connections.md) | OpsServerMetrics\['concurrent\_connections'\] | number of current concurrent connections to the server | +| [os](./kibana-plugin-core-server.opsmetrics.os.md) | OpsOsMetrics | OS related metrics | +| [process](./kibana-plugin-core-server.opsmetrics.process.md) | OpsProcessMetrics | Process related metrics. | +| [processes](./kibana-plugin-core-server.opsmetrics.processes.md) | OpsProcessMetrics\[\] | Process related metrics. Reports an array of objects for each kibana pid. | +| [requests](./kibana-plugin-core-server.opsmetrics.requests.md) | OpsServerMetrics\['requests'\] | server requests stats | +| [response\_times](./kibana-plugin-core-server.opsmetrics.response_times.md) | OpsServerMetrics\['response\_times'\] | server response time stats | diff --git a/docs/development/core/server/kibana-plugin-core-server.opsosmetrics.md b/docs/development/core/server/kibana-plugin-core-server.opsosmetrics.md index 893860853113..08f205d48dd0 100644 --- a/docs/development/core/server/kibana-plugin-core-server.opsosmetrics.md +++ b/docs/development/core/server/kibana-plugin-core-server.opsosmetrics.md @@ -16,13 +16,13 @@ export interface OpsOsMetrics | Property | Type | Description | | --- | --- | --- | -| [cpu](./kibana-plugin-core-server.opsosmetrics.cpu.md) | {
control_group: string;
cfs_period_micros: number;
cfs_quota_micros: number;
stat: {
number_of_elapsed_periods: number;
number_of_times_throttled: number;
time_throttled_nanos: number;
};
} | cpu cgroup metrics, undefined when not running in a cgroup | -| [cpuacct](./kibana-plugin-core-server.opsosmetrics.cpuacct.md) | {
control_group: string;
usage_nanos: number;
} | cpu accounting metrics, undefined when not running in a cgroup | -| [distro](./kibana-plugin-core-server.opsosmetrics.distro.md) | string | The os distrib. Only present for linux platforms | -| [distroRelease](./kibana-plugin-core-server.opsosmetrics.distrorelease.md) | string | The os distrib release, prefixed by the os distrib. Only present for linux platforms | -| [load](./kibana-plugin-core-server.opsosmetrics.load.md) | {
'1m': number;
'5m': number;
'15m': number;
} | cpu load metrics | -| [memory](./kibana-plugin-core-server.opsosmetrics.memory.md) | {
total_in_bytes: number;
free_in_bytes: number;
used_in_bytes: number;
} | system memory usage metrics | -| [platform](./kibana-plugin-core-server.opsosmetrics.platform.md) | NodeJS.Platform | The os platform | -| [platformRelease](./kibana-plugin-core-server.opsosmetrics.platformrelease.md) | string | The os platform release, prefixed by the platform name | -| [uptime\_in\_millis](./kibana-plugin-core-server.opsosmetrics.uptime_in_millis.md) | number | the OS uptime | +| [cpu?](./kibana-plugin-core-server.opsosmetrics.cpu.md) | { control\_group: string; cfs\_period\_micros: number; cfs\_quota\_micros: number; stat: { number\_of\_elapsed\_periods: number; number\_of\_times\_throttled: number; time\_throttled\_nanos: number; }; } | (Optional) cpu cgroup metrics, undefined when not running in a cgroup | +| [cpuacct?](./kibana-plugin-core-server.opsosmetrics.cpuacct.md) | { control\_group: string; usage\_nanos: number; } | (Optional) cpu accounting metrics, undefined when not running in a cgroup | +| [distro?](./kibana-plugin-core-server.opsosmetrics.distro.md) | string | (Optional) The os distrib. Only present for linux platforms | +| [distroRelease?](./kibana-plugin-core-server.opsosmetrics.distrorelease.md) | string | (Optional) The os distrib release, prefixed by the os distrib. Only present for linux platforms | +| [load](./kibana-plugin-core-server.opsosmetrics.load.md) | { '1m': number; '5m': number; '15m': number; } | cpu load metrics | +| [memory](./kibana-plugin-core-server.opsosmetrics.memory.md) | { total\_in\_bytes: number; free\_in\_bytes: number; used\_in\_bytes: number; } | system memory usage metrics | +| [platform](./kibana-plugin-core-server.opsosmetrics.platform.md) | NodeJS.Platform | The os platform | +| [platformRelease](./kibana-plugin-core-server.opsosmetrics.platformrelease.md) | string | The os platform release, prefixed by the platform name | +| [uptime\_in\_millis](./kibana-plugin-core-server.opsosmetrics.uptime_in_millis.md) | number | the OS uptime | diff --git a/docs/development/core/server/kibana-plugin-core-server.opsprocessmetrics.md b/docs/development/core/server/kibana-plugin-core-server.opsprocessmetrics.md index 198b668afca6..43a4333d7bd2 100644 --- a/docs/development/core/server/kibana-plugin-core-server.opsprocessmetrics.md +++ b/docs/development/core/server/kibana-plugin-core-server.opsprocessmetrics.md @@ -16,9 +16,9 @@ export interface OpsProcessMetrics | Property | Type | Description | | --- | --- | --- | -| [event\_loop\_delay\_histogram](./kibana-plugin-core-server.opsprocessmetrics.event_loop_delay_histogram.md) | IntervalHistogram | node event loop delay histogram since last collection | -| [event\_loop\_delay](./kibana-plugin-core-server.opsprocessmetrics.event_loop_delay.md) | number | mean event loop delay since last collection | -| [memory](./kibana-plugin-core-server.opsprocessmetrics.memory.md) | {
heap: {
total_in_bytes: number;
used_in_bytes: number;
size_limit: number;
};
resident_set_size_in_bytes: number;
} | process memory usage | -| [pid](./kibana-plugin-core-server.opsprocessmetrics.pid.md) | number | pid of the kibana process | -| [uptime\_in\_millis](./kibana-plugin-core-server.opsprocessmetrics.uptime_in_millis.md) | number | uptime of the kibana process | +| [event\_loop\_delay\_histogram](./kibana-plugin-core-server.opsprocessmetrics.event_loop_delay_histogram.md) | IntervalHistogram | node event loop delay histogram since last collection | +| [event\_loop\_delay](./kibana-plugin-core-server.opsprocessmetrics.event_loop_delay.md) | number | mean event loop delay since last collection | +| [memory](./kibana-plugin-core-server.opsprocessmetrics.memory.md) | { heap: { total\_in\_bytes: number; used\_in\_bytes: number; size\_limit: number; }; resident\_set\_size\_in\_bytes: number; } | process memory usage | +| [pid](./kibana-plugin-core-server.opsprocessmetrics.pid.md) | number | pid of the kibana process | +| [uptime\_in\_millis](./kibana-plugin-core-server.opsprocessmetrics.uptime_in_millis.md) | number | uptime of the kibana process | diff --git a/docs/development/core/server/kibana-plugin-core-server.opsservermetrics.md b/docs/development/core/server/kibana-plugin-core-server.opsservermetrics.md index ad6f64600a96..ddabbd124627 100644 --- a/docs/development/core/server/kibana-plugin-core-server.opsservermetrics.md +++ b/docs/development/core/server/kibana-plugin-core-server.opsservermetrics.md @@ -16,7 +16,7 @@ export interface OpsServerMetrics | Property | Type | Description | | --- | --- | --- | -| [concurrent\_connections](./kibana-plugin-core-server.opsservermetrics.concurrent_connections.md) | number | number of current concurrent connections to the server | -| [requests](./kibana-plugin-core-server.opsservermetrics.requests.md) | {
disconnects: number;
total: number;
statusCodes: Record<number, number>;
} | server requests stats | -| [response\_times](./kibana-plugin-core-server.opsservermetrics.response_times.md) | {
avg_in_millis: number;
max_in_millis: number;
} | server response time stats | +| [concurrent\_connections](./kibana-plugin-core-server.opsservermetrics.concurrent_connections.md) | number | number of current concurrent connections to the server | +| [requests](./kibana-plugin-core-server.opsservermetrics.requests.md) | { disconnects: number; total: number; statusCodes: Record<number, number>; } | server requests stats | +| [response\_times](./kibana-plugin-core-server.opsservermetrics.response_times.md) | { avg\_in\_millis: number; max\_in\_millis: number; } | server response time stats | diff --git a/docs/development/core/server/kibana-plugin-core-server.plugin.md b/docs/development/core/server/kibana-plugin-core-server.plugin_2.md similarity index 57% rename from docs/development/core/server/kibana-plugin-core-server.plugin.md rename to docs/development/core/server/kibana-plugin-core-server.plugin_2.md index b1fce06d46f3..79dbbb56c86f 100644 --- a/docs/development/core/server/kibana-plugin-core-server.plugin.md +++ b/docs/development/core/server/kibana-plugin-core-server.plugin_2.md @@ -1,8 +1,8 @@ -[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [Plugin](./kibana-plugin-core-server.plugin.md) +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [Plugin\_2](./kibana-plugin-core-server.plugin_2.md) -## Plugin interface +## Plugin\_2 interface The interface that should be returned by a `PluginInitializer` for a `standard` plugin. @@ -16,7 +16,7 @@ export interface Plugin(Optional) | diff --git a/docs/development/core/server/kibana-plugin-core-server.plugin.setup.md b/docs/development/core/server/kibana-plugin-core-server.plugin_2.setup.md similarity index 57% rename from docs/development/core/server/kibana-plugin-core-server.plugin.setup.md rename to docs/development/core/server/kibana-plugin-core-server.plugin_2.setup.md index a8b0aae28d25..cedce40b5800 100644 --- a/docs/development/core/server/kibana-plugin-core-server.plugin.setup.md +++ b/docs/development/core/server/kibana-plugin-core-server.plugin_2.setup.md @@ -1,8 +1,8 @@ -[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [Plugin](./kibana-plugin-core-server.plugin.md) > [setup](./kibana-plugin-core-server.plugin.setup.md) +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [Plugin\_2](./kibana-plugin-core-server.plugin_2.md) > [setup](./kibana-plugin-core-server.plugin_2.setup.md) -## Plugin.setup() method +## Plugin\_2.setup() method Signature: @@ -14,10 +14,10 @@ setup(core: CoreSetup, plugins: TPluginsSetup): TSetup; | Parameter | Type | Description | | --- | --- | --- | -| core | CoreSetup | | -| plugins | TPluginsSetup | | +| core | CoreSetup | | +| plugins | TPluginsSetup | | Returns: -`TSetup` +TSetup diff --git a/docs/development/core/server/kibana-plugin-core-server.plugin.start.md b/docs/development/core/server/kibana-plugin-core-server.plugin_2.start.md similarity index 57% rename from docs/development/core/server/kibana-plugin-core-server.plugin.start.md rename to docs/development/core/server/kibana-plugin-core-server.plugin_2.start.md index 851f84474fe1..08eb5431a2cf 100644 --- a/docs/development/core/server/kibana-plugin-core-server.plugin.start.md +++ b/docs/development/core/server/kibana-plugin-core-server.plugin_2.start.md @@ -1,8 +1,8 @@ -[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [Plugin](./kibana-plugin-core-server.plugin.md) > [start](./kibana-plugin-core-server.plugin.start.md) +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [Plugin\_2](./kibana-plugin-core-server.plugin_2.md) > [start](./kibana-plugin-core-server.plugin_2.start.md) -## Plugin.start() method +## Plugin\_2.start() method Signature: @@ -14,10 +14,10 @@ start(core: CoreStart, plugins: TPluginsStart): TStart; | Parameter | Type | Description | | --- | --- | --- | -| core | CoreStart | | -| plugins | TPluginsStart | | +| core | CoreStart | | +| plugins | TPluginsStart | | Returns: -`TStart` +TStart diff --git a/docs/development/core/server/kibana-plugin-core-server.plugin.stop.md b/docs/development/core/server/kibana-plugin-core-server.plugin_2.stop.md similarity index 56% rename from docs/development/core/server/kibana-plugin-core-server.plugin.stop.md rename to docs/development/core/server/kibana-plugin-core-server.plugin_2.stop.md index 5396e3d9c59f..5b62a5e82b2e 100644 --- a/docs/development/core/server/kibana-plugin-core-server.plugin.stop.md +++ b/docs/development/core/server/kibana-plugin-core-server.plugin_2.stop.md @@ -1,8 +1,8 @@ -[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [Plugin](./kibana-plugin-core-server.plugin.md) > [stop](./kibana-plugin-core-server.plugin.stop.md) +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [Plugin\_2](./kibana-plugin-core-server.plugin_2.md) > [stop](./kibana-plugin-core-server.plugin_2.stop.md) -## Plugin.stop() method +## Plugin\_2.stop() method Signature: @@ -11,5 +11,5 @@ stop?(): void; ``` Returns: -`void` +void diff --git a/docs/development/core/server/kibana-plugin-core-server.pluginconfigdescriptor.md b/docs/development/core/server/kibana-plugin-core-server.pluginconfigdescriptor.md index 80e807a1361f..b9cf0eea3362 100644 --- a/docs/development/core/server/kibana-plugin-core-server.pluginconfigdescriptor.md +++ b/docs/development/core/server/kibana-plugin-core-server.pluginconfigdescriptor.md @@ -37,15 +37,14 @@ export const config: PluginConfigDescriptor = { unused('deprecatedProperty'), ], }; - ``` ## Properties | Property | Type | Description | | --- | --- | --- | -| [deprecations](./kibana-plugin-core-server.pluginconfigdescriptor.deprecations.md) | ConfigDeprecationProvider | Provider for the to apply to the plugin configuration. | -| [exposeToBrowser](./kibana-plugin-core-server.pluginconfigdescriptor.exposetobrowser.md) | {
[P in keyof T]?: boolean;
} | List of configuration properties that will be available on the client-side plugin. | -| [exposeToUsage](./kibana-plugin-core-server.pluginconfigdescriptor.exposetousage.md) | MakeUsageFromSchema<T> | Expose non-default configs to usage collection to be sent via telemetry. set a config to true to report the actual changed config value. set a config to false to report the changed config value as \[redacted\].All changed configs except booleans and numbers will be reported as \[redacted\] unless otherwise specified.[MakeUsageFromSchema](./kibana-plugin-core-server.makeusagefromschema.md) | -| [schema](./kibana-plugin-core-server.pluginconfigdescriptor.schema.md) | PluginConfigSchema<T> | Schema to use to validate the plugin configuration.[PluginConfigSchema](./kibana-plugin-core-server.pluginconfigschema.md) | +| [deprecations?](./kibana-plugin-core-server.pluginconfigdescriptor.deprecations.md) | ConfigDeprecationProvider | (Optional) Provider for the to apply to the plugin configuration. | +| [exposeToBrowser?](./kibana-plugin-core-server.pluginconfigdescriptor.exposetobrowser.md) | { \[P in keyof T\]?: boolean; } | (Optional) List of configuration properties that will be available on the client-side plugin. | +| [exposeToUsage?](./kibana-plugin-core-server.pluginconfigdescriptor.exposetousage.md) | MakeUsageFromSchema<T> | (Optional) Expose non-default configs to usage collection to be sent via telemetry. set a config to true to report the actual changed config value. set a config to false to report the changed config value as \[redacted\].All changed configs except booleans and numbers will be reported as \[redacted\] unless otherwise specified.[MakeUsageFromSchema](./kibana-plugin-core-server.makeusagefromschema.md) | +| [schema](./kibana-plugin-core-server.pluginconfigdescriptor.schema.md) | PluginConfigSchema<T> | Schema to use to validate the plugin configuration.[PluginConfigSchema](./kibana-plugin-core-server.pluginconfigschema.md) | diff --git a/docs/development/core/server/kibana-plugin-core-server.plugininitializercontext.logger.md b/docs/development/core/server/kibana-plugin-core-server.plugininitializercontext.logger.md index e5de046eccf1..74bf5b0c1384 100644 --- a/docs/development/core/server/kibana-plugin-core-server.plugininitializercontext.logger.md +++ b/docs/development/core/server/kibana-plugin-core-server.plugininitializercontext.logger.md @@ -27,6 +27,5 @@ export class MyPlugin implements Plugin { // `mySubLogger` context: `plugins.myPlugin.sub` } } - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.plugininitializercontext.md b/docs/development/core/server/kibana-plugin-core-server.plugininitializercontext.md index 9bc9d6d83674..e2d115578d7c 100644 --- a/docs/development/core/server/kibana-plugin-core-server.plugininitializercontext.md +++ b/docs/development/core/server/kibana-plugin-core-server.plugininitializercontext.md @@ -16,8 +16,8 @@ export interface PluginInitializerContext | Property | Type | Description | | --- | --- | --- | -| [config](./kibana-plugin-core-server.plugininitializercontext.config.md) | {
legacy: {
globalConfig$: Observable<SharedGlobalConfig>;
get: () => SharedGlobalConfig;
};
create: <T = ConfigSchema>() => Observable<T>;
get: <T = ConfigSchema>() => T;
} | Accessors for the plugin's configuration | -| [env](./kibana-plugin-core-server.plugininitializercontext.env.md) | {
mode: EnvironmentMode;
packageInfo: Readonly<PackageInfo>;
instanceUuid: string;
configs: readonly string[];
} | | -| [logger](./kibana-plugin-core-server.plugininitializercontext.logger.md) | LoggerFactory | instance already bound to the plugin's logging context | -| [opaqueId](./kibana-plugin-core-server.plugininitializercontext.opaqueid.md) | PluginOpaqueId | | +| [config](./kibana-plugin-core-server.plugininitializercontext.config.md) | { legacy: { globalConfig$: Observable<SharedGlobalConfig>; get: () => SharedGlobalConfig; }; create: <T = ConfigSchema>() => Observable<T>; get: <T = ConfigSchema>() => T; } | Accessors for the plugin's configuration | +| [env](./kibana-plugin-core-server.plugininitializercontext.env.md) | { mode: EnvironmentMode; packageInfo: Readonly<PackageInfo>; instanceUuid: string; configs: readonly string\[\]; } | | +| [logger](./kibana-plugin-core-server.plugininitializercontext.logger.md) | LoggerFactory | instance already bound to the plugin's logging context | +| [opaqueId](./kibana-plugin-core-server.plugininitializercontext.opaqueid.md) | PluginOpaqueId | | diff --git a/docs/development/core/server/kibana-plugin-core-server.pluginmanifest.md b/docs/development/core/server/kibana-plugin-core-server.pluginmanifest.md index e82599c11f51..4c7c63b791a7 100644 --- a/docs/development/core/server/kibana-plugin-core-server.pluginmanifest.md +++ b/docs/development/core/server/kibana-plugin-core-server.pluginmanifest.md @@ -20,18 +20,18 @@ Should never be used in code outside of Core but is exported for documentation p | Property | Type | Description | | --- | --- | --- | -| [configPath](./kibana-plugin-core-server.pluginmanifest.configpath.md) | ConfigPath | Root used by the plugin, defaults to "id" in snake\_case format. | -| [description](./kibana-plugin-core-server.pluginmanifest.description.md) | string | TODO: make required once all plugins specify this. A brief description of what this plugin does and any capabilities it provides. | -| [extraPublicDirs](./kibana-plugin-core-server.pluginmanifest.extrapublicdirs.md) | string[] | Specifies directory names that can be imported by other ui-plugins built using the same instance of the @kbn/optimizer. A temporary measure we plan to replace with better mechanisms for sharing static code between plugins | -| [id](./kibana-plugin-core-server.pluginmanifest.id.md) | PluginName | Identifier of the plugin. Must be a string in camelCase. Part of a plugin public contract. Other plugins leverage it to access plugin API, navigate to the plugin, etc. | -| [kibanaVersion](./kibana-plugin-core-server.pluginmanifest.kibanaversion.md) | string | The version of Kibana the plugin is compatible with, defaults to "version". | -| [optionalPlugins](./kibana-plugin-core-server.pluginmanifest.optionalplugins.md) | readonly PluginName[] | An optional list of the other plugins that if installed and enabled \*\*may be\*\* leveraged by this plugin for some additional functionality but otherwise are not required for this plugin to work properly. | -| [owner](./kibana-plugin-core-server.pluginmanifest.owner.md) | {
readonly name: string;
readonly githubTeam?: string;
} | | -| [requiredBundles](./kibana-plugin-core-server.pluginmanifest.requiredbundles.md) | readonly string[] | List of plugin ids that this plugin's UI code imports modules from that are not in requiredPlugins. | -| [requiredPlugins](./kibana-plugin-core-server.pluginmanifest.requiredplugins.md) | readonly PluginName[] | An optional list of the other plugins that \*\*must be\*\* installed and enabled for this plugin to function properly. | -| [server](./kibana-plugin-core-server.pluginmanifest.server.md) | boolean | Specifies whether plugin includes some server-side specific functionality. | -| [serviceFolders](./kibana-plugin-core-server.pluginmanifest.servicefolders.md) | readonly string[] | Only used for the automatically generated API documentation. Specifying service folders will cause your plugin API reference to be broken up into sub sections. | -| [type](./kibana-plugin-core-server.pluginmanifest.type.md) | PluginType | Type of the plugin, defaults to standard. | -| [ui](./kibana-plugin-core-server.pluginmanifest.ui.md) | boolean | Specifies whether plugin includes some client/browser specific functionality that should be included into client bundle via public/ui_plugin.js file. | -| [version](./kibana-plugin-core-server.pluginmanifest.version.md) | string | Version of the plugin. | +| [configPath](./kibana-plugin-core-server.pluginmanifest.configpath.md) | ConfigPath | Root used by the plugin, defaults to "id" in snake\_case format. | +| [description?](./kibana-plugin-core-server.pluginmanifest.description.md) | string | (Optional) TODO: make required once all plugins specify this. A brief description of what this plugin does and any capabilities it provides. | +| [extraPublicDirs?](./kibana-plugin-core-server.pluginmanifest.extrapublicdirs.md) | string\[\] | (Optional) Specifies directory names that can be imported by other ui-plugins built using the same instance of the @kbn/optimizer. A temporary measure we plan to replace with better mechanisms for sharing static code between plugins | +| [id](./kibana-plugin-core-server.pluginmanifest.id.md) | PluginName | Identifier of the plugin. Must be a string in camelCase. Part of a plugin public contract. Other plugins leverage it to access plugin API, navigate to the plugin, etc. | +| [kibanaVersion](./kibana-plugin-core-server.pluginmanifest.kibanaversion.md) | string | The version of Kibana the plugin is compatible with, defaults to "version". | +| [optionalPlugins](./kibana-plugin-core-server.pluginmanifest.optionalplugins.md) | readonly PluginName\[\] | An optional list of the other plugins that if installed and enabled \*\*may be\*\* leveraged by this plugin for some additional functionality but otherwise are not required for this plugin to work properly. | +| [owner](./kibana-plugin-core-server.pluginmanifest.owner.md) | { readonly name: string; readonly githubTeam?: string; } | | +| [requiredBundles](./kibana-plugin-core-server.pluginmanifest.requiredbundles.md) | readonly string\[\] | List of plugin ids that this plugin's UI code imports modules from that are not in requiredPlugins. | +| [requiredPlugins](./kibana-plugin-core-server.pluginmanifest.requiredplugins.md) | readonly PluginName\[\] | An optional list of the other plugins that \*\*must be\*\* installed and enabled for this plugin to function properly. | +| [server](./kibana-plugin-core-server.pluginmanifest.server.md) | boolean | Specifies whether plugin includes some server-side specific functionality. | +| [serviceFolders?](./kibana-plugin-core-server.pluginmanifest.servicefolders.md) | readonly string\[\] | (Optional) Only used for the automatically generated API documentation. Specifying service folders will cause your plugin API reference to be broken up into sub sections. | +| [type](./kibana-plugin-core-server.pluginmanifest.type.md) | PluginType | Type of the plugin, defaults to standard. | +| [ui](./kibana-plugin-core-server.pluginmanifest.ui.md) | boolean | Specifies whether plugin includes some client/browser specific functionality that should be included into client bundle via public/ui_plugin.js file. | +| [version](./kibana-plugin-core-server.pluginmanifest.version.md) | string | Version of the plugin. | diff --git a/docs/development/core/server/kibana-plugin-core-server.prebootplugin.md b/docs/development/core/server/kibana-plugin-core-server.prebootplugin.md index df851daab780..8bbb042965dd 100644 --- a/docs/development/core/server/kibana-plugin-core-server.prebootplugin.md +++ b/docs/development/core/server/kibana-plugin-core-server.prebootplugin.md @@ -17,5 +17,5 @@ export interface PrebootPlugin(Optional) | diff --git a/docs/development/core/server/kibana-plugin-core-server.prebootplugin.setup.md b/docs/development/core/server/kibana-plugin-core-server.prebootplugin.setup.md index 0ee2a26293e9..f55819eeaca5 100644 --- a/docs/development/core/server/kibana-plugin-core-server.prebootplugin.setup.md +++ b/docs/development/core/server/kibana-plugin-core-server.prebootplugin.setup.md @@ -14,10 +14,10 @@ setup(core: CorePreboot, plugins: TPluginsSetup): TSetup; | Parameter | Type | Description | | --- | --- | --- | -| core | CorePreboot | | -| plugins | TPluginsSetup | | +| core | CorePreboot | | +| plugins | TPluginsSetup | | Returns: -`TSetup` +TSetup diff --git a/docs/development/core/server/kibana-plugin-core-server.prebootplugin.stop.md b/docs/development/core/server/kibana-plugin-core-server.prebootplugin.stop.md index 89566b2ae668..c93dcb7709a1 100644 --- a/docs/development/core/server/kibana-plugin-core-server.prebootplugin.stop.md +++ b/docs/development/core/server/kibana-plugin-core-server.prebootplugin.stop.md @@ -11,5 +11,5 @@ stop?(): void; ``` Returns: -`void` +void diff --git a/docs/development/core/server/kibana-plugin-core-server.prebootservicepreboot.md b/docs/development/core/server/kibana-plugin-core-server.prebootservicepreboot.md index bf503499b629..c9c7c15ac327 100644 --- a/docs/development/core/server/kibana-plugin-core-server.prebootservicepreboot.md +++ b/docs/development/core/server/kibana-plugin-core-server.prebootservicepreboot.md @@ -22,7 +22,6 @@ core.preboot.holdSetupUntilResolved('Just waiting for 5 seconds', setTimeout(resolve, 5000); }) ); - ``` If the supplied `Promise` resolves to an object with the `shouldReloadConfig` property set to `true`, Kibana will also reload its configuration from disk. @@ -33,13 +32,12 @@ core.preboot.holdSetupUntilResolved('Just waiting for 5 seconds before reloading setTimeout(() => resolve({ shouldReloadConfig: true }), 5000); }) ); - ``` ## Properties | Property | Type | Description | | --- | --- | --- | -| [holdSetupUntilResolved](./kibana-plugin-core-server.prebootservicepreboot.holdsetupuntilresolved.md) | (reason: string, promise: Promise<{
shouldReloadConfig: boolean;
} | undefined>) => void | Registers a Promise as a precondition before Kibana can proceed to setup. This method can be invoked multiple times and from multiple preboot plugins. Kibana will proceed to setup only when all registered Promises instances are resolved, or it will shut down if any of them is rejected. | -| [isSetupOnHold](./kibana-plugin-core-server.prebootservicepreboot.issetuponhold.md) | () => boolean | Indicates whether Kibana is currently on hold and cannot proceed to setup yet. | +| [holdSetupUntilResolved](./kibana-plugin-core-server.prebootservicepreboot.holdsetupuntilresolved.md) | (reason: string, promise: Promise<{ shouldReloadConfig: boolean; } \| undefined>) => void | Registers a Promise as a precondition before Kibana can proceed to setup. This method can be invoked multiple times and from multiple preboot plugins. Kibana will proceed to setup only when all registered Promises instances are resolved, or it will shut down if any of them is rejected. | +| [isSetupOnHold](./kibana-plugin-core-server.prebootservicepreboot.issetuponhold.md) | () => boolean | Indicates whether Kibana is currently on hold and cannot proceed to setup yet. | diff --git a/docs/development/core/server/kibana-plugin-core-server.registerdeprecationsconfig.md b/docs/development/core/server/kibana-plugin-core-server.registerdeprecationsconfig.md index 444c2653512d..b7787a140631 100644 --- a/docs/development/core/server/kibana-plugin-core-server.registerdeprecationsconfig.md +++ b/docs/development/core/server/kibana-plugin-core-server.registerdeprecationsconfig.md @@ -15,5 +15,5 @@ export interface RegisterDeprecationsConfig | Property | Type | Description | | --- | --- | --- | -| [getDeprecations](./kibana-plugin-core-server.registerdeprecationsconfig.getdeprecations.md) | (context: GetDeprecationsContext) => MaybePromise<DeprecationsDetails[]> | | +| [getDeprecations](./kibana-plugin-core-server.registerdeprecationsconfig.getdeprecations.md) | (context: GetDeprecationsContext) => MaybePromise<DeprecationsDetails\[\]> | | diff --git a/docs/development/core/server/kibana-plugin-core-server.requesthandler.md b/docs/development/core/server/kibana-plugin-core-server.requesthandler.md index d32ac4d80c33..0ba0f72d7ab2 100644 --- a/docs/development/core/server/kibana-plugin-core-server.requesthandler.md +++ b/docs/development/core/server/kibana-plugin-core-server.requesthandler.md @@ -37,6 +37,5 @@ router.get( return response.ok(data); } ); - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.requesthandlercontext.md b/docs/development/core/server/kibana-plugin-core-server.requesthandlercontext.md index 15a2e235fff2..0d705c9daa33 100644 --- a/docs/development/core/server/kibana-plugin-core-server.requesthandlercontext.md +++ b/docs/development/core/server/kibana-plugin-core-server.requesthandlercontext.md @@ -18,5 +18,5 @@ export interface RequestHandlerContext | Property | Type | Description | | --- | --- | --- | -| [core](./kibana-plugin-core-server.requesthandlercontext.core.md) | {
savedObjects: {
client: SavedObjectsClientContract;
typeRegistry: ISavedObjectTypeRegistry;
getClient: (options?: SavedObjectsClientProviderOptions) => SavedObjectsClientContract;
getExporter: (client: SavedObjectsClientContract) => ISavedObjectsExporter;
getImporter: (client: SavedObjectsClientContract) => ISavedObjectsImporter;
};
elasticsearch: {
client: IScopedClusterClient;
};
uiSettings: {
client: IUiSettingsClient;
};
deprecations: {
client: DeprecationsClient;
};
} | | +| [core](./kibana-plugin-core-server.requesthandlercontext.core.md) | { savedObjects: { client: SavedObjectsClientContract; typeRegistry: ISavedObjectTypeRegistry; getClient: (options?: SavedObjectsClientProviderOptions) => SavedObjectsClientContract; getExporter: (client: SavedObjectsClientContract) => ISavedObjectsExporter; getImporter: (client: SavedObjectsClientContract) => ISavedObjectsImporter; }; elasticsearch: { client: IScopedClusterClient; }; uiSettings: { client: IUiSettingsClient; }; deprecations: { client: DeprecationsClient; }; } | | diff --git a/docs/development/core/server/kibana-plugin-core-server.requesthandlerwrapper.md b/docs/development/core/server/kibana-plugin-core-server.requesthandlerwrapper.md index 76c7ee4f2290..6ae585b4eeb0 100644 --- a/docs/development/core/server/kibana-plugin-core-server.requesthandlerwrapper.md +++ b/docs/development/core/server/kibana-plugin-core-server.requesthandlerwrapper.md @@ -22,6 +22,5 @@ export const wrapper: RequestHandlerWrapper = handler => { ... }; } - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.resolvecapabilitiesoptions.md b/docs/development/core/server/kibana-plugin-core-server.resolvecapabilitiesoptions.md index f118c34c9be0..e23d07d7683d 100644 --- a/docs/development/core/server/kibana-plugin-core-server.resolvecapabilitiesoptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.resolvecapabilitiesoptions.md @@ -16,5 +16,5 @@ export interface ResolveCapabilitiesOptions | Property | Type | Description | | --- | --- | --- | -| [useDefaultCapabilities](./kibana-plugin-core-server.resolvecapabilitiesoptions.usedefaultcapabilities.md) | boolean | Indicates if capability switchers are supposed to return a default set of capabilities. | +| [useDefaultCapabilities](./kibana-plugin-core-server.resolvecapabilitiesoptions.usedefaultcapabilities.md) | boolean | Indicates if capability switchers are supposed to return a default set of capabilities. | diff --git a/docs/development/core/server/kibana-plugin-core-server.routeconfig.md b/docs/development/core/server/kibana-plugin-core-server.routeconfig.md index b61ac23e68cb..6297e2745cd3 100644 --- a/docs/development/core/server/kibana-plugin-core-server.routeconfig.md +++ b/docs/development/core/server/kibana-plugin-core-server.routeconfig.md @@ -16,7 +16,7 @@ export interface RouteConfig | Property | Type | Description | | --- | --- | --- | -| [options](./kibana-plugin-core-server.routeconfig.options.md) | RouteConfigOptions<Method> | Additional route options [RouteConfigOptions](./kibana-plugin-core-server.routeconfigoptions.md). | -| [path](./kibana-plugin-core-server.routeconfig.path.md) | string | The endpoint \_within\_ the router path to register the route. | -| [validate](./kibana-plugin-core-server.routeconfig.validate.md) | RouteValidatorFullConfig<P, Q, B> | false | A schema created with @kbn/config-schema that every request will be validated against. | +| [options?](./kibana-plugin-core-server.routeconfig.options.md) | RouteConfigOptions<Method> | (Optional) Additional route options [RouteConfigOptions](./kibana-plugin-core-server.routeconfigoptions.md). | +| [path](./kibana-plugin-core-server.routeconfig.path.md) | string | The endpoint \_within\_ the router path to register the route. | +| [validate](./kibana-plugin-core-server.routeconfig.validate.md) | RouteValidatorFullConfig<P, Q, B> \| false | A schema created with @kbn/config-schema that every request will be validated against. | diff --git a/docs/development/core/server/kibana-plugin-core-server.routeconfig.validate.md b/docs/development/core/server/kibana-plugin-core-server.routeconfig.validate.md index 3bbabc04f250..1f9cc216cad3 100644 --- a/docs/development/core/server/kibana-plugin-core-server.routeconfig.validate.md +++ b/docs/development/core/server/kibana-plugin-core-server.routeconfig.validate.md @@ -57,6 +57,5 @@ router.get({ console.log(req.params.id); // value myValidationLibrary.validate({ params: req.params }); }); - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.routeconfigoptions.md b/docs/development/core/server/kibana-plugin-core-server.routeconfigoptions.md index cf0fe32c14d1..2dcd8ee5420a 100644 --- a/docs/development/core/server/kibana-plugin-core-server.routeconfigoptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.routeconfigoptions.md @@ -16,9 +16,9 @@ export interface RouteConfigOptions | Property | Type | Description | | --- | --- | --- | -| [authRequired](./kibana-plugin-core-server.routeconfigoptions.authrequired.md) | boolean | 'optional' | Defines authentication mode for a route: - true. A user has to have valid credentials to access a resource - false. A user can access a resource without any credentials. - 'optional'. A user can access a resource, and will be authenticated if provided credentials are valid. Can be useful when we grant access to a resource but want to identify a user if possible.Defaults to true if an auth mechanism is registered. | -| [body](./kibana-plugin-core-server.routeconfigoptions.body.md) | Method extends 'get' | 'options' ? undefined : RouteConfigOptionsBody | Additional body options [RouteConfigOptionsBody](./kibana-plugin-core-server.routeconfigoptionsbody.md). | -| [tags](./kibana-plugin-core-server.routeconfigoptions.tags.md) | readonly string[] | Additional metadata tag strings to attach to the route. | -| [timeout](./kibana-plugin-core-server.routeconfigoptions.timeout.md) | {
payload?: Method extends 'get' | 'options' ? undefined : number;
idleSocket?: number;
} | Defines per-route timeouts. | -| [xsrfRequired](./kibana-plugin-core-server.routeconfigoptions.xsrfrequired.md) | Method extends 'get' ? never : boolean | Defines xsrf protection requirements for a route: - true. Requires an incoming POST/PUT/DELETE request to contain kbn-xsrf header. - false. Disables xsrf protection.Set to true by default | +| [authRequired?](./kibana-plugin-core-server.routeconfigoptions.authrequired.md) | boolean \| 'optional' | (Optional) Defines authentication mode for a route: - true. A user has to have valid credentials to access a resource - false. A user can access a resource without any credentials. - 'optional'. A user can access a resource, and will be authenticated if provided credentials are valid. Can be useful when we grant access to a resource but want to identify a user if possible.Defaults to true if an auth mechanism is registered. | +| [body?](./kibana-plugin-core-server.routeconfigoptions.body.md) | Method extends 'get' \| 'options' ? undefined : RouteConfigOptionsBody | (Optional) Additional body options [RouteConfigOptionsBody](./kibana-plugin-core-server.routeconfigoptionsbody.md). | +| [tags?](./kibana-plugin-core-server.routeconfigoptions.tags.md) | readonly string\[\] | (Optional) Additional metadata tag strings to attach to the route. | +| [timeout?](./kibana-plugin-core-server.routeconfigoptions.timeout.md) | { payload?: Method extends 'get' \| 'options' ? undefined : number; idleSocket?: number; } | (Optional) Defines per-route timeouts. | +| [xsrfRequired?](./kibana-plugin-core-server.routeconfigoptions.xsrfrequired.md) | Method extends 'get' ? never : boolean | (Optional) Defines xsrf protection requirements for a route: - true. Requires an incoming POST/PUT/DELETE request to contain kbn-xsrf header. - false. Disables xsrf protection.Set to true by default | diff --git a/docs/development/core/server/kibana-plugin-core-server.routeconfigoptionsbody.md b/docs/development/core/server/kibana-plugin-core-server.routeconfigoptionsbody.md index d27c67891161..fdae03f7cd7c 100644 --- a/docs/development/core/server/kibana-plugin-core-server.routeconfigoptionsbody.md +++ b/docs/development/core/server/kibana-plugin-core-server.routeconfigoptionsbody.md @@ -16,8 +16,8 @@ export interface RouteConfigOptionsBody | Property | Type | Description | | --- | --- | --- | -| [accepts](./kibana-plugin-core-server.routeconfigoptionsbody.accepts.md) | RouteContentType | RouteContentType[] | string | string[] | A string or an array of strings with the allowed mime types for the endpoint. Use this settings to limit the set of allowed mime types. Note that allowing additional mime types not listed above will not enable them to be parsed, and if parse is true, the request will result in an error response.Default value: allows parsing of the following mime types: \* application/json \* application/\*+json \* application/octet-stream \* application/x-www-form-urlencoded \* multipart/form-data \* text/\* | -| [maxBytes](./kibana-plugin-core-server.routeconfigoptionsbody.maxbytes.md) | number | Limits the size of incoming payloads to the specified byte count. Allowing very large payloads may cause the server to run out of memory.Default value: The one set in the kibana.yml config file under the parameter server.maxPayload. | -| [output](./kibana-plugin-core-server.routeconfigoptionsbody.output.md) | typeof validBodyOutput[number] | The processed payload format. The value must be one of: \* 'data' - the incoming payload is read fully into memory. If parse is true, the payload is parsed (JSON, form-decoded, multipart) based on the 'Content-Type' header. If parse is false, a raw Buffer is returned. \* 'stream' - the incoming payload is made available via a Stream.Readable interface. If the payload is 'multipart/form-data' and parse is true, field values are presented as text while files are provided as streams. File streams from a 'multipart/form-data' upload will also have a hapi property containing the filename and headers properties. Note that payload streams for multipart payloads are a synthetic interface created on top of the entire multipart content loaded into memory. To avoid loading large multipart payloads into memory, set parse to false and handle the multipart payload in the handler using a streaming parser (e.g. pez).Default value: 'data', unless no validation.body is provided in the route definition. In that case the default is 'stream' to alleviate memory pressure. | -| [parse](./kibana-plugin-core-server.routeconfigoptionsbody.parse.md) | boolean | 'gunzip' | Determines if the incoming payload is processed or presented raw. Available values: \* true - if the request 'Content-Type' matches the allowed mime types set by allow (for the whole payload as well as parts), the payload is converted into an object when possible. If the format is unknown, a Bad Request (400) error response is sent. Any known content encoding is decoded. \* false - the raw payload is returned unmodified. \* 'gunzip' - the raw payload is returned unmodified after any known content encoding is decoded.Default value: true, unless no validation.body is provided in the route definition. In that case the default is false to alleviate memory pressure. | +| [accepts?](./kibana-plugin-core-server.routeconfigoptionsbody.accepts.md) | RouteContentType \| RouteContentType\[\] \| string \| string\[\] | (Optional) A string or an array of strings with the allowed mime types for the endpoint. Use this settings to limit the set of allowed mime types. Note that allowing additional mime types not listed above will not enable them to be parsed, and if parse is true, the request will result in an error response.Default value: allows parsing of the following mime types: \* application/json \* application/\*+json \* application/octet-stream \* application/x-www-form-urlencoded \* multipart/form-data \* text/\* | +| [maxBytes?](./kibana-plugin-core-server.routeconfigoptionsbody.maxbytes.md) | number | (Optional) Limits the size of incoming payloads to the specified byte count. Allowing very large payloads may cause the server to run out of memory.Default value: The one set in the kibana.yml config file under the parameter server.maxPayload. | +| [output?](./kibana-plugin-core-server.routeconfigoptionsbody.output.md) | typeof validBodyOutput\[number\] | (Optional) The processed payload format. The value must be one of: \* 'data' - the incoming payload is read fully into memory. If parse is true, the payload is parsed (JSON, form-decoded, multipart) based on the 'Content-Type' header. If parse is false, a raw Buffer is returned. \* 'stream' - the incoming payload is made available via a Stream.Readable interface. If the payload is 'multipart/form-data' and parse is true, field values are presented as text while files are provided as streams. File streams from a 'multipart/form-data' upload will also have a hapi property containing the filename and headers properties. Note that payload streams for multipart payloads are a synthetic interface created on top of the entire multipart content loaded into memory. To avoid loading large multipart payloads into memory, set parse to false and handle the multipart payload in the handler using a streaming parser (e.g. pez).Default value: 'data', unless no validation.body is provided in the route definition. In that case the default is 'stream' to alleviate memory pressure. | +| [parse?](./kibana-plugin-core-server.routeconfigoptionsbody.parse.md) | boolean \| 'gunzip' | (Optional) Determines if the incoming payload is processed or presented raw. Available values: \* true - if the request 'Content-Type' matches the allowed mime types set by allow (for the whole payload as well as parts), the payload is converted into an object when possible. If the format is unknown, a Bad Request (400) error response is sent. Any known content encoding is decoded. \* false - the raw payload is returned unmodified. \* 'gunzip' - the raw payload is returned unmodified after any known content encoding is decoded.Default value: true, unless no validation.body is provided in the route definition. In that case the default is false to alleviate memory pressure. | diff --git a/docs/development/core/server/kibana-plugin-core-server.routevalidationerror._constructor_.md b/docs/development/core/server/kibana-plugin-core-server.routevalidationerror._constructor_.md index ddacc1f7af2e..ad1a4bae0dab 100644 --- a/docs/development/core/server/kibana-plugin-core-server.routevalidationerror._constructor_.md +++ b/docs/development/core/server/kibana-plugin-core-server.routevalidationerror._constructor_.md @@ -16,6 +16,6 @@ constructor(error: Error | string, path?: string[]); | Parameter | Type | Description | | --- | --- | --- | -| error | Error | string | | -| path | string[] | | +| error | Error \| string | | +| path | string\[\] | | diff --git a/docs/development/core/server/kibana-plugin-core-server.routevalidationerror.md b/docs/development/core/server/kibana-plugin-core-server.routevalidationerror.md index 037e53c32bbc..60a47236b4be 100644 --- a/docs/development/core/server/kibana-plugin-core-server.routevalidationerror.md +++ b/docs/development/core/server/kibana-plugin-core-server.routevalidationerror.md @@ -11,6 +11,7 @@ Error to return when the validation is not successful. ```typescript export declare class RouteValidationError extends SchemaTypeError ``` +Extends: SchemaTypeError ## Constructors diff --git a/docs/development/core/server/kibana-plugin-core-server.routevalidationfunction.md b/docs/development/core/server/kibana-plugin-core-server.routevalidationfunction.md index 3ee61a07987b..e3fd33552f7d 100644 --- a/docs/development/core/server/kibana-plugin-core-server.routevalidationfunction.md +++ b/docs/development/core/server/kibana-plugin-core-server.routevalidationfunction.md @@ -37,6 +37,5 @@ const myBodyValidation: RouteValidationFunction = (data, validat return badRequest('Wrong payload', ['body']); } } - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.routevalidationresultfactory.md b/docs/development/core/server/kibana-plugin-core-server.routevalidationresultfactory.md index eee77a91d73d..69e8b5e73136 100644 --- a/docs/development/core/server/kibana-plugin-core-server.routevalidationresultfactory.md +++ b/docs/development/core/server/kibana-plugin-core-server.routevalidationresultfactory.md @@ -18,6 +18,6 @@ export interface RouteValidationResultFactory | Property | Type | Description | | --- | --- | --- | -| [badRequest](./kibana-plugin-core-server.routevalidationresultfactory.badrequest.md) | (error: Error | string, path?: string[]) => {
error: RouteValidationError;
} | | -| [ok](./kibana-plugin-core-server.routevalidationresultfactory.ok.md) | <T>(value: T) => {
value: T;
} | | +| [badRequest](./kibana-plugin-core-server.routevalidationresultfactory.badrequest.md) | (error: Error \| string, path?: string\[\]) => { error: RouteValidationError; } | | +| [ok](./kibana-plugin-core-server.routevalidationresultfactory.ok.md) | <T>(value: T) => { value: T; } | | diff --git a/docs/development/core/server/kibana-plugin-core-server.routevalidatorconfig.md b/docs/development/core/server/kibana-plugin-core-server.routevalidatorconfig.md index c8ed3612ec9f..848bf6aa4b15 100644 --- a/docs/development/core/server/kibana-plugin-core-server.routevalidatorconfig.md +++ b/docs/development/core/server/kibana-plugin-core-server.routevalidatorconfig.md @@ -16,7 +16,7 @@ export interface RouteValidatorConfig | Property | Type | Description | | --- | --- | --- | -| [body](./kibana-plugin-core-server.routevalidatorconfig.body.md) | RouteValidationSpec<B> | Validation logic for the body payload | -| [params](./kibana-plugin-core-server.routevalidatorconfig.params.md) | RouteValidationSpec<P> | Validation logic for the URL params | -| [query](./kibana-plugin-core-server.routevalidatorconfig.query.md) | RouteValidationSpec<Q> | Validation logic for the Query params | +| [body?](./kibana-plugin-core-server.routevalidatorconfig.body.md) | RouteValidationSpec<B> | (Optional) Validation logic for the body payload | +| [params?](./kibana-plugin-core-server.routevalidatorconfig.params.md) | RouteValidationSpec<P> | (Optional) Validation logic for the URL params | +| [query?](./kibana-plugin-core-server.routevalidatorconfig.query.md) | RouteValidationSpec<Q> | (Optional) Validation logic for the Query params | diff --git a/docs/development/core/server/kibana-plugin-core-server.routevalidatoroptions.md b/docs/development/core/server/kibana-plugin-core-server.routevalidatoroptions.md index 0d9a1369c3c3..f054ca388762 100644 --- a/docs/development/core/server/kibana-plugin-core-server.routevalidatoroptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.routevalidatoroptions.md @@ -16,5 +16,5 @@ export interface RouteValidatorOptions | Property | Type | Description | | --- | --- | --- | -| [unsafe](./kibana-plugin-core-server.routevalidatoroptions.unsafe.md) | {
params?: boolean;
query?: boolean;
body?: boolean;
} | Set the unsafe config to avoid running some additional internal \*safe\* validations on top of your custom validation | +| [unsafe?](./kibana-plugin-core-server.routevalidatoroptions.unsafe.md) | { params?: boolean; query?: boolean; body?: boolean; } | (Optional) Set the unsafe config to avoid running some additional internal \*safe\* validations on top of your custom validation | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobject.md b/docs/development/core/server/kibana-plugin-core-server.savedobject.md index 4c62b359b284..cffb47659dc2 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobject.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobject.md @@ -14,15 +14,15 @@ export interface SavedObject | Property | Type | Description | | --- | --- | --- | -| [attributes](./kibana-plugin-core-server.savedobject.attributes.md) | T | The data for a Saved Object is stored as an object in the attributes property. | -| [coreMigrationVersion](./kibana-plugin-core-server.savedobject.coremigrationversion.md) | string | A semver value that is used when upgrading objects between Kibana versions. | -| [error](./kibana-plugin-core-server.savedobject.error.md) | SavedObjectError | | -| [id](./kibana-plugin-core-server.savedobject.id.md) | string | The ID of this Saved Object, guaranteed to be unique for all objects of the same type | -| [migrationVersion](./kibana-plugin-core-server.savedobject.migrationversion.md) | SavedObjectsMigrationVersion | Information about the migrations that have been applied to this SavedObject. When Kibana starts up, KibanaMigrator detects outdated documents and migrates them based on this value. For each migration that has been applied, the plugin's name is used as a key and the latest migration version as the value. | -| [namespaces](./kibana-plugin-core-server.savedobject.namespaces.md) | string[] | Space(s) that this saved object exists in. This attribute is not used for "global" saved object types which are registered with namespaceType: 'agnostic'. | -| [originId](./kibana-plugin-core-server.savedobject.originid.md) | string | The ID of the saved object this originated from. This is set if this object's id was regenerated; that can happen during migration from a legacy single-namespace type, or during import. It is only set during migration or create operations. This is used during import to ensure that ID regeneration is deterministic, so saved objects will be overwritten if they are imported multiple times into a given space. | -| [references](./kibana-plugin-core-server.savedobject.references.md) | SavedObjectReference[] | A reference to another saved object. | -| [type](./kibana-plugin-core-server.savedobject.type.md) | string | The type of Saved Object. Each plugin can define it's own custom Saved Object types. | -| [updated\_at](./kibana-plugin-core-server.savedobject.updated_at.md) | string | Timestamp of the last time this document had been updated. | -| [version](./kibana-plugin-core-server.savedobject.version.md) | string | An opaque version number which changes on each successful write operation. Can be used for implementing optimistic concurrency control. | +| [attributes](./kibana-plugin-core-server.savedobject.attributes.md) | T | The data for a Saved Object is stored as an object in the attributes property. | +| [coreMigrationVersion?](./kibana-plugin-core-server.savedobject.coremigrationversion.md) | string | (Optional) A semver value that is used when upgrading objects between Kibana versions. | +| [error?](./kibana-plugin-core-server.savedobject.error.md) | SavedObjectError | (Optional) | +| [id](./kibana-plugin-core-server.savedobject.id.md) | string | The ID of this Saved Object, guaranteed to be unique for all objects of the same type | +| [migrationVersion?](./kibana-plugin-core-server.savedobject.migrationversion.md) | SavedObjectsMigrationVersion | (Optional) Information about the migrations that have been applied to this SavedObject. When Kibana starts up, KibanaMigrator detects outdated documents and migrates them based on this value. For each migration that has been applied, the plugin's name is used as a key and the latest migration version as the value. | +| [namespaces?](./kibana-plugin-core-server.savedobject.namespaces.md) | string\[\] | (Optional) Space(s) that this saved object exists in. This attribute is not used for "global" saved object types which are registered with namespaceType: 'agnostic'. | +| [originId?](./kibana-plugin-core-server.savedobject.originid.md) | string | (Optional) The ID of the saved object this originated from. This is set if this object's id was regenerated; that can happen during migration from a legacy single-namespace type, or during import. It is only set during migration or create operations. This is used during import to ensure that ID regeneration is deterministic, so saved objects will be overwritten if they are imported multiple times into a given space. | +| [references](./kibana-plugin-core-server.savedobject.references.md) | SavedObjectReference\[\] | A reference to another saved object. | +| [type](./kibana-plugin-core-server.savedobject.type.md) | string | The type of Saved Object. Each plugin can define it's own custom Saved Object types. | +| [updated\_at?](./kibana-plugin-core-server.savedobject.updated_at.md) | string | (Optional) Timestamp of the last time this document had been updated. | +| [version?](./kibana-plugin-core-server.savedobject.version.md) | string | (Optional) An opaque version number which changes on each successful write operation. Can be used for implementing optimistic concurrency control. | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectexportbaseoptions.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectexportbaseoptions.md index cd0c35208642..d2749cb85cd3 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectexportbaseoptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectexportbaseoptions.md @@ -15,9 +15,9 @@ export interface SavedObjectExportBaseOptions | Property | Type | Description | | --- | --- | --- | -| [excludeExportDetails](./kibana-plugin-core-server.savedobjectexportbaseoptions.excludeexportdetails.md) | boolean | flag to not append [export details](./kibana-plugin-core-server.savedobjectsexportresultdetails.md) to the end of the export stream. | -| [includeNamespaces](./kibana-plugin-core-server.savedobjectexportbaseoptions.includenamespaces.md) | boolean | Flag to also include namespace information in the export stream. By default, namespace information is not included in exported objects. This is only intended to be used internally during copy-to-space operations, and it is not exposed as an option for the external HTTP route for exports. | -| [includeReferencesDeep](./kibana-plugin-core-server.savedobjectexportbaseoptions.includereferencesdeep.md) | boolean | flag to also include all related saved objects in the export stream. | -| [namespace](./kibana-plugin-core-server.savedobjectexportbaseoptions.namespace.md) | string | optional namespace to override the namespace used by the savedObjectsClient. | -| [request](./kibana-plugin-core-server.savedobjectexportbaseoptions.request.md) | KibanaRequest | The http request initiating the export. | +| [excludeExportDetails?](./kibana-plugin-core-server.savedobjectexportbaseoptions.excludeexportdetails.md) | boolean | (Optional) flag to not append [export details](./kibana-plugin-core-server.savedobjectsexportresultdetails.md) to the end of the export stream. | +| [includeNamespaces?](./kibana-plugin-core-server.savedobjectexportbaseoptions.includenamespaces.md) | boolean | (Optional) Flag to also include namespace information in the export stream. By default, namespace information is not included in exported objects. This is only intended to be used internally during copy-to-space operations, and it is not exposed as an option for the external HTTP route for exports. | +| [includeReferencesDeep?](./kibana-plugin-core-server.savedobjectexportbaseoptions.includereferencesdeep.md) | boolean | (Optional) flag to also include all related saved objects in the export stream. | +| [namespace?](./kibana-plugin-core-server.savedobjectexportbaseoptions.namespace.md) | string | (Optional) optional namespace to override the namespace used by the savedObjectsClient. | +| [request](./kibana-plugin-core-server.savedobjectexportbaseoptions.request.md) | KibanaRequest | The http request initiating the export. | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectmigrationcontext.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectmigrationcontext.md index 21ca234fde18..3a265cc8e1d4 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectmigrationcontext.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectmigrationcontext.md @@ -16,8 +16,8 @@ export interface SavedObjectMigrationContext | Property | Type | Description | | --- | --- | --- | -| [convertToMultiNamespaceTypeVersion](./kibana-plugin-core-server.savedobjectmigrationcontext.converttomultinamespacetypeversion.md) | string | The version in which this object type is being converted to a multi-namespace type | -| [isSingleNamespaceType](./kibana-plugin-core-server.savedobjectmigrationcontext.issinglenamespacetype.md) | boolean | Whether this is a single-namespace type or not | -| [log](./kibana-plugin-core-server.savedobjectmigrationcontext.log.md) | SavedObjectsMigrationLogger | logger instance to be used by the migration handler | -| [migrationVersion](./kibana-plugin-core-server.savedobjectmigrationcontext.migrationversion.md) | string | The migration version that this migration function is defined for | +| [convertToMultiNamespaceTypeVersion?](./kibana-plugin-core-server.savedobjectmigrationcontext.converttomultinamespacetypeversion.md) | string | (Optional) The version in which this object type is being converted to a multi-namespace type | +| [isSingleNamespaceType](./kibana-plugin-core-server.savedobjectmigrationcontext.issinglenamespacetype.md) | boolean | Whether this is a single-namespace type or not | +| [log](./kibana-plugin-core-server.savedobjectmigrationcontext.log.md) | SavedObjectsMigrationLogger | logger instance to be used by the migration handler | +| [migrationVersion](./kibana-plugin-core-server.savedobjectmigrationcontext.migrationversion.md) | string | The migration version that this migration function is defined for | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectmigrationfn.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectmigrationfn.md index a3294fb0a087..1c96c63a3d4f 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectmigrationfn.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectmigrationfn.md @@ -39,6 +39,5 @@ const migrateToV2: SavedObjectMigrationFn = }, }; }; - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectmigrationmap.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectmigrationmap.md index c07a41e28d45..64575d34bfb1 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectmigrationmap.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectmigrationmap.md @@ -22,6 +22,5 @@ const migrationsMap: SavedObjectMigrationMap = { '1.0.0': migrateToV1, '2.1.0': migrateToV21 } - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectreference.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectreference.md index 1c8b58018739..bf21b13acfcf 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectreference.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectreference.md @@ -16,7 +16,7 @@ export interface SavedObjectReference | Property | Type | Description | | --- | --- | --- | -| [id](./kibana-plugin-core-server.savedobjectreference.id.md) | string | | -| [name](./kibana-plugin-core-server.savedobjectreference.name.md) | string | | -| [type](./kibana-plugin-core-server.savedobjectreference.type.md) | string | | +| [id](./kibana-plugin-core-server.savedobjectreference.id.md) | string | | +| [name](./kibana-plugin-core-server.savedobjectreference.name.md) | string | | +| [type](./kibana-plugin-core-server.savedobjectreference.type.md) | string | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectreferencewithcontext.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectreferencewithcontext.md index 1f8b33c6e94e..8cdfbb4fde48 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectreferencewithcontext.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectreferencewithcontext.md @@ -16,10 +16,10 @@ export interface SavedObjectReferenceWithContext | Property | Type | Description | | --- | --- | --- | -| [id](./kibana-plugin-core-server.savedobjectreferencewithcontext.id.md) | string | The ID of the referenced object | -| [inboundReferences](./kibana-plugin-core-server.savedobjectreferencewithcontext.inboundreferences.md) | Array<{
type: string;
id: string;
name: string;
}> | References to this object; note that this does not contain \_all inbound references everywhere for this object\_, it only contains inbound references for the scope of this operation | -| [isMissing](./kibana-plugin-core-server.savedobjectreferencewithcontext.ismissing.md) | boolean | Whether or not this object or reference is missing | -| [spaces](./kibana-plugin-core-server.savedobjectreferencewithcontext.spaces.md) | string[] | The space(s) that the referenced object exists in | -| [spacesWithMatchingAliases](./kibana-plugin-core-server.savedobjectreferencewithcontext.spaceswithmatchingaliases.md) | string[] | The space(s) that legacy URL aliases matching this type/id exist in | -| [type](./kibana-plugin-core-server.savedobjectreferencewithcontext.type.md) | string | The type of the referenced object | +| [id](./kibana-plugin-core-server.savedobjectreferencewithcontext.id.md) | string | The ID of the referenced object | +| [inboundReferences](./kibana-plugin-core-server.savedobjectreferencewithcontext.inboundreferences.md) | Array<{ type: string; id: string; name: string; }> | References to this object; note that this does not contain \_all inbound references everywhere for this object\_, it only contains inbound references for the scope of this operation | +| [isMissing?](./kibana-plugin-core-server.savedobjectreferencewithcontext.ismissing.md) | boolean | (Optional) Whether or not this object or reference is missing | +| [spaces](./kibana-plugin-core-server.savedobjectreferencewithcontext.spaces.md) | string\[\] | The space(s) that the referenced object exists in | +| [spacesWithMatchingAliases?](./kibana-plugin-core-server.savedobjectreferencewithcontext.spaceswithmatchingaliases.md) | string\[\] | (Optional) The space(s) that legacy URL aliases matching this type/id exist in | +| [type](./kibana-plugin-core-server.savedobjectreferencewithcontext.type.md) | string | The type of the referenced object | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsbaseoptions.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsbaseoptions.md index 72f07c42949d..6686ad7ca8ba 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsbaseoptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsbaseoptions.md @@ -15,5 +15,5 @@ export interface SavedObjectsBaseOptions | Property | Type | Description | | --- | --- | --- | -| [namespace](./kibana-plugin-core-server.savedobjectsbaseoptions.namespace.md) | string | Specify the namespace for this operation | +| [namespace?](./kibana-plugin-core-server.savedobjectsbaseoptions.namespace.md) | string | (Optional) Specify the namespace for this operation | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkcreateobject.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkcreateobject.md index 463c3fe81b70..441df5d50c61 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkcreateobject.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkcreateobject.md @@ -15,13 +15,13 @@ export interface SavedObjectsBulkCreateObject | Property | Type | Description | | --- | --- | --- | -| [attributes](./kibana-plugin-core-server.savedobjectsbulkcreateobject.attributes.md) | T | | -| [coreMigrationVersion](./kibana-plugin-core-server.savedobjectsbulkcreateobject.coremigrationversion.md) | string | A semver value that is used when upgrading objects between Kibana versions. If undefined, this will be automatically set to the current Kibana version when the object is created. If this is set to a non-semver value, or it is set to a semver value greater than the current Kibana version, it will result in an error. | -| [id](./kibana-plugin-core-server.savedobjectsbulkcreateobject.id.md) | string | | -| [initialNamespaces](./kibana-plugin-core-server.savedobjectsbulkcreateobject.initialnamespaces.md) | string[] | Optional initial namespaces for the object to be created in. If this is defined, it will supersede the namespace ID that is in [SavedObjectsCreateOptions](./kibana-plugin-core-server.savedobjectscreateoptions.md).\* For shareable object types (registered with namespaceType: 'multiple'): this option can be used to specify one or more spaces, including the "All spaces" identifier ('*'). \* For isolated object types (registered with namespaceType: 'single' or namespaceType: 'multiple-isolated'): this option can only be used to specify a single space, and the "All spaces" identifier ('*') is not allowed. \* For global object types (registered with namespaceType: 'agnostic'): this option cannot be used. | -| [migrationVersion](./kibana-plugin-core-server.savedobjectsbulkcreateobject.migrationversion.md) | SavedObjectsMigrationVersion | Information about the migrations that have been applied to this SavedObject. When Kibana starts up, KibanaMigrator detects outdated documents and migrates them based on this value. For each migration that has been applied, the plugin's name is used as a key and the latest migration version as the value. | -| [originId](./kibana-plugin-core-server.savedobjectsbulkcreateobject.originid.md) | string | Optional ID of the original saved object, if this object's id was regenerated | -| [references](./kibana-plugin-core-server.savedobjectsbulkcreateobject.references.md) | SavedObjectReference[] | | -| [type](./kibana-plugin-core-server.savedobjectsbulkcreateobject.type.md) | string | | -| [version](./kibana-plugin-core-server.savedobjectsbulkcreateobject.version.md) | string | | +| [attributes](./kibana-plugin-core-server.savedobjectsbulkcreateobject.attributes.md) | T | | +| [coreMigrationVersion?](./kibana-plugin-core-server.savedobjectsbulkcreateobject.coremigrationversion.md) | string | (Optional) A semver value that is used when upgrading objects between Kibana versions. If undefined, this will be automatically set to the current Kibana version when the object is created. If this is set to a non-semver value, or it is set to a semver value greater than the current Kibana version, it will result in an error. | +| [id?](./kibana-plugin-core-server.savedobjectsbulkcreateobject.id.md) | string | (Optional) | +| [initialNamespaces?](./kibana-plugin-core-server.savedobjectsbulkcreateobject.initialnamespaces.md) | string\[\] | (Optional) Optional initial namespaces for the object to be created in. If this is defined, it will supersede the namespace ID that is in [SavedObjectsCreateOptions](./kibana-plugin-core-server.savedobjectscreateoptions.md).\* For shareable object types (registered with namespaceType: 'multiple'): this option can be used to specify one or more spaces, including the "All spaces" identifier ('*'). \* For isolated object types (registered with namespaceType: 'single' or namespaceType: 'multiple-isolated'): this option can only be used to specify a single space, and the "All spaces" identifier ('*') is not allowed. \* For global object types (registered with namespaceType: 'agnostic'): this option cannot be used. | +| [migrationVersion?](./kibana-plugin-core-server.savedobjectsbulkcreateobject.migrationversion.md) | SavedObjectsMigrationVersion | (Optional) Information about the migrations that have been applied to this SavedObject. When Kibana starts up, KibanaMigrator detects outdated documents and migrates them based on this value. For each migration that has been applied, the plugin's name is used as a key and the latest migration version as the value. | +| [originId?](./kibana-plugin-core-server.savedobjectsbulkcreateobject.originid.md) | string | (Optional) Optional ID of the original saved object, if this object's id was regenerated | +| [references?](./kibana-plugin-core-server.savedobjectsbulkcreateobject.references.md) | SavedObjectReference\[\] | (Optional) | +| [type](./kibana-plugin-core-server.savedobjectsbulkcreateobject.type.md) | string | | +| [version?](./kibana-plugin-core-server.savedobjectsbulkcreateobject.version.md) | string | (Optional) | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkgetobject.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkgetobject.md index 0ad5f1d66ee5..0eb5b507a1f0 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkgetobject.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkgetobject.md @@ -15,8 +15,8 @@ export interface SavedObjectsBulkGetObject | Property | Type | Description | | --- | --- | --- | -| [fields](./kibana-plugin-core-server.savedobjectsbulkgetobject.fields.md) | string[] | SavedObject fields to include in the response | -| [id](./kibana-plugin-core-server.savedobjectsbulkgetobject.id.md) | string | | -| [namespaces](./kibana-plugin-core-server.savedobjectsbulkgetobject.namespaces.md) | string[] | Optional namespace(s) for the object to be retrieved in. If this is defined, it will supersede the namespace ID that is in the top-level options.\* For shareable object types (registered with namespaceType: 'multiple'): this option can be used to specify one or more spaces, including the "All spaces" identifier ('*'). \* For isolated object types (registered with namespaceType: 'single' or namespaceType: 'multiple-isolated'): this option can only be used to specify a single space, and the "All spaces" identifier ('*') is not allowed. \* For global object types (registered with namespaceType: 'agnostic'): this option cannot be used. | -| [type](./kibana-plugin-core-server.savedobjectsbulkgetobject.type.md) | string | | +| [fields?](./kibana-plugin-core-server.savedobjectsbulkgetobject.fields.md) | string\[\] | (Optional) SavedObject fields to include in the response | +| [id](./kibana-plugin-core-server.savedobjectsbulkgetobject.id.md) | string | | +| [namespaces?](./kibana-plugin-core-server.savedobjectsbulkgetobject.namespaces.md) | string\[\] | (Optional) Optional namespace(s) for the object to be retrieved in. If this is defined, it will supersede the namespace ID that is in the top-level options.\* For shareable object types (registered with namespaceType: 'multiple'): this option can be used to specify one or more spaces, including the "All spaces" identifier ('*'). \* For isolated object types (registered with namespaceType: 'single' or namespaceType: 'multiple-isolated'): this option can only be used to specify a single space, and the "All spaces" identifier ('*') is not allowed. \* For global object types (registered with namespaceType: 'agnostic'): this option cannot be used. | +| [type](./kibana-plugin-core-server.savedobjectsbulkgetobject.type.md) | string | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkresolveobject.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkresolveobject.md index 3960511b2143..a81e18cf3593 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkresolveobject.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkresolveobject.md @@ -15,6 +15,6 @@ export interface SavedObjectsBulkResolveObject | Property | Type | Description | | --- | --- | --- | -| [id](./kibana-plugin-core-server.savedobjectsbulkresolveobject.id.md) | string | | -| [type](./kibana-plugin-core-server.savedobjectsbulkresolveobject.type.md) | string | | +| [id](./kibana-plugin-core-server.savedobjectsbulkresolveobject.id.md) | string | | +| [type](./kibana-plugin-core-server.savedobjectsbulkresolveobject.type.md) | string | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkresolveresponse.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkresolveresponse.md index 8384ecc1861f..e280877d77cd 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkresolveresponse.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkresolveresponse.md @@ -15,5 +15,5 @@ export interface SavedObjectsBulkResolveResponse | Property | Type | Description | | --- | --- | --- | -| [resolved\_objects](./kibana-plugin-core-server.savedobjectsbulkresolveresponse.resolved_objects.md) | Array<SavedObjectsResolveResponse<T>> | | +| [resolved\_objects](./kibana-plugin-core-server.savedobjectsbulkresolveresponse.resolved_objects.md) | Array<SavedObjectsResolveResponse<T>> | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkresponse.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkresponse.md index bf08ae7816b9..e47350e4bf88 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkresponse.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkresponse.md @@ -15,5 +15,5 @@ export interface SavedObjectsBulkResponse | Property | Type | Description | | --- | --- | --- | -| [saved\_objects](./kibana-plugin-core-server.savedobjectsbulkresponse.saved_objects.md) | Array<SavedObject<T>> | | +| [saved\_objects](./kibana-plugin-core-server.savedobjectsbulkresponse.saved_objects.md) | Array<SavedObject<T>> | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkupdateobject.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkupdateobject.md index dc30400bbd74..fa20d5d13d8f 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkupdateobject.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkupdateobject.md @@ -10,13 +10,14 @@ ```typescript export interface SavedObjectsBulkUpdateObject extends Pick, 'version' | 'references'> ``` +Extends: Pick<SavedObjectsUpdateOptions<T>, 'version' \| 'references'> ## Properties | Property | Type | Description | | --- | --- | --- | -| [attributes](./kibana-plugin-core-server.savedobjectsbulkupdateobject.attributes.md) | Partial<T> | The data for a Saved Object is stored as an object in the attributes property. | -| [id](./kibana-plugin-core-server.savedobjectsbulkupdateobject.id.md) | string | The ID of this Saved Object, guaranteed to be unique for all objects of the same type | -| [namespace](./kibana-plugin-core-server.savedobjectsbulkupdateobject.namespace.md) | string | Optional namespace string to use when searching for this object. If this is defined, it will supersede the namespace ID that is in [SavedObjectsBulkUpdateOptions](./kibana-plugin-core-server.savedobjectsbulkupdateoptions.md).Note: the default namespace's string representation is 'default', and its ID representation is undefined. | -| [type](./kibana-plugin-core-server.savedobjectsbulkupdateobject.type.md) | string | The type of this Saved Object. Each plugin can define it's own custom Saved Object types. | +| [attributes](./kibana-plugin-core-server.savedobjectsbulkupdateobject.attributes.md) | Partial<T> | The data for a Saved Object is stored as an object in the attributes property. | +| [id](./kibana-plugin-core-server.savedobjectsbulkupdateobject.id.md) | string | The ID of this Saved Object, guaranteed to be unique for all objects of the same type | +| [namespace?](./kibana-plugin-core-server.savedobjectsbulkupdateobject.namespace.md) | string | (Optional) Optional namespace string to use when searching for this object. If this is defined, it will supersede the namespace ID that is in [SavedObjectsBulkUpdateOptions](./kibana-plugin-core-server.savedobjectsbulkupdateoptions.md).Note: the default namespace's string representation is 'default', and its ID representation is undefined. | +| [type](./kibana-plugin-core-server.savedobjectsbulkupdateobject.type.md) | string | The type of this Saved Object. Each plugin can define it's own custom Saved Object types. | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkupdateoptions.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkupdateoptions.md index bf5d1fc536f9..97285b326dba 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkupdateoptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkupdateoptions.md @@ -10,10 +10,11 @@ ```typescript export interface SavedObjectsBulkUpdateOptions extends SavedObjectsBaseOptions ``` +Extends: SavedObjectsBaseOptions ## Properties | Property | Type | Description | | --- | --- | --- | -| [refresh](./kibana-plugin-core-server.savedobjectsbulkupdateoptions.refresh.md) | MutatingOperationRefreshSetting | The Elasticsearch Refresh setting for this operation | +| [refresh?](./kibana-plugin-core-server.savedobjectsbulkupdateoptions.refresh.md) | MutatingOperationRefreshSetting | (Optional) The Elasticsearch Refresh setting for this operation | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkupdateresponse.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkupdateresponse.md index 361575b3b1ce..e1a1af2da25c 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkupdateresponse.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkupdateresponse.md @@ -15,5 +15,5 @@ export interface SavedObjectsBulkUpdateResponse | Property | Type | Description | | --- | --- | --- | -| [saved\_objects](./kibana-plugin-core-server.savedobjectsbulkupdateresponse.saved_objects.md) | Array<SavedObjectsUpdateResponse<T>> | | +| [saved\_objects](./kibana-plugin-core-server.savedobjectsbulkupdateresponse.saved_objects.md) | Array<SavedObjectsUpdateResponse<T>> | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectscheckconflictsobject.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectscheckconflictsobject.md index c327cc4a2055..af7d9ff74db2 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectscheckconflictsobject.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectscheckconflictsobject.md @@ -15,6 +15,6 @@ export interface SavedObjectsCheckConflictsObject | Property | Type | Description | | --- | --- | --- | -| [id](./kibana-plugin-core-server.savedobjectscheckconflictsobject.id.md) | string | | -| [type](./kibana-plugin-core-server.savedobjectscheckconflictsobject.type.md) | string | | +| [id](./kibana-plugin-core-server.savedobjectscheckconflictsobject.id.md) | string | | +| [type](./kibana-plugin-core-server.savedobjectscheckconflictsobject.type.md) | string | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectscheckconflictsresponse.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectscheckconflictsresponse.md index 499398586e7d..68bbdbe67c27 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectscheckconflictsresponse.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectscheckconflictsresponse.md @@ -15,5 +15,5 @@ export interface SavedObjectsCheckConflictsResponse | Property | Type | Description | | --- | --- | --- | -| [errors](./kibana-plugin-core-server.savedobjectscheckconflictsresponse.errors.md) | Array<{
id: string;
type: string;
error: SavedObjectError;
}> | | +| [errors](./kibana-plugin-core-server.savedobjectscheckconflictsresponse.errors.md) | Array<{ id: string; type: string; error: SavedObjectError; }> | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.bulkcreate.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.bulkcreate.md index b175fe84fc4c..a88d82ef49e7 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.bulkcreate.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.bulkcreate.md @@ -16,10 +16,10 @@ bulkCreate(objects: Array>, options | Parameter | Type | Description | | --- | --- | --- | -| objects | Array<SavedObjectsBulkCreateObject<T>> | | -| options | SavedObjectsCreateOptions | | +| objects | Array<SavedObjectsBulkCreateObject<T>> | | +| options | SavedObjectsCreateOptions | | Returns: -`Promise>` +Promise<SavedObjectsBulkResponse<T>> diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.bulkget.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.bulkget.md index 82cf65a78bcf..077cb08843ac 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.bulkget.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.bulkget.md @@ -16,12 +16,12 @@ bulkGet(objects?: SavedObjectsBulkGetObject[], options?: SavedObjec | Parameter | Type | Description | | --- | --- | --- | -| objects | SavedObjectsBulkGetObject[] | an array of ids, or an array of objects containing id, type and optionally fields | -| options | SavedObjectsBaseOptions | | +| objects | SavedObjectsBulkGetObject\[\] | an array of ids, or an array of objects containing id, type and optionally fields | +| options | SavedObjectsBaseOptions | | Returns: -`Promise>` +Promise<SavedObjectsBulkResponse<T>> ## Example diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.bulkresolve.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.bulkresolve.md index 0525b361ebec..3cf6e4d8d76a 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.bulkresolve.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.bulkresolve.md @@ -16,12 +16,12 @@ bulkResolve(objects: SavedObjectsBulkResolveObject[], options?: Sav | Parameter | Type | Description | | --- | --- | --- | -| objects | SavedObjectsBulkResolveObject[] | an array of objects containing id, type | -| options | SavedObjectsBaseOptions | | +| objects | SavedObjectsBulkResolveObject\[\] | an array of objects containing id, type | +| options | SavedObjectsBaseOptions | | Returns: -`Promise>` +Promise<SavedObjectsBulkResolveResponse<T>> ## Example diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.bulkupdate.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.bulkupdate.md index cfd178a03f98..6c4034357a4e 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.bulkupdate.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.bulkupdate.md @@ -16,10 +16,10 @@ bulkUpdate(objects: Array>, options | Parameter | Type | Description | | --- | --- | --- | -| objects | Array<SavedObjectsBulkUpdateObject<T>> | | -| options | SavedObjectsBulkUpdateOptions | | +| objects | Array<SavedObjectsBulkUpdateObject<T>> | | +| options | SavedObjectsBulkUpdateOptions | | Returns: -`Promise>` +Promise<SavedObjectsBulkUpdateResponse<T>> diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.checkconflicts.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.checkconflicts.md index 5cffb0c498b0..69d52ee098a3 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.checkconflicts.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.checkconflicts.md @@ -16,10 +16,10 @@ checkConflicts(objects?: SavedObjectsCheckConflictsObject[], options?: SavedObje | Parameter | Type | Description | | --- | --- | --- | -| objects | SavedObjectsCheckConflictsObject[] | | -| options | SavedObjectsBaseOptions | | +| objects | SavedObjectsCheckConflictsObject\[\] | | +| options | SavedObjectsBaseOptions | | Returns: -`Promise` +Promise<SavedObjectsCheckConflictsResponse> diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.closepointintime.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.closepointintime.md index 79c7d18adf30..beb5ea847bf4 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.closepointintime.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.closepointintime.md @@ -18,10 +18,10 @@ closePointInTime(id: string, options?: SavedObjectsClosePointInTimeOptions): Pro | Parameter | Type | Description | | --- | --- | --- | -| id | string | | -| options | SavedObjectsClosePointInTimeOptions | | +| id | string | | +| options | SavedObjectsClosePointInTimeOptions | | Returns: -`Promise` +Promise<SavedObjectsClosePointInTimeResponse> diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.collectmultinamespacereferences.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.collectmultinamespacereferences.md index 155167d32a73..64ccd4187597 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.collectmultinamespacereferences.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.collectmultinamespacereferences.md @@ -16,10 +16,10 @@ collectMultiNamespaceReferences(objects: SavedObjectsCollectMultiNamespaceRefere | Parameter | Type | Description | | --- | --- | --- | -| objects | SavedObjectsCollectMultiNamespaceReferencesObject[] | | -| options | SavedObjectsCollectMultiNamespaceReferencesOptions | | +| objects | SavedObjectsCollectMultiNamespaceReferencesObject\[\] | | +| options | SavedObjectsCollectMultiNamespaceReferencesOptions | | Returns: -`Promise` +Promise<SavedObjectsCollectMultiNamespaceReferencesResponse> diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.create.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.create.md index e2575c20b31f..9f9b72984bbb 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.create.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.create.md @@ -16,11 +16,11 @@ create(type: string, attributes: T, options?: SavedObjectsCreateOpt | Parameter | Type | Description | | --- | --- | --- | -| type | string | | -| attributes | T | | -| options | SavedObjectsCreateOptions | | +| type | string | | +| attributes | T | | +| options | SavedObjectsCreateOptions | | Returns: -`Promise>` +Promise<SavedObject<T>> diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.createpointintimefinder.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.createpointintimefinder.md index 39d09807e4f3..eab4312b1daa 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.createpointintimefinder.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.createpointintimefinder.md @@ -22,12 +22,12 @@ createPointInTimeFinder(findOptions: SavedObjectsCreat | Parameter | Type | Description | | --- | --- | --- | -| findOptions | SavedObjectsCreatePointInTimeFinderOptions | | -| dependencies | SavedObjectsCreatePointInTimeFinderDependencies | | +| findOptions | SavedObjectsCreatePointInTimeFinderOptions | | +| dependencies | SavedObjectsCreatePointInTimeFinderDependencies | | Returns: -`ISavedObjectsPointInTimeFinder` +ISavedObjectsPointInTimeFinder<T, A> ## Example @@ -48,6 +48,5 @@ for await (const response of finder.find()) { await finder.close(); } } - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.delete.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.delete.md index 07e635efd0e8..64ed7778d3be 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.delete.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.delete.md @@ -16,11 +16,11 @@ delete(type: string, id: string, options?: SavedObjectsDeleteOptions): Promise<{ | Parameter | Type | Description | | --- | --- | --- | -| type | string | | -| id | string | | -| options | SavedObjectsDeleteOptions | | +| type | string | | +| id | string | | +| options | SavedObjectsDeleteOptions | | Returns: -`Promise<{}>` +Promise<{}> diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.find.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.find.md index 56d76125108d..dc48f7481dc0 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.find.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.find.md @@ -16,9 +16,9 @@ find(options: SavedObjectsFindOptions): PromiseSavedObjectsFindOptions | | +| options | SavedObjectsFindOptions | | Returns: -`Promise>` +Promise<SavedObjectsFindResponse<T, A>> diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.get.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.get.md index 166265ca320b..00b6dd28bb7a 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.get.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.get.md @@ -16,11 +16,11 @@ get(type: string, id: string, options?: SavedObjectsBaseOptions): P | Parameter | Type | Description | | --- | --- | --- | -| type | string | The type of SavedObject to retrieve | -| id | string | The ID of the SavedObject to retrieve | -| options | SavedObjectsBaseOptions | | +| type | string | The type of SavedObject to retrieve | +| id | string | The ID of the SavedObject to retrieve | +| options | SavedObjectsBaseOptions | | Returns: -`Promise>` +Promise<SavedObject<T>> diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.md index e92b6d8e151b..c77bcfac2f0e 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.md @@ -18,8 +18,8 @@ The constructor for this class is marked as internal. Third-party code should no | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [errors](./kibana-plugin-core-server.savedobjectsclient.errors.md) | | typeof SavedObjectsErrorHelpers | | -| [errors](./kibana-plugin-core-server.savedobjectsclient.errors.md) | static | typeof SavedObjectsErrorHelpers | | +| [errors](./kibana-plugin-core-server.savedobjectsclient.errors.md) | | typeof SavedObjectsErrorHelpers | | +| [errors](./kibana-plugin-core-server.savedobjectsclient.errors.md) | static | typeof SavedObjectsErrorHelpers | | ## Methods diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.openpointintimefortype.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.openpointintimefortype.md index c76159ffa503..c449fc7b1c3f 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.openpointintimefortype.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.openpointintimefortype.md @@ -18,10 +18,10 @@ openPointInTimeForType(type: string | string[], options?: SavedObjectsOpenPointI | Parameter | Type | Description | | --- | --- | --- | -| type | string | string[] | | -| options | SavedObjectsOpenPointInTimeOptions | | +| type | string \| string\[\] | | +| options | SavedObjectsOpenPointInTimeOptions | | Returns: -`Promise` +Promise<SavedObjectsOpenPointInTimeResponse> diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.removereferencesto.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.removereferencesto.md index 002992a17c31..560c210b0105 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.removereferencesto.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.removereferencesto.md @@ -16,11 +16,11 @@ removeReferencesTo(type: string, id: string, options?: SavedObjectsRemoveReferen | Parameter | Type | Description | | --- | --- | --- | -| type | string | | -| id | string | | -| options | SavedObjectsRemoveReferencesToOptions | | +| type | string | | +| id | string | | +| options | SavedObjectsRemoveReferencesToOptions | | Returns: -`Promise` +Promise<SavedObjectsRemoveReferencesToResponse> diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.resolve.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.resolve.md index b9a63f0b8c05..31eabe46d6cb 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.resolve.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.resolve.md @@ -16,11 +16,11 @@ resolve(type: string, id: string, options?: SavedObjectsBaseOptions | Parameter | Type | Description | | --- | --- | --- | -| type | string | The type of SavedObject to retrieve | -| id | string | The ID of the SavedObject to retrieve | -| options | SavedObjectsBaseOptions | | +| type | string | The type of SavedObject to retrieve | +| id | string | The ID of the SavedObject to retrieve | +| options | SavedObjectsBaseOptions | | Returns: -`Promise>` +Promise<SavedObjectsResolveResponse<T>> diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.update.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.update.md index 8c4e5962e1db..20a67387813f 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.update.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.update.md @@ -16,12 +16,12 @@ update(type: string, id: string, attributes: Partial, options?: | Parameter | Type | Description | | --- | --- | --- | -| type | string | | -| id | string | | -| attributes | Partial<T> | | -| options | SavedObjectsUpdateOptions<T> | | +| type | string | | +| id | string | | +| attributes | Partial<T> | | +| options | SavedObjectsUpdateOptions<T> | | Returns: -`Promise>` +Promise<SavedObjectsUpdateResponse<T>> diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.updateobjectsspaces.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.updateobjectsspaces.md index 7ababbbe1f53..09012607fd93 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.updateobjectsspaces.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclient.updateobjectsspaces.md @@ -16,12 +16,12 @@ updateObjectsSpaces(objects: SavedObjectsUpdateObjectsSpacesObject[], spacesToAd | Parameter | Type | Description | | --- | --- | --- | -| objects | SavedObjectsUpdateObjectsSpacesObject[] | | -| spacesToAdd | string[] | | -| spacesToRemove | string[] | | -| options | SavedObjectsUpdateObjectsSpacesOptions | | +| objects | SavedObjectsUpdateObjectsSpacesObject\[\] | | +| spacesToAdd | string\[\] | | +| spacesToRemove | string\[\] | | +| options | SavedObjectsUpdateObjectsSpacesOptions | | Returns: -`Promise` +Promise<import("./lib").SavedObjectsUpdateObjectsSpacesResponse> diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclientprovideroptions.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclientprovideroptions.md index be1f73f06484..a02f54214163 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclientprovideroptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclientprovideroptions.md @@ -16,6 +16,6 @@ export interface SavedObjectsClientProviderOptions | Property | Type | Description | | --- | --- | --- | -| [excludedWrappers](./kibana-plugin-core-server.savedobjectsclientprovideroptions.excludedwrappers.md) | string[] | | -| [includedHiddenTypes](./kibana-plugin-core-server.savedobjectsclientprovideroptions.includedhiddentypes.md) | string[] | | +| [excludedWrappers?](./kibana-plugin-core-server.savedobjectsclientprovideroptions.excludedwrappers.md) | string\[\] | (Optional) | +| [includedHiddenTypes?](./kibana-plugin-core-server.savedobjectsclientprovideroptions.includedhiddentypes.md) | string\[\] | (Optional) | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclientwrapperoptions.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclientwrapperoptions.md index 5b0a9edd24f3..16d104e4a8df 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclientwrapperoptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclientwrapperoptions.md @@ -16,7 +16,7 @@ export interface SavedObjectsClientWrapperOptions | Property | Type | Description | | --- | --- | --- | -| [client](./kibana-plugin-core-server.savedobjectsclientwrapperoptions.client.md) | SavedObjectsClientContract | | -| [request](./kibana-plugin-core-server.savedobjectsclientwrapperoptions.request.md) | KibanaRequest | | -| [typeRegistry](./kibana-plugin-core-server.savedobjectsclientwrapperoptions.typeregistry.md) | ISavedObjectTypeRegistry | | +| [client](./kibana-plugin-core-server.savedobjectsclientwrapperoptions.client.md) | SavedObjectsClientContract | | +| [request](./kibana-plugin-core-server.savedobjectsclientwrapperoptions.request.md) | KibanaRequest | | +| [typeRegistry](./kibana-plugin-core-server.savedobjectsclientwrapperoptions.typeregistry.md) | ISavedObjectTypeRegistry | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclosepointintimeresponse.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclosepointintimeresponse.md index 43ecd1298d5d..27010232bd46 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsclosepointintimeresponse.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsclosepointintimeresponse.md @@ -15,6 +15,6 @@ export interface SavedObjectsClosePointInTimeResponse | Property | Type | Description | | --- | --- | --- | -| [num\_freed](./kibana-plugin-core-server.savedobjectsclosepointintimeresponse.num_freed.md) | number | The number of search contexts that have been successfully closed. | -| [succeeded](./kibana-plugin-core-server.savedobjectsclosepointintimeresponse.succeeded.md) | boolean | If true, all search contexts associated with the PIT id are successfully closed. | +| [num\_freed](./kibana-plugin-core-server.savedobjectsclosepointintimeresponse.num_freed.md) | number | The number of search contexts that have been successfully closed. | +| [succeeded](./kibana-plugin-core-server.savedobjectsclosepointintimeresponse.succeeded.md) | boolean | If true, all search contexts associated with the PIT id are successfully closed. | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectscollectmultinamespacereferencesobject.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectscollectmultinamespacereferencesobject.md index b4e6379234f7..5f419a63e8c7 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectscollectmultinamespacereferencesobject.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectscollectmultinamespacereferencesobject.md @@ -18,6 +18,6 @@ export interface SavedObjectsCollectMultiNamespaceReferencesObject | Property | Type | Description | | --- | --- | --- | -| [id](./kibana-plugin-core-server.savedobjectscollectmultinamespacereferencesobject.id.md) | string | | -| [type](./kibana-plugin-core-server.savedobjectscollectmultinamespacereferencesobject.type.md) | string | | +| [id](./kibana-plugin-core-server.savedobjectscollectmultinamespacereferencesobject.id.md) | string | | +| [type](./kibana-plugin-core-server.savedobjectscollectmultinamespacereferencesobject.type.md) | string | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectscollectmultinamespacereferencesoptions.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectscollectmultinamespacereferencesoptions.md index 9311a6626975..57298e40a88b 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectscollectmultinamespacereferencesoptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectscollectmultinamespacereferencesoptions.md @@ -11,10 +11,11 @@ Options for collecting references. ```typescript export interface SavedObjectsCollectMultiNamespaceReferencesOptions extends SavedObjectsBaseOptions ``` +Extends: SavedObjectsBaseOptions ## Properties | Property | Type | Description | | --- | --- | --- | -| [purpose](./kibana-plugin-core-server.savedobjectscollectmultinamespacereferencesoptions.purpose.md) | 'collectMultiNamespaceReferences' | 'updateObjectsSpaces' | Optional purpose used to determine filtering and authorization checks; default is 'collectMultiNamespaceReferences' | +| [purpose?](./kibana-plugin-core-server.savedobjectscollectmultinamespacereferencesoptions.purpose.md) | 'collectMultiNamespaceReferences' \| 'updateObjectsSpaces' | (Optional) Optional purpose used to determine filtering and authorization checks; default is 'collectMultiNamespaceReferences' | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectscollectmultinamespacereferencesresponse.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectscollectmultinamespacereferencesresponse.md index bc72e7399446..514e9271aa17 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectscollectmultinamespacereferencesresponse.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectscollectmultinamespacereferencesresponse.md @@ -16,5 +16,5 @@ export interface SavedObjectsCollectMultiNamespaceReferencesResponse | Property | Type | Description | | --- | --- | --- | -| [objects](./kibana-plugin-core-server.savedobjectscollectmultinamespacereferencesresponse.objects.md) | SavedObjectReferenceWithContext[] | | +| [objects](./kibana-plugin-core-server.savedobjectscollectmultinamespacereferencesresponse.objects.md) | SavedObjectReferenceWithContext\[\] | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectscreateoptions.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectscreateoptions.md index 7eaa9c51f5c8..646a0f6fcf54 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectscreateoptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectscreateoptions.md @@ -10,18 +10,19 @@ ```typescript export interface SavedObjectsCreateOptions extends SavedObjectsBaseOptions ``` +Extends: SavedObjectsBaseOptions ## Properties | Property | Type | Description | | --- | --- | --- | -| [coreMigrationVersion](./kibana-plugin-core-server.savedobjectscreateoptions.coremigrationversion.md) | string | A semver value that is used when upgrading objects between Kibana versions. If undefined, this will be automatically set to the current Kibana version when the object is created. If this is set to a non-semver value, or it is set to a semver value greater than the current Kibana version, it will result in an error. | -| [id](./kibana-plugin-core-server.savedobjectscreateoptions.id.md) | string | (not recommended) Specify an id for the document | -| [initialNamespaces](./kibana-plugin-core-server.savedobjectscreateoptions.initialnamespaces.md) | string[] | Optional initial namespaces for the object to be created in. If this is defined, it will supersede the namespace ID that is in [SavedObjectsCreateOptions](./kibana-plugin-core-server.savedobjectscreateoptions.md).\* For shareable object types (registered with namespaceType: 'multiple'): this option can be used to specify one or more spaces, including the "All spaces" identifier ('*'). \* For isolated object types (registered with namespaceType: 'single' or namespaceType: 'multiple-isolated'): this option can only be used to specify a single space, and the "All spaces" identifier ('*') is not allowed. \* For global object types (registered with namespaceType: 'agnostic'): this option cannot be used. | -| [migrationVersion](./kibana-plugin-core-server.savedobjectscreateoptions.migrationversion.md) | SavedObjectsMigrationVersion | Information about the migrations that have been applied to this SavedObject. When Kibana starts up, KibanaMigrator detects outdated documents and migrates them based on this value. For each migration that has been applied, the plugin's name is used as a key and the latest migration version as the value. | -| [originId](./kibana-plugin-core-server.savedobjectscreateoptions.originid.md) | string | Optional ID of the original saved object, if this object's id was regenerated | -| [overwrite](./kibana-plugin-core-server.savedobjectscreateoptions.overwrite.md) | boolean | Overwrite existing documents (defaults to false) | -| [references](./kibana-plugin-core-server.savedobjectscreateoptions.references.md) | SavedObjectReference[] | | -| [refresh](./kibana-plugin-core-server.savedobjectscreateoptions.refresh.md) | MutatingOperationRefreshSetting | The Elasticsearch Refresh setting for this operation | -| [version](./kibana-plugin-core-server.savedobjectscreateoptions.version.md) | string | An opaque version number which changes on each successful write operation. Can be used in conjunction with overwrite for implementing optimistic concurrency control. | +| [coreMigrationVersion?](./kibana-plugin-core-server.savedobjectscreateoptions.coremigrationversion.md) | string | (Optional) A semver value that is used when upgrading objects between Kibana versions. If undefined, this will be automatically set to the current Kibana version when the object is created. If this is set to a non-semver value, or it is set to a semver value greater than the current Kibana version, it will result in an error. | +| [id?](./kibana-plugin-core-server.savedobjectscreateoptions.id.md) | string | (Optional) (not recommended) Specify an id for the document | +| [initialNamespaces?](./kibana-plugin-core-server.savedobjectscreateoptions.initialnamespaces.md) | string\[\] | (Optional) Optional initial namespaces for the object to be created in. If this is defined, it will supersede the namespace ID that is in [SavedObjectsCreateOptions](./kibana-plugin-core-server.savedobjectscreateoptions.md).\* For shareable object types (registered with namespaceType: 'multiple'): this option can be used to specify one or more spaces, including the "All spaces" identifier ('*'). \* For isolated object types (registered with namespaceType: 'single' or namespaceType: 'multiple-isolated'): this option can only be used to specify a single space, and the "All spaces" identifier ('*') is not allowed. \* For global object types (registered with namespaceType: 'agnostic'): this option cannot be used. | +| [migrationVersion?](./kibana-plugin-core-server.savedobjectscreateoptions.migrationversion.md) | SavedObjectsMigrationVersion | (Optional) Information about the migrations that have been applied to this SavedObject. When Kibana starts up, KibanaMigrator detects outdated documents and migrates them based on this value. For each migration that has been applied, the plugin's name is used as a key and the latest migration version as the value. | +| [originId?](./kibana-plugin-core-server.savedobjectscreateoptions.originid.md) | string | (Optional) Optional ID of the original saved object, if this object's id was regenerated | +| [overwrite?](./kibana-plugin-core-server.savedobjectscreateoptions.overwrite.md) | boolean | (Optional) Overwrite existing documents (defaults to false) | +| [references?](./kibana-plugin-core-server.savedobjectscreateoptions.references.md) | SavedObjectReference\[\] | (Optional) | +| [refresh?](./kibana-plugin-core-server.savedobjectscreateoptions.refresh.md) | MutatingOperationRefreshSetting | (Optional) The Elasticsearch Refresh setting for this operation | +| [version?](./kibana-plugin-core-server.savedobjectscreateoptions.version.md) | string | (Optional) An opaque version number which changes on each successful write operation. Can be used in conjunction with overwrite for implementing optimistic concurrency control. | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectscreatepointintimefinderdependencies.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectscreatepointintimefinderdependencies.md index 47c640bfabcb..f647a9c1367b 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectscreatepointintimefinderdependencies.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectscreatepointintimefinderdependencies.md @@ -15,5 +15,5 @@ export interface SavedObjectsCreatePointInTimeFinderDependencies | Property | Type | Description | | --- | --- | --- | -| [client](./kibana-plugin-core-server.savedobjectscreatepointintimefinderdependencies.client.md) | Pick<SavedObjectsClientContract, 'find' | 'openPointInTimeForType' | 'closePointInTime'> | | +| [client](./kibana-plugin-core-server.savedobjectscreatepointintimefinderdependencies.client.md) | Pick<SavedObjectsClientContract, 'find' \| 'openPointInTimeForType' \| 'closePointInTime'> | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsdeletebynamespaceoptions.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsdeletebynamespaceoptions.md index ba81a3e8c32d..49b6c36cf3ed 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsdeletebynamespaceoptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsdeletebynamespaceoptions.md @@ -10,10 +10,11 @@ ```typescript export interface SavedObjectsDeleteByNamespaceOptions extends SavedObjectsBaseOptions ``` +Extends: SavedObjectsBaseOptions ## Properties | Property | Type | Description | | --- | --- | --- | -| [refresh](./kibana-plugin-core-server.savedobjectsdeletebynamespaceoptions.refresh.md) | boolean | The Elasticsearch supports only boolean flag for this operation | +| [refresh?](./kibana-plugin-core-server.savedobjectsdeletebynamespaceoptions.refresh.md) | boolean | (Optional) The Elasticsearch supports only boolean flag for this operation | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsdeleteoptions.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsdeleteoptions.md index 245819e44d37..e1bc1fcec3f2 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsdeleteoptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsdeleteoptions.md @@ -10,11 +10,12 @@ ```typescript export interface SavedObjectsDeleteOptions extends SavedObjectsBaseOptions ``` +Extends: SavedObjectsBaseOptions ## Properties | Property | Type | Description | | --- | --- | --- | -| [force](./kibana-plugin-core-server.savedobjectsdeleteoptions.force.md) | boolean | Force deletion of an object that exists in multiple namespaces | -| [refresh](./kibana-plugin-core-server.savedobjectsdeleteoptions.refresh.md) | MutatingOperationRefreshSetting | The Elasticsearch Refresh setting for this operation | +| [force?](./kibana-plugin-core-server.savedobjectsdeleteoptions.force.md) | boolean | (Optional) Force deletion of an object that exists in multiple namespaces | +| [refresh?](./kibana-plugin-core-server.savedobjectsdeleteoptions.refresh.md) | MutatingOperationRefreshSetting | (Optional) The Elasticsearch Refresh setting for this operation | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.createbadrequesterror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.createbadrequesterror.md index 03d5aceec612..f101aa98d8bd 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.createbadrequesterror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.createbadrequesterror.md @@ -14,9 +14,9 @@ static createBadRequestError(reason?: string): DecoratedError; | Parameter | Type | Description | | --- | --- | --- | -| reason | string | | +| reason | string | | Returns: -`DecoratedError` +DecoratedError diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.createconflicterror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.createconflicterror.md index 97d33c3060bb..426de67ded2d 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.createconflicterror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.createconflicterror.md @@ -14,11 +14,11 @@ static createConflictError(type: string, id: string, reason?: string): Decorated | Parameter | Type | Description | | --- | --- | --- | -| type | string | | -| id | string | | -| reason | string | | +| type | string | | +| id | string | | +| reason | string | | Returns: -`DecoratedError` +DecoratedError diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.creategenericnotfounderror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.creategenericnotfounderror.md index 9df39c82745d..6ac403b44236 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.creategenericnotfounderror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.creategenericnotfounderror.md @@ -14,10 +14,10 @@ static createGenericNotFoundError(type?: string | null, id?: string | null): Dec | Parameter | Type | Description | | --- | --- | --- | -| type | string | null | | -| id | string | null | | +| type | string \| null | | +| id | string \| null | | Returns: -`DecoratedError` +DecoratedError diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.createindexaliasnotfounderror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.createindexaliasnotfounderror.md index 2b897db7bba4..4f9fa9d4484b 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.createindexaliasnotfounderror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.createindexaliasnotfounderror.md @@ -14,9 +14,9 @@ static createIndexAliasNotFoundError(alias: string): DecoratedError; | Parameter | Type | Description | | --- | --- | --- | -| alias | string | | +| alias | string | | Returns: -`DecoratedError` +DecoratedError diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.createinvalidversionerror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.createinvalidversionerror.md index c3eca80ef3ef..59e2a6569400 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.createinvalidversionerror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.createinvalidversionerror.md @@ -14,9 +14,9 @@ static createInvalidVersionError(versionInput?: string): DecoratedError; | Parameter | Type | Description | | --- | --- | --- | -| versionInput | string | | +| versionInput | string | | Returns: -`DecoratedError` +DecoratedError diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.createtoomanyrequestserror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.createtoomanyrequestserror.md index 6d93dc97a107..3d4903c3482e 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.createtoomanyrequestserror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.createtoomanyrequestserror.md @@ -14,10 +14,10 @@ static createTooManyRequestsError(type: string, id: string): DecoratedError; | Parameter | Type | Description | | --- | --- | --- | -| type | string | | -| id | string | | +| type | string | | +| id | string | | Returns: -`DecoratedError` +DecoratedError diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.createunsupportedtypeerror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.createunsupportedtypeerror.md index bcfd5d4296a4..4ca95c1565db 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.createunsupportedtypeerror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.createunsupportedtypeerror.md @@ -14,9 +14,9 @@ static createUnsupportedTypeError(type: string): DecoratedError; | Parameter | Type | Description | | --- | --- | --- | -| type | string | | +| type | string | | Returns: -`DecoratedError` +DecoratedError diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decoratebadrequesterror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decoratebadrequesterror.md index 604f2bd93cc7..043950407519 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decoratebadrequesterror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decoratebadrequesterror.md @@ -14,10 +14,10 @@ static decorateBadRequestError(error: Error, reason?: string): DecoratedError; | Parameter | Type | Description | | --- | --- | --- | -| error | Error | | -| reason | string | | +| error | Error | | +| reason | string | | Returns: -`DecoratedError` +DecoratedError diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorateconflicterror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorateconflicterror.md index 172f8f5ee6b4..dfb981a0a656 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorateconflicterror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorateconflicterror.md @@ -14,10 +14,10 @@ static decorateConflictError(error: Error, reason?: string): DecoratedError; | Parameter | Type | Description | | --- | --- | --- | -| error | Error | | -| reason | string | | +| error | Error | | +| reason | string | | Returns: -`DecoratedError` +DecoratedError diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorateescannotexecutescripterror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorateescannotexecutescripterror.md index 94060bba5006..18b019f1b536 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorateescannotexecutescripterror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorateescannotexecutescripterror.md @@ -14,10 +14,10 @@ static decorateEsCannotExecuteScriptError(error: Error, reason?: string): Decora | Parameter | Type | Description | | --- | --- | --- | -| error | Error | | -| reason | string | | +| error | Error | | +| reason | string | | Returns: -`DecoratedError` +DecoratedError diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorateesunavailableerror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorateesunavailableerror.md index 54135f9875f5..9d272b1e7845 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorateesunavailableerror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorateesunavailableerror.md @@ -14,10 +14,10 @@ static decorateEsUnavailableError(error: Error, reason?: string): DecoratedError | Parameter | Type | Description | | --- | --- | --- | -| error | Error | | -| reason | string | | +| error | Error | | +| reason | string | | Returns: -`DecoratedError` +DecoratedError diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorateforbiddenerror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorateforbiddenerror.md index 82d84defba6f..11b53ec21933 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorateforbiddenerror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorateforbiddenerror.md @@ -14,10 +14,10 @@ static decorateForbiddenError(error: Error, reason?: string): DecoratedError; | Parameter | Type | Description | | --- | --- | --- | -| error | Error | | -| reason | string | | +| error | Error | | +| reason | string | | Returns: -`DecoratedError` +DecoratedError diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorategeneralerror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorategeneralerror.md index 310258bc9a6e..595789611b5c 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorategeneralerror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorategeneralerror.md @@ -14,10 +14,10 @@ static decorateGeneralError(error: Error, reason?: string): DecoratedError; | Parameter | Type | Description | | --- | --- | --- | -| error | Error | | -| reason | string | | +| error | Error | | +| reason | string | | Returns: -`DecoratedError` +DecoratedError diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorateindexaliasnotfounderror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorateindexaliasnotfounderror.md index c7e10fc42ead..a2e74ca7769e 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorateindexaliasnotfounderror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decorateindexaliasnotfounderror.md @@ -14,10 +14,10 @@ static decorateIndexAliasNotFoundError(error: Error, alias: string): DecoratedEr | Parameter | Type | Description | | --- | --- | --- | -| error | Error | | -| alias | string | | +| error | Error | | +| alias | string | | Returns: -`DecoratedError` +DecoratedError diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decoratenotauthorizederror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decoratenotauthorizederror.md index 81405a6597f7..d50d5d9ebf45 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decoratenotauthorizederror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decoratenotauthorizederror.md @@ -14,10 +14,10 @@ static decorateNotAuthorizedError(error: Error, reason?: string): DecoratedError | Parameter | Type | Description | | --- | --- | --- | -| error | Error | | -| reason | string | | +| error | Error | | +| reason | string | | Returns: -`DecoratedError` +DecoratedError diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decoraterequestentitytoolargeerror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decoraterequestentitytoolargeerror.md index edfa466aa972..487d64f83ca3 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decoraterequestentitytoolargeerror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decoraterequestentitytoolargeerror.md @@ -14,10 +14,10 @@ static decorateRequestEntityTooLargeError(error: Error, reason?: string): Decora | Parameter | Type | Description | | --- | --- | --- | -| error | Error | | -| reason | string | | +| error | Error | | +| reason | string | | Returns: -`DecoratedError` +DecoratedError diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decoratetoomanyrequestserror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decoratetoomanyrequestserror.md index 46c94e1756ed..b85cf196c3cd 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decoratetoomanyrequestserror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.decoratetoomanyrequestserror.md @@ -14,10 +14,10 @@ static decorateTooManyRequestsError(error: Error, reason?: string): DecoratedErr | Parameter | Type | Description | | --- | --- | --- | -| error | Error | | -| reason | string | | +| error | Error | | +| reason | string | | Returns: -`DecoratedError` +DecoratedError diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isbadrequesterror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isbadrequesterror.md index 2fd613920fb1..5dd6a50b61e5 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isbadrequesterror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isbadrequesterror.md @@ -14,9 +14,9 @@ static isBadRequestError(error: Error | DecoratedError): boolean; | Parameter | Type | Description | | --- | --- | --- | -| error | Error | DecoratedError | | +| error | Error \| DecoratedError | | Returns: -`boolean` +boolean diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isconflicterror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isconflicterror.md index c8066c396f83..9762462af9ef 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isconflicterror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isconflicterror.md @@ -14,9 +14,9 @@ static isConflictError(error: Error | DecoratedError): boolean; | Parameter | Type | Description | | --- | --- | --- | -| error | Error | DecoratedError | | +| error | Error \| DecoratedError | | Returns: -`boolean` +boolean diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isescannotexecutescripterror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isescannotexecutescripterror.md index debb94fe4f8d..e007dd30f2bb 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isescannotexecutescripterror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isescannotexecutescripterror.md @@ -14,9 +14,9 @@ static isEsCannotExecuteScriptError(error: Error | DecoratedError): boolean; | Parameter | Type | Description | | --- | --- | --- | -| error | Error | DecoratedError | | +| error | Error \| DecoratedError | | Returns: -`boolean` +boolean diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isesunavailableerror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isesunavailableerror.md index 6f38d414b30c..a6fb911f5e0e 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isesunavailableerror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isesunavailableerror.md @@ -14,9 +14,9 @@ static isEsUnavailableError(error: Error | DecoratedError): boolean; | Parameter | Type | Description | | --- | --- | --- | -| error | Error | DecoratedError | | +| error | Error \| DecoratedError | | Returns: -`boolean` +boolean diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isforbiddenerror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isforbiddenerror.md index 74cfecd49f4a..e45ef7a7ed3f 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isforbiddenerror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isforbiddenerror.md @@ -14,9 +14,9 @@ static isForbiddenError(error: Error | DecoratedError): boolean; | Parameter | Type | Description | | --- | --- | --- | -| error | Error | DecoratedError | | +| error | Error \| DecoratedError | | Returns: -`boolean` +boolean diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isgeneralerror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isgeneralerror.md index 4b4ede2f77a7..cbec5d3b36a8 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isgeneralerror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isgeneralerror.md @@ -14,9 +14,9 @@ static isGeneralError(error: Error | DecoratedError): boolean; | Parameter | Type | Description | | --- | --- | --- | -| error | Error | DecoratedError | | +| error | Error \| DecoratedError | | Returns: -`boolean` +boolean diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isinvalidversionerror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isinvalidversionerror.md index 8fde00aad394..8ad480147adf 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isinvalidversionerror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isinvalidversionerror.md @@ -14,9 +14,9 @@ static isInvalidVersionError(error: Error | DecoratedError): boolean; | Parameter | Type | Description | | --- | --- | --- | -| error | Error | DecoratedError | | +| error | Error \| DecoratedError | | Returns: -`boolean` +boolean diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isnotauthorizederror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isnotauthorizederror.md index 39811943abe4..5e85718bde51 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isnotauthorizederror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isnotauthorizederror.md @@ -14,9 +14,9 @@ static isNotAuthorizedError(error: Error | DecoratedError): boolean; | Parameter | Type | Description | | --- | --- | --- | -| error | Error | DecoratedError | | +| error | Error \| DecoratedError | | Returns: -`boolean` +boolean diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isnotfounderror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isnotfounderror.md index d37fec7ca08b..05e848322ae9 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isnotfounderror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isnotfounderror.md @@ -14,9 +14,9 @@ static isNotFoundError(error: Error | DecoratedError): boolean; | Parameter | Type | Description | | --- | --- | --- | -| error | Error | DecoratedError | | +| error | Error \| DecoratedError | | Returns: -`boolean` +boolean diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isrequestentitytoolargeerror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isrequestentitytoolargeerror.md index e2699c53b383..d6674f0a588e 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isrequestentitytoolargeerror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.isrequestentitytoolargeerror.md @@ -14,9 +14,9 @@ static isRequestEntityTooLargeError(error: Error | DecoratedError): boolean; | Parameter | Type | Description | | --- | --- | --- | -| error | Error | DecoratedError | | +| error | Error \| DecoratedError | | Returns: -`boolean` +boolean diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.issavedobjectsclienterror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.issavedobjectsclienterror.md index 0dc0df0401b7..0505c3a450a3 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.issavedobjectsclienterror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.issavedobjectsclienterror.md @@ -14,9 +14,9 @@ static isSavedObjectsClientError(error: any): error is DecoratedError; | Parameter | Type | Description | | --- | --- | --- | -| error | any | | +| error | any | | Returns: -`error is DecoratedError` +error is DecoratedError diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.istoomanyrequestserror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.istoomanyrequestserror.md index 4422966ee3e5..3f9c360710ae 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.istoomanyrequestserror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectserrorhelpers.istoomanyrequestserror.md @@ -14,9 +14,9 @@ static isTooManyRequestsError(error: Error | DecoratedError): boolean; | Parameter | Type | Description | | --- | --- | --- | -| error | Error | DecoratedError | | +| error | Error \| DecoratedError | | Returns: -`boolean` +boolean diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexportbyobjectoptions.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexportbyobjectoptions.md index cb20fc540012..853125f2d1d1 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexportbyobjectoptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexportbyobjectoptions.md @@ -11,10 +11,11 @@ Options for the [export by objects API](./kibana-plugin-core-server.savedobjects ```typescript export interface SavedObjectsExportByObjectOptions extends SavedObjectExportBaseOptions ``` +Extends: SavedObjectExportBaseOptions ## Properties | Property | Type | Description | | --- | --- | --- | -| [objects](./kibana-plugin-core-server.savedobjectsexportbyobjectoptions.objects.md) | Array<{
id: string;
type: string;
}> | optional array of objects to export. | +| [objects](./kibana-plugin-core-server.savedobjectsexportbyobjectoptions.objects.md) | Array<{ id: string; type: string; }> | optional array of objects to export. | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexportbytypeoptions.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexportbytypeoptions.md index 26ebfd658f19..707db0dca30a 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexportbytypeoptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexportbytypeoptions.md @@ -11,12 +11,13 @@ Options for the [export by type API](./kibana-plugin-core-server.savedobjectsexp ```typescript export interface SavedObjectsExportByTypeOptions extends SavedObjectExportBaseOptions ``` +Extends: SavedObjectExportBaseOptions ## Properties | Property | Type | Description | | --- | --- | --- | -| [hasReference](./kibana-plugin-core-server.savedobjectsexportbytypeoptions.hasreference.md) | SavedObjectsFindOptionsReference[] | optional array of references to search object for. | -| [search](./kibana-plugin-core-server.savedobjectsexportbytypeoptions.search.md) | string | optional query string to filter exported objects. | -| [types](./kibana-plugin-core-server.savedobjectsexportbytypeoptions.types.md) | string[] | array of saved object types. | +| [hasReference?](./kibana-plugin-core-server.savedobjectsexportbytypeoptions.hasreference.md) | SavedObjectsFindOptionsReference\[\] | (Optional) optional array of references to search object for. | +| [search?](./kibana-plugin-core-server.savedobjectsexportbytypeoptions.search.md) | string | (Optional) optional query string to filter exported objects. | +| [types](./kibana-plugin-core-server.savedobjectsexportbytypeoptions.types.md) | string\[\] | array of saved object types. | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporter.__private_.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporter.__private_.md deleted file mode 100644 index 23f49a703814..000000000000 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporter.__private_.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SavedObjectsExporter](./kibana-plugin-core-server.savedobjectsexporter.md) > ["\#private"](./kibana-plugin-core-server.savedobjectsexporter.__private_.md) - -## SavedObjectsExporter."\#private" property - -Signature: - -```typescript -#private; -``` diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporter._constructor_.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporter._constructor_.md index 3f3d708c590e..1c2f60570348 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporter._constructor_.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporter._constructor_.md @@ -21,5 +21,5 @@ constructor({ savedObjectsClient, typeRegistry, exportSizeLimit, logger, }: { | Parameter | Type | Description | | --- | --- | --- | -| { savedObjectsClient, typeRegistry, exportSizeLimit, logger, } | {
savedObjectsClient: SavedObjectsClientContract;
typeRegistry: ISavedObjectTypeRegistry;
exportSizeLimit: number;
logger: Logger;
} | | +| { savedObjectsClient, typeRegistry, exportSizeLimit, logger, } | { savedObjectsClient: SavedObjectsClientContract; typeRegistry: ISavedObjectTypeRegistry; exportSizeLimit: number; logger: Logger; } | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporter.exportbyobjects.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporter.exportbyobjects.md index a7dc5a71b835..b143d17fa59b 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporter.exportbyobjects.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporter.exportbyobjects.md @@ -18,11 +18,11 @@ exportByObjects(options: SavedObjectsExportByObjectOptions): PromiseSavedObjectsExportByObjectOptions | | +| options | SavedObjectsExportByObjectOptions | | Returns: -`Promise` +Promise<import("stream").Readable> ## Exceptions diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporter.exportbytypes.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporter.exportbytypes.md index 83da41bad7fe..cf32d988f6ec 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporter.exportbytypes.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporter.exportbytypes.md @@ -18,11 +18,11 @@ exportByTypes(options: SavedObjectsExportByTypeOptions): PromiseSavedObjectsExportByTypeOptions | | +| options | SavedObjectsExportByTypeOptions | | Returns: -`Promise` +Promise<import("stream").Readable> ## Exceptions diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporter.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporter.md index ce23e91633b0..66f52f4aa490 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporter.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporter.md @@ -17,12 +17,6 @@ export declare class SavedObjectsExporter | --- | --- | --- | | [(constructor)({ savedObjectsClient, typeRegistry, exportSizeLimit, logger, })](./kibana-plugin-core-server.savedobjectsexporter._constructor_.md) | | Constructs a new instance of the SavedObjectsExporter class | -## Properties - -| Property | Modifiers | Type | Description | -| --- | --- | --- | --- | -| ["\#private"](./kibana-plugin-core-server.savedobjectsexporter.__private_.md) | | | | - ## Methods | Method | Modifiers | Description | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporterror._constructor_.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporterror._constructor_.md index 33bc6113d56e..ee25dbf8c22e 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporterror._constructor_.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporterror._constructor_.md @@ -16,7 +16,7 @@ constructor(type: string, message: string, attributes?: Record | un | Parameter | Type | Description | | --- | --- | --- | -| type | string | | -| message | string | | -| attributes | Record<string, any> | undefined | | +| type | string | | +| message | string | | +| attributes | Record<string, any> \| undefined | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporterror.exportsizeexceeded.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporterror.exportsizeexceeded.md index c4097724b193..b69c46383aae 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporterror.exportsizeexceeded.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporterror.exportsizeexceeded.md @@ -14,9 +14,9 @@ static exportSizeExceeded(limit: number): SavedObjectsExportError; | Parameter | Type | Description | | --- | --- | --- | -| limit | number | | +| limit | number | | Returns: -`SavedObjectsExportError` +SavedObjectsExportError diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporterror.invalidtransformerror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporterror.invalidtransformerror.md index 103d1ff8a912..a6f0190f27fb 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporterror.invalidtransformerror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporterror.invalidtransformerror.md @@ -16,9 +16,9 @@ static invalidTransformError(objectKeys: string[]): SavedObjectsExportError; | Parameter | Type | Description | | --- | --- | --- | -| objectKeys | string[] | | +| objectKeys | string\[\] | | Returns: -`SavedObjectsExportError` +SavedObjectsExportError diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporterror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporterror.md index 2a503f9377da..4c70b8395d8a 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporterror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporterror.md @@ -10,6 +10,7 @@ ```typescript export declare class SavedObjectsExportError extends Error ``` +Extends: Error ## Constructors @@ -21,8 +22,8 @@ export declare class SavedObjectsExportError extends Error | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [attributes](./kibana-plugin-core-server.savedobjectsexporterror.attributes.md) | | Record<string, any> | undefined | | -| [type](./kibana-plugin-core-server.savedobjectsexporterror.type.md) | | string | | +| [attributes?](./kibana-plugin-core-server.savedobjectsexporterror.attributes.md) | | Record<string, any> \| undefined | (Optional) | +| [type](./kibana-plugin-core-server.savedobjectsexporterror.type.md) | | string | | ## Methods diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporterror.objectfetcherror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporterror.objectfetcherror.md index afaa4693f3c7..172b9e0f3ef1 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporterror.objectfetcherror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporterror.objectfetcherror.md @@ -14,9 +14,9 @@ static objectFetchError(objects: SavedObject[]): SavedObjectsExportError; | Parameter | Type | Description | | --- | --- | --- | -| objects | SavedObject[] | | +| objects | SavedObject\[\] | | Returns: -`SavedObjectsExportError` +SavedObjectsExportError diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporterror.objecttransformerror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporterror.objecttransformerror.md index 393cf20dbae1..46d415068e9e 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporterror.objecttransformerror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporterror.objecttransformerror.md @@ -16,10 +16,10 @@ static objectTransformError(objects: SavedObject[], cause: Error): SavedObjectsE | Parameter | Type | Description | | --- | --- | --- | -| objects | SavedObject[] | | -| cause | Error | | +| objects | SavedObject\[\] | | +| cause | Error | | Returns: -`SavedObjectsExportError` +SavedObjectsExportError diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexportexcludedobject.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexportexcludedobject.md index 4766ae25a936..053e9b8bec46 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexportexcludedobject.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexportexcludedobject.md @@ -15,7 +15,7 @@ export interface SavedObjectsExportExcludedObject | Property | Type | Description | | --- | --- | --- | -| [id](./kibana-plugin-core-server.savedobjectsexportexcludedobject.id.md) | string | id of the excluded object | -| [reason](./kibana-plugin-core-server.savedobjectsexportexcludedobject.reason.md) | string | optional cause of the exclusion | -| [type](./kibana-plugin-core-server.savedobjectsexportexcludedobject.type.md) | string | type of the excluded object | +| [id](./kibana-plugin-core-server.savedobjectsexportexcludedobject.id.md) | string | id of the excluded object | +| [reason?](./kibana-plugin-core-server.savedobjectsexportexcludedobject.reason.md) | string | (Optional) optional cause of the exclusion | +| [type](./kibana-plugin-core-server.savedobjectsexportexcludedobject.type.md) | string | type of the excluded object | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexportresultdetails.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexportresultdetails.md index f017f2329170..872147dc8145 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexportresultdetails.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexportresultdetails.md @@ -16,9 +16,9 @@ export interface SavedObjectsExportResultDetails | Property | Type | Description | | --- | --- | --- | -| [excludedObjects](./kibana-plugin-core-server.savedobjectsexportresultdetails.excludedobjects.md) | SavedObjectsExportExcludedObject[] | excluded objects details | -| [excludedObjectsCount](./kibana-plugin-core-server.savedobjectsexportresultdetails.excludedobjectscount.md) | number | number of objects that were excluded from the export | -| [exportedCount](./kibana-plugin-core-server.savedobjectsexportresultdetails.exportedcount.md) | number | number of successfully exported objects | -| [missingRefCount](./kibana-plugin-core-server.savedobjectsexportresultdetails.missingrefcount.md) | number | number of missing references | -| [missingReferences](./kibana-plugin-core-server.savedobjectsexportresultdetails.missingreferences.md) | Array<{
id: string;
type: string;
}> | missing references details | +| [excludedObjects](./kibana-plugin-core-server.savedobjectsexportresultdetails.excludedobjects.md) | SavedObjectsExportExcludedObject\[\] | excluded objects details | +| [excludedObjectsCount](./kibana-plugin-core-server.savedobjectsexportresultdetails.excludedobjectscount.md) | number | number of objects that were excluded from the export | +| [exportedCount](./kibana-plugin-core-server.savedobjectsexportresultdetails.exportedcount.md) | number | number of successfully exported objects | +| [missingRefCount](./kibana-plugin-core-server.savedobjectsexportresultdetails.missingrefcount.md) | number | number of missing references | +| [missingReferences](./kibana-plugin-core-server.savedobjectsexportresultdetails.missingreferences.md) | Array<{ id: string; type: string; }> | missing references details | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporttransform.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporttransform.md index 2effed1ae9d7..2f83d5188e89 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporttransform.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporttransform.md @@ -45,7 +45,6 @@ export class Plugin() { }); } } - ``` ## Example 2 @@ -81,6 +80,5 @@ export class Plugin() { }); } } - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporttransformcontext.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporttransformcontext.md index 271f0048842b..c277308c6fc3 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporttransformcontext.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsexporttransformcontext.md @@ -16,5 +16,5 @@ export interface SavedObjectsExportTransformContext | Property | Type | Description | | --- | --- | --- | -| [request](./kibana-plugin-core-server.savedobjectsexporttransformcontext.request.md) | KibanaRequest | The request that initiated the export request. Can be used to create scoped services or client inside the [transformation](./kibana-plugin-core-server.savedobjectsexporttransform.md) | +| [request](./kibana-plugin-core-server.savedobjectsexporttransformcontext.request.md) | KibanaRequest | The request that initiated the export request. Can be used to create scoped services or client inside the [transformation](./kibana-plugin-core-server.savedobjectsexporttransform.md) | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsfindoptions.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsfindoptions.md index d3696ee71049..5f3bb46cc7a9 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsfindoptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsfindoptions.md @@ -15,22 +15,22 @@ export interface SavedObjectsFindOptions | Property | Type | Description | | --- | --- | --- | -| [defaultSearchOperator](./kibana-plugin-core-server.savedobjectsfindoptions.defaultsearchoperator.md) | 'AND' | 'OR' | The search operator to use with the provided filter. Defaults to OR | -| [fields](./kibana-plugin-core-server.savedobjectsfindoptions.fields.md) | string[] | An array of fields to include in the results | -| [filter](./kibana-plugin-core-server.savedobjectsfindoptions.filter.md) | string | KueryNode | | -| [hasReference](./kibana-plugin-core-server.savedobjectsfindoptions.hasreference.md) | SavedObjectsFindOptionsReference | SavedObjectsFindOptionsReference[] | Search for documents having a reference to the specified objects. Use hasReferenceOperator to specify the operator to use when searching for multiple references. | -| [hasReferenceOperator](./kibana-plugin-core-server.savedobjectsfindoptions.hasreferenceoperator.md) | 'AND' | 'OR' | The operator to use when searching by multiple references using the hasReference option. Defaults to OR | -| [namespaces](./kibana-plugin-core-server.savedobjectsfindoptions.namespaces.md) | string[] | | -| [page](./kibana-plugin-core-server.savedobjectsfindoptions.page.md) | number | | -| [perPage](./kibana-plugin-core-server.savedobjectsfindoptions.perpage.md) | number | | -| [pit](./kibana-plugin-core-server.savedobjectsfindoptions.pit.md) | SavedObjectsPitParams | Search against a specific Point In Time (PIT) that you've opened with [SavedObjectsClient.openPointInTimeForType()](./kibana-plugin-core-server.savedobjectsclient.openpointintimefortype.md). | -| [preference](./kibana-plugin-core-server.savedobjectsfindoptions.preference.md) | string | An optional ES preference value to be used for the query \* | -| [rootSearchFields](./kibana-plugin-core-server.savedobjectsfindoptions.rootsearchfields.md) | string[] | The fields to perform the parsed query against. Unlike the searchFields argument, these are expected to be root fields and will not be modified. If used in conjunction with searchFields, both are concatenated together. | -| [search](./kibana-plugin-core-server.savedobjectsfindoptions.search.md) | string | Search documents using the Elasticsearch Simple Query String syntax. See Elasticsearch Simple Query String query argument for more information | -| [searchAfter](./kibana-plugin-core-server.savedobjectsfindoptions.searchafter.md) | estypes.Id[] | Use the sort values from the previous page to retrieve the next page of results. | -| [searchFields](./kibana-plugin-core-server.savedobjectsfindoptions.searchfields.md) | string[] | The fields to perform the parsed query against. See Elasticsearch Simple Query String fields argument for more information | -| [sortField](./kibana-plugin-core-server.savedobjectsfindoptions.sortfield.md) | string | | -| [sortOrder](./kibana-plugin-core-server.savedobjectsfindoptions.sortorder.md) | estypes.SearchSortOrder | | -| [type](./kibana-plugin-core-server.savedobjectsfindoptions.type.md) | string | string[] | | -| [typeToNamespacesMap](./kibana-plugin-core-server.savedobjectsfindoptions.typetonamespacesmap.md) | Map<string, string[] | undefined> | This map defines each type to search for, and the namespace(s) to search for the type in; this is only intended to be used by a saved object client wrapper. If this is defined, it supersedes the type and namespaces fields when building the Elasticsearch query. Any types that are not included in this map will be excluded entirely. If a type is included but its value is undefined, the operation will search for that type in the Default namespace. | +| [defaultSearchOperator?](./kibana-plugin-core-server.savedobjectsfindoptions.defaultsearchoperator.md) | 'AND' \| 'OR' | (Optional) The search operator to use with the provided filter. Defaults to OR | +| [fields?](./kibana-plugin-core-server.savedobjectsfindoptions.fields.md) | string\[\] | (Optional) An array of fields to include in the results | +| [filter?](./kibana-plugin-core-server.savedobjectsfindoptions.filter.md) | string \| KueryNode | (Optional) | +| [hasReference?](./kibana-plugin-core-server.savedobjectsfindoptions.hasreference.md) | SavedObjectsFindOptionsReference \| SavedObjectsFindOptionsReference\[\] | (Optional) Search for documents having a reference to the specified objects. Use hasReferenceOperator to specify the operator to use when searching for multiple references. | +| [hasReferenceOperator?](./kibana-plugin-core-server.savedobjectsfindoptions.hasreferenceoperator.md) | 'AND' \| 'OR' | (Optional) The operator to use when searching by multiple references using the hasReference option. Defaults to OR | +| [namespaces?](./kibana-plugin-core-server.savedobjectsfindoptions.namespaces.md) | string\[\] | (Optional) | +| [page?](./kibana-plugin-core-server.savedobjectsfindoptions.page.md) | number | (Optional) | +| [perPage?](./kibana-plugin-core-server.savedobjectsfindoptions.perpage.md) | number | (Optional) | +| [pit?](./kibana-plugin-core-server.savedobjectsfindoptions.pit.md) | SavedObjectsPitParams | (Optional) Search against a specific Point In Time (PIT) that you've opened with [SavedObjectsClient.openPointInTimeForType()](./kibana-plugin-core-server.savedobjectsclient.openpointintimefortype.md). | +| [preference?](./kibana-plugin-core-server.savedobjectsfindoptions.preference.md) | string | (Optional) An optional ES preference value to be used for the query \* | +| [rootSearchFields?](./kibana-plugin-core-server.savedobjectsfindoptions.rootsearchfields.md) | string\[\] | (Optional) The fields to perform the parsed query against. Unlike the searchFields argument, these are expected to be root fields and will not be modified. If used in conjunction with searchFields, both are concatenated together. | +| [search?](./kibana-plugin-core-server.savedobjectsfindoptions.search.md) | string | (Optional) Search documents using the Elasticsearch Simple Query String syntax. See Elasticsearch Simple Query String query argument for more information | +| [searchAfter?](./kibana-plugin-core-server.savedobjectsfindoptions.searchafter.md) | estypes.Id\[\] | (Optional) Use the sort values from the previous page to retrieve the next page of results. | +| [searchFields?](./kibana-plugin-core-server.savedobjectsfindoptions.searchfields.md) | string\[\] | (Optional) The fields to perform the parsed query against. See Elasticsearch Simple Query String fields argument for more information | +| [sortField?](./kibana-plugin-core-server.savedobjectsfindoptions.sortfield.md) | string | (Optional) | +| [sortOrder?](./kibana-plugin-core-server.savedobjectsfindoptions.sortorder.md) | estypes.SearchSortOrder | (Optional) | +| [type](./kibana-plugin-core-server.savedobjectsfindoptions.type.md) | string \| string\[\] | | +| [typeToNamespacesMap?](./kibana-plugin-core-server.savedobjectsfindoptions.typetonamespacesmap.md) | Map<string, string\[\] \| undefined> | (Optional) This map defines each type to search for, and the namespace(s) to search for the type in; this is only intended to be used by a saved object client wrapper. If this is defined, it supersedes the type and namespaces fields when building the Elasticsearch query. Any types that are not included in this map will be excluded entirely. If a type is included but its value is undefined, the operation will search for that type in the Default namespace. | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsfindoptionsreference.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsfindoptionsreference.md index db04ef7b162a..21eb9f06cc11 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsfindoptionsreference.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsfindoptionsreference.md @@ -15,6 +15,6 @@ export interface SavedObjectsFindOptionsReference | Property | Type | Description | | --- | --- | --- | -| [id](./kibana-plugin-core-server.savedobjectsfindoptionsreference.id.md) | string | | -| [type](./kibana-plugin-core-server.savedobjectsfindoptionsreference.type.md) | string | | +| [id](./kibana-plugin-core-server.savedobjectsfindoptionsreference.id.md) | string | | +| [type](./kibana-plugin-core-server.savedobjectsfindoptionsreference.type.md) | string | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsfindresponse.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsfindresponse.md index 8176baf44acb..4afb825fd0f4 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsfindresponse.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsfindresponse.md @@ -18,10 +18,10 @@ export interface SavedObjectsFindResponse | Property | Type | Description | | --- | --- | --- | -| [aggregations](./kibana-plugin-core-server.savedobjectsfindresponse.aggregations.md) | A | | -| [page](./kibana-plugin-core-server.savedobjectsfindresponse.page.md) | number | | -| [per\_page](./kibana-plugin-core-server.savedobjectsfindresponse.per_page.md) | number | | -| [pit\_id](./kibana-plugin-core-server.savedobjectsfindresponse.pit_id.md) | string | | -| [saved\_objects](./kibana-plugin-core-server.savedobjectsfindresponse.saved_objects.md) | Array<SavedObjectsFindResult<T>> | | -| [total](./kibana-plugin-core-server.savedobjectsfindresponse.total.md) | number | | +| [aggregations?](./kibana-plugin-core-server.savedobjectsfindresponse.aggregations.md) | A | (Optional) | +| [page](./kibana-plugin-core-server.savedobjectsfindresponse.page.md) | number | | +| [per\_page](./kibana-plugin-core-server.savedobjectsfindresponse.per_page.md) | number | | +| [pit\_id?](./kibana-plugin-core-server.savedobjectsfindresponse.pit_id.md) | string | (Optional) | +| [saved\_objects](./kibana-plugin-core-server.savedobjectsfindresponse.saved_objects.md) | Array<SavedObjectsFindResult<T>> | | +| [total](./kibana-plugin-core-server.savedobjectsfindresponse.total.md) | number | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsfindresult.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsfindresult.md index a729ce32e1c8..f2ba01697da1 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsfindresult.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsfindresult.md @@ -10,11 +10,12 @@ ```typescript export interface SavedObjectsFindResult extends SavedObject ``` +Extends: SavedObject<T> ## Properties | Property | Type | Description | | --- | --- | --- | -| [score](./kibana-plugin-core-server.savedobjectsfindresult.score.md) | number | The Elasticsearch _score of this result. | -| [sort](./kibana-plugin-core-server.savedobjectsfindresult.sort.md) | string[] | The Elasticsearch sort value of this result. | +| [score](./kibana-plugin-core-server.savedobjectsfindresult.score.md) | number | The Elasticsearch _score of this result. | +| [sort?](./kibana-plugin-core-server.savedobjectsfindresult.sort.md) | string\[\] | (Optional) The Elasticsearch sort value of this result. | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsfindresult.sort.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsfindresult.sort.md index e73d6b4926d8..5df1b3291b07 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsfindresult.sort.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsfindresult.sort.md @@ -36,6 +36,5 @@ const page2 = await savedObjectsClient.find({ searchAfter: lastHit.sort, }); await savedObjectsClient.closePointInTime(page2.pit_id); - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportactionrequiredwarning.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportactionrequiredwarning.md index c8b96004662d..c4ec5fdd2f8e 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportactionrequiredwarning.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportactionrequiredwarning.md @@ -18,8 +18,8 @@ export interface SavedObjectsImportActionRequiredWarning | Property | Type | Description | | --- | --- | --- | -| [actionPath](./kibana-plugin-core-server.savedobjectsimportactionrequiredwarning.actionpath.md) | string | The path (without the basePath) that the user should be redirect to address this warning. | -| [buttonLabel](./kibana-plugin-core-server.savedobjectsimportactionrequiredwarning.buttonlabel.md) | string | An optional label to use for the link button. If unspecified, a default label will be used. | -| [message](./kibana-plugin-core-server.savedobjectsimportactionrequiredwarning.message.md) | string | The translated message to display to the user. | -| [type](./kibana-plugin-core-server.savedobjectsimportactionrequiredwarning.type.md) | 'action_required' | | +| [actionPath](./kibana-plugin-core-server.savedobjectsimportactionrequiredwarning.actionpath.md) | string | The path (without the basePath) that the user should be redirect to address this warning. | +| [buttonLabel?](./kibana-plugin-core-server.savedobjectsimportactionrequiredwarning.buttonlabel.md) | string | (Optional) An optional label to use for the link button. If unspecified, a default label will be used. | +| [message](./kibana-plugin-core-server.savedobjectsimportactionrequiredwarning.message.md) | string | The translated message to display to the user. | +| [type](./kibana-plugin-core-server.savedobjectsimportactionrequiredwarning.type.md) | 'action\_required' | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportambiguousconflicterror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportambiguousconflicterror.md index d2c0a397ebe8..7d275fa199c5 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportambiguousconflicterror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportambiguousconflicterror.md @@ -16,6 +16,6 @@ export interface SavedObjectsImportAmbiguousConflictError | Property | Type | Description | | --- | --- | --- | -| [destinations](./kibana-plugin-core-server.savedobjectsimportambiguousconflicterror.destinations.md) | Array<{
id: string;
title?: string;
updatedAt?: string;
}> | | -| [type](./kibana-plugin-core-server.savedobjectsimportambiguousconflicterror.type.md) | 'ambiguous_conflict' | | +| [destinations](./kibana-plugin-core-server.savedobjectsimportambiguousconflicterror.destinations.md) | Array<{ id: string; title?: string; updatedAt?: string; }> | | +| [type](./kibana-plugin-core-server.savedobjectsimportambiguousconflicterror.type.md) | 'ambiguous\_conflict' | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportconflicterror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportconflicterror.md index 153cd55c9199..9456e042035f 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportconflicterror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportconflicterror.md @@ -16,6 +16,6 @@ export interface SavedObjectsImportConflictError | Property | Type | Description | | --- | --- | --- | -| [destinationId](./kibana-plugin-core-server.savedobjectsimportconflicterror.destinationid.md) | string | | -| [type](./kibana-plugin-core-server.savedobjectsimportconflicterror.type.md) | 'conflict' | | +| [destinationId?](./kibana-plugin-core-server.savedobjectsimportconflicterror.destinationid.md) | string | (Optional) | +| [type](./kibana-plugin-core-server.savedobjectsimportconflicterror.type.md) | 'conflict' | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporter.__private_.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporter.__private_.md deleted file mode 100644 index 2d780a957e08..000000000000 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporter.__private_.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SavedObjectsImporter](./kibana-plugin-core-server.savedobjectsimporter.md) > ["\#private"](./kibana-plugin-core-server.savedobjectsimporter.__private_.md) - -## SavedObjectsImporter."\#private" property - -Signature: - -```typescript -#private; -``` diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporter._constructor_.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporter._constructor_.md index 67df4dbf09ad..8451e35d1518 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporter._constructor_.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporter._constructor_.md @@ -20,5 +20,5 @@ constructor({ savedObjectsClient, typeRegistry, importSizeLimit, }: { | Parameter | Type | Description | | --- | --- | --- | -| { savedObjectsClient, typeRegistry, importSizeLimit, } | {
savedObjectsClient: SavedObjectsClientContract;
typeRegistry: ISavedObjectTypeRegistry;
importSizeLimit: number;
} | | +| { savedObjectsClient, typeRegistry, importSizeLimit, } | { savedObjectsClient: SavedObjectsClientContract; typeRegistry: ISavedObjectTypeRegistry; importSizeLimit: number; } | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporter.import.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporter.import.md index 5b1b2d733fa0..1ca6058e7d74 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporter.import.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporter.import.md @@ -16,11 +16,11 @@ import({ readStream, createNewCopies, namespace, overwrite, }: SavedObjectsImpor | Parameter | Type | Description | | --- | --- | --- | -| { readStream, createNewCopies, namespace, overwrite, } | SavedObjectsImportOptions | | +| { readStream, createNewCopies, namespace, overwrite, } | SavedObjectsImportOptions | | Returns: -`Promise` +Promise<SavedObjectsImportResponse> ## Exceptions diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporter.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporter.md index cd5c71077e66..18ce27ca2c0d 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporter.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporter.md @@ -17,12 +17,6 @@ export declare class SavedObjectsImporter | --- | --- | --- | | [(constructor)({ savedObjectsClient, typeRegistry, importSizeLimit, })](./kibana-plugin-core-server.savedobjectsimporter._constructor_.md) | | Constructs a new instance of the SavedObjectsImporter class | -## Properties - -| Property | Modifiers | Type | Description | -| --- | --- | --- | --- | -| ["\#private"](./kibana-plugin-core-server.savedobjectsimporter.__private_.md) | | | | - ## Methods | Method | Modifiers | Description | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporter.resolveimporterrors.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporter.resolveimporterrors.md index 9418b581ad5b..e1c95723ed3a 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporter.resolveimporterrors.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporter.resolveimporterrors.md @@ -16,11 +16,11 @@ resolveImportErrors({ readStream, createNewCopies, namespace, retries, }: SavedO | Parameter | Type | Description | | --- | --- | --- | -| { readStream, createNewCopies, namespace, retries, } | SavedObjectsResolveImportErrorsOptions | | +| { readStream, createNewCopies, namespace, retries, } | SavedObjectsResolveImportErrorsOptions | | Returns: -`Promise` +Promise<SavedObjectsImportResponse> ## Exceptions diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporterror.importsizeexceeded.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporterror.importsizeexceeded.md index 9dcc43633d9e..421557445670 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporterror.importsizeexceeded.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporterror.importsizeexceeded.md @@ -14,9 +14,9 @@ static importSizeExceeded(limit: number): SavedObjectsImportError; | Parameter | Type | Description | | --- | --- | --- | -| limit | number | | +| limit | number | | Returns: -`SavedObjectsImportError` +SavedObjectsImportError diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporterror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporterror.md index b37b6143e7b7..2e4fd1a01eb0 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporterror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporterror.md @@ -10,13 +10,14 @@ ```typescript export declare class SavedObjectsImportError extends Error ``` +Extends: Error ## Properties | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [attributes](./kibana-plugin-core-server.savedobjectsimporterror.attributes.md) | | Record<string, any> | undefined | | -| [type](./kibana-plugin-core-server.savedobjectsimporterror.type.md) | | string | | +| [attributes?](./kibana-plugin-core-server.savedobjectsimporterror.attributes.md) | | Record<string, any> \| undefined | (Optional) | +| [type](./kibana-plugin-core-server.savedobjectsimporterror.type.md) | | string | | ## Methods diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporterror.nonuniqueimportobjects.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporterror.nonuniqueimportobjects.md index a4a1975af0b4..29533db10302 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporterror.nonuniqueimportobjects.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporterror.nonuniqueimportobjects.md @@ -14,9 +14,9 @@ static nonUniqueImportObjects(nonUniqueEntries: string[]): SavedObjectsImportErr | Parameter | Type | Description | | --- | --- | --- | -| nonUniqueEntries | string[] | | +| nonUniqueEntries | string\[\] | | Returns: -`SavedObjectsImportError` +SavedObjectsImportError diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporterror.nonuniqueretrydestinations.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporterror.nonuniqueretrydestinations.md index a60f6c34cb7e..4fd23c3f6d62 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporterror.nonuniqueretrydestinations.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporterror.nonuniqueretrydestinations.md @@ -14,9 +14,9 @@ static nonUniqueRetryDestinations(nonUniqueRetryDestinations: string[]): SavedOb | Parameter | Type | Description | | --- | --- | --- | -| nonUniqueRetryDestinations | string[] | | +| nonUniqueRetryDestinations | string\[\] | | Returns: -`SavedObjectsImportError` +SavedObjectsImportError diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporterror.nonuniqueretryobjects.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporterror.nonuniqueretryobjects.md index 187904ccf59a..bf8a2c2c0176 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporterror.nonuniqueretryobjects.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporterror.nonuniqueretryobjects.md @@ -14,9 +14,9 @@ static nonUniqueRetryObjects(nonUniqueRetryObjects: string[]): SavedObjectsImpor | Parameter | Type | Description | | --- | --- | --- | -| nonUniqueRetryObjects | string[] | | +| nonUniqueRetryObjects | string\[\] | | Returns: -`SavedObjectsImportError` +SavedObjectsImportError diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporterror.referencesfetcherror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporterror.referencesfetcherror.md index c9392739838d..4202f164900b 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporterror.referencesfetcherror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporterror.referencesfetcherror.md @@ -14,9 +14,9 @@ static referencesFetchError(objects: SavedObject[]): SavedObjectsImportError; | Parameter | Type | Description | | --- | --- | --- | -| objects | SavedObject[] | | +| objects | SavedObject\[\] | | Returns: -`SavedObjectsImportError` +SavedObjectsImportError diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportfailure.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportfailure.md index 536f48f45e0c..52db837479cf 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportfailure.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportfailure.md @@ -16,10 +16,10 @@ export interface SavedObjectsImportFailure | Property | Type | Description | | --- | --- | --- | -| [error](./kibana-plugin-core-server.savedobjectsimportfailure.error.md) | SavedObjectsImportConflictError | SavedObjectsImportAmbiguousConflictError | SavedObjectsImportUnsupportedTypeError | SavedObjectsImportMissingReferencesError | SavedObjectsImportUnknownError | | -| [id](./kibana-plugin-core-server.savedobjectsimportfailure.id.md) | string | | -| [meta](./kibana-plugin-core-server.savedobjectsimportfailure.meta.md) | {
title?: string;
icon?: string;
} | | -| [overwrite](./kibana-plugin-core-server.savedobjectsimportfailure.overwrite.md) | boolean | If overwrite is specified, an attempt was made to overwrite an existing object. | -| [title](./kibana-plugin-core-server.savedobjectsimportfailure.title.md) | string | | -| [type](./kibana-plugin-core-server.savedobjectsimportfailure.type.md) | string | | +| [error](./kibana-plugin-core-server.savedobjectsimportfailure.error.md) | SavedObjectsImportConflictError \| SavedObjectsImportAmbiguousConflictError \| SavedObjectsImportUnsupportedTypeError \| SavedObjectsImportMissingReferencesError \| SavedObjectsImportUnknownError | | +| [id](./kibana-plugin-core-server.savedobjectsimportfailure.id.md) | string | | +| [meta](./kibana-plugin-core-server.savedobjectsimportfailure.meta.md) | { title?: string; icon?: string; } | | +| [overwrite?](./kibana-plugin-core-server.savedobjectsimportfailure.overwrite.md) | boolean | (Optional) If overwrite is specified, an attempt was made to overwrite an existing object. | +| [title?](./kibana-plugin-core-server.savedobjectsimportfailure.title.md) | string | (Optional) | +| [type](./kibana-plugin-core-server.savedobjectsimportfailure.type.md) | string | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporthookresult.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporthookresult.md index 9756ce7fac35..eb16aa2fb028 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporthookresult.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimporthookresult.md @@ -16,5 +16,5 @@ export interface SavedObjectsImportHookResult | Property | Type | Description | | --- | --- | --- | -| [warnings](./kibana-plugin-core-server.savedobjectsimporthookresult.warnings.md) | SavedObjectsImportWarning[] | An optional list of warnings to display in the UI when the import succeeds. | +| [warnings?](./kibana-plugin-core-server.savedobjectsimporthookresult.warnings.md) | SavedObjectsImportWarning\[\] | (Optional) An optional list of warnings to display in the UI when the import succeeds. | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportmissingreferenceserror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportmissingreferenceserror.md index 01557eff549f..25d2a88e87e8 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportmissingreferenceserror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportmissingreferenceserror.md @@ -16,6 +16,6 @@ export interface SavedObjectsImportMissingReferencesError | Property | Type | Description | | --- | --- | --- | -| [references](./kibana-plugin-core-server.savedobjectsimportmissingreferenceserror.references.md) | Array<{
type: string;
id: string;
}> | | -| [type](./kibana-plugin-core-server.savedobjectsimportmissingreferenceserror.type.md) | 'missing_references' | | +| [references](./kibana-plugin-core-server.savedobjectsimportmissingreferenceserror.references.md) | Array<{ type: string; id: string; }> | | +| [type](./kibana-plugin-core-server.savedobjectsimportmissingreferenceserror.type.md) | 'missing\_references' | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportoptions.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportoptions.md index ddda72938b13..58d0f4bf982c 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportoptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportoptions.md @@ -16,8 +16,8 @@ export interface SavedObjectsImportOptions | Property | Type | Description | | --- | --- | --- | -| [createNewCopies](./kibana-plugin-core-server.savedobjectsimportoptions.createnewcopies.md) | boolean | If true, will create new copies of import objects, each with a random id and undefined originId. | -| [namespace](./kibana-plugin-core-server.savedobjectsimportoptions.namespace.md) | string | if specified, will import in given namespace, else will import as global object | -| [overwrite](./kibana-plugin-core-server.savedobjectsimportoptions.overwrite.md) | boolean | If true, will override existing object if present. Note: this has no effect when used with the createNewCopies option. | -| [readStream](./kibana-plugin-core-server.savedobjectsimportoptions.readstream.md) | Readable | The stream of [saved objects](./kibana-plugin-core-server.savedobject.md) to import | +| [createNewCopies](./kibana-plugin-core-server.savedobjectsimportoptions.createnewcopies.md) | boolean | If true, will create new copies of import objects, each with a random id and undefined originId. | +| [namespace?](./kibana-plugin-core-server.savedobjectsimportoptions.namespace.md) | string | (Optional) if specified, will import in given namespace, else will import as global object | +| [overwrite](./kibana-plugin-core-server.savedobjectsimportoptions.overwrite.md) | boolean | If true, will override existing object if present. Note: this has no effect when used with the createNewCopies option. | +| [readStream](./kibana-plugin-core-server.savedobjectsimportoptions.readstream.md) | Readable | The stream of [saved objects](./kibana-plugin-core-server.savedobject.md) to import | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportresponse.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportresponse.md index 55f651197490..e39b4b02bb55 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportresponse.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportresponse.md @@ -16,9 +16,9 @@ export interface SavedObjectsImportResponse | Property | Type | Description | | --- | --- | --- | -| [errors](./kibana-plugin-core-server.savedobjectsimportresponse.errors.md) | SavedObjectsImportFailure[] | | -| [success](./kibana-plugin-core-server.savedobjectsimportresponse.success.md) | boolean | | -| [successCount](./kibana-plugin-core-server.savedobjectsimportresponse.successcount.md) | number | | -| [successResults](./kibana-plugin-core-server.savedobjectsimportresponse.successresults.md) | SavedObjectsImportSuccess[] | | -| [warnings](./kibana-plugin-core-server.savedobjectsimportresponse.warnings.md) | SavedObjectsImportWarning[] | | +| [errors?](./kibana-plugin-core-server.savedobjectsimportresponse.errors.md) | SavedObjectsImportFailure\[\] | (Optional) | +| [success](./kibana-plugin-core-server.savedobjectsimportresponse.success.md) | boolean | | +| [successCount](./kibana-plugin-core-server.savedobjectsimportresponse.successcount.md) | number | | +| [successResults?](./kibana-plugin-core-server.savedobjectsimportresponse.successresults.md) | SavedObjectsImportSuccess\[\] | (Optional) | +| [warnings](./kibana-plugin-core-server.savedobjectsimportresponse.warnings.md) | SavedObjectsImportWarning\[\] | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportretry.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportretry.md index 70693e6f43a3..b79ec63ed86c 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportretry.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportretry.md @@ -16,11 +16,11 @@ export interface SavedObjectsImportRetry | Property | Type | Description | | --- | --- | --- | -| [createNewCopy](./kibana-plugin-core-server.savedobjectsimportretry.createnewcopy.md) | boolean | If createNewCopy is specified, the new object has a new (undefined) origin ID. This is only needed for the case where createNewCopies mode is disabled and ambiguous source conflicts are detected. | -| [destinationId](./kibana-plugin-core-server.savedobjectsimportretry.destinationid.md) | string | The object ID that will be created or overwritten. If not specified, the id field will be used. | -| [id](./kibana-plugin-core-server.savedobjectsimportretry.id.md) | string | | -| [ignoreMissingReferences](./kibana-plugin-core-server.savedobjectsimportretry.ignoremissingreferences.md) | boolean | If ignoreMissingReferences is specified, reference validation will be skipped for this object. | -| [overwrite](./kibana-plugin-core-server.savedobjectsimportretry.overwrite.md) | boolean | | -| [replaceReferences](./kibana-plugin-core-server.savedobjectsimportretry.replacereferences.md) | Array<{
type: string;
from: string;
to: string;
}> | | -| [type](./kibana-plugin-core-server.savedobjectsimportretry.type.md) | string | | +| [createNewCopy?](./kibana-plugin-core-server.savedobjectsimportretry.createnewcopy.md) | boolean | (Optional) If createNewCopy is specified, the new object has a new (undefined) origin ID. This is only needed for the case where createNewCopies mode is disabled and ambiguous source conflicts are detected. | +| [destinationId?](./kibana-plugin-core-server.savedobjectsimportretry.destinationid.md) | string | (Optional) The object ID that will be created or overwritten. If not specified, the id field will be used. | +| [id](./kibana-plugin-core-server.savedobjectsimportretry.id.md) | string | | +| [ignoreMissingReferences?](./kibana-plugin-core-server.savedobjectsimportretry.ignoremissingreferences.md) | boolean | (Optional) If ignoreMissingReferences is specified, reference validation will be skipped for this object. | +| [overwrite](./kibana-plugin-core-server.savedobjectsimportretry.overwrite.md) | boolean | | +| [replaceReferences](./kibana-plugin-core-server.savedobjectsimportretry.replacereferences.md) | Array<{ type: string; from: string; to: string; }> | | +| [type](./kibana-plugin-core-server.savedobjectsimportretry.type.md) | string | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportsimplewarning.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportsimplewarning.md index 52d46e4f8db8..7dc428540047 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportsimplewarning.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportsimplewarning.md @@ -16,6 +16,6 @@ export interface SavedObjectsImportSimpleWarning | Property | Type | Description | | --- | --- | --- | -| [message](./kibana-plugin-core-server.savedobjectsimportsimplewarning.message.md) | string | The translated message to display to the user | -| [type](./kibana-plugin-core-server.savedobjectsimportsimplewarning.type.md) | 'simple' | | +| [message](./kibana-plugin-core-server.savedobjectsimportsimplewarning.message.md) | string | The translated message to display to the user | +| [type](./kibana-plugin-core-server.savedobjectsimportsimplewarning.type.md) | 'simple' | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportsuccess.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportsuccess.md index 18a226f636b1..74242ba6d75b 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportsuccess.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportsuccess.md @@ -16,10 +16,10 @@ export interface SavedObjectsImportSuccess | Property | Type | Description | | --- | --- | --- | -| [createNewCopy](./kibana-plugin-core-server.savedobjectsimportsuccess.createnewcopy.md) | boolean | | -| [destinationId](./kibana-plugin-core-server.savedobjectsimportsuccess.destinationid.md) | string | If destinationId is specified, the new object has a new ID that is different from the import ID. | -| [id](./kibana-plugin-core-server.savedobjectsimportsuccess.id.md) | string | | -| [meta](./kibana-plugin-core-server.savedobjectsimportsuccess.meta.md) | {
title?: string;
icon?: string;
} | | -| [overwrite](./kibana-plugin-core-server.savedobjectsimportsuccess.overwrite.md) | boolean | If overwrite is specified, this object overwrote an existing one (or will do so, in the case of a pending resolution). | -| [type](./kibana-plugin-core-server.savedobjectsimportsuccess.type.md) | string | | +| [createNewCopy?](./kibana-plugin-core-server.savedobjectsimportsuccess.createnewcopy.md) | boolean | (Optional) | +| [destinationId?](./kibana-plugin-core-server.savedobjectsimportsuccess.destinationid.md) | string | (Optional) If destinationId is specified, the new object has a new ID that is different from the import ID. | +| [id](./kibana-plugin-core-server.savedobjectsimportsuccess.id.md) | string | | +| [meta](./kibana-plugin-core-server.savedobjectsimportsuccess.meta.md) | { title?: string; icon?: string; } | | +| [overwrite?](./kibana-plugin-core-server.savedobjectsimportsuccess.overwrite.md) | boolean | (Optional) If overwrite is specified, this object overwrote an existing one (or will do so, in the case of a pending resolution). | +| [type](./kibana-plugin-core-server.savedobjectsimportsuccess.type.md) | string | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportunknownerror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportunknownerror.md index c178d363761e..158afd45752f 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportunknownerror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportunknownerror.md @@ -16,7 +16,7 @@ export interface SavedObjectsImportUnknownError | Property | Type | Description | | --- | --- | --- | -| [message](./kibana-plugin-core-server.savedobjectsimportunknownerror.message.md) | string | | -| [statusCode](./kibana-plugin-core-server.savedobjectsimportunknownerror.statuscode.md) | number | | -| [type](./kibana-plugin-core-server.savedobjectsimportunknownerror.type.md) | 'unknown' | | +| [message](./kibana-plugin-core-server.savedobjectsimportunknownerror.message.md) | string | | +| [statusCode](./kibana-plugin-core-server.savedobjectsimportunknownerror.statuscode.md) | number | | +| [type](./kibana-plugin-core-server.savedobjectsimportunknownerror.type.md) | 'unknown' | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportunsupportedtypeerror.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportunsupportedtypeerror.md index 3f580b27b7fd..48aff60c69d1 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportunsupportedtypeerror.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsimportunsupportedtypeerror.md @@ -16,5 +16,5 @@ export interface SavedObjectsImportUnsupportedTypeError | Property | Type | Description | | --- | --- | --- | -| [type](./kibana-plugin-core-server.savedobjectsimportunsupportedtypeerror.type.md) | 'unsupported_type' | | +| [type](./kibana-plugin-core-server.savedobjectsimportunsupportedtypeerror.type.md) | 'unsupported\_type' | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsincrementcounterfield.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsincrementcounterfield.md index 10615c7da4c3..a45d48523f46 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsincrementcounterfield.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsincrementcounterfield.md @@ -15,6 +15,6 @@ export interface SavedObjectsIncrementCounterField | Property | Type | Description | | --- | --- | --- | -| [fieldName](./kibana-plugin-core-server.savedobjectsincrementcounterfield.fieldname.md) | string | The field name to increment the counter by. | -| [incrementBy](./kibana-plugin-core-server.savedobjectsincrementcounterfield.incrementby.md) | number | The number to increment the field by (defaults to 1). | +| [fieldName](./kibana-plugin-core-server.savedobjectsincrementcounterfield.fieldname.md) | string | The field name to increment the counter by. | +| [incrementBy?](./kibana-plugin-core-server.savedobjectsincrementcounterfield.incrementby.md) | number | (Optional) The number to increment the field by (defaults to 1). | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsincrementcounteroptions.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsincrementcounteroptions.md index 8da2458cf007..8740ffb1be18 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsincrementcounteroptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsincrementcounteroptions.md @@ -10,13 +10,14 @@ ```typescript export interface SavedObjectsIncrementCounterOptions extends SavedObjectsBaseOptions ``` +Extends: SavedObjectsBaseOptions ## Properties | Property | Type | Description | | --- | --- | --- | -| [initialize](./kibana-plugin-core-server.savedobjectsincrementcounteroptions.initialize.md) | boolean | (default=false) If true, sets all the counter fields to 0 if they don't already exist. Existing fields will be left as-is and won't be incremented. | -| [migrationVersion](./kibana-plugin-core-server.savedobjectsincrementcounteroptions.migrationversion.md) | SavedObjectsMigrationVersion | [SavedObjectsMigrationVersion](./kibana-plugin-core-server.savedobjectsmigrationversion.md) | -| [refresh](./kibana-plugin-core-server.savedobjectsincrementcounteroptions.refresh.md) | MutatingOperationRefreshSetting | (default='wait\_for') The Elasticsearch refresh setting for this operation. See [MutatingOperationRefreshSetting](./kibana-plugin-core-server.mutatingoperationrefreshsetting.md) | -| [upsertAttributes](./kibana-plugin-core-server.savedobjectsincrementcounteroptions.upsertattributes.md) | Attributes | Attributes to use when upserting the document if it doesn't exist. | +| [initialize?](./kibana-plugin-core-server.savedobjectsincrementcounteroptions.initialize.md) | boolean | (Optional) (default=false) If true, sets all the counter fields to 0 if they don't already exist. Existing fields will be left as-is and won't be incremented. | +| [migrationVersion?](./kibana-plugin-core-server.savedobjectsincrementcounteroptions.migrationversion.md) | SavedObjectsMigrationVersion | (Optional) [SavedObjectsMigrationVersion](./kibana-plugin-core-server.savedobjectsmigrationversion.md) | +| [refresh?](./kibana-plugin-core-server.savedobjectsincrementcounteroptions.refresh.md) | MutatingOperationRefreshSetting | (Optional) (default='wait\_for') The Elasticsearch refresh setting for this operation. See [MutatingOperationRefreshSetting](./kibana-plugin-core-server.mutatingoperationrefreshsetting.md) | +| [upsertAttributes?](./kibana-plugin-core-server.savedobjectsincrementcounteroptions.upsertattributes.md) | Attributes | (Optional) Attributes to use when upserting the document if it doesn't exist. | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsmigrationlogger.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsmigrationlogger.md index 697f8823c496..80f332c39515 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsmigrationlogger.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsmigrationlogger.md @@ -15,9 +15,9 @@ export interface SavedObjectsMigrationLogger | Property | Type | Description | | --- | --- | --- | -| [debug](./kibana-plugin-core-server.savedobjectsmigrationlogger.debug.md) | (msg: string) => void | | -| [error](./kibana-plugin-core-server.savedobjectsmigrationlogger.error.md) | <Meta extends LogMeta = LogMeta>(msg: string, meta: Meta) => void | | -| [info](./kibana-plugin-core-server.savedobjectsmigrationlogger.info.md) | (msg: string) => void | | -| [warn](./kibana-plugin-core-server.savedobjectsmigrationlogger.warn.md) | (msg: string) => void | | -| [warning](./kibana-plugin-core-server.savedobjectsmigrationlogger.warning.md) | (msg: string) => void | | +| [debug](./kibana-plugin-core-server.savedobjectsmigrationlogger.debug.md) | (msg: string) => void | | +| [error](./kibana-plugin-core-server.savedobjectsmigrationlogger.error.md) | <Meta extends LogMeta = LogMeta>(msg: string, meta: Meta) => void | | +| [info](./kibana-plugin-core-server.savedobjectsmigrationlogger.info.md) | (msg: string) => void | | +| [warn](./kibana-plugin-core-server.savedobjectsmigrationlogger.warn.md) | (msg: string) => void | | +| [warning](./kibana-plugin-core-server.savedobjectsmigrationlogger.warning.md) | (msg: string) => void | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsopenpointintimeoptions.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsopenpointintimeoptions.md index fc825e3bf293..331fb6cbe0a6 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsopenpointintimeoptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsopenpointintimeoptions.md @@ -15,7 +15,7 @@ export interface SavedObjectsOpenPointInTimeOptions | Property | Type | Description | | --- | --- | --- | -| [keepAlive](./kibana-plugin-core-server.savedobjectsopenpointintimeoptions.keepalive.md) | string | Optionally specify how long ES should keep the PIT alive until the next request. Defaults to 5m. | -| [namespaces](./kibana-plugin-core-server.savedobjectsopenpointintimeoptions.namespaces.md) | string[] | An optional list of namespaces to be used when opening the PIT.When the spaces plugin is enabled: - this will default to the user's current space (as determined by the URL) - if specified, the user's current space will be ignored - ['*'] will search across all available spaces | -| [preference](./kibana-plugin-core-server.savedobjectsopenpointintimeoptions.preference.md) | string | An optional ES preference value to be used for the query. | +| [keepAlive?](./kibana-plugin-core-server.savedobjectsopenpointintimeoptions.keepalive.md) | string | (Optional) Optionally specify how long ES should keep the PIT alive until the next request. Defaults to 5m. | +| [namespaces?](./kibana-plugin-core-server.savedobjectsopenpointintimeoptions.namespaces.md) | string\[\] | (Optional) An optional list of namespaces to be used when opening the PIT.When the spaces plugin is enabled: - this will default to the user's current space (as determined by the URL) - if specified, the user's current space will be ignored - ['*'] will search across all available spaces | +| [preference?](./kibana-plugin-core-server.savedobjectsopenpointintimeoptions.preference.md) | string | (Optional) An optional ES preference value to be used for the query. | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsopenpointintimeresponse.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsopenpointintimeresponse.md index c4be2692763a..e3804d63a1e6 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsopenpointintimeresponse.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsopenpointintimeresponse.md @@ -15,5 +15,5 @@ export interface SavedObjectsOpenPointInTimeResponse | Property | Type | Description | | --- | --- | --- | -| [id](./kibana-plugin-core-server.savedobjectsopenpointintimeresponse.id.md) | string | PIT ID returned from ES. | +| [id](./kibana-plugin-core-server.savedobjectsopenpointintimeresponse.id.md) | string | PIT ID returned from ES. | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectspitparams.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectspitparams.md index 7bffca7cda28..3109a6bd88f7 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectspitparams.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectspitparams.md @@ -15,6 +15,6 @@ export interface SavedObjectsPitParams | Property | Type | Description | | --- | --- | --- | -| [id](./kibana-plugin-core-server.savedobjectspitparams.id.md) | string | | -| [keepAlive](./kibana-plugin-core-server.savedobjectspitparams.keepalive.md) | string | | +| [id](./kibana-plugin-core-server.savedobjectspitparams.id.md) | string | | +| [keepAlive?](./kibana-plugin-core-server.savedobjectspitparams.keepalive.md) | string | (Optional) | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrawdoc.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrawdoc.md index 54bca496b993..8bce7fac941a 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrawdoc.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrawdoc.md @@ -16,8 +16,8 @@ export interface SavedObjectsRawDoc | Property | Type | Description | | --- | --- | --- | -| [\_id](./kibana-plugin-core-server.savedobjectsrawdoc._id.md) | string | | -| [\_primary\_term](./kibana-plugin-core-server.savedobjectsrawdoc._primary_term.md) | number | | -| [\_seq\_no](./kibana-plugin-core-server.savedobjectsrawdoc._seq_no.md) | number | | -| [\_source](./kibana-plugin-core-server.savedobjectsrawdoc._source.md) | SavedObjectsRawDocSource | | +| [\_id](./kibana-plugin-core-server.savedobjectsrawdoc._id.md) | string | | +| [\_primary\_term?](./kibana-plugin-core-server.savedobjectsrawdoc._primary_term.md) | number | (Optional) | +| [\_seq\_no?](./kibana-plugin-core-server.savedobjectsrawdoc._seq_no.md) | number | (Optional) | +| [\_source](./kibana-plugin-core-server.savedobjectsrawdoc._source.md) | SavedObjectsRawDocSource | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrawdocparseoptions.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrawdocparseoptions.md index 708d1bc9c514..dc2166258d0c 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrawdocparseoptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrawdocparseoptions.md @@ -16,5 +16,5 @@ export interface SavedObjectsRawDocParseOptions | Property | Type | Description | | --- | --- | --- | -| [namespaceTreatment](./kibana-plugin-core-server.savedobjectsrawdocparseoptions.namespacetreatment.md) | 'strict' | 'lax' | Optional setting to allow for lax handling of the raw document ID and namespace field. This is needed when a previously single-namespace object type is converted to a multi-namespace object type, and it is only intended to be used during upgrade migrations.If not specified, the default treatment is strict. | +| [namespaceTreatment?](./kibana-plugin-core-server.savedobjectsrawdocparseoptions.namespacetreatment.md) | 'strict' \| 'lax' | (Optional) Optional setting to allow for lax handling of the raw document ID and namespace field. This is needed when a previously single-namespace object type is converted to a multi-namespace object type, and it is only intended to be used during upgrade migrations.If not specified, the default treatment is strict. | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsremovereferencestooptions.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsremovereferencestooptions.md index 0874aa460e22..c10f74297305 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsremovereferencestooptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsremovereferencestooptions.md @@ -10,10 +10,11 @@ ```typescript export interface SavedObjectsRemoveReferencesToOptions extends SavedObjectsBaseOptions ``` +Extends: SavedObjectsBaseOptions ## Properties | Property | Type | Description | | --- | --- | --- | -| [refresh](./kibana-plugin-core-server.savedobjectsremovereferencestooptions.refresh.md) | boolean | The Elasticsearch Refresh setting for this operation. Defaults to true | +| [refresh?](./kibana-plugin-core-server.savedobjectsremovereferencestooptions.refresh.md) | boolean | (Optional) The Elasticsearch Refresh setting for this operation. Defaults to true | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsremovereferencestoresponse.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsremovereferencestoresponse.md index b5468a300d51..cd10a9f916b0 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsremovereferencestoresponse.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsremovereferencestoresponse.md @@ -10,10 +10,11 @@ ```typescript export interface SavedObjectsRemoveReferencesToResponse extends SavedObjectsBaseOptions ``` +Extends: SavedObjectsBaseOptions ## Properties | Property | Type | Description | | --- | --- | --- | -| [updated](./kibana-plugin-core-server.savedobjectsremovereferencestoresponse.updated.md) | number | The number of objects that have been updated by this operation | +| [updated](./kibana-plugin-core-server.savedobjectsremovereferencestoresponse.updated.md) | number | The number of objects that have been updated by this operation | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.bulkcreate.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.bulkcreate.md index 17daf3ab1f04..e71a9d266a3d 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.bulkcreate.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.bulkcreate.md @@ -16,12 +16,12 @@ bulkCreate(objects: Array>, options | Parameter | Type | Description | | --- | --- | --- | -| objects | Array<SavedObjectsBulkCreateObject<T>> | | -| options | SavedObjectsCreateOptions | | +| objects | Array<SavedObjectsBulkCreateObject<T>> | \[{ type, id, attributes, references, migrationVersion }\] | +| options | SavedObjectsCreateOptions | {boolean} \[options.overwrite=false\] - overwrites existing documents {string} \[options.namespace\] | Returns: -`Promise>` +Promise<SavedObjectsBulkResponse<T>> {promise} - {saved\_objects: \[\[{ id, type, version, references, attributes, error: { message } }\]} diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.bulkget.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.bulkget.md index 354ee4dfff62..ab265132d606 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.bulkget.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.bulkget.md @@ -16,12 +16,12 @@ bulkGet(objects?: SavedObjectsBulkGetObject[], options?: SavedObjec | Parameter | Type | Description | | --- | --- | --- | -| objects | SavedObjectsBulkGetObject[] | | -| options | SavedObjectsBaseOptions | | +| objects | SavedObjectsBulkGetObject\[\] | an array of objects containing id, type and optionally fields | +| options | SavedObjectsBaseOptions | {string} \[options.namespace\] | Returns: -`Promise>` +Promise<SavedObjectsBulkResponse<T>> {promise} - { saved\_objects: \[{ id, type, version, attributes }\] } diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.bulkresolve.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.bulkresolve.md index f489972207a6..a67521753892 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.bulkresolve.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.bulkresolve.md @@ -16,12 +16,12 @@ bulkResolve(objects: SavedObjectsBulkResolveObject[], options?: Sav | Parameter | Type | Description | | --- | --- | --- | -| objects | SavedObjectsBulkResolveObject[] | | -| options | SavedObjectsBaseOptions | | +| objects | SavedObjectsBulkResolveObject\[\] | an array of objects containing id, type | +| options | SavedObjectsBaseOptions | {string} \[options.namespace\] | Returns: -`Promise>` +Promise<SavedObjectsBulkResolveResponse<T>> {promise} - { resolved\_objects: \[{ saved\_object, outcome }\] } diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.bulkupdate.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.bulkupdate.md index de61549b7680..c4244a8e34e3 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.bulkupdate.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.bulkupdate.md @@ -16,12 +16,12 @@ bulkUpdate(objects: Array>, options | Parameter | Type | Description | | --- | --- | --- | -| objects | Array<SavedObjectsBulkUpdateObject<T>> | | -| options | SavedObjectsBulkUpdateOptions | | +| objects | Array<SavedObjectsBulkUpdateObject<T>> | \[{ type, id, attributes, options: { version, namespace } references }\] {string} options.version - ensures version matches that of persisted object {string} \[options.namespace\] | +| options | SavedObjectsBulkUpdateOptions | | Returns: -`Promise>` +Promise<SavedObjectsBulkUpdateResponse<T>> {promise} - {saved\_objects: \[\[{ id, type, version, references, attributes, error: { message } }\]} diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.checkconflicts.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.checkconflicts.md index 6e44bd704d6a..48adf6a2dba4 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.checkconflicts.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.checkconflicts.md @@ -16,10 +16,10 @@ checkConflicts(objects?: SavedObjectsCheckConflictsObject[], options?: SavedObje | Parameter | Type | Description | | --- | --- | --- | -| objects | SavedObjectsCheckConflictsObject[] | | -| options | SavedObjectsBaseOptions | | +| objects | SavedObjectsCheckConflictsObject\[\] | | +| options | SavedObjectsBaseOptions | | Returns: -`Promise` +Promise<SavedObjectsCheckConflictsResponse> diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.closepointintime.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.closepointintime.md index b9d81c89bffd..e25cd9dfcaae 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.closepointintime.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.closepointintime.md @@ -18,12 +18,12 @@ closePointInTime(id: string, options?: SavedObjectsClosePointInTimeOptions): Pro | Parameter | Type | Description | | --- | --- | --- | -| id | string | | -| options | SavedObjectsClosePointInTimeOptions | | +| id | string | | +| options | SavedObjectsClosePointInTimeOptions | [SavedObjectsClosePointInTimeOptions](./kibana-plugin-core-server.savedobjectsclosepointintimeoptions.md) | Returns: -`Promise` +Promise<SavedObjectsClosePointInTimeResponse> {promise} - [SavedObjectsClosePointInTimeResponse](./kibana-plugin-core-server.savedobjectsclosepointintimeresponse.md) @@ -55,6 +55,5 @@ const response = await repository.find({ }); await repository.closePointInTime(response.pit_id); - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.collectmultinamespacereferences.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.collectmultinamespacereferences.md index 450cd14a2052..b22b3bd8c0b5 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.collectmultinamespacereferences.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.collectmultinamespacereferences.md @@ -16,10 +16,10 @@ collectMultiNamespaceReferences(objects: SavedObjectsCollectMultiNamespaceRefere | Parameter | Type | Description | | --- | --- | --- | -| objects | SavedObjectsCollectMultiNamespaceReferencesObject[] | | -| options | SavedObjectsCollectMultiNamespaceReferencesOptions | | +| objects | SavedObjectsCollectMultiNamespaceReferencesObject\[\] | The objects to get the references for. | +| options | SavedObjectsCollectMultiNamespaceReferencesOptions | | Returns: -`Promise` +Promise<import("./collect\_multi\_namespace\_references").SavedObjectsCollectMultiNamespaceReferencesResponse> diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.create.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.create.md index 316f72f62610..0c5412e2cd2d 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.create.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.create.md @@ -16,13 +16,13 @@ create(type: string, attributes: T, options?: SavedObjectsCreateOpt | Parameter | Type | Description | | --- | --- | --- | -| type | string | | -| attributes | T | | -| options | SavedObjectsCreateOptions | | +| type | string | | +| attributes | T | | +| options | SavedObjectsCreateOptions | {string} \[options.id\] - force id on creation, not recommended {boolean} \[options.overwrite=false\] {object} \[options.migrationVersion=undefined\] {string} \[options.namespace\] {array} \[options.references=\[\]\] - \[{ name, type, id }\] | Returns: -`Promise>` +Promise<SavedObject<T>> {promise} - { id, type, version, attributes } diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.createpointintimefinder.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.createpointintimefinder.md index c92a1986966f..4cbf51b85f26 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.createpointintimefinder.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.createpointintimefinder.md @@ -22,12 +22,12 @@ createPointInTimeFinder(findOptions: SavedObjectsCreat | Parameter | Type | Description | | --- | --- | --- | -| findOptions | SavedObjectsCreatePointInTimeFinderOptions | | -| dependencies | SavedObjectsCreatePointInTimeFinderDependencies | | +| findOptions | SavedObjectsCreatePointInTimeFinderOptions | | +| dependencies | SavedObjectsCreatePointInTimeFinderDependencies | | Returns: -`ISavedObjectsPointInTimeFinder` +ISavedObjectsPointInTimeFinder<T, A> ## Example @@ -48,6 +48,5 @@ for await (const response of finder.find()) { await finder.close(); } } - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.delete.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.delete.md index c10ab0ab57eb..2caa59210b9d 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.delete.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.delete.md @@ -16,13 +16,13 @@ delete(type: string, id: string, options?: SavedObjectsDeleteOptions): Promise<{ | Parameter | Type | Description | | --- | --- | --- | -| type | string | | -| id | string | | -| options | SavedObjectsDeleteOptions | | +| type | string | | +| id | string | | +| options | SavedObjectsDeleteOptions | {string} \[options.namespace\] | Returns: -`Promise<{}>` +Promise<{}> {promise} diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.deletebynamespace.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.deletebynamespace.md index 3cdfb095d133..2e9048bcbe18 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.deletebynamespace.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.deletebynamespace.md @@ -16,12 +16,12 @@ deleteByNamespace(namespace: string, options?: SavedObjectsDeleteByNamespaceOpti | Parameter | Type | Description | | --- | --- | --- | -| namespace | string | | -| options | SavedObjectsDeleteByNamespaceOptions | | +| namespace | string | | +| options | SavedObjectsDeleteByNamespaceOptions | | Returns: -`Promise` +Promise<any> {promise} - { took, timed\_out, total, deleted, batches, version\_conflicts, noops, retries, failures } diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.find.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.find.md index 5c823b756791..58c14917aa2c 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.find.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.find.md @@ -14,11 +14,11 @@ find(options: SavedObjectsFindOptions): PromiseSavedObjectsFindOptions | | +| options | SavedObjectsFindOptions | {(string\|Array)} \[options.type\] {string} \[options.search\] {string} \[options.defaultSearchOperator\] {Array} \[options.searchFields\] - see Elasticsearch Simple Query String Query field argument for more information {integer} \[options.page=1\] {integer} \[options.perPage=20\] {Array} \[options.searchAfter\] {string} \[options.sortField\] {string} \[options.sortOrder\] {Array} \[options.fields\] {string} \[options.namespace\] {object} \[options.hasReference\] - { type, id } {string} \[options.pit\] {string} \[options.preference\] | Returns: -`Promise>` +Promise<SavedObjectsFindResponse<T, A>> {promise} - { saved\_objects: \[{ id, type, version, attributes }\], total, per\_page, page } diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.get.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.get.md index f9368a1b400c..9f2b1b924857 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.get.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.get.md @@ -16,13 +16,13 @@ get(type: string, id: string, options?: SavedObjectsBaseOptions): P | Parameter | Type | Description | | --- | --- | --- | -| type | string | | -| id | string | | -| options | SavedObjectsBaseOptions | | +| type | string | | +| id | string | | +| options | SavedObjectsBaseOptions | {string} \[options.namespace\] | Returns: -`Promise>` +Promise<SavedObject<T>> {promise} - { id, type, version, attributes } diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.incrementcounter.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.incrementcounter.md index 007b453817c8..0a51ec9429fe 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.incrementcounter.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.incrementcounter.md @@ -16,14 +16,14 @@ incrementCounter(type: string, id: string, counterFields: Arraystring | The type of saved object whose fields should be incremented | -| id | string | The id of the document whose fields should be incremented | -| counterFields | Array<string | SavedObjectsIncrementCounterField> | An array of field names to increment or an array of [SavedObjectsIncrementCounterField](./kibana-plugin-core-server.savedobjectsincrementcounterfield.md) | -| options | SavedObjectsIncrementCounterOptions<T> | [SavedObjectsIncrementCounterOptions](./kibana-plugin-core-server.savedobjectsincrementcounteroptions.md) | +| type | string | The type of saved object whose fields should be incremented | +| id | string | The id of the document whose fields should be incremented | +| counterFields | Array<string \| SavedObjectsIncrementCounterField> | An array of field names to increment or an array of [SavedObjectsIncrementCounterField](./kibana-plugin-core-server.savedobjectsincrementcounterfield.md) | +| options | SavedObjectsIncrementCounterOptions<T> | [SavedObjectsIncrementCounterOptions](./kibana-plugin-core-server.savedobjectsincrementcounteroptions.md) | Returns: -`Promise>` +Promise<SavedObject<T>> The saved object after the specified fields were incremented @@ -65,6 +65,5 @@ repository.incrementCounter<{ appId: string }>( [ 'stats.apiCalls'], { upsertAttributes: { appId: 'myId' } } ) - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.openpointintimefortype.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.openpointintimefortype.md index b33765bb79dd..e0eb4bc603a2 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.openpointintimefortype.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.openpointintimefortype.md @@ -18,12 +18,12 @@ openPointInTimeForType(type: string | string[], { keepAlive, preference }?: Save | Parameter | Type | Description | | --- | --- | --- | -| type | string | string[] | | -| { keepAlive, preference } | SavedObjectsOpenPointInTimeOptions | | +| type | string \| string\[\] | | +| { keepAlive, preference } | SavedObjectsOpenPointInTimeOptions | | Returns: -`Promise` +Promise<SavedObjectsOpenPointInTimeResponse> {promise} - { id: string } @@ -50,6 +50,5 @@ const page2 = await savedObjectsClient.find({ searchAfter: lastHit.sort, }); await savedObjectsClient.closePointInTime(page2.pit_id); - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.removereferencesto.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.removereferencesto.md index ff0592636093..6691bf69e58d 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.removereferencesto.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.removereferencesto.md @@ -16,13 +16,13 @@ removeReferencesTo(type: string, id: string, options?: SavedObjectsRemoveReferen | Parameter | Type | Description | | --- | --- | --- | -| type | string | | -| id | string | | -| options | SavedObjectsRemoveReferencesToOptions | | +| type | string | | +| id | string | | +| options | SavedObjectsRemoveReferencesToOptions | | Returns: -`Promise` +Promise<SavedObjectsRemoveReferencesToResponse> ## Remarks diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.resolve.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.resolve.md index 7d0a1c7d204b..bf558eca975f 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.resolve.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.resolve.md @@ -16,13 +16,13 @@ resolve(type: string, id: string, options?: SavedObjectsBaseOptions | Parameter | Type | Description | | --- | --- | --- | -| type | string | | -| id | string | | -| options | SavedObjectsBaseOptions | | +| type | string | | +| id | string | | +| options | SavedObjectsBaseOptions | {string} \[options.namespace\] | Returns: -`Promise>` +Promise<SavedObjectsResolveResponse<T>> {promise} - { saved\_object, outcome } diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.update.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.update.md index d0d48b8938db..681ba9eb3f01 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.update.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.update.md @@ -16,14 +16,14 @@ update(type: string, id: string, attributes: Partial, options?: | Parameter | Type | Description | | --- | --- | --- | -| type | string | | -| id | string | | -| attributes | Partial<T> | | -| options | SavedObjectsUpdateOptions<T> | | +| type | string | | +| id | string | | +| attributes | Partial<T> | | +| options | SavedObjectsUpdateOptions<T> | {string} options.version - ensures version matches that of persisted object {string} \[options.namespace\] {array} \[options.references\] - \[{ name, type, id }\] | Returns: -`Promise>` +Promise<SavedObjectsUpdateResponse<T>> {promise} diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.updateobjectsspaces.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.updateobjectsspaces.md index 6914c1b46b82..c226e8d2d2b1 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.updateobjectsspaces.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.updateobjectsspaces.md @@ -16,12 +16,12 @@ updateObjectsSpaces(objects: SavedObjectsUpdateObjectsSpacesObject[], spacesToAd | Parameter | Type | Description | | --- | --- | --- | -| objects | SavedObjectsUpdateObjectsSpacesObject[] | | -| spacesToAdd | string[] | | -| spacesToRemove | string[] | | -| options | SavedObjectsUpdateObjectsSpacesOptions | | +| objects | SavedObjectsUpdateObjectsSpacesObject\[\] | | +| spacesToAdd | string\[\] | | +| spacesToRemove | string\[\] | | +| options | SavedObjectsUpdateObjectsSpacesOptions | | Returns: -`Promise` +Promise<import("./update\_objects\_spaces").SavedObjectsUpdateObjectsSpacesResponse> diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepositoryfactory.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepositoryfactory.md index dec768b68cd3..72aa79ed4df2 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepositoryfactory.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsrepositoryfactory.md @@ -16,6 +16,6 @@ export interface SavedObjectsRepositoryFactory | Property | Type | Description | | --- | --- | --- | -| [createInternalRepository](./kibana-plugin-core-server.savedobjectsrepositoryfactory.createinternalrepository.md) | (includedHiddenTypes?: string[]) => ISavedObjectsRepository | Creates a [Saved Objects repository](./kibana-plugin-core-server.isavedobjectsrepository.md) that uses the internal Kibana user for authenticating with Elasticsearch. | -| [createScopedRepository](./kibana-plugin-core-server.savedobjectsrepositoryfactory.createscopedrepository.md) | (req: KibanaRequest, includedHiddenTypes?: string[]) => ISavedObjectsRepository | Creates a [Saved Objects repository](./kibana-plugin-core-server.isavedobjectsrepository.md) that uses the credentials from the passed in request to authenticate with Elasticsearch. | +| [createInternalRepository](./kibana-plugin-core-server.savedobjectsrepositoryfactory.createinternalrepository.md) | (includedHiddenTypes?: string\[\]) => ISavedObjectsRepository | Creates a [Saved Objects repository](./kibana-plugin-core-server.isavedobjectsrepository.md) that uses the internal Kibana user for authenticating with Elasticsearch. | +| [createScopedRepository](./kibana-plugin-core-server.savedobjectsrepositoryfactory.createscopedrepository.md) | (req: KibanaRequest, includedHiddenTypes?: string\[\]) => ISavedObjectsRepository | Creates a [Saved Objects repository](./kibana-plugin-core-server.isavedobjectsrepository.md) that uses the credentials from the passed in request to authenticate with Elasticsearch. | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsresolveimporterrorsoptions.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsresolveimporterrorsoptions.md index dcd2305c831f..7a005db4334b 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsresolveimporterrorsoptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsresolveimporterrorsoptions.md @@ -16,8 +16,8 @@ export interface SavedObjectsResolveImportErrorsOptions | Property | Type | Description | | --- | --- | --- | -| [createNewCopies](./kibana-plugin-core-server.savedobjectsresolveimporterrorsoptions.createnewcopies.md) | boolean | If true, will create new copies of import objects, each with a random id and undefined originId. | -| [namespace](./kibana-plugin-core-server.savedobjectsresolveimporterrorsoptions.namespace.md) | string | if specified, will import in given namespace | -| [readStream](./kibana-plugin-core-server.savedobjectsresolveimporterrorsoptions.readstream.md) | Readable | The stream of [saved objects](./kibana-plugin-core-server.savedobject.md) to resolve errors from | -| [retries](./kibana-plugin-core-server.savedobjectsresolveimporterrorsoptions.retries.md) | SavedObjectsImportRetry[] | saved object import references to retry | +| [createNewCopies](./kibana-plugin-core-server.savedobjectsresolveimporterrorsoptions.createnewcopies.md) | boolean | If true, will create new copies of import objects, each with a random id and undefined originId. | +| [namespace?](./kibana-plugin-core-server.savedobjectsresolveimporterrorsoptions.namespace.md) | string | (Optional) if specified, will import in given namespace | +| [readStream](./kibana-plugin-core-server.savedobjectsresolveimporterrorsoptions.readstream.md) | Readable | The stream of [saved objects](./kibana-plugin-core-server.savedobject.md) to resolve errors from | +| [retries](./kibana-plugin-core-server.savedobjectsresolveimporterrorsoptions.retries.md) | SavedObjectsImportRetry\[\] | saved object import references to retry | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsresolveresponse.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsresolveresponse.md index bbffd9902c0e..1eab71a7d7e7 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsresolveresponse.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsresolveresponse.md @@ -15,7 +15,7 @@ export interface SavedObjectsResolveResponse | Property | Type | Description | | --- | --- | --- | -| [alias\_target\_id](./kibana-plugin-core-server.savedobjectsresolveresponse.alias_target_id.md) | string | The ID of the object that the legacy URL alias points to. This is only defined when the outcome is 'aliasMatch' or 'conflict'. | -| [outcome](./kibana-plugin-core-server.savedobjectsresolveresponse.outcome.md) | 'exactMatch' | 'aliasMatch' | 'conflict' | The outcome for a successful resolve call is one of the following values:\* 'exactMatch' -- One document exactly matched the given ID. \* 'aliasMatch' -- One document with a legacy URL alias matched the given ID; in this case the saved_object.id field is different than the given ID. \* 'conflict' -- Two documents matched the given ID, one was an exact match and another with a legacy URL alias; in this case the saved_object object is the exact match, and the saved_object.id field is the same as the given ID. | -| [saved\_object](./kibana-plugin-core-server.savedobjectsresolveresponse.saved_object.md) | SavedObject<T> | The saved object that was found. | +| [alias\_target\_id?](./kibana-plugin-core-server.savedobjectsresolveresponse.alias_target_id.md) | string | (Optional) The ID of the object that the legacy URL alias points to. This is only defined when the outcome is 'aliasMatch' or 'conflict'. | +| [outcome](./kibana-plugin-core-server.savedobjectsresolveresponse.outcome.md) | 'exactMatch' \| 'aliasMatch' \| 'conflict' | The outcome for a successful resolve call is one of the following values:\* 'exactMatch' -- One document exactly matched the given ID. \* 'aliasMatch' -- One document with a legacy URL alias matched the given ID; in this case the saved_object.id field is different than the given ID. \* 'conflict' -- Two documents matched the given ID, one was an exact match and another with a legacy URL alias; in this case the saved_object object is the exact match, and the saved_object.id field is the same as the given ID. | +| [saved\_object](./kibana-plugin-core-server.savedobjectsresolveresponse.saved_object.md) | SavedObject<T> | The saved object that was found. | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsserializer.generaterawid.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsserializer.generaterawid.md index a9dfd84cf0b4..6172a05d5c8f 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsserializer.generaterawid.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsserializer.generaterawid.md @@ -16,11 +16,11 @@ generateRawId(namespace: string | undefined, type: string, id: string): string; | Parameter | Type | Description | | --- | --- | --- | -| namespace | string | undefined | | -| type | string | | -| id | string | | +| namespace | string \| undefined | The namespace of the saved object | +| type | string | The saved object type | +| id | string | The id of the saved object | Returns: -`string` +string diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsserializer.generaterawlegacyurlaliasid.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsserializer.generaterawlegacyurlaliasid.md index d33f42ee2cf5..a0465b96f05b 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsserializer.generaterawlegacyurlaliasid.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsserializer.generaterawlegacyurlaliasid.md @@ -16,11 +16,11 @@ generateRawLegacyUrlAliasId(namespace: string, type: string, id: string): string | Parameter | Type | Description | | --- | --- | --- | -| namespace | string | | -| type | string | | -| id | string | | +| namespace | string | The namespace of the saved object | +| type | string | The saved object type | +| id | string | The id of the saved object | Returns: -`string` +string diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsserializer.israwsavedobject.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsserializer.israwsavedobject.md index 1094cc25ab55..00963e353aa2 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsserializer.israwsavedobject.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsserializer.israwsavedobject.md @@ -16,10 +16,10 @@ isRawSavedObject(doc: SavedObjectsRawDoc, options?: SavedObjectsRawDocParseOptio | Parameter | Type | Description | | --- | --- | --- | -| doc | SavedObjectsRawDoc | | -| options | SavedObjectsRawDocParseOptions | | +| doc | SavedObjectsRawDoc | The raw ES document to be tested | +| options | SavedObjectsRawDocParseOptions | Options for parsing the raw document. | Returns: -`boolean` +boolean diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsserializer.rawtosavedobject.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsserializer.rawtosavedobject.md index d71db9caf6a3..9ac0ae0feee0 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsserializer.rawtosavedobject.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsserializer.rawtosavedobject.md @@ -16,10 +16,10 @@ rawToSavedObject(doc: SavedObjectsRawDoc, options?: SavedObjectsRaw | Parameter | Type | Description | | --- | --- | --- | -| doc | SavedObjectsRawDoc | | -| options | SavedObjectsRawDocParseOptions | | +| doc | SavedObjectsRawDoc | The raw ES document to be converted to saved object format. | +| options | SavedObjectsRawDocParseOptions | Options for parsing the raw document. | Returns: -`SavedObjectSanitizedDoc` +SavedObjectSanitizedDoc<T> diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsserializer.savedobjecttoraw.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsserializer.savedobjecttoraw.md index 16d499a7b7b3..560011fc0963 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsserializer.savedobjecttoraw.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsserializer.savedobjecttoraw.md @@ -16,9 +16,9 @@ savedObjectToRaw(savedObj: SavedObjectSanitizedDoc): SavedObjectsRawDoc; | Parameter | Type | Description | | --- | --- | --- | -| savedObj | SavedObjectSanitizedDoc | | +| savedObj | SavedObjectSanitizedDoc | The saved object to be converted to raw ES format. | Returns: -`SavedObjectsRawDoc` +SavedObjectsRawDoc diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsservicesetup.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsservicesetup.md index 336d9f63f0ce..28afaacce7ce 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsservicesetup.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsservicesetup.md @@ -29,7 +29,6 @@ export class Plugin() { }) } } - ``` ## Example 2 @@ -44,15 +43,14 @@ export class Plugin() { core.savedObjects.registerType(mySoType); } } - ``` ## Properties | Property | Type | Description | | --- | --- | --- | -| [addClientWrapper](./kibana-plugin-core-server.savedobjectsservicesetup.addclientwrapper.md) | (priority: number, id: string, factory: SavedObjectsClientWrapperFactory) => void | Add a [client wrapper factory](./kibana-plugin-core-server.savedobjectsclientwrapperfactory.md) with the given priority. | -| [getKibanaIndex](./kibana-plugin-core-server.savedobjectsservicesetup.getkibanaindex.md) | () => string | Returns the default index used for saved objects. | -| [registerType](./kibana-plugin-core-server.savedobjectsservicesetup.registertype.md) | <Attributes = any>(type: SavedObjectsType<Attributes>) => void | Register a [savedObjects type](./kibana-plugin-core-server.savedobjectstype.md) definition.See the [mappings format](./kibana-plugin-core-server.savedobjectstypemappingdefinition.md) and [migration format](./kibana-plugin-core-server.savedobjectmigrationmap.md) for more details about these. | -| [setClientFactoryProvider](./kibana-plugin-core-server.savedobjectsservicesetup.setclientfactoryprovider.md) | (clientFactoryProvider: SavedObjectsClientFactoryProvider) => void | Set the default [factory provider](./kibana-plugin-core-server.savedobjectsclientfactoryprovider.md) for creating Saved Objects clients. Only one provider can be set, subsequent calls to this method will fail. | +| [addClientWrapper](./kibana-plugin-core-server.savedobjectsservicesetup.addclientwrapper.md) | (priority: number, id: string, factory: SavedObjectsClientWrapperFactory) => void | Add a [client wrapper factory](./kibana-plugin-core-server.savedobjectsclientwrapperfactory.md) with the given priority. | +| [getKibanaIndex](./kibana-plugin-core-server.savedobjectsservicesetup.getkibanaindex.md) | () => string | Returns the default index used for saved objects. | +| [registerType](./kibana-plugin-core-server.savedobjectsservicesetup.registertype.md) | <Attributes = any>(type: SavedObjectsType<Attributes>) => void | Register a [savedObjects type](./kibana-plugin-core-server.savedobjectstype.md) definition.See the [mappings format](./kibana-plugin-core-server.savedobjectstypemappingdefinition.md) and [migration format](./kibana-plugin-core-server.savedobjectmigrationmap.md) for more details about these. | +| [setClientFactoryProvider](./kibana-plugin-core-server.savedobjectsservicesetup.setclientfactoryprovider.md) | (clientFactoryProvider: SavedObjectsClientFactoryProvider) => void | Set the default [factory provider](./kibana-plugin-core-server.savedobjectsclientfactoryprovider.md) for creating Saved Objects clients. Only one provider can be set, subsequent calls to this method will fail. | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsservicesetup.registertype.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsservicesetup.registertype.md index 7f74ce4d7bea..3085224fdaa6 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsservicesetup.registertype.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsservicesetup.registertype.md @@ -51,6 +51,5 @@ export class Plugin() { core.savedObjects.registerType(myType); } } - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsservicestart.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsservicestart.md index 075a363fe1aa..ae7480ab1e65 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsservicestart.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsservicestart.md @@ -16,11 +16,11 @@ export interface SavedObjectsServiceStart | Property | Type | Description | | --- | --- | --- | -| [createExporter](./kibana-plugin-core-server.savedobjectsservicestart.createexporter.md) | (client: SavedObjectsClientContract) => ISavedObjectsExporter | Creates an [exporter](./kibana-plugin-core-server.isavedobjectsexporter.md) bound to given client. | -| [createImporter](./kibana-plugin-core-server.savedobjectsservicestart.createimporter.md) | (client: SavedObjectsClientContract) => ISavedObjectsImporter | Creates an [importer](./kibana-plugin-core-server.isavedobjectsimporter.md) bound to given client. | -| [createInternalRepository](./kibana-plugin-core-server.savedobjectsservicestart.createinternalrepository.md) | (includedHiddenTypes?: string[]) => ISavedObjectsRepository | Creates a [Saved Objects repository](./kibana-plugin-core-server.isavedobjectsrepository.md) that uses the internal Kibana user for authenticating with Elasticsearch. | -| [createScopedRepository](./kibana-plugin-core-server.savedobjectsservicestart.createscopedrepository.md) | (req: KibanaRequest, includedHiddenTypes?: string[]) => ISavedObjectsRepository | Creates a [Saved Objects repository](./kibana-plugin-core-server.isavedobjectsrepository.md) that uses the credentials from the passed in request to authenticate with Elasticsearch. | -| [createSerializer](./kibana-plugin-core-server.savedobjectsservicestart.createserializer.md) | () => SavedObjectsSerializer | Creates a [serializer](./kibana-plugin-core-server.savedobjectsserializer.md) that is aware of all registered types. | -| [getScopedClient](./kibana-plugin-core-server.savedobjectsservicestart.getscopedclient.md) | (req: KibanaRequest, options?: SavedObjectsClientProviderOptions) => SavedObjectsClientContract | Creates a [Saved Objects client](./kibana-plugin-core-server.savedobjectsclientcontract.md) that uses the credentials from the passed in request to authenticate with Elasticsearch. If other plugins have registered Saved Objects client wrappers, these will be applied to extend the functionality of the client.A client that is already scoped to the incoming request is also exposed from the route handler context see [RequestHandlerContext](./kibana-plugin-core-server.requesthandlercontext.md). | -| [getTypeRegistry](./kibana-plugin-core-server.savedobjectsservicestart.gettyperegistry.md) | () => ISavedObjectTypeRegistry | Returns the [registry](./kibana-plugin-core-server.isavedobjecttyperegistry.md) containing all registered [saved object types](./kibana-plugin-core-server.savedobjectstype.md) | +| [createExporter](./kibana-plugin-core-server.savedobjectsservicestart.createexporter.md) | (client: SavedObjectsClientContract) => ISavedObjectsExporter | Creates an [exporter](./kibana-plugin-core-server.isavedobjectsexporter.md) bound to given client. | +| [createImporter](./kibana-plugin-core-server.savedobjectsservicestart.createimporter.md) | (client: SavedObjectsClientContract) => ISavedObjectsImporter | Creates an [importer](./kibana-plugin-core-server.isavedobjectsimporter.md) bound to given client. | +| [createInternalRepository](./kibana-plugin-core-server.savedobjectsservicestart.createinternalrepository.md) | (includedHiddenTypes?: string\[\]) => ISavedObjectsRepository | Creates a [Saved Objects repository](./kibana-plugin-core-server.isavedobjectsrepository.md) that uses the internal Kibana user for authenticating with Elasticsearch. | +| [createScopedRepository](./kibana-plugin-core-server.savedobjectsservicestart.createscopedrepository.md) | (req: KibanaRequest, includedHiddenTypes?: string\[\]) => ISavedObjectsRepository | Creates a [Saved Objects repository](./kibana-plugin-core-server.isavedobjectsrepository.md) that uses the credentials from the passed in request to authenticate with Elasticsearch. | +| [createSerializer](./kibana-plugin-core-server.savedobjectsservicestart.createserializer.md) | () => SavedObjectsSerializer | Creates a [serializer](./kibana-plugin-core-server.savedobjectsserializer.md) that is aware of all registered types. | +| [getScopedClient](./kibana-plugin-core-server.savedobjectsservicestart.getscopedclient.md) | (req: KibanaRequest, options?: SavedObjectsClientProviderOptions) => SavedObjectsClientContract | Creates a [Saved Objects client](./kibana-plugin-core-server.savedobjectsclientcontract.md) that uses the credentials from the passed in request to authenticate with Elasticsearch. If other plugins have registered Saved Objects client wrappers, these will be applied to extend the functionality of the client.A client that is already scoped to the incoming request is also exposed from the route handler context see [RequestHandlerContext](./kibana-plugin-core-server.requesthandlercontext.md). | +| [getTypeRegistry](./kibana-plugin-core-server.savedobjectsservicestart.gettyperegistry.md) | () => ISavedObjectTypeRegistry | Returns the [registry](./kibana-plugin-core-server.isavedobjecttyperegistry.md) containing all registered [saved object types](./kibana-plugin-core-server.savedobjectstype.md) | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectstatusmeta.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectstatusmeta.md index 3a0b23d18632..890ed36535b3 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectstatusmeta.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectstatusmeta.md @@ -16,5 +16,5 @@ export interface SavedObjectStatusMeta | Property | Type | Description | | --- | --- | --- | -| [migratedIndices](./kibana-plugin-core-server.savedobjectstatusmeta.migratedindices.md) | {
[status: string]: number;
skipped: number;
migrated: number;
} | | +| [migratedIndices](./kibana-plugin-core-server.savedobjectstatusmeta.migratedindices.md) | { \[status: string\]: number; skipped: number; migrated: number; } | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectstype.converttomultinamespacetypeversion.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectstype.converttomultinamespacetypeversion.md index 20346919fc65..a3fac3415363 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectstype.converttomultinamespacetypeversion.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectstype.converttomultinamespacetypeversion.md @@ -19,7 +19,6 @@ Example of a single-namespace type in 7.12: namespaceType: 'single', mappings: {...} } - ``` Example after converting to a multi-namespace (isolated) type in 8.0: @@ -31,7 +30,6 @@ Example after converting to a multi-namespace (isolated) type in 8.0: mappings: {...}, convertToMultiNamespaceTypeVersion: '8.0.0' } - ``` Example after converting to a multi-namespace (shareable) type in 8.1: @@ -43,7 +41,6 @@ Example after converting to a multi-namespace (shareable) type in 8.1: mappings: {...}, convertToMultiNamespaceTypeVersion: '8.0.0' } - ``` Note: migration function(s) can be optionally specified for any of these versions and will not interfere with the conversion process. diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectstype.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectstype.md index bdb90be2bc8f..3c76a898d06f 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectstype.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectstype.md @@ -18,8 +18,8 @@ This is only internal for now, and will only be public when we expose the regist | Property | Type | Description | | --- | --- | --- | -| [convertToAliasScript](./kibana-plugin-core-server.savedobjectstype.converttoaliasscript.md) | string | If defined, will be used to convert the type to an alias. | -| [convertToMultiNamespaceTypeVersion](./kibana-plugin-core-server.savedobjectstype.converttomultinamespacetypeversion.md) | string | If defined, objects of this type will be converted to a 'multiple' or 'multiple-isolated' namespace type when migrating to this version.Requirements:1. This string value must be a valid semver version 2. This type must have previously specified [\`namespaceType: 'single'\`](./kibana-plugin-core-server.savedobjectsnamespacetype.md) 3. This type must also specify [\`namespaceType: 'multiple'\`](./kibana-plugin-core-server.savedobjectsnamespacetype.md) \*or\* [\`namespaceType: 'multiple-isolated'\`](./kibana-plugin-core-server.savedobjectsnamespacetype.md)Example of a single-namespace type in 7.12: +| [convertToAliasScript?](./kibana-plugin-core-server.savedobjectstype.converttoaliasscript.md) | string | (Optional) If defined, will be used to convert the type to an alias. | +| [convertToMultiNamespaceTypeVersion?](./kibana-plugin-core-server.savedobjectstype.converttomultinamespacetypeversion.md) | string | (Optional) If defined, objects of this type will be converted to a 'multiple' or 'multiple-isolated' namespace type when migrating to this version.Requirements:1. This string value must be a valid semver version 2. This type must have previously specified [\`namespaceType: 'single'\`](./kibana-plugin-core-server.savedobjectsnamespacetype.md) 3. This type must also specify [\`namespaceType: 'multiple'\`](./kibana-plugin-core-server.savedobjectsnamespacetype.md) \*or\* [\`namespaceType: 'multiple-isolated'\`](./kibana-plugin-core-server.savedobjectsnamespacetype.md)Example of a single-namespace type in 7.12: ```ts { name: 'foo', @@ -27,7 +27,6 @@ This is only internal for now, and will only be public when we expose the regist namespaceType: 'single', mappings: {...} } - ``` Example after converting to a multi-namespace (isolated) type in 8.0: ```ts @@ -38,7 +37,6 @@ Example after converting to a multi-namespace (isolated) type in 8.0: mappings: {...}, convertToMultiNamespaceTypeVersion: '8.0.0' } - ``` Example after converting to a multi-namespace (shareable) type in 8.1: ```ts @@ -49,15 +47,14 @@ Example after converting to a multi-namespace (shareable) type in 8.1: mappings: {...}, convertToMultiNamespaceTypeVersion: '8.0.0' } - ``` Note: migration function(s) can be optionally specified for any of these versions and will not interfere with the conversion process. | -| [excludeOnUpgrade](./kibana-plugin-core-server.savedobjectstype.excludeonupgrade.md) | SavedObjectTypeExcludeFromUpgradeFilterHook | If defined, allows a type to exclude unneeded documents from the migration process and effectively be deleted. See [SavedObjectTypeExcludeFromUpgradeFilterHook](./kibana-plugin-core-server.savedobjecttypeexcludefromupgradefilterhook.md) for more details. | -| [hidden](./kibana-plugin-core-server.savedobjectstype.hidden.md) | boolean | Is the type hidden by default. If true, repositories will not have access to this type unless explicitly declared as an extraType when creating the repository.See [createInternalRepository](./kibana-plugin-core-server.savedobjectsservicestart.createinternalrepository.md). | -| [indexPattern](./kibana-plugin-core-server.savedobjectstype.indexpattern.md) | string | If defined, the type instances will be stored in the given index instead of the default one. | -| [management](./kibana-plugin-core-server.savedobjectstype.management.md) | SavedObjectsTypeManagementDefinition<Attributes> | An optional [saved objects management section](./kibana-plugin-core-server.savedobjectstypemanagementdefinition.md) definition for the type. | -| [mappings](./kibana-plugin-core-server.savedobjectstype.mappings.md) | SavedObjectsTypeMappingDefinition | The [mapping definition](./kibana-plugin-core-server.savedobjectstypemappingdefinition.md) for the type. | -| [migrations](./kibana-plugin-core-server.savedobjectstype.migrations.md) | SavedObjectMigrationMap | (() => SavedObjectMigrationMap) | An optional map of [migrations](./kibana-plugin-core-server.savedobjectmigrationfn.md) or a function returning a map of [migrations](./kibana-plugin-core-server.savedobjectmigrationfn.md) to be used to migrate the type. | -| [name](./kibana-plugin-core-server.savedobjectstype.name.md) | string | The name of the type, which is also used as the internal id. | -| [namespaceType](./kibana-plugin-core-server.savedobjectstype.namespacetype.md) | SavedObjectsNamespaceType | The [namespace type](./kibana-plugin-core-server.savedobjectsnamespacetype.md) for the type. | +| [excludeOnUpgrade?](./kibana-plugin-core-server.savedobjectstype.excludeonupgrade.md) | SavedObjectTypeExcludeFromUpgradeFilterHook | (Optional) If defined, allows a type to exclude unneeded documents from the migration process and effectively be deleted. See [SavedObjectTypeExcludeFromUpgradeFilterHook](./kibana-plugin-core-server.savedobjecttypeexcludefromupgradefilterhook.md) for more details. | +| [hidden](./kibana-plugin-core-server.savedobjectstype.hidden.md) | boolean | Is the type hidden by default. If true, repositories will not have access to this type unless explicitly declared as an extraType when creating the repository.See [createInternalRepository](./kibana-plugin-core-server.savedobjectsservicestart.createinternalrepository.md). | +| [indexPattern?](./kibana-plugin-core-server.savedobjectstype.indexpattern.md) | string | (Optional) If defined, the type instances will be stored in the given index instead of the default one. | +| [management?](./kibana-plugin-core-server.savedobjectstype.management.md) | SavedObjectsTypeManagementDefinition<Attributes> | (Optional) An optional [saved objects management section](./kibana-plugin-core-server.savedobjectstypemanagementdefinition.md) definition for the type. | +| [mappings](./kibana-plugin-core-server.savedobjectstype.mappings.md) | SavedObjectsTypeMappingDefinition | The [mapping definition](./kibana-plugin-core-server.savedobjectstypemappingdefinition.md) for the type. | +| [migrations?](./kibana-plugin-core-server.savedobjectstype.migrations.md) | SavedObjectMigrationMap \| (() => SavedObjectMigrationMap) | (Optional) An optional map of [migrations](./kibana-plugin-core-server.savedobjectmigrationfn.md) or a function returning a map of [migrations](./kibana-plugin-core-server.savedobjectmigrationfn.md) to be used to migrate the type. | +| [name](./kibana-plugin-core-server.savedobjectstype.name.md) | string | The name of the type, which is also used as the internal id. | +| [namespaceType](./kibana-plugin-core-server.savedobjectstype.namespacetype.md) | SavedObjectsNamespaceType | The [namespace type](./kibana-plugin-core-server.savedobjectsnamespacetype.md) for the type. | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectstypemanagementdefinition.isexportable.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectstypemanagementdefinition.isexportable.md index fef178e1d984..c6dff6061099 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectstypemanagementdefinition.isexportable.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectstypemanagementdefinition.isexportable.md @@ -44,6 +44,5 @@ export class Plugin() { }); } } - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectstypemanagementdefinition.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectstypemanagementdefinition.md index 057eb6284bf9..eeda40cd5966 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectstypemanagementdefinition.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectstypemanagementdefinition.md @@ -16,15 +16,15 @@ export interface SavedObjectsTypeManagementDefinition | Property | Type | Description | | --- | --- | --- | -| [defaultSearchField](./kibana-plugin-core-server.savedobjectstypemanagementdefinition.defaultsearchfield.md) | string | The default search field to use for this type. Defaults to id. | -| [displayName](./kibana-plugin-core-server.savedobjectstypemanagementdefinition.displayname.md) | string | When specified, will be used instead of the type's name in SO management section's labels. | -| [getEditUrl](./kibana-plugin-core-server.savedobjectstypemanagementdefinition.getediturl.md) | (savedObject: SavedObject<Attributes>) => string | Function returning the url to use to redirect to the editing page of this object. If not defined, editing will not be allowed. | -| [getInAppUrl](./kibana-plugin-core-server.savedobjectstypemanagementdefinition.getinappurl.md) | (savedObject: SavedObject<Attributes>) => {
path: string;
uiCapabilitiesPath: string;
} | Function returning the url to use to redirect to this object from the management section. If not defined, redirecting to the object will not be allowed. | -| [getTitle](./kibana-plugin-core-server.savedobjectstypemanagementdefinition.gettitle.md) | (savedObject: SavedObject<Attributes>) => string | Function returning the title to display in the management table. If not defined, will use the object's type and id to generate a label. | -| [icon](./kibana-plugin-core-server.savedobjectstypemanagementdefinition.icon.md) | string | The eui icon name to display in the management table. If not defined, the default icon will be used. | -| [importableAndExportable](./kibana-plugin-core-server.savedobjectstypemanagementdefinition.importableandexportable.md) | boolean | Is the type importable or exportable. Defaults to false. | -| [isExportable](./kibana-plugin-core-server.savedobjectstypemanagementdefinition.isexportable.md) | SavedObjectsExportablePredicate<Attributes> | Optional hook to specify whether an object should be exportable.If specified, isExportable will be called during export for each of this type's objects in the export, and the ones not matching the predicate will be excluded from the export.When implementing both isExportable and onExport, it is mandatory that isExportable returns the same value for an object before and after going though the export transform. E.g isExportable(objectBeforeTransform) === isExportable(objectAfterTransform) | -| [onExport](./kibana-plugin-core-server.savedobjectstypemanagementdefinition.onexport.md) | SavedObjectsExportTransform<Attributes> | An optional export transform function that can be used transform the objects of the registered type during the export process.It can be used to either mutate the exported objects, or add additional objects (of any type) to the export list.See [the transform type documentation](./kibana-plugin-core-server.savedobjectsexporttransform.md) for more info and examples.When implementing both isExportable and onExport, it is mandatory that isExportable returns the same value for an object before and after going though the export transform. E.g isExportable(objectBeforeTransform) === isExportable(objectAfterTransform) | -| [onImport](./kibana-plugin-core-server.savedobjectstypemanagementdefinition.onimport.md) | SavedObjectsImportHook<Attributes> | An optional [import hook](./kibana-plugin-core-server.savedobjectsimporthook.md) to use when importing given type.Import hooks are executed during the savedObjects import process and allow to interact with the imported objects. See the [hook documentation](./kibana-plugin-core-server.savedobjectsimporthook.md) for more info. | -| [visibleInManagement](./kibana-plugin-core-server.savedobjectstypemanagementdefinition.visibleinmanagement.md) | boolean | When set to false, the type will not be listed or searchable in the SO management section. Main usage of setting this property to false for a type is when objects from the type should be included in the export via references or export hooks, but should not directly appear in the SOM. Defaults to true. | +| [defaultSearchField?](./kibana-plugin-core-server.savedobjectstypemanagementdefinition.defaultsearchfield.md) | string | (Optional) The default search field to use for this type. Defaults to id. | +| [displayName?](./kibana-plugin-core-server.savedobjectstypemanagementdefinition.displayname.md) | string | (Optional) When specified, will be used instead of the type's name in SO management section's labels. | +| [getEditUrl?](./kibana-plugin-core-server.savedobjectstypemanagementdefinition.getediturl.md) | (savedObject: SavedObject<Attributes>) => string | (Optional) Function returning the url to use to redirect to the editing page of this object. If not defined, editing will not be allowed. | +| [getInAppUrl?](./kibana-plugin-core-server.savedobjectstypemanagementdefinition.getinappurl.md) | (savedObject: SavedObject<Attributes>) => { path: string; uiCapabilitiesPath: string; } | (Optional) Function returning the url to use to redirect to this object from the management section. If not defined, redirecting to the object will not be allowed. | +| [getTitle?](./kibana-plugin-core-server.savedobjectstypemanagementdefinition.gettitle.md) | (savedObject: SavedObject<Attributes>) => string | (Optional) Function returning the title to display in the management table. If not defined, will use the object's type and id to generate a label. | +| [icon?](./kibana-plugin-core-server.savedobjectstypemanagementdefinition.icon.md) | string | (Optional) The eui icon name to display in the management table. If not defined, the default icon will be used. | +| [importableAndExportable?](./kibana-plugin-core-server.savedobjectstypemanagementdefinition.importableandexportable.md) | boolean | (Optional) Is the type importable or exportable. Defaults to false. | +| [isExportable?](./kibana-plugin-core-server.savedobjectstypemanagementdefinition.isexportable.md) | SavedObjectsExportablePredicate<Attributes> | (Optional) Optional hook to specify whether an object should be exportable.If specified, isExportable will be called during export for each of this type's objects in the export, and the ones not matching the predicate will be excluded from the export.When implementing both isExportable and onExport, it is mandatory that isExportable returns the same value for an object before and after going though the export transform. E.g isExportable(objectBeforeTransform) === isExportable(objectAfterTransform) | +| [onExport?](./kibana-plugin-core-server.savedobjectstypemanagementdefinition.onexport.md) | SavedObjectsExportTransform<Attributes> | (Optional) An optional export transform function that can be used transform the objects of the registered type during the export process.It can be used to either mutate the exported objects, or add additional objects (of any type) to the export list.See [the transform type documentation](./kibana-plugin-core-server.savedobjectsexporttransform.md) for more info and examples.When implementing both isExportable and onExport, it is mandatory that isExportable returns the same value for an object before and after going though the export transform. E.g isExportable(objectBeforeTransform) === isExportable(objectAfterTransform) | +| [onImport?](./kibana-plugin-core-server.savedobjectstypemanagementdefinition.onimport.md) | SavedObjectsImportHook<Attributes> | (Optional) An optional [import hook](./kibana-plugin-core-server.savedobjectsimporthook.md) to use when importing given type.Import hooks are executed during the savedObjects import process and allow to interact with the imported objects. See the [hook documentation](./kibana-plugin-core-server.savedobjectsimporthook.md) for more info. | +| [visibleInManagement?](./kibana-plugin-core-server.savedobjectstypemanagementdefinition.visibleinmanagement.md) | boolean | (Optional) When set to false, the type will not be listed or searchable in the SO management section. Main usage of setting this property to false for a type is when objects from the type should be included in the export via references or export hooks, but should not directly appear in the SOM. Defaults to true. | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectstypemanagementdefinition.onimport.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectstypemanagementdefinition.onimport.md index 332247b8eb8e..c54570d79a7e 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectstypemanagementdefinition.onimport.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectstypemanagementdefinition.onimport.md @@ -50,6 +50,5 @@ export class Plugin() { }); } } - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectstypemappingdefinition.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectstypemappingdefinition.md index 3d3b73880fa7..7f4c82c23e2c 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectstypemappingdefinition.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectstypemappingdefinition.md @@ -34,13 +34,12 @@ const typeDefinition: SavedObjectsTypeMappingDefinition = { }, } } - ``` ## Properties | Property | Type | Description | | --- | --- | --- | -| [dynamic](./kibana-plugin-core-server.savedobjectstypemappingdefinition.dynamic.md) | false | 'strict' | The dynamic property of the mapping, either false or 'strict'. If unspecified dynamic: 'strict' will be inherited from the top-level index mappings. | -| [properties](./kibana-plugin-core-server.savedobjectstypemappingdefinition.properties.md) | SavedObjectsMappingProperties | The underlying properties of the type mapping | +| [dynamic?](./kibana-plugin-core-server.savedobjectstypemappingdefinition.dynamic.md) | false \| 'strict' | (Optional) The dynamic property of the mapping, either false or 'strict'. If unspecified dynamic: 'strict' will be inherited from the top-level index mappings. | +| [properties](./kibana-plugin-core-server.savedobjectstypemappingdefinition.properties.md) | SavedObjectsMappingProperties | The underlying properties of the type mapping | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsupdateobjectsspacesobject.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsupdateobjectsspacesobject.md index 847e40a8896b..6fa04623c96a 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsupdateobjectsspacesobject.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsupdateobjectsspacesobject.md @@ -16,6 +16,6 @@ export interface SavedObjectsUpdateObjectsSpacesObject | Property | Type | Description | | --- | --- | --- | -| [id](./kibana-plugin-core-server.savedobjectsupdateobjectsspacesobject.id.md) | string | The type of the object to update | -| [type](./kibana-plugin-core-server.savedobjectsupdateobjectsspacesobject.type.md) | string | The ID of the object to update | +| [id](./kibana-plugin-core-server.savedobjectsupdateobjectsspacesobject.id.md) | string | The type of the object to update | +| [type](./kibana-plugin-core-server.savedobjectsupdateobjectsspacesobject.type.md) | string | The ID of the object to update | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsupdateobjectsspacesoptions.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsupdateobjectsspacesoptions.md index 49ee013c5d2d..b8f17699b184 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsupdateobjectsspacesoptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsupdateobjectsspacesoptions.md @@ -11,10 +11,11 @@ Options for the update operation. ```typescript export interface SavedObjectsUpdateObjectsSpacesOptions extends SavedObjectsBaseOptions ``` +Extends: SavedObjectsBaseOptions ## Properties | Property | Type | Description | | --- | --- | --- | -| [refresh](./kibana-plugin-core-server.savedobjectsupdateobjectsspacesoptions.refresh.md) | MutatingOperationRefreshSetting | The Elasticsearch Refresh setting for this operation | +| [refresh?](./kibana-plugin-core-server.savedobjectsupdateobjectsspacesoptions.refresh.md) | MutatingOperationRefreshSetting | (Optional) The Elasticsearch Refresh setting for this operation | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsupdateobjectsspacesresponse.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsupdateobjectsspacesresponse.md index bf53277887bd..aff67e0c54e6 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsupdateobjectsspacesresponse.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsupdateobjectsspacesresponse.md @@ -16,5 +16,5 @@ export interface SavedObjectsUpdateObjectsSpacesResponse | Property | Type | Description | | --- | --- | --- | -| [objects](./kibana-plugin-core-server.savedobjectsupdateobjectsspacesresponse.objects.md) | SavedObjectsUpdateObjectsSpacesResponseObject[] | | +| [objects](./kibana-plugin-core-server.savedobjectsupdateobjectsspacesresponse.objects.md) | SavedObjectsUpdateObjectsSpacesResponseObject\[\] | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsupdateobjectsspacesresponseobject.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsupdateobjectsspacesresponseobject.md index 03802278ee5a..5078473e9e6b 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsupdateobjectsspacesresponseobject.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsupdateobjectsspacesresponseobject.md @@ -16,8 +16,8 @@ export interface SavedObjectsUpdateObjectsSpacesResponseObject | Property | Type | Description | | --- | --- | --- | -| [error](./kibana-plugin-core-server.savedobjectsupdateobjectsspacesresponseobject.error.md) | SavedObjectError | Included if there was an error updating this object's spaces | -| [id](./kibana-plugin-core-server.savedobjectsupdateobjectsspacesresponseobject.id.md) | string | The ID of the referenced object | -| [spaces](./kibana-plugin-core-server.savedobjectsupdateobjectsspacesresponseobject.spaces.md) | string[] | The space(s) that the referenced object exists in | -| [type](./kibana-plugin-core-server.savedobjectsupdateobjectsspacesresponseobject.type.md) | string | The type of the referenced object | +| [error?](./kibana-plugin-core-server.savedobjectsupdateobjectsspacesresponseobject.error.md) | SavedObjectError | (Optional) Included if there was an error updating this object's spaces | +| [id](./kibana-plugin-core-server.savedobjectsupdateobjectsspacesresponseobject.id.md) | string | The ID of the referenced object | +| [spaces](./kibana-plugin-core-server.savedobjectsupdateobjectsspacesresponseobject.spaces.md) | string\[\] | The space(s) that the referenced object exists in | +| [type](./kibana-plugin-core-server.savedobjectsupdateobjectsspacesresponseobject.type.md) | string | The type of the referenced object | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsupdateoptions.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsupdateoptions.md index 3111c1c8e65f..b81a59c745e7 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsupdateoptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsupdateoptions.md @@ -10,13 +10,14 @@ ```typescript export interface SavedObjectsUpdateOptions extends SavedObjectsBaseOptions ``` +Extends: SavedObjectsBaseOptions ## Properties | Property | Type | Description | | --- | --- | --- | -| [references](./kibana-plugin-core-server.savedobjectsupdateoptions.references.md) | SavedObjectReference[] | A reference to another saved object. | -| [refresh](./kibana-plugin-core-server.savedobjectsupdateoptions.refresh.md) | MutatingOperationRefreshSetting | The Elasticsearch Refresh setting for this operation | -| [upsert](./kibana-plugin-core-server.savedobjectsupdateoptions.upsert.md) | Attributes | If specified, will be used to perform an upsert if the document doesn't exist | -| [version](./kibana-plugin-core-server.savedobjectsupdateoptions.version.md) | string | An opaque version number which changes on each successful write operation. Can be used for implementing optimistic concurrency control. | +| [references?](./kibana-plugin-core-server.savedobjectsupdateoptions.references.md) | SavedObjectReference\[\] | (Optional) A reference to another saved object. | +| [refresh?](./kibana-plugin-core-server.savedobjectsupdateoptions.refresh.md) | MutatingOperationRefreshSetting | (Optional) The Elasticsearch Refresh setting for this operation | +| [upsert?](./kibana-plugin-core-server.savedobjectsupdateoptions.upsert.md) | Attributes | (Optional) If specified, will be used to perform an upsert if the document doesn't exist | +| [version?](./kibana-plugin-core-server.savedobjectsupdateoptions.version.md) | string | (Optional) An opaque version number which changes on each successful write operation. Can be used for implementing optimistic concurrency control. | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsupdateresponse.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsupdateresponse.md index d8130830eb1f..5c773d92c636 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsupdateresponse.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsupdateresponse.md @@ -10,11 +10,12 @@ ```typescript export interface SavedObjectsUpdateResponse extends Omit, 'attributes' | 'references'> ``` +Extends: Omit<SavedObject<T>, 'attributes' \| 'references'> ## Properties | Property | Type | Description | | --- | --- | --- | -| [attributes](./kibana-plugin-core-server.savedobjectsupdateresponse.attributes.md) | Partial<T> | | -| [references](./kibana-plugin-core-server.savedobjectsupdateresponse.references.md) | SavedObjectReference[] | undefined | | +| [attributes](./kibana-plugin-core-server.savedobjectsupdateresponse.attributes.md) | Partial<T> | | +| [references](./kibana-plugin-core-server.savedobjectsupdateresponse.references.md) | SavedObjectReference\[\] \| undefined | | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsutils.generateid.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsutils.generateid.md index f09518448499..887f2fb5d9fe 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsutils.generateid.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsutils.generateid.md @@ -13,5 +13,5 @@ static generateId(): string; ``` Returns: -`string` +string diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsutils.getconvertedobjectid.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsutils.getconvertedobjectid.md index c6a429d345ed..502d9dcab8cf 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsutils.getconvertedobjectid.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsutils.getconvertedobjectid.md @@ -16,13 +16,13 @@ static getConvertedObjectId(namespace: string | undefined, type: string, id: str | Parameter | Type | Description | | --- | --- | --- | -| namespace | string | undefined | | -| type | string | | -| id | string | | +| namespace | string \| undefined | The namespace of the saved object before it is converted. | +| type | string | The type of the saved object before it is converted. | +| id | string | The ID of the saved object before it is converted. | Returns: -`string` +string {string} The ID of the saved object after it is converted. diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsutils.israndomid.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsutils.israndomid.md index 5a44321ee060..75db00c44965 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsutils.israndomid.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsutils.israndomid.md @@ -16,9 +16,9 @@ static isRandomId(id: string | undefined): boolean; | Parameter | Type | Description | | --- | --- | --- | -| id | string | undefined | | +| id | string \| undefined | The ID of a saved object. Use uuid.validate once upgraded to v5.3+ | Returns: -`boolean` +boolean diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsutils.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsutils.md index ab6382aca6a5..9a8c5cf9889b 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsutils.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsutils.md @@ -15,9 +15,9 @@ export declare class SavedObjectsUtils | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [createEmptyFindResponse](./kibana-plugin-core-server.savedobjectsutils.createemptyfindresponse.md) | static | <T, A>({ page, perPage, }: SavedObjectsFindOptions) => SavedObjectsFindResponse<T, A> | Creates an empty response for a find operation. This is only intended to be used by saved objects client wrappers. | -| [namespaceIdToString](./kibana-plugin-core-server.savedobjectsutils.namespaceidtostring.md) | static | (namespace?: string | undefined) => string | Converts a given saved object namespace ID to its string representation. All namespace IDs have an identical string representation, with the exception of the undefined namespace ID (which has a namespace string of 'default'). | -| [namespaceStringToId](./kibana-plugin-core-server.savedobjectsutils.namespacestringtoid.md) | static | (namespace: string) => string | undefined | Converts a given saved object namespace string to its ID representation. All namespace strings have an identical ID representation, with the exception of the 'default' namespace string (which has a namespace ID of undefined). | +| [createEmptyFindResponse](./kibana-plugin-core-server.savedobjectsutils.createemptyfindresponse.md) | static | <T, A>({ page, perPage, }: SavedObjectsFindOptions) => SavedObjectsFindResponse<T, A> | Creates an empty response for a find operation. This is only intended to be used by saved objects client wrappers. | +| [namespaceIdToString](./kibana-plugin-core-server.savedobjectsutils.namespaceidtostring.md) | static | (namespace?: string \| undefined) => string | Converts a given saved object namespace ID to its string representation. All namespace IDs have an identical string representation, with the exception of the undefined namespace ID (which has a namespace string of 'default'). | +| [namespaceStringToId](./kibana-plugin-core-server.savedobjectsutils.namespacestringtoid.md) | static | (namespace: string) => string \| undefined | Converts a given saved object namespace string to its ID representation. All namespace strings have an identical ID representation, with the exception of the 'default' namespace string (which has a namespace ID of undefined). | ## Methods diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.getalltypes.md b/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.getalltypes.md index 20d631ff74ac..7e4733f89295 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.getalltypes.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.getalltypes.md @@ -15,5 +15,5 @@ getAllTypes(): SavedObjectsType[]; ``` Returns: -`SavedObjectsType[]` +SavedObjectsType<any>\[\] diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.getimportableandexportabletypes.md b/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.getimportableandexportabletypes.md index 1e29e632a6ec..a20360128406 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.getimportableandexportabletypes.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.getimportableandexportabletypes.md @@ -13,5 +13,5 @@ getImportableAndExportableTypes(): SavedObjectsType[]; ``` Returns: -`SavedObjectsType[]` +SavedObjectsType<any>\[\] diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.getindex.md b/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.getindex.md index dca43c48ec46..9da28c7f0127 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.getindex.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.getindex.md @@ -16,9 +16,9 @@ getIndex(type: string): string | undefined; | Parameter | Type | Description | | --- | --- | --- | -| type | string | | +| type | string | | Returns: -`string | undefined` +string \| undefined diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.gettype.md b/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.gettype.md index 160aadb73cce..d6fc255958c8 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.gettype.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.gettype.md @@ -16,9 +16,9 @@ getType(type: string): SavedObjectsType | undefined; | Parameter | Type | Description | | --- | --- | --- | -| type | string | | +| type | string | | Returns: -`SavedObjectsType | undefined` +SavedObjectsType<any> \| undefined diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.getvisibletypes.md b/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.getvisibletypes.md index 05f22dcf7010..9588e77e646f 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.getvisibletypes.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.getvisibletypes.md @@ -15,5 +15,5 @@ getVisibleTypes(): SavedObjectsType[]; ``` Returns: -`SavedObjectsType[]` +SavedObjectsType<any>\[\] diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.ishidden.md b/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.ishidden.md index aa19fa9b4364..2d29e753218d 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.ishidden.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.ishidden.md @@ -16,9 +16,9 @@ isHidden(type: string): boolean; | Parameter | Type | Description | | --- | --- | --- | -| type | string | | +| type | string | | Returns: -`boolean` +boolean diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.isimportableandexportable.md b/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.isimportableandexportable.md index aeefc207da4f..8487af6a5891 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.isimportableandexportable.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.isimportableandexportable.md @@ -16,9 +16,9 @@ isImportableAndExportable(type: string): boolean; | Parameter | Type | Description | | --- | --- | --- | -| type | string | | +| type | string | | Returns: -`boolean` +boolean diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.ismultinamespace.md b/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.ismultinamespace.md index 0ff07ae2804f..d4ec6de2392d 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.ismultinamespace.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.ismultinamespace.md @@ -16,9 +16,9 @@ isMultiNamespace(type: string): boolean; | Parameter | Type | Description | | --- | --- | --- | -| type | string | | +| type | string | | Returns: -`boolean` +boolean diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.isnamespaceagnostic.md b/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.isnamespaceagnostic.md index 859c7b971181..d6eca4981f7a 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.isnamespaceagnostic.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.isnamespaceagnostic.md @@ -16,9 +16,9 @@ isNamespaceAgnostic(type: string): boolean; | Parameter | Type | Description | | --- | --- | --- | -| type | string | | +| type | string | | Returns: -`boolean` +boolean diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.isshareable.md b/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.isshareable.md index ee240268f9d6..0b67992e5308 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.isshareable.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.isshareable.md @@ -16,9 +16,9 @@ isShareable(type: string): boolean; | Parameter | Type | Description | | --- | --- | --- | -| type | string | | +| type | string | | Returns: -`boolean` +boolean diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.issinglenamespace.md b/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.issinglenamespace.md index 18146b2fd6ea..d1db00d0c816 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.issinglenamespace.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.issinglenamespace.md @@ -16,9 +16,9 @@ isSingleNamespace(type: string): boolean; | Parameter | Type | Description | | --- | --- | --- | -| type | string | | +| type | string | | Returns: -`boolean` +boolean diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.registertype.md b/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.registertype.md index 7108805852c8..c0442e2aaa4c 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.registertype.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjecttyperegistry.registertype.md @@ -16,9 +16,9 @@ registerType(type: SavedObjectsType): void; | Parameter | Type | Description | | --- | --- | --- | -| type | SavedObjectsType | | +| type | SavedObjectsType | | Returns: -`void` +void diff --git a/docs/development/core/server/kibana-plugin-core-server.searchresponse.md b/docs/development/core/server/kibana-plugin-core-server.searchresponse.md index cbaab4632014..7deca96e4054 100644 --- a/docs/development/core/server/kibana-plugin-core-server.searchresponse.md +++ b/docs/development/core/server/kibana-plugin-core-server.searchresponse.md @@ -15,11 +15,11 @@ export interface SearchResponse | Property | Type | Description | | --- | --- | --- | -| [\_scroll\_id](./kibana-plugin-core-server.searchresponse._scroll_id.md) | string | | -| [\_shards](./kibana-plugin-core-server.searchresponse._shards.md) | ShardsResponse | | -| [aggregations](./kibana-plugin-core-server.searchresponse.aggregations.md) | any | | -| [hits](./kibana-plugin-core-server.searchresponse.hits.md) | {
total: number;
max_score: number;
hits: Array<{
_index: string;
_type: string;
_id: string;
_score: number;
_source: T;
_version?: number;
_explanation?: Explanation;
fields?: any;
highlight?: any;
inner_hits?: any;
matched_queries?: string[];
sort?: unknown[];
}>;
} | | -| [pit\_id](./kibana-plugin-core-server.searchresponse.pit_id.md) | string | | -| [timed\_out](./kibana-plugin-core-server.searchresponse.timed_out.md) | boolean | | -| [took](./kibana-plugin-core-server.searchresponse.took.md) | number | | +| [\_scroll\_id?](./kibana-plugin-core-server.searchresponse._scroll_id.md) | string | (Optional) | +| [\_shards](./kibana-plugin-core-server.searchresponse._shards.md) | ShardsResponse | | +| [aggregations?](./kibana-plugin-core-server.searchresponse.aggregations.md) | any | (Optional) | +| [hits](./kibana-plugin-core-server.searchresponse.hits.md) | { total: number; max\_score: number; hits: Array<{ \_index: string; \_type: string; \_id: string; \_score: number; \_source: T; \_version?: number; \_explanation?: Explanation; fields?: any; highlight?: any; inner\_hits?: any; matched\_queries?: string\[\]; sort?: unknown\[\]; }>; } | | +| [pit\_id?](./kibana-plugin-core-server.searchresponse.pit_id.md) | string | (Optional) | +| [timed\_out](./kibana-plugin-core-server.searchresponse.timed_out.md) | boolean | | +| [took](./kibana-plugin-core-server.searchresponse.took.md) | number | | diff --git a/docs/development/core/server/kibana-plugin-core-server.servicestatus.md b/docs/development/core/server/kibana-plugin-core-server.servicestatus.md index d35fc951c57f..5c04cb33a752 100644 --- a/docs/development/core/server/kibana-plugin-core-server.servicestatus.md +++ b/docs/development/core/server/kibana-plugin-core-server.servicestatus.md @@ -16,9 +16,9 @@ export interface ServiceStatus | unknown = unkn | Property | Type | Description | | --- | --- | --- | -| [detail](./kibana-plugin-core-server.servicestatus.detail.md) | string | A more detailed description of the service status. | -| [documentationUrl](./kibana-plugin-core-server.servicestatus.documentationurl.md) | string | A URL to open in a new tab about how to resolve or troubleshoot the problem. | -| [level](./kibana-plugin-core-server.servicestatus.level.md) | ServiceStatusLevel | The current availability level of the service. | -| [meta](./kibana-plugin-core-server.servicestatus.meta.md) | Meta | Any JSON-serializable data to be included in the HTTP API response. Useful for providing more fine-grained, machine-readable information about the service status. May include status information for underlying features. | -| [summary](./kibana-plugin-core-server.servicestatus.summary.md) | string | A high-level summary of the service status. | +| [detail?](./kibana-plugin-core-server.servicestatus.detail.md) | string | (Optional) A more detailed description of the service status. | +| [documentationUrl?](./kibana-plugin-core-server.servicestatus.documentationurl.md) | string | (Optional) A URL to open in a new tab about how to resolve or troubleshoot the problem. | +| [level](./kibana-plugin-core-server.servicestatus.level.md) | ServiceStatusLevel | The current availability level of the service. | +| [meta?](./kibana-plugin-core-server.servicestatus.meta.md) | Meta | (Optional) Any JSON-serializable data to be included in the HTTP API response. Useful for providing more fine-grained, machine-readable information about the service status. May include status information for underlying features. | +| [summary](./kibana-plugin-core-server.servicestatus.summary.md) | string | A high-level summary of the service status. | diff --git a/docs/development/core/server/kibana-plugin-core-server.sessioncookievalidationresult.md b/docs/development/core/server/kibana-plugin-core-server.sessioncookievalidationresult.md index 0c190c4819b5..6c1a5e7af78a 100644 --- a/docs/development/core/server/kibana-plugin-core-server.sessioncookievalidationresult.md +++ b/docs/development/core/server/kibana-plugin-core-server.sessioncookievalidationresult.md @@ -16,6 +16,6 @@ export interface SessionCookieValidationResult | Property | Type | Description | | --- | --- | --- | -| [isValid](./kibana-plugin-core-server.sessioncookievalidationresult.isvalid.md) | boolean | Whether the cookie is valid or not. | -| [path](./kibana-plugin-core-server.sessioncookievalidationresult.path.md) | string | The "Path" attribute of the cookie; if the cookie is invalid, this is used to clear it. | +| [isValid](./kibana-plugin-core-server.sessioncookievalidationresult.isvalid.md) | boolean | Whether the cookie is valid or not. | +| [path?](./kibana-plugin-core-server.sessioncookievalidationresult.path.md) | string | (Optional) The "Path" attribute of the cookie; if the cookie is invalid, this is used to clear it. | diff --git a/docs/development/core/server/kibana-plugin-core-server.sessionstorage.clear.md b/docs/development/core/server/kibana-plugin-core-server.sessionstorage.clear.md index 731050a48807..ac34c9b17be8 100644 --- a/docs/development/core/server/kibana-plugin-core-server.sessionstorage.clear.md +++ b/docs/development/core/server/kibana-plugin-core-server.sessionstorage.clear.md @@ -13,5 +13,5 @@ clear(): void; ``` Returns: -`void` +void diff --git a/docs/development/core/server/kibana-plugin-core-server.sessionstorage.get.md b/docs/development/core/server/kibana-plugin-core-server.sessionstorage.get.md index 4e4b2d9aa21c..9e867b9e0fcc 100644 --- a/docs/development/core/server/kibana-plugin-core-server.sessionstorage.get.md +++ b/docs/development/core/server/kibana-plugin-core-server.sessionstorage.get.md @@ -13,5 +13,5 @@ get(): Promise; ``` Returns: -`Promise` +Promise<T \| null> diff --git a/docs/development/core/server/kibana-plugin-core-server.sessionstorage.set.md b/docs/development/core/server/kibana-plugin-core-server.sessionstorage.set.md index 15a4d9ec7594..a17aadf8fb98 100644 --- a/docs/development/core/server/kibana-plugin-core-server.sessionstorage.set.md +++ b/docs/development/core/server/kibana-plugin-core-server.sessionstorage.set.md @@ -16,9 +16,9 @@ set(sessionValue: T): void; | Parameter | Type | Description | | --- | --- | --- | -| sessionValue | T | value to put | +| sessionValue | T | value to put | Returns: -`void` +void diff --git a/docs/development/core/server/kibana-plugin-core-server.sessionstoragecookieoptions.md b/docs/development/core/server/kibana-plugin-core-server.sessionstoragecookieoptions.md index b5dad1111735..425daf32f5cb 100644 --- a/docs/development/core/server/kibana-plugin-core-server.sessionstoragecookieoptions.md +++ b/docs/development/core/server/kibana-plugin-core-server.sessionstoragecookieoptions.md @@ -16,9 +16,9 @@ export interface SessionStorageCookieOptions | Property | Type | Description | | --- | --- | --- | -| [encryptionKey](./kibana-plugin-core-server.sessionstoragecookieoptions.encryptionkey.md) | string | A key used to encrypt a cookie's value. Should be at least 32 characters long. | -| [isSecure](./kibana-plugin-core-server.sessionstoragecookieoptions.issecure.md) | boolean | Flag indicating whether the cookie should be sent only via a secure connection. | -| [name](./kibana-plugin-core-server.sessionstoragecookieoptions.name.md) | string | Name of the session cookie. | -| [sameSite](./kibana-plugin-core-server.sessionstoragecookieoptions.samesite.md) | 'Strict' | 'Lax' | 'None' | Defines SameSite attribute of the Set-Cookie Header. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite | -| [validate](./kibana-plugin-core-server.sessionstoragecookieoptions.validate.md) | (sessionValue: T | T[]) => SessionCookieValidationResult | Function called to validate a cookie's decrypted value. | +| [encryptionKey](./kibana-plugin-core-server.sessionstoragecookieoptions.encryptionkey.md) | string | A key used to encrypt a cookie's value. Should be at least 32 characters long. | +| [isSecure](./kibana-plugin-core-server.sessionstoragecookieoptions.issecure.md) | boolean | Flag indicating whether the cookie should be sent only via a secure connection. | +| [name](./kibana-plugin-core-server.sessionstoragecookieoptions.name.md) | string | Name of the session cookie. | +| [sameSite?](./kibana-plugin-core-server.sessionstoragecookieoptions.samesite.md) | 'Strict' \| 'Lax' \| 'None' | (Optional) Defines SameSite attribute of the Set-Cookie Header. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite | +| [validate](./kibana-plugin-core-server.sessionstoragecookieoptions.validate.md) | (sessionValue: T \| T\[\]) => SessionCookieValidationResult | Function called to validate a cookie's decrypted value. | diff --git a/docs/development/core/server/kibana-plugin-core-server.sessionstoragefactory.md b/docs/development/core/server/kibana-plugin-core-server.sessionstoragefactory.md index 848558291eb0..7bdea28beeda 100644 --- a/docs/development/core/server/kibana-plugin-core-server.sessionstoragefactory.md +++ b/docs/development/core/server/kibana-plugin-core-server.sessionstoragefactory.md @@ -16,5 +16,5 @@ export interface SessionStorageFactory | Property | Type | Description | | --- | --- | --- | -| [asScoped](./kibana-plugin-core-server.sessionstoragefactory.asscoped.md) | (request: KibanaRequest) => SessionStorage<T> | | +| [asScoped](./kibana-plugin-core-server.sessionstoragefactory.asscoped.md) | (request: KibanaRequest) => SessionStorage<T> | | diff --git a/docs/development/core/server/kibana-plugin-core-server.shardsinfo.md b/docs/development/core/server/kibana-plugin-core-server.shardsinfo.md index 9eafe3792c14..6c006c020d3f 100644 --- a/docs/development/core/server/kibana-plugin-core-server.shardsinfo.md +++ b/docs/development/core/server/kibana-plugin-core-server.shardsinfo.md @@ -15,8 +15,8 @@ export interface ShardsInfo | Property | Type | Description | | --- | --- | --- | -| [failed](./kibana-plugin-core-server.shardsinfo.failed.md) | number | | -| [skipped](./kibana-plugin-core-server.shardsinfo.skipped.md) | number | | -| [successful](./kibana-plugin-core-server.shardsinfo.successful.md) | number | | -| [total](./kibana-plugin-core-server.shardsinfo.total.md) | number | | +| [failed](./kibana-plugin-core-server.shardsinfo.failed.md) | number | | +| [skipped](./kibana-plugin-core-server.shardsinfo.skipped.md) | number | | +| [successful](./kibana-plugin-core-server.shardsinfo.successful.md) | number | | +| [total](./kibana-plugin-core-server.shardsinfo.total.md) | number | | diff --git a/docs/development/core/server/kibana-plugin-core-server.shardsresponse.md b/docs/development/core/server/kibana-plugin-core-server.shardsresponse.md index 722ffd8efdb5..65e113f05212 100644 --- a/docs/development/core/server/kibana-plugin-core-server.shardsresponse.md +++ b/docs/development/core/server/kibana-plugin-core-server.shardsresponse.md @@ -15,8 +15,8 @@ export interface ShardsResponse | Property | Type | Description | | --- | --- | --- | -| [failed](./kibana-plugin-core-server.shardsresponse.failed.md) | number | | -| [skipped](./kibana-plugin-core-server.shardsresponse.skipped.md) | number | | -| [successful](./kibana-plugin-core-server.shardsresponse.successful.md) | number | | -| [total](./kibana-plugin-core-server.shardsresponse.total.md) | number | | +| [failed](./kibana-plugin-core-server.shardsresponse.failed.md) | number | | +| [skipped](./kibana-plugin-core-server.shardsresponse.skipped.md) | number | | +| [successful](./kibana-plugin-core-server.shardsresponse.successful.md) | number | | +| [total](./kibana-plugin-core-server.shardsresponse.total.md) | number | | diff --git a/docs/development/core/server/kibana-plugin-core-server.statusservicesetup.md b/docs/development/core/server/kibana-plugin-core-server.statusservicesetup.md index f522d11a7ffe..5409772c369c 100644 --- a/docs/development/core/server/kibana-plugin-core-server.statusservicesetup.md +++ b/docs/development/core/server/kibana-plugin-core-server.statusservicesetup.md @@ -30,7 +30,6 @@ core.status.set( }) ; ); ); - ``` ## Example 2 @@ -64,18 +63,17 @@ core.status.set( }) ) ); - ``` ## Properties | Property | Type | Description | | --- | --- | --- | -| [core$](./kibana-plugin-core-server.statusservicesetup.core_.md) | Observable<CoreStatus> | Current status for all Core services. | -| [dependencies$](./kibana-plugin-core-server.statusservicesetup.dependencies_.md) | Observable<Record<string, ServiceStatus>> | Current status for all plugins this plugin depends on. Each key of the Record is a plugin id. | -| [derivedStatus$](./kibana-plugin-core-server.statusservicesetup.derivedstatus_.md) | Observable<ServiceStatus> | The status of this plugin as derived from its dependencies. | -| [isStatusPageAnonymous](./kibana-plugin-core-server.statusservicesetup.isstatuspageanonymous.md) | () => boolean | Whether or not the status HTTP APIs are available to unauthenticated users when an authentication provider is present. | -| [overall$](./kibana-plugin-core-server.statusservicesetup.overall_.md) | Observable<ServiceStatus> | Overall system status for all of Kibana. | +| [core$](./kibana-plugin-core-server.statusservicesetup.core_.md) | Observable<CoreStatus> | Current status for all Core services. | +| [dependencies$](./kibana-plugin-core-server.statusservicesetup.dependencies_.md) | Observable<Record<string, ServiceStatus>> | Current status for all plugins this plugin depends on. Each key of the Record is a plugin id. | +| [derivedStatus$](./kibana-plugin-core-server.statusservicesetup.derivedstatus_.md) | Observable<ServiceStatus> | The status of this plugin as derived from its dependencies. | +| [isStatusPageAnonymous](./kibana-plugin-core-server.statusservicesetup.isstatuspageanonymous.md) | () => boolean | Whether or not the status HTTP APIs are available to unauthenticated users when an authentication provider is present. | +| [overall$](./kibana-plugin-core-server.statusservicesetup.overall_.md) | Observable<ServiceStatus> | Overall system status for all of Kibana. | ## Methods diff --git a/docs/development/core/server/kibana-plugin-core-server.statusservicesetup.set.md b/docs/development/core/server/kibana-plugin-core-server.statusservicesetup.set.md index bf08ca1682f3..b60319e19529 100644 --- a/docs/development/core/server/kibana-plugin-core-server.statusservicesetup.set.md +++ b/docs/development/core/server/kibana-plugin-core-server.statusservicesetup.set.md @@ -16,11 +16,11 @@ set(status$: Observable): void; | Parameter | Type | Description | | --- | --- | --- | -| status$ | Observable<ServiceStatus> | | +| status$ | Observable<ServiceStatus> | | Returns: -`void` +void ## Remarks diff --git a/docs/development/core/server/kibana-plugin-core-server.uisettingsparams.md b/docs/development/core/server/kibana-plugin-core-server.uisettingsparams.md index c0da909cfe5e..531a0e75c97b 100644 --- a/docs/development/core/server/kibana-plugin-core-server.uisettingsparams.md +++ b/docs/development/core/server/kibana-plugin-core-server.uisettingsparams.md @@ -16,18 +16,18 @@ export interface UiSettingsParams | Property | Type | Description | | --- | --- | --- | -| [category](./kibana-plugin-core-server.uisettingsparams.category.md) | string[] | used to group the configured setting in the UI | -| [deprecation](./kibana-plugin-core-server.uisettingsparams.deprecation.md) | DeprecationSettings | optional deprecation information. Used to generate a deprecation warning. | -| [description](./kibana-plugin-core-server.uisettingsparams.description.md) | string | description provided to a user in UI | -| [metric](./kibana-plugin-core-server.uisettingsparams.metric.md) | {
type: UiCounterMetricType;
name: string;
} | Metric to track once this property changes | -| [name](./kibana-plugin-core-server.uisettingsparams.name.md) | string | title in the UI | -| [optionLabels](./kibana-plugin-core-server.uisettingsparams.optionlabels.md) | Record<string, string> | text labels for 'select' type UI element | -| [options](./kibana-plugin-core-server.uisettingsparams.options.md) | string[] | array of permitted values for this setting | -| [order](./kibana-plugin-core-server.uisettingsparams.order.md) | number | index of the settings within its category (ascending order, smallest will be displayed first). Used for ordering in the UI. settings without order defined will be displayed last and ordered by name | -| [readonly](./kibana-plugin-core-server.uisettingsparams.readonly.md) | boolean | a flag indicating that value cannot be changed | -| [requiresPageReload](./kibana-plugin-core-server.uisettingsparams.requirespagereload.md) | boolean | a flag indicating whether new value applying requires page reloading | -| [schema](./kibana-plugin-core-server.uisettingsparams.schema.md) | Type<T> | | -| [sensitive](./kibana-plugin-core-server.uisettingsparams.sensitive.md) | boolean | a flag indicating that value might contain user sensitive data. used by telemetry to mask the value of the setting when sent. | -| [type](./kibana-plugin-core-server.uisettingsparams.type.md) | UiSettingsType | defines a type of UI element [UiSettingsType](./kibana-plugin-core-server.uisettingstype.md) | -| [value](./kibana-plugin-core-server.uisettingsparams.value.md) | T | default value to fall back to if a user doesn't provide any | +| [category?](./kibana-plugin-core-server.uisettingsparams.category.md) | string\[\] | (Optional) used to group the configured setting in the UI | +| [deprecation?](./kibana-plugin-core-server.uisettingsparams.deprecation.md) | DeprecationSettings | (Optional) optional deprecation information. Used to generate a deprecation warning. | +| [description?](./kibana-plugin-core-server.uisettingsparams.description.md) | string | (Optional) description provided to a user in UI | +| [metric?](./kibana-plugin-core-server.uisettingsparams.metric.md) | { type: UiCounterMetricType; name: string; } | (Optional) Metric to track once this property changes | +| [name?](./kibana-plugin-core-server.uisettingsparams.name.md) | string | (Optional) title in the UI | +| [optionLabels?](./kibana-plugin-core-server.uisettingsparams.optionlabels.md) | Record<string, string> | (Optional) text labels for 'select' type UI element | +| [options?](./kibana-plugin-core-server.uisettingsparams.options.md) | string\[\] | (Optional) array of permitted values for this setting | +| [order?](./kibana-plugin-core-server.uisettingsparams.order.md) | number | (Optional) index of the settings within its category (ascending order, smallest will be displayed first). Used for ordering in the UI. settings without order defined will be displayed last and ordered by name | +| [readonly?](./kibana-plugin-core-server.uisettingsparams.readonly.md) | boolean | (Optional) a flag indicating that value cannot be changed | +| [requiresPageReload?](./kibana-plugin-core-server.uisettingsparams.requirespagereload.md) | boolean | (Optional) a flag indicating whether new value applying requires page reloading | +| [schema](./kibana-plugin-core-server.uisettingsparams.schema.md) | Type<T> | | +| [sensitive?](./kibana-plugin-core-server.uisettingsparams.sensitive.md) | boolean | (Optional) a flag indicating that value might contain user sensitive data. used by telemetry to mask the value of the setting when sent. | +| [type?](./kibana-plugin-core-server.uisettingsparams.type.md) | UiSettingsType | (Optional) defines a type of UI element [UiSettingsType](./kibana-plugin-core-server.uisettingstype.md) | +| [value?](./kibana-plugin-core-server.uisettingsparams.value.md) | T | (Optional) default value to fall back to if a user doesn't provide any | diff --git a/docs/development/core/server/kibana-plugin-core-server.uisettingsservicesetup.register.md b/docs/development/core/server/kibana-plugin-core-server.uisettingsservicesetup.register.md index 24bfc32cb113..97b06ddb00e7 100644 --- a/docs/development/core/server/kibana-plugin-core-server.uisettingsservicesetup.register.md +++ b/docs/development/core/server/kibana-plugin-core-server.uisettingsservicesetup.register.md @@ -16,11 +16,11 @@ register(settings: Record): void; | Parameter | Type | Description | | --- | --- | --- | -| settings | Record<string, UiSettingsParams> | | +| settings | Record<string, UiSettingsParams> | | Returns: -`void` +void ## Example @@ -35,6 +35,5 @@ setup(core: CoreSetup){ }, }]); } - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.uisettingsservicestart.asscopedtoclient.md b/docs/development/core/server/kibana-plugin-core-server.uisettingsservicestart.asscopedtoclient.md index 1703df00a5e7..1d76bc26a415 100644 --- a/docs/development/core/server/kibana-plugin-core-server.uisettingsservicestart.asscopedtoclient.md +++ b/docs/development/core/server/kibana-plugin-core-server.uisettingsservicestart.asscopedtoclient.md @@ -18,11 +18,11 @@ asScopedToClient(savedObjectsClient: SavedObjectsClientContract): IUiSettingsCli | Parameter | Type | Description | | --- | --- | --- | -| savedObjectsClient | SavedObjectsClientContract | | +| savedObjectsClient | SavedObjectsClientContract | | Returns: -`IUiSettingsClient` +IUiSettingsClient ## Example @@ -32,6 +32,5 @@ start(core: CoreStart) { const soClient = core.savedObjects.getScopedClient(arbitraryRequest); const uiSettingsClient = core.uiSettings.asScopedToClient(soClient); } - ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.userprovidedvalues.md b/docs/development/core/server/kibana-plugin-core-server.userprovidedvalues.md index eddfcb456826..fe8aaf233fbf 100644 --- a/docs/development/core/server/kibana-plugin-core-server.userprovidedvalues.md +++ b/docs/development/core/server/kibana-plugin-core-server.userprovidedvalues.md @@ -16,6 +16,6 @@ export interface UserProvidedValues | Property | Type | Description | | --- | --- | --- | -| [isOverridden](./kibana-plugin-core-server.userprovidedvalues.isoverridden.md) | boolean | | -| [userValue](./kibana-plugin-core-server.userprovidedvalues.uservalue.md) | T | | +| [isOverridden?](./kibana-plugin-core-server.userprovidedvalues.isoverridden.md) | boolean | (Optional) | +| [userValue?](./kibana-plugin-core-server.userprovidedvalues.uservalue.md) | T | (Optional) | diff --git a/docs/user/production-considerations/security-production-considerations.asciidoc b/docs/user/production-considerations/security-production-considerations.asciidoc index a23911375639..0a7a3988f1c7 100644 --- a/docs/user/production-considerations/security-production-considerations.asciidoc +++ b/docs/user/production-considerations/security-production-considerations.asciidoc @@ -17,7 +17,10 @@ For more information on {kib}'s security controls, see <>. +parties. See +{ref}/security-basic-setup-https.html#encrypt-kibana-http[encrypt HTTP client communications for {kib}]. + +encrypt-kibana-http [float] [[configuring-kibana-shield]] diff --git a/docs/user/security/securing-communications/elasticsearch-mutual-tls.asciidoc b/docs/user/security/securing-communications/elasticsearch-mutual-tls.asciidoc index 57ecb1705e00..1bc1f579ecbc 100644 --- a/docs/user/security/securing-communications/elasticsearch-mutual-tls.asciidoc +++ b/docs/user/security/securing-communications/elasticsearch-mutual-tls.asciidoc @@ -5,36 +5,42 @@ Mutual TLS with {es} ++++ -Secure Sockets Layer (SSL) and Transport Layer Security (TLS) provide encryption for data-in-transit. While these terms are often used -interchangeably, {kib} supports only TLS, which supersedes the old SSL protocols. - -TLS requires X.509 certificates to authenticate the communicating parties and perform encryption of data-in-transit. Each certificate -contains a public key and has and an associated -- but separate -- private key; these keys are used for cryptographic operations. {kib} -supports certificates and private keys in PEM or PKCS#12 format. - -In a standard TLS configuration, the server presents a signed certificate to authenticate itself to the client. In a mutual TLS -configuration, the client also presents a signed certificate to authenticate itself to the server. - -When {es} {security-features} is enabled on your cluster, each request that {kib} (the client) makes to {es} (the server) must be -authenticated. Most requests made by end users through {kib} to {es} are authenticated by using the credentials of the logged-in user. There -are, however, a few internal requests that {kib} needs to make to {es}. For this reason, you must configure credentials for {kib} to use for -those requests. - -If {kib} has `elasticsearch.username` and `elasticsearch.password` configured, it will attempt to use these to authenticate to {es} via the -{ref}/native-realm.html[native realm]. However, {kib} also supports mutual TLS authentication with {es} via a {ref}/pki-realm.html[Public -Key Infrastructure (PKI) realm]. To do so, {es} needs to verify the signature on the {kib} client certificate, and it also needs to map the -client certificate's distinguished name (DN) to the appropriate `kibana_system` role. - -NOTE: Using a PKI realm is a gold feature. For a comparison of the Elastic license levels, see https://www.elastic.co/subscriptions[the -subscription page]. - -To configure {kib} and {es} to use mutual TLS authentication: - -. <>. - -. <>. -+ -This entails generating a "server certificate" for {es} to use on the HTTP layer. +Secure Sockets Layer (SSL) and Transport Layer Security (TLS) provide encryption +for data-in-transit. While these terms are often used interchangeably, {kib} +supports only TLS, which supersedes the old SSL protocols. + +TLS requires X.509 certificates to authenticate the communicating parties and +perform encryption of data-in-transit. Each certificate contains a public key +and has and an associated -- but separate -- private key; these keys are used +for cryptographic operations. {kib} supports certificates and private keys in +PEM or PKCS#12 format. + +In a standard TLS configuration, the server presents a signed certificate to +authenticate itself to the client. In a mutual TLS configuration, the client +also presents a signed certificate to authenticate itself to the server. + +{es} {security-features} are enabled on your cluster by default, so each request +that {kib} (the client) makes to {es} (the server) is authenticated. Most +requests made by end users through {kib} to {es} are authenticated by using the +credentials of the logged-in user. + +To {ref}/configuring-stack-security.html#stack-start-with-security[enroll {kib} with an {es} cluster], you pass a generated enrollment token. This token +configures {kib} to authenticate with {es} using a +{ref}/service-accounts.html#service-accounts-tokens[service account token]. +{kib} also supports mutual TLS authentication with {es} via a +{ref}/pki-realm.html[Public Key Infrastructure (PKI) realm]. With this setup, +{es} needs to verify the signature on the {kib} client certificate, and it also +needs to map the client certificate's distinguished name (DN) to the appropriate +`kibana_system` role. + +NOTE: Using a PKI realm is a gold feature. For a comparison of the Elastic +license levels, see https://www.elastic.co/subscriptions[the subscription page]. + +[discrete] +==== Configure {kib} and {es} to use mutual TLS authentication + +If you haven't already, start {kib} and connect it to {es} using the +{ref}/configuring-stack-security.html#stack-start-with-security[enrollment token]. . Obtain a client certificate and private key for {kib}. + @@ -43,15 +49,14 @@ This entails generating a "server certificate" for {es} to use on the HTTP layer NOTE: This is not the same as the <> that {kib} will present to web browsers. -You may choose to generate a client certificate and private key using the {ref}/certutil.html[`elasticsearch-certutil`] tool. If you -followed the {es} documentation for {ref}/configuring-tls.html#node-certificates[generating node certificates], then you likely have already -set up a certificate authority (CA) to sign the {es} server certificate. You may choose to use the same CA to sign the {kib} client -certificate. For example: +You may choose to generate a client certificate and private key using the {ref}/certutil.html[`elasticsearch-certutil`] tool. If you followed the {es} documentation for {ref}/security-basic-setup.html#generate-certificates[generating the certificates authority], then you already have a certificate authority (CA) to sign +the {es} server certificate. You may choose to use the same CA to sign the {kib} +client certificate. For example: [source,sh] --------------------------------------------------------------------------------- +---- bin/elasticsearch-certutil cert -ca elastic-stack-ca.p12 -name kibana-client -dns --------------------------------------------------------------------------------- +---- This will generate a client certificate and private key in a PKCS#12 file named `kibana-client.p12`. In this example, the client certificate has a Common Name (CN) of `"kibana-client"` and a subject alternative name (SAN) of `""`. The SAN may be required if @@ -67,9 +72,9 @@ If you followed the instructions to generate a client certificate, then you will certificate chain from this file. For example: [source,sh] --------------------------------------------------------------------------------- +---- openssl pkcs12 -in kibana-client.p12 -cacerts -nokeys -out kibana-ca.crt --------------------------------------------------------------------------------- +---- This will produce a PEM-formatted file named `kibana-ca.crt` that contains the CA certificate from the PKCS#12 file. -- @@ -81,11 +86,11 @@ By default, {es} provides a native realm for authenticating with a username and and a native realm (for end users), you must configure each realm in `elasticsearch.yml`: [source,yaml] --------------------------------------------------------------------------------- +---- xpack.security.authc.realms.pki.realm1.order: 1 xpack.security.authc.realms.pki.realm1.certificate_authorities: "/path/to/kibana-ca.crt" xpack.security.authc.realms.native.realm2.order: 2 --------------------------------------------------------------------------------- +---- -- . Configure {es} to request client certificates. @@ -95,9 +100,9 @@ By default, {es} will not request a client certificate when establishing a TLS c certificate authentication in `elasticsearch.yml`: [source,yaml] --------------------------------------------------------------------------------- +---- xpack.security.http.ssl.client_authentication: "optional" --------------------------------------------------------------------------------- +---- -- . Restart {es}. @@ -124,16 +129,16 @@ You need to specify the information required to access your client certificate a Specify your PKCS#12 file in `kibana.yml`: [source,yaml] --------------------------------------------------------------------------------- +---- elasticsearch.ssl.keystore.path: "/path/to/kibana-client.p12" --------------------------------------------------------------------------------- +---- If your PKCS#12 file is encrypted, add the decryption password to your <>: [source,yaml] --------------------------------------------------------------------------------- +---- bin/kibana-keystore add elasticsearch.ssl.keystore.password --------------------------------------------------------------------------------- +---- TIP: If your PKCS#12 file isn't protected with a password, depending on how it was generated, you may need to set `elasticsearch.ssl.keystore.password` to an empty string. @@ -145,17 +150,17 @@ TIP: If your PKCS#12 file isn't protected with a password, depending on how it w Specify your certificate and private key in `kibana.yml`: [source,yaml] --------------------------------------------------------------------------------- +---- elasticsearch.ssl.certificate: "/path/to/kibana-client.crt" elasticsearch.ssl.key: "/path/to/kibana-client.key" --------------------------------------------------------------------------------- +---- If your private key is encrypted, add the decryption password to your <>: [source,yaml] --------------------------------------------------------------------------------- +---- bin/kibana-keystore add elasticsearch.ssl.keyPassphrase --------------------------------------------------------------------------------- +---- -- . Configure {kib} _not_ to use a username and password for {es}. diff --git a/docs/user/security/securing-communications/index.asciidoc b/docs/user/security/securing-communications/index.asciidoc deleted file mode 100644 index ac014f7abe52..000000000000 --- a/docs/user/security/securing-communications/index.asciidoc +++ /dev/null @@ -1,16 +0,0 @@ -[[configuring-tls-communication]] -=== Encrypt communications in {kib} -++++ -Encrypt communications -++++ - -Secure Sockets Layer (SSL) and Transport Layer Security (TLS) provide encryption for data-in-transit. While these terms are often used -interchangeably, {kib} supports only TLS, which supersedes the old SSL protocols. - -Browsers send traffic to {kib} and {kib} sends traffic to {es}. These communication channels are configured separately to use TLS. - -TLS requires X.509 certificates to authenticate the communicating parties and perform encryption of data-in-transit. Each certificate -contains a public key and has an associated -- but separate -- private key; these keys are used for cryptographic operations. {kib} -supports certificates and private keys in PEM or PKCS#12 format. - -See {ref}/security-basic-setup-https.html[Set up basic security for the Elastic Stack] to encrypt HTTP communications for {es} and {kib}. \ No newline at end of file diff --git a/docs/user/security/securing-kibana.asciidoc b/docs/user/security/securing-kibana.asciidoc index bdb36a6fe117..875830ab88b4 100644 --- a/docs/user/security/securing-kibana.asciidoc +++ b/docs/user/security/securing-kibana.asciidoc @@ -5,42 +5,25 @@ Configure security ++++ -{kib} users have to log in when {stack-security-features} are enabled on your -cluster. You configure roles for your {kib} users to control what data those -users can access. +When you start {es} for the first time, {stack-security-features} are enabled on +your cluster and TLS is configured automatically. The security configuration +process generates a password for the `elastic` user and an enrollment token for +{kib}. +{ref}/configuring-stack-security.html[Start the {stack} with security enabled] +and then enroll {kib} as part of the configuration process. -Most requests made through {kib} to {es} are authenticated by using the -credentials of the logged-in user. There are, however, a few internal requests -that the {kib} server needs to make to the {es} cluster. For this reason, you -must configure credentials for the {kib} server to use for those requests. +You can then log in to {kib} as the `elastic` user to create additional roles +and users. -With {security-features} enabled, if you load a {kib} dashboard that accesses -data in an index that you are not authorized to view, you get an error that -indicates the index does not exist. The {security-features} do not currently -provide a way to control which users can load which dashboards. +NOTE: When a user is not authorized to view data in an index (such as an {es} +index), the entire index will be inaccessible and not display in {kib}. -To use {kib} with {security-features}: +[discrete] +[[security-configure-settings]] +=== Configure security settings -. {ref}/configuring-security.html[Configure security in {es}]. - -. Configure {kib} to use the appropriate built-in user. -+ --- -Update the following settings in the `kibana.yml` configuration -file: - -[source,yaml] ------------------------------------------------ -elasticsearch.username: "kibana_system" -elasticsearch.password: "kibanapassword" ------------------------------------------------ - -The {kib} server submits requests as this user to access the cluster monitoring -APIs and the `.kibana` index. The server does _not_ need access to user indices. - -NOTE: The password for the built-in `kibana_system` user is typically set as part of the security configuration process on {es}. For more -information, see {ref}/built-in-users.html[Built-in users]. --- +Set an encryption key so that sessions are not invalidated. You can optionally +configure additional security settings and authentication. . Set the `xpack.security.encryptionKey` property in the `kibana.yml` configuration file. You can use any text string that is 32 characters or longer @@ -48,36 +31,33 @@ as the encryption key. + -- [source,yaml] --------------------------------------------------------------------------------- +---- xpack.security.encryptionKey: "something_at_least_32_characters" --------------------------------------------------------------------------------- +---- For more information, see <>. -- -. Configure {kib}'s session expiration settings. Set both the idle timeout and lifespan settings: -+ --- -[source,yaml] --------------------------------------------------------------------------------- -xpack.security.session.idleTimeout: "1h" -xpack.security.session.lifespan: "30d" --------------------------------------------------------------------------------- - -For more information, see <>. --- - -. Optional: <>. +. Optional: <>. . Optional: <>. . Restart {kib}. -. Temporarily log in to {kib} using the built-in `elastic` superuser so you can create new users and assign roles. If you are running {kib} -locally, go to `https://localhost:5601` to view the login page. +[discrete] +[[security-create-roles]] +=== Create roles and users +Configure roles for your {kib} users to control what data those users can +access. + +. Temporarily log in to {kib} using the built-in `elastic` superuser so you can +create new users and assign roles. If you are running {kib} locally, go to +`https://localhost:5601` to view the login page. + -NOTE: The password for the built-in `elastic` user is typically set as part of the security configuration process on {es}. For more -information, see {ref}/built-in-users.html[Built-in users]. +NOTE: The password for the built-in `elastic` user is generated as part of the +security configuration process on {es}. If you need to reset the password for +the `elastic` user or other built-in users, run the +{ref}/reset-password.html[`elasticsearch-reset-password`] tool. . [[kibana-roles]]Create roles and users to grant access to {kib}. + @@ -120,7 +100,6 @@ NOTE: This must be a user who has been assigned <=2.0.0 <4.0.0", "@types/selenium-webdriver": "^4.0.15", "@types/semver": "^7", diff --git a/packages/kbn-apm-config-loader/src/config.test.ts b/packages/kbn-apm-config-loader/src/config.test.ts index 60d773e3a420..b0beebfefd6b 100644 --- a/packages/kbn-apm-config-loader/src/config.test.ts +++ b/packages/kbn-apm-config-loader/src/config.test.ts @@ -21,7 +21,7 @@ describe('ApmConfiguration', () => { beforeEach(() => { // start with an empty env to avoid CI from spoiling snapshots, env is unique for each jest file process.env = {}; - + devConfigMock.raw = {}; packageMock.raw = { version: '8.0.0', build: { @@ -86,10 +86,11 @@ describe('ApmConfiguration', () => { let config = new ApmConfiguration(mockedRootDir, {}, false); expect(config.getConfig('serviceName')).toMatchInlineSnapshot(` Object { - "active": false, + "active": true, "breakdownMetrics": true, "captureSpanStackTraces": false, "centralConfig": false, + "contextPropagationOnly": true, "environment": "development", "globalLabels": Object {}, "logUncaughtExceptions": true, @@ -105,12 +106,13 @@ describe('ApmConfiguration', () => { config = new ApmConfiguration(mockedRootDir, {}, true); expect(config.getConfig('serviceName')).toMatchInlineSnapshot(` Object { - "active": false, + "active": true, "breakdownMetrics": false, "captureBody": "off", "captureHeaders": false, "captureSpanStackTraces": false, "centralConfig": false, + "contextPropagationOnly": true, "environment": "development", "globalLabels": Object { "git_rev": "sha", @@ -162,13 +164,12 @@ describe('ApmConfiguration', () => { it('does not load the configuration from the dev config in distributable', () => { devConfigMock.raw = { - active: true, - serverUrl: 'https://dev-url.co', + active: false, }; const config = new ApmConfiguration(mockedRootDir, {}, true); expect(config.getConfig('serviceName')).toEqual( expect.objectContaining({ - active: false, + active: true, }) ); }); @@ -224,4 +225,130 @@ describe('ApmConfiguration', () => { }) ); }); + + describe('contextPropagationOnly', () => { + it('sets "active: true" and "contextPropagationOnly: true" by default', () => { + expect(new ApmConfiguration(mockedRootDir, {}, false).getConfig('serviceName')).toEqual( + expect.objectContaining({ + active: true, + contextPropagationOnly: true, + }) + ); + + expect(new ApmConfiguration(mockedRootDir, {}, true).getConfig('serviceName')).toEqual( + expect.objectContaining({ + active: true, + contextPropagationOnly: true, + }) + ); + }); + + it('value from config overrides the default', () => { + const kibanaConfig = { + elastic: { + apm: { + active: false, + contextPropagationOnly: false, + }, + }, + }; + + expect( + new ApmConfiguration(mockedRootDir, kibanaConfig, false).getConfig('serviceName') + ).toEqual( + expect.objectContaining({ + active: false, + contextPropagationOnly: false, + }) + ); + + expect( + new ApmConfiguration(mockedRootDir, kibanaConfig, true).getConfig('serviceName') + ).toEqual( + expect.objectContaining({ + active: false, + contextPropagationOnly: false, + }) + ); + }); + + it('is "false" if "active: true" configured and "contextPropagationOnly" is not specified', () => { + const kibanaConfig = { + elastic: { + apm: { + active: true, + }, + }, + }; + + expect( + new ApmConfiguration(mockedRootDir, kibanaConfig, false).getConfig('serviceName') + ).toEqual( + expect.objectContaining({ + active: true, + contextPropagationOnly: false, + }) + ); + + expect( + new ApmConfiguration(mockedRootDir, kibanaConfig, true).getConfig('serviceName') + ).toEqual( + expect.objectContaining({ + active: true, + contextPropagationOnly: false, + }) + ); + }); + + it('throws if "active: false" set without configuring "contextPropagationOnly: false"', () => { + const kibanaConfig = { + elastic: { + apm: { + active: false, + }, + }, + }; + + expect(() => + new ApmConfiguration(mockedRootDir, kibanaConfig, false).getConfig('serviceName') + ).toThrowErrorMatchingInlineSnapshot( + `"APM is disabled, but context propagation is enabled. Please disable context propagation with contextPropagationOnly:false"` + ); + + expect(() => + new ApmConfiguration(mockedRootDir, kibanaConfig, true).getConfig('serviceName') + ).toThrowErrorMatchingInlineSnapshot( + `"APM is disabled, but context propagation is enabled. Please disable context propagation with contextPropagationOnly:false"` + ); + }); + + it('does not throw if "active: false" and "contextPropagationOnly: false" configured', () => { + const kibanaConfig = { + elastic: { + apm: { + active: false, + contextPropagationOnly: false, + }, + }, + }; + + expect( + new ApmConfiguration(mockedRootDir, kibanaConfig, false).getConfig('serviceName') + ).toEqual( + expect.objectContaining({ + active: false, + contextPropagationOnly: false, + }) + ); + + expect( + new ApmConfiguration(mockedRootDir, kibanaConfig, true).getConfig('serviceName') + ).toEqual( + expect.objectContaining({ + active: false, + contextPropagationOnly: false, + }) + ); + }); + }); }); diff --git a/packages/kbn-apm-config-loader/src/config.ts b/packages/kbn-apm-config-loader/src/config.ts index 999e4ce3a680..ecafcbd7e326 100644 --- a/packages/kbn-apm-config-loader/src/config.ts +++ b/packages/kbn-apm-config-loader/src/config.ts @@ -16,7 +16,8 @@ import type { AgentConfigOptions } from 'elastic-apm-node'; // https://www.elastic.co/guide/en/apm/agent/nodejs/current/configuration.html const DEFAULT_CONFIG: AgentConfigOptions = { - active: false, + active: true, + contextPropagationOnly: true, environment: 'development', logUncaughtExceptions: true, globalLabels: {}, @@ -71,6 +72,8 @@ export class ApmConfiguration { private getBaseConfig() { if (!this.baseConfig) { + const configFromSources = this.getConfigFromAllSources(); + this.baseConfig = merge( { serviceVersion: this.kibanaVersion, @@ -79,9 +82,7 @@ export class ApmConfiguration { this.getUuidConfig(), this.getGitConfig(), this.getCiConfig(), - this.getConfigFromKibanaConfig(), - this.getDevConfig(), - this.getConfigFromEnv() + configFromSources ); /** @@ -114,6 +115,12 @@ export class ApmConfiguration { config.active = true; } + if (process.env.ELASTIC_APM_CONTEXT_PROPAGATION_ONLY === 'true') { + config.contextPropagationOnly = true; + } else if (process.env.ELASTIC_APM_CONTEXT_PROPAGATION_ONLY === 'false') { + config.contextPropagationOnly = false; + } + if (process.env.ELASTIC_APM_ENVIRONMENT || process.env.NODE_ENV) { config.environment = process.env.ELASTIC_APM_ENVIRONMENT || process.env.NODE_ENV; } @@ -249,4 +256,28 @@ export class ApmConfiguration { return {}; } } + + /** + * Reads APM configuration from different sources and merges them together. + */ + private getConfigFromAllSources(): AgentConfigOptions { + const config = merge( + {}, + this.getConfigFromKibanaConfig(), + this.getDevConfig(), + this.getConfigFromEnv() + ); + + if (config.active === false && config.contextPropagationOnly !== false) { + throw new Error( + 'APM is disabled, but context propagation is enabled. Please disable context propagation with contextPropagationOnly:false' + ); + } + + if (config.active === true) { + config.contextPropagationOnly = config.contextPropagationOnly ?? false; + } + + return config; + } } diff --git a/packages/kbn-es-archiver/BUILD.bazel b/packages/kbn-es-archiver/BUILD.bazel index 90c63f82b72f..2dc311ed7440 100644 --- a/packages/kbn-es-archiver/BUILD.bazel +++ b/packages/kbn-es-archiver/BUILD.bazel @@ -34,7 +34,6 @@ RUNTIME_DEPS = [ "//packages/kbn-utils", "@npm//@elastic/elasticsearch", "@npm//aggregate-error", - "@npm//bluebird", "@npm//chance", "@npm//globby", "@npm//json-stable-stringify", @@ -51,7 +50,6 @@ TYPES_DEPS = [ "@npm//aggregate-error", "@npm//globby", "@npm//zlib", - "@npm//@types/bluebird", "@npm//@types/chance", "@npm//@types/jest", "@npm//@types/json-stable-stringify", diff --git a/packages/kbn-es-archiver/src/actions/rebuild_all.ts b/packages/kbn-es-archiver/src/actions/rebuild_all.ts index f286f9719bdf..360fdb438f2d 100644 --- a/packages/kbn-es-archiver/src/actions/rebuild_all.ts +++ b/packages/kbn-es-archiver/src/actions/rebuild_all.ts @@ -7,9 +7,9 @@ */ import { resolve, relative } from 'path'; -import { stat, Stats, rename, createReadStream, createWriteStream } from 'fs'; +import { Stats, createReadStream, createWriteStream } from 'fs'; +import { stat, rename } from 'fs/promises'; import { Readable, Writable } from 'stream'; -import { fromNode } from 'bluebird'; import { ToolingLog, REPO_ROOT } from '@kbn/dev-utils'; import { createPromiseFromStreams } from '@kbn/utils'; import { @@ -21,7 +21,7 @@ import { } from '../lib'; async function isDirectory(path: string): Promise { - const stats: Stats = await fromNode((cb) => stat(path, cb)); + const stats: Stats = await stat(path); return stats.isDirectory(); } @@ -50,7 +50,7 @@ export async function rebuildAllAction({ dataDir, log }: { dataDir: string; log: createWriteStream(tempFile), ] as [Readable, ...Writable[]]); - await fromNode((cb) => rename(tempFile, childPath, cb)); + await rename(tempFile, childPath); log.info('[%s] Rebuilt %j', archiveName, childName); } } diff --git a/packages/kbn-es-archiver/src/lib/directory.ts b/packages/kbn-es-archiver/src/lib/directory.ts index f82e59a0ed25..2ff5b7e704ed 100644 --- a/packages/kbn-es-archiver/src/lib/directory.ts +++ b/packages/kbn-es-archiver/src/lib/directory.ts @@ -6,10 +6,9 @@ * Side Public License, v 1. */ -import { readdir } from 'fs'; -import { fromNode } from 'bluebird'; +import { readdir } from 'fs/promises'; export async function readDirectory(path: string) { - const allNames = await fromNode((cb) => readdir(path, cb)); + const allNames = await readdir(path); return allNames.filter((name) => !name.startsWith('.')); } diff --git a/packages/kbn-logging/src/log_record.ts b/packages/kbn-logging/src/log_record.ts index 22931a67a823..a212a50b8c98 100644 --- a/packages/kbn-logging/src/log_record.ts +++ b/packages/kbn-logging/src/log_record.ts @@ -6,7 +6,8 @@ * Side Public License, v 1. */ -import { LogLevel } from './log_level'; +import type { LogLevel } from './log_level'; +import type { LogMeta } from './log_meta'; /** * Essential parts of every log message. @@ -18,6 +19,9 @@ export interface LogRecord { context: string; message: string; error?: Error; - meta?: { [name: string]: any }; + meta?: LogMeta; pid: number; + spanId?: string; + traceId?: string; + transactionId?: string; } diff --git a/packages/kbn-test/src/functional_test_runner/integration_tests/__fixtures__/failure_hooks/config.js b/packages/kbn-test/src/functional_test_runner/integration_tests/__fixtures__/failure_hooks/config.js index 0b9cfd88b4cb..1375e5a3df2f 100644 --- a/packages/kbn-test/src/functional_test_runner/integration_tests/__fixtures__/failure_hooks/config.js +++ b/packages/kbn-test/src/functional_test_runner/integration_tests/__fixtures__/failure_hooks/config.js @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { delay } from 'bluebird'; +import { setTimeout as setTimeoutAsync } from 'timers/promises'; export default function () { return { @@ -22,13 +22,13 @@ export default function () { lifecycle.testFailure.add(async (err, test) => { log.info('testFailure %s %s', err.message, test.fullTitle()); - await delay(10); + await setTimeoutAsync(10); log.info('testFailureAfterDelay %s %s', err.message, test.fullTitle()); }); lifecycle.testHookFailure.add(async (err, test) => { log.info('testHookFailure %s %s', err.message, test.fullTitle()); - await delay(10); + await setTimeoutAsync(10); log.info('testHookFailureAfterDelay %s %s', err.message, test.fullTitle()); }); }, diff --git a/packages/kbn-test/src/jest/setup/polyfills.js b/packages/kbn-test/src/jest/setup/polyfills.js index 48b597d280b4..ebe6178dbdd9 100644 --- a/packages/kbn-test/src/jest/setup/polyfills.js +++ b/packages/kbn-test/src/jest/setup/polyfills.js @@ -6,13 +6,6 @@ * Side Public License, v 1. */ -// bluebird < v3.3.5 does not work with MutationObserver polyfill -// when MutationObserver exists, bluebird avoids using node's builtin async schedulers -const bluebird = require('bluebird'); -bluebird.Promise.setScheduler(function (fn) { - global.setImmediate.call(global, fn); -}); - const MutationObserver = require('mutation-observer'); Object.defineProperty(window, 'MutationObserver', { value: MutationObserver }); diff --git a/packages/kbn-test/src/jest/utils/testbed/index.ts b/packages/kbn-test/src/jest/utils/testbed/index.ts index dfa5f011853c..0e839c180b6b 100644 --- a/packages/kbn-test/src/jest/utils/testbed/index.ts +++ b/packages/kbn-test/src/jest/utils/testbed/index.ts @@ -7,4 +7,12 @@ */ export { registerTestBed } from './testbed'; -export type { TestBed, TestBedConfig, SetupFunc, UnwrapPromise } from './types'; +export type { + TestBed, + TestBedConfig, + AsyncTestBedConfig, + SetupFunc, + UnwrapPromise, + SyncSetupFunc, + AsyncSetupFunc, +} from './types'; diff --git a/packages/kbn-test/src/jest/utils/testbed/testbed.ts b/packages/kbn-test/src/jest/utils/testbed/testbed.ts index 472b9f2df939..240ec25a9c29 100644 --- a/packages/kbn-test/src/jest/utils/testbed/testbed.ts +++ b/packages/kbn-test/src/jest/utils/testbed/testbed.ts @@ -16,7 +16,14 @@ import { mountComponentAsync, getJSXComponentWithProps, } from './mount_component'; -import { TestBedConfig, TestBed, SetupFunc } from './types'; +import { + TestBedConfig, + AsyncTestBedConfig, + TestBed, + SetupFunc, + SyncSetupFunc, + AsyncSetupFunc, +} from './types'; const defaultConfig: TestBedConfig = { defaultProps: {}, @@ -48,10 +55,18 @@ const defaultConfig: TestBedConfig = { }); ``` */ -export const registerTestBed = ( +export function registerTestBed( + Component: ComponentType, + config: AsyncTestBedConfig +): AsyncSetupFunc; +export function registerTestBed( Component: ComponentType, config?: TestBedConfig -): SetupFunc => { +): SyncSetupFunc; +export function registerTestBed( + Component: ComponentType, + config?: AsyncTestBedConfig | TestBedConfig +): SetupFunc { const { defaultProps = defaultConfig.defaultProps, memoryRouter = defaultConfig.memoryRouter!, @@ -188,7 +203,7 @@ export const registerTestBed = ( value, isAsync = false ) => { - const formInput = typeof input === 'string' ? find(input) : (input as ReactWrapper); + const formInput = typeof input === 'string' ? find(input) : input; if (!formInput.length) { throw new Error(`Input "${input}" was not found.`); @@ -207,7 +222,7 @@ export const registerTestBed = ( value, doUpdateComponent = true ) => { - const formSelect = typeof select === 'string' ? find(select) : (select as ReactWrapper); + const formSelect = typeof select === 'string' ? find(select) : select; if (!formSelect.length) { throw new Error(`Select "${select}" was not found.`); @@ -314,7 +329,7 @@ export const registerTestBed = ( router.history.push(url); }; - return { + const testBed: TestBed = { component, exists, find, @@ -336,8 +351,10 @@ export const registerTestBed = ( navigateTo, }, }; + + return testBed; } }; return setup; -}; +} diff --git a/packages/kbn-test/src/jest/utils/testbed/types.ts b/packages/kbn-test/src/jest/utils/testbed/types.ts index bba504951c0b..121b848e51b5 100644 --- a/packages/kbn-test/src/jest/utils/testbed/types.ts +++ b/packages/kbn-test/src/jest/utils/testbed/types.ts @@ -7,10 +7,13 @@ */ import { Store } from 'redux'; -import { ReactWrapper } from 'enzyme'; +import { ReactWrapper as GenericReactWrapper } from 'enzyme'; import { LocationDescriptor } from 'history'; +export type AsyncSetupFunc = (props?: any) => Promise>; +export type SyncSetupFunc = (props?: any) => TestBed; export type SetupFunc = (props?: any) => TestBed | Promise>; +export type ReactWrapper = GenericReactWrapper; export interface EuiTableMetaData { /** Array of rows of the table. Each row exposes its reactWrapper and its columns */ @@ -51,7 +54,7 @@ export interface TestBed { find('myForm.nameInput'); ``` */ - find: (testSubject: T, reactWrapper?: ReactWrapper) => ReactWrapper; + find: (testSubject: T, reactWrapper?: ReactWrapper) => ReactWrapper; /** * Update the props of the mounted component * @@ -147,15 +150,23 @@ export interface TestBed { }; } -export interface TestBedConfig { +export interface BaseTestBedConfig { /** The default props to pass to the mounted component. */ defaultProps?: Record; /** Configuration object for the react-router `MemoryRouter. */ memoryRouter?: MemoryRouterConfig; /** An optional redux store. You can also provide a function that returns a store. */ store?: (() => Store) | Store | null; +} + +export interface AsyncTestBedConfig extends BaseTestBedConfig { + /* Mount the component asynchronously. When using "hooked" components with _useEffect()_ calls, you need to set this to "true". */ + doMountAsync: true; +} + +export interface TestBedConfig extends BaseTestBedConfig { /* Mount the component asynchronously. When using "hooked" components with _useEffect()_ calls, you need to set this to "true". */ - doMountAsync?: boolean; + doMountAsync?: false; } export interface MemoryRouterConfig { diff --git a/packages/kbn-test/src/mocha/junit_report_generation.test.js b/packages/kbn-test/src/mocha/junit_report_generation.test.js index e4e4499f556f..c19550349fd8 100644 --- a/packages/kbn-test/src/mocha/junit_report_generation.test.js +++ b/packages/kbn-test/src/mocha/junit_report_generation.test.js @@ -7,9 +7,9 @@ */ import { resolve } from 'path'; -import { readFileSync } from 'fs'; +import { readFile } from 'fs/promises'; +import { promisify } from 'util'; -import { fromNode as fcb } from 'bluebird'; import { parseString } from 'xml2js'; import del from 'del'; import Mocha from 'mocha'; @@ -22,6 +22,8 @@ const DURATION_REGEX = /^\d+\.\d{3}$/; const ISO_DATE_SEC_REGEX = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/; const XML_PATH = getUniqueJunitReportPath(PROJECT_DIR, 'test'); +const parseStringAsync = promisify(parseString); + describe('dev/mocha/junit report generation', () => { afterEach(() => { del.sync(resolve(PROJECT_DIR, 'target')); @@ -39,7 +41,7 @@ describe('dev/mocha/junit report generation', () => { mocha.addFile(resolve(PROJECT_DIR, 'test.js')); await new Promise((resolve) => mocha.run(resolve)); - const report = await fcb((cb) => parseString(readFileSync(XML_PATH), cb)); + const report = await parseStringAsync(await readFile(XML_PATH)); // test case results are wrapped in expect(report).toEqual({ diff --git a/packages/kbn-utils/src/streams/map_stream.test.ts b/packages/kbn-utils/src/streams/map_stream.test.ts index 2c3df67fdf35..94c01d04f7dc 100644 --- a/packages/kbn-utils/src/streams/map_stream.test.ts +++ b/packages/kbn-utils/src/streams/map_stream.test.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { delay } from 'bluebird'; +import { setTimeout as setTimeoutAsync } from 'timers/promises'; import { createPromiseFromStreams } from './promise_from_streams'; import { createListStream } from './list_stream'; @@ -39,7 +39,7 @@ describe('createMapStream()', () => { const result = await createPromiseFromStreams([ createListStream([1, 2, 3]), createMapStream(async (n: number, i: number) => { - await delay(n); + await setTimeoutAsync(n); return n * i; }), createConcatStream([]), diff --git a/src/core/public/doc_links/doc_links_service.ts b/src/core/public/doc_links/doc_links_service.ts index 41bf27c7706a..ee4e50627074 100644 --- a/src/core/public/doc_links/doc_links_service.ts +++ b/src/core/public/doc_links/doc_links_service.ts @@ -118,6 +118,7 @@ export class DocLinksService { range: `${ELASTICSEARCH_DOCS}search-aggregations-bucket-range-aggregation.html`, significant_terms: `${ELASTICSEARCH_DOCS}search-aggregations-bucket-significantterms-aggregation.html`, terms: `${ELASTICSEARCH_DOCS}search-aggregations-bucket-terms-aggregation.html`, + terms_doc_count_error: `${ELASTICSEARCH_DOCS}search-aggregations-bucket-terms-aggregation.html#_per_bucket_document_count_error`, avg: `${ELASTICSEARCH_DOCS}search-aggregations-metrics-avg-aggregation.html`, avg_bucket: `${ELASTICSEARCH_DOCS}search-aggregations-pipeline-avg-bucket-aggregation.html`, max_bucket: `${ELASTICSEARCH_DOCS}search-aggregations-pipeline-max-bucket-aggregation.html`, @@ -613,6 +614,7 @@ export interface DocLinksStart { readonly range: string; readonly significant_terms: string; readonly terms: string; + readonly terms_doc_count_error: string; readonly avg: string; readonly avg_bucket: string; readonly max_bucket: string; diff --git a/src/core/public/public.api.md b/src/core/public/public.api.md index 26df3ee28d5c..1dc7ead28292 100644 --- a/src/core/public/public.api.md +++ b/src/core/public/public.api.md @@ -4,8 +4,11 @@ ```ts +/// + import { Action } from 'history'; import Boom from '@hapi/boom'; +import { ByteSizeValue } from '@kbn/config-schema'; import { ConfigPath } from '@kbn/config'; import { DetailedPeerCertificate } from 'tls'; import { EnvironmentMode } from '@kbn/config'; @@ -16,12 +19,12 @@ import { EuiConfirmModalProps } from '@elastic/eui'; import { EuiFlyoutSize } from '@elastic/eui'; import { EuiGlobalToastListToast } from '@elastic/eui'; import { EuiOverlayMaskProps } from '@elastic/eui'; -import { History } from 'history'; +import { History as History_2 } from 'history'; import { Href } from 'history'; import { IconType } from '@elastic/eui'; import { IncomingHttpHeaders } from 'http'; -import { KibanaClient } from '@elastic/elasticsearch/lib/api/kibana'; -import { Location } from 'history'; +import type { KibanaClient } from '@elastic/elasticsearch/lib/api/kibana'; +import { Location as Location_2 } from 'history'; import { LocationDescriptorObject } from 'history'; import { Logger } from '@kbn/logging'; import { LogMeta } from '@kbn/logging'; @@ -31,21 +34,21 @@ import { Observable } from 'rxjs'; import { PackageInfo } from '@kbn/config'; import { Path } from 'history'; import { PeerCertificate } from 'tls'; -import { PublicMethodsOf } from '@kbn/utility-types'; +import type { PublicMethodsOf } from '@kbn/utility-types'; import { PublicUiSettingsParams as PublicUiSettingsParams_2 } from 'src/core/server/types'; -import React from 'react'; +import { default as React_2 } from 'react'; import { RecursiveReadonly } from '@kbn/utility-types'; -import { Request } from '@hapi/hapi'; +import { Request as Request_2 } from '@hapi/hapi'; import * as Rx from 'rxjs'; import { SchemaTypeError } from '@kbn/config-schema'; -import { TransportRequestOptions } from '@elastic/elasticsearch'; -import { TransportRequestParams } from '@elastic/elasticsearch'; -import { TransportResult } from '@elastic/elasticsearch'; +import type { TransportRequestOptions } from '@elastic/elasticsearch'; +import type { TransportRequestParams } from '@elastic/elasticsearch'; +import type { TransportResult } from '@elastic/elasticsearch'; import { Type } from '@kbn/config-schema'; import { TypeOf } from '@kbn/config-schema'; import { UiCounterMetricType } from '@kbn/analytics'; import { UnregisterCallback } from 'history'; -import { URL } from 'url'; +import { URL as URL_2 } from 'url'; import { UserProvidedValues as UserProvidedValues_2 } from 'src/core/server/types'; // @internal (undocumented) @@ -251,7 +254,7 @@ export type ChromeHelpExtensionLinkBase = Pick; // (undocumented) stop(): void; - } +} // @internal (undocumented) export const DEFAULT_APP_CATEGORIES: Record; @@ -557,6 +560,7 @@ export interface DocLinksStart { readonly range: string; readonly significant_terms: string; readonly terms: string; + readonly terms_doc_count_error: string; readonly avg: string; readonly avg_bucket: string; readonly max_bucket: string; @@ -912,7 +916,7 @@ export type HttpStart = HttpSetup; // @public export interface I18nStart { Context: ({ children }: { - children: React.ReactNode; + children: React_2.ReactNode; }) => JSX.Element; } @@ -1136,7 +1140,7 @@ export interface OverlayStart { export { PackageInfo } // @public -export interface Plugin { +interface Plugin_2 { // (undocumented) setup(core: CoreSetup, plugins: TPluginsSetup): TSetup; // (undocumented) @@ -1144,9 +1148,10 @@ export interface Plugin = (core: PluginInitializerContext) => Plugin | AsyncPlugin; +export type PluginInitializer = (core: PluginInitializerContext) => Plugin_2 | AsyncPlugin; // @public export interface PluginInitializerContext { @@ -1607,10 +1612,10 @@ export interface SavedObjectsUpdateOptions { } // @public -export class ScopedHistory implements History { - constructor(parentHistory: History, basePath: string); +export class ScopedHistory implements History_2 { + constructor(parentHistory: History_2, basePath: string); get action(): Action; - block: (prompt?: string | boolean | History.TransitionPromptHook | undefined) => UnregisterCallback; + block: (prompt?: string | boolean | History_2.TransitionPromptHook | undefined) => UnregisterCallback; createHref: (location: LocationDescriptorObject, { prependBasePath }?: { prependBasePath?: boolean | undefined; }) => Href; @@ -1619,11 +1624,11 @@ export class ScopedHistory implements History void; goForward: () => void; get length(): number; - listen: (listener: (location: Location, action: Action) => void) => UnregisterCallback; - get location(): Location; + listen: (listener: (location: Location_2, action: Action) => void) => UnregisterCallback; + get location(): Location_2; push: (pathOrLocation: Path | LocationDescriptorObject, state?: HistoryLocationState | undefined) => void; replace: (pathOrLocation: Path | LocationDescriptorObject, state?: HistoryLocationState | undefined) => void; - } +} // @public export class SimpleSavedObject { @@ -1699,7 +1704,7 @@ export class ToastsApi implements IToasts { overlays: OverlayStart; i18n: I18nStart; }): void; - } +} // @public (undocumented) export type ToastsSetup = IToasts; @@ -1754,7 +1759,6 @@ export interface UserProvidedValues { userValue?: T; } - // Warnings were encountered during analysis: // // src/core/public/core_system.ts:168:21 - (ae-forgotten-export) The symbol "InternalApplicationStart" needs to be exported by the entry point index.d.ts diff --git a/src/core/server/logging/__snapshots__/logging_system.test.ts.snap b/src/core/server/logging/__snapshots__/logging_system.test.ts.snap index 49035cdda391..e369d7b0cba3 100644 --- a/src/core/server/logging/__snapshots__/logging_system.test.ts.snap +++ b/src/core/server/logging/__snapshots__/logging_system.test.ts.snap @@ -117,7 +117,10 @@ Object { "message": "trace message", "meta": undefined, "pid": Any, + "spanId": undefined, "timestamp": 2012-02-01T14:33:22.011Z, + "traceId": undefined, + "transactionId": undefined, } `; @@ -133,6 +136,9 @@ Object { "some": "value", }, "pid": Any, + "spanId": undefined, "timestamp": 2012-02-01T14:33:22.011Z, + "traceId": undefined, + "transactionId": undefined, } `; diff --git a/src/core/server/logging/appenders/rewrite/policies/meta/meta_policy.test.ts b/src/core/server/logging/appenders/rewrite/policies/meta/meta_policy.test.ts index f03c5bd9d1f8..47799ef5d433 100644 --- a/src/core/server/logging/appenders/rewrite/policies/meta/meta_policy.test.ts +++ b/src/core/server/logging/appenders/rewrite/policies/meta/meta_policy.test.ts @@ -29,26 +29,27 @@ describe('MetaRewritePolicy', () => { // @ts-expect-error ECS custom meta const log = createLogRecord({ a: 'before' }); const policy = createPolicy('update', [{ path: 'a', value: 'after' }]); + // @ts-expect-error ECS custom meta expect(policy.rewrite(log).meta!.a).toBe('after'); }); it('updates nested properties in LogMeta', () => { - // @ts-expect-error ECS custom meta - const log = createLogRecord({ a: 'before a', b: { c: 'before b.c' }, d: [0, 1] }); + const log = createLogRecord({ + error: { message: 'before b.c' }, + tags: ['0', '1'], + }); const policy = createPolicy('update', [ - { path: 'a', value: 'after a' }, - { path: 'b.c', value: 'after b.c' }, - { path: 'd[1]', value: 2 }, + { path: 'error.message', value: 'after b.c' }, + { path: 'tags[1]', value: '2' }, ]); expect(policy.rewrite(log).meta).toMatchInlineSnapshot(` Object { - "a": "after a", - "b": Object { - "c": "after b.c", + "error": Object { + "message": "after b.c", }, - "d": Array [ - 0, - 2, + "tags": Array [ + "0", + "2", ], } `); @@ -80,14 +81,13 @@ describe('MetaRewritePolicy', () => { it(`does not add properties which don't exist yet`, () => { const policy = createPolicy('update', [ - { path: 'a.b', value: 'foo' }, - { path: 'a.c', value: 'bar' }, + { path: 'error.message', value: 'foo' }, + { path: 'error.id', value: 'bar' }, ]); - // @ts-expect-error ECS custom meta - const log = createLogRecord({ a: { b: 'existing meta' } }); + const log = createLogRecord({ error: { message: 'existing meta' } }); const { meta } = policy.rewrite(log); - expect(meta!.a.b).toBe('foo'); - expect(meta!.a.c).toBeUndefined(); + expect(meta?.error?.message).toBe('foo'); + expect(meta?.error?.id).toBeUndefined(); }); it('does not touch anything outside of LogMeta', () => { @@ -110,22 +110,19 @@ describe('MetaRewritePolicy', () => { describe('mode: remove', () => { it('removes existing properties in LogMeta', () => { - // @ts-expect-error ECS custom meta - const log = createLogRecord({ a: 'goodbye' }); - const policy = createPolicy('remove', [{ path: 'a' }]); - expect(policy.rewrite(log).meta!.a).toBeUndefined(); + const log = createLogRecord({ error: { message: 'before' } }); + const policy = createPolicy('remove', [{ path: 'error' }]); + expect(policy.rewrite(log).meta?.error).toBeUndefined(); }); it('removes nested properties in LogMeta', () => { - // @ts-expect-error ECS custom meta - const log = createLogRecord({ a: 'a', b: { c: 'b.c' }, d: [0, 1] }); - const policy = createPolicy('remove', [{ path: 'b.c' }, { path: 'd[1]' }]); + const log = createLogRecord({ error: { message: 'reason' }, tags: ['0', '1'] }); + const policy = createPolicy('remove', [{ path: 'error.message' }, { path: 'tags[1]' }]); expect(policy.rewrite(log).meta).toMatchInlineSnapshot(` Object { - "a": "a", - "b": Object {}, - "d": Array [ - 0, + "error": Object {}, + "tags": Array [ + "0", undefined, ], } @@ -133,12 +130,11 @@ describe('MetaRewritePolicy', () => { }); it('has no effect if property does not exist', () => { - // @ts-expect-error ECS custom meta - const log = createLogRecord({ a: 'a' }); + const log = createLogRecord({ error: {} }); const policy = createPolicy('remove', [{ path: 'b' }]); expect(policy.rewrite(log).meta).toMatchInlineSnapshot(` Object { - "a": "a", + "error": Object {}, } `); }); diff --git a/src/core/server/logging/layouts/__snapshots__/json_layout.test.ts.snap b/src/core/server/logging/layouts/__snapshots__/json_layout.test.ts.snap index 48bbb1944741..0809dbffce67 100644 --- a/src/core/server/logging/layouts/__snapshots__/json_layout.test.ts.snap +++ b/src/core/server/logging/layouts/__snapshots__/json_layout.test.ts.snap @@ -88,3 +88,26 @@ Object { }, } `; + +exports[`\`format()\` correctly formats record and includes correct ECS version. 7`] = ` +Object { + "@timestamp": "2012-02-01T09:30:22.011-05:00", + "log": Object { + "level": "TRACE", + "logger": "context-7", + }, + "message": "message-6", + "process": Object { + "pid": 5355, + }, + "span": Object { + "id": "spanId-1", + }, + "trace": Object { + "id": "traceId-1", + }, + "transaction": Object { + "id": "transactionId-1", + }, +} +`; diff --git a/src/core/server/logging/layouts/json_layout.test.ts b/src/core/server/logging/layouts/json_layout.test.ts index 56184ebd67ae..d3bf2eab473a 100644 --- a/src/core/server/logging/layouts/json_layout.test.ts +++ b/src/core/server/logging/layouts/json_layout.test.ts @@ -58,6 +58,16 @@ const records: LogRecord[] = [ timestamp, pid: 5355, }, + { + context: 'context-7', + level: LogLevel.Trace, + message: 'message-6', + timestamp, + pid: 5355, + spanId: 'spanId-1', + traceId: 'traceId-1', + transactionId: 'transactionId-1', + }, ]; test('`createConfigSchema()` creates correct schema.', () => { @@ -88,6 +98,7 @@ test('`format()` correctly formats record with meta-data', () => { timestamp, pid: 5355, meta: { + // @ts-expect-error ECS custom meta version: { from: 'v7', to: 'v8', @@ -130,6 +141,7 @@ test('`format()` correctly formats error record with meta-data', () => { timestamp, pid: 5355, meta: { + // @ts-expect-error ECS custom meta version: { from: 'v7', to: 'v8', @@ -172,6 +184,7 @@ test('format() meta can merge override logs', () => { pid: 3, meta: { log: { + // @ts-expect-error ECS custom meta kbn_custom_field: 'hello', }, }, @@ -203,6 +216,7 @@ test('format() meta can not override message', () => { context: 'bar', pid: 3, meta: { + // @ts-expect-error cannot override message message: 'baz', }, }) @@ -232,7 +246,8 @@ test('format() meta can not override ecs version', () => { context: 'bar', pid: 3, meta: { - message: 'baz', + // @ts-expect-error cannot override ecs version + ecs: 1, }, }) ) @@ -262,6 +277,7 @@ test('format() meta can not override logger or level', () => { pid: 3, meta: { log: { + // @ts-expect-error cannot override log.level level: 'IGNORE', logger: 'me', }, @@ -293,6 +309,7 @@ test('format() meta can not override timestamp', () => { context: 'bar', pid: 3, meta: { + // @ts-expect-error cannot override @timestamp '@timestamp': '2099-02-01T09:30:22.011-05:00', }, }) @@ -310,3 +327,40 @@ test('format() meta can not override timestamp', () => { }, }); }); + +test('format() meta can not override tracing properties', () => { + const layout = new JsonLayout(); + expect( + JSON.parse( + layout.format({ + message: 'foo', + timestamp, + level: LogLevel.Debug, + context: 'bar', + pid: 3, + meta: { + span: { id: 'span_override' }, + trace: { id: 'trace_override' }, + transaction: { id: 'transaction_override' }, + }, + spanId: 'spanId-1', + traceId: 'traceId-1', + transactionId: 'transactionId-1', + }) + ) + ).toStrictEqual({ + ecs: { version: expect.any(String) }, + '@timestamp': '2012-02-01T09:30:22.011-05:00', + message: 'foo', + log: { + level: 'DEBUG', + logger: 'bar', + }, + process: { + pid: 3, + }, + span: { id: 'spanId-1' }, + trace: { id: 'traceId-1' }, + transaction: { id: 'transactionId-1' }, + }); +}); diff --git a/src/core/server/logging/layouts/json_layout.ts b/src/core/server/logging/layouts/json_layout.ts index f0717f49a6b1..5c23e7ac1a91 100644 --- a/src/core/server/logging/layouts/json_layout.ts +++ b/src/core/server/logging/layouts/json_layout.ts @@ -54,6 +54,9 @@ export class JsonLayout implements Layout { process: { pid: record.pid, }, + span: record.spanId ? { id: record.spanId } : undefined, + trace: record.traceId ? { id: record.traceId } : undefined, + transaction: record.transactionId ? { id: record.transactionId } : undefined, }; const output = record.meta ? merge({ ...record.meta }, log) : log; diff --git a/src/core/server/logging/layouts/pattern_layout.test.ts b/src/core/server/logging/layouts/pattern_layout.test.ts index bb66722d4c2d..22495736227b 100644 --- a/src/core/server/logging/layouts/pattern_layout.test.ts +++ b/src/core/server/logging/layouts/pattern_layout.test.ts @@ -118,6 +118,7 @@ test('`format()` correctly formats record with meta data.', () => { timestamp, pid: 5355, meta: { + // @ts-expect-error not valid ECS field from: 'v7', to: 'v8', }, @@ -177,6 +178,7 @@ test('`format()` allows specifying pattern with meta.', () => { to: 'v8', }, }; + // @ts-expect-error not valid ECS field expect(layout.format(record)).toBe('context-{"from":"v7","to":"v8"}-message'); }); diff --git a/src/core/server/logging/logger.ts b/src/core/server/logging/logger.ts index e025c28a88f0..2c9283da5489 100644 --- a/src/core/server/logging/logger.ts +++ b/src/core/server/logging/logger.ts @@ -5,7 +5,7 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ - +import apmAgent from 'elastic-apm-node'; import { Appender, LogLevel, LogRecord, LoggerFactory, LogMeta, Logger } from '@kbn/logging'; function isError(x: any): x is Error { @@ -73,6 +73,7 @@ export class BaseLogger implements Logger { meta, timestamp: new Date(), pid: process.pid, + ...this.getTraceIds(), }; } @@ -83,6 +84,15 @@ export class BaseLogger implements Logger { meta, timestamp: new Date(), pid: process.pid, + ...this.getTraceIds(), + }; + } + + private getTraceIds() { + return { + spanId: apmAgent.currentTraceIds['span.id'], + traceId: apmAgent.currentTraceIds['trace.id'], + transactionId: apmAgent.currentTraceIds['transaction.id'], }; } } diff --git a/src/core/server/saved_objects/migrations/__snapshots__/migrations_state_action_machine.test.ts.snap b/src/core/server/saved_objects/migrations/__snapshots__/migrations_state_action_machine.test.ts.snap index c3512d8fd50b..760a83fa65cf 100644 --- a/src/core/server/saved_objects/migrations/__snapshots__/migrations_state_action_machine.test.ts.snap +++ b/src/core/server/saved_objects/migrations/__snapshots__/migrations_state_action_machine.test.ts.snap @@ -84,11 +84,26 @@ Object { "type": "file-upload-telemetry", }, }, + Object { + "term": Object { + "type": "fleet-agent-actions", + }, + }, Object { "term": Object { "type": "fleet-agent-events", }, }, + Object { + "term": Object { + "type": "fleet-agents", + }, + }, + Object { + "term": Object { + "type": "fleet-enrollment-api-keys", + }, + }, Object { "term": Object { "type": "ml-telemetry", @@ -225,11 +240,26 @@ Object { "type": "file-upload-telemetry", }, }, + Object { + "term": Object { + "type": "fleet-agent-actions", + }, + }, Object { "term": Object { "type": "fleet-agent-events", }, }, + Object { + "term": Object { + "type": "fleet-agents", + }, + }, + Object { + "term": Object { + "type": "fleet-enrollment-api-keys", + }, + }, Object { "term": Object { "type": "ml-telemetry", @@ -370,11 +400,26 @@ Object { "type": "file-upload-telemetry", }, }, + Object { + "term": Object { + "type": "fleet-agent-actions", + }, + }, Object { "term": Object { "type": "fleet-agent-events", }, }, + Object { + "term": Object { + "type": "fleet-agents", + }, + }, + Object { + "term": Object { + "type": "fleet-enrollment-api-keys", + }, + }, Object { "term": Object { "type": "ml-telemetry", @@ -519,11 +564,26 @@ Object { "type": "file-upload-telemetry", }, }, + Object { + "term": Object { + "type": "fleet-agent-actions", + }, + }, Object { "term": Object { "type": "fleet-agent-events", }, }, + Object { + "term": Object { + "type": "fleet-agents", + }, + }, + Object { + "term": Object { + "type": "fleet-enrollment-api-keys", + }, + }, Object { "term": Object { "type": "ml-telemetry", @@ -705,11 +765,26 @@ Object { "type": "file-upload-telemetry", }, }, + Object { + "term": Object { + "type": "fleet-agent-actions", + }, + }, Object { "term": Object { "type": "fleet-agent-events", }, }, + Object { + "term": Object { + "type": "fleet-agents", + }, + }, + Object { + "term": Object { + "type": "fleet-enrollment-api-keys", + }, + }, Object { "term": Object { "type": "ml-telemetry", @@ -857,11 +932,26 @@ Object { "type": "file-upload-telemetry", }, }, + Object { + "term": Object { + "type": "fleet-agent-actions", + }, + }, Object { "term": Object { "type": "fleet-agent-events", }, }, + Object { + "term": Object { + "type": "fleet-agents", + }, + }, + Object { + "term": Object { + "type": "fleet-enrollment-api-keys", + }, + }, Object { "term": Object { "type": "ml-telemetry", diff --git a/src/core/server/saved_objects/migrations/core/unused_types.ts b/src/core/server/saved_objects/migrations/core/unused_types.ts index f5f6647201bb..ddcadc09502f 100644 --- a/src/core/server/saved_objects/migrations/core/unused_types.ts +++ b/src/core/server/saved_objects/migrations/core/unused_types.ts @@ -18,6 +18,10 @@ export const REMOVED_TYPES: string[] = [ 'file-upload-telemetry', // https://github.com/elastic/kibana/issues/91869 'fleet-agent-events', + // https://github.com/elastic/obs-dc-team/issues/334 + 'fleet-agents', + 'fleet-agent-actions', + 'fleet-enrollment-api-keys', // Was removed in 7.12 'ml-telemetry', 'server', diff --git a/src/core/server/server.api.md b/src/core/server/server.api.md index f135d8caaf54..18d1e479ddde 100644 --- a/src/core/server/server.api.md +++ b/src/core/server/server.api.md @@ -4,11 +4,14 @@ ```ts +/// + import { AddConfigDeprecation } from '@kbn/config'; import Boom from '@hapi/boom'; import { ByteSizeValue } from '@kbn/config-schema'; import { CliArgs } from '@kbn/config'; -import { ClientOptions } from '@elastic/elasticsearch/lib/client'; +import type { ClientOptions } from '@elastic/elasticsearch/lib/client'; +import { ConditionalType } from '@kbn/config-schema/target_types/types'; import { ConfigDeprecation } from '@kbn/config'; import { ConfigDeprecationContext } from '@kbn/config'; import { ConfigDeprecationFactory } from '@kbn/config'; @@ -26,13 +29,14 @@ import { EcsEventType } from '@kbn/logging'; import { EnvironmentMode } from '@kbn/config'; import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { IncomingHttpHeaders } from 'http'; -import { KibanaClient } from '@elastic/elasticsearch/lib/api/kibana'; +import type { KibanaClient } from '@elastic/elasticsearch/lib/api/kibana'; import { Logger } from '@kbn/logging'; import { LoggerFactory } from '@kbn/logging'; -import { LogLevel } from '@kbn/logging'; +import { LogLevel as LogLevel_2 } from '@kbn/logging'; +import { LogLevelId } from '@kbn/logging'; import { LogMeta } from '@kbn/logging'; import { LogRecord } from '@kbn/logging'; -import { MaybePromise } from '@kbn/utility-types'; +import type { MaybePromise } from '@kbn/utility-types'; import { ObjectType } from '@kbn/config-schema'; import { Observable } from 'rxjs'; import { PackageInfo } from '@kbn/config'; @@ -41,20 +45,20 @@ import { PeerCertificate } from 'tls'; import { PublicMethodsOf } from '@kbn/utility-types'; import { Readable } from 'stream'; import { RecursiveReadonly } from '@kbn/utility-types'; -import { Request } from '@hapi/hapi'; -import { RequestHandlerContext as RequestHandlerContext_2 } from 'src/core/server'; +import { Request as Request_2 } from '@hapi/hapi'; +import type { RequestHandlerContext as RequestHandlerContext_2 } from 'src/core/server'; import { ResponseObject } from '@hapi/hapi'; import { ResponseToolkit } from '@hapi/hapi'; import { SchemaTypeError } from '@kbn/config-schema'; import { ShallowPromise } from '@kbn/utility-types'; import { Stream } from 'stream'; -import { TransportRequestOptions } from '@elastic/elasticsearch'; -import { TransportRequestParams } from '@elastic/elasticsearch'; -import { TransportResult } from '@elastic/elasticsearch'; +import type { TransportRequestOptions } from '@elastic/elasticsearch'; +import type { TransportRequestParams } from '@elastic/elasticsearch'; +import type { TransportResult } from '@elastic/elasticsearch'; import { Type } from '@kbn/config-schema'; import { TypeOf } from '@kbn/config-schema'; import { UiCounterMetricType } from '@kbn/analytics'; -import { URL } from 'url'; +import { URL as URL_2 } from 'url'; export { AddConfigDeprecation } @@ -223,42 +227,42 @@ export type CapabilitiesSwitcher = (request: KibanaRequest, uiCapabilities: Capa // @alpha export const config: { elasticsearch: { - schema: import("@kbn/config-schema").ObjectType<{ - sniffOnStart: Type; - sniffInterval: Type; - sniffOnConnectionFault: Type; - hosts: Type; - username: Type; - password: Type; - serviceAccountToken: Type; - requestHeadersWhitelist: Type; - customHeaders: Type>; - shardTimeout: Type; - requestTimeout: Type; - pingTimeout: Type; - logQueries: Type; - ssl: import("@kbn/config-schema").ObjectType<{ - verificationMode: Type<"none" | "certificate" | "full">; - certificateAuthorities: Type; - certificate: Type; - key: Type; - keyPassphrase: Type; - keystore: import("@kbn/config-schema").ObjectType<{ - path: Type; - password: Type; - }>; - truststore: import("@kbn/config-schema").ObjectType<{ - path: Type; - password: Type; - }>; - alwaysPresentCertificate: Type; - }>; - apiVersion: Type; - healthCheck: import("@kbn/config-schema").ObjectType<{ - delay: Type; - }>; - ignoreVersionMismatch: import("@kbn/config-schema/target_types/types").ConditionalType; - skipStartupConnectionCheck: import("@kbn/config-schema/target_types/types").ConditionalType; + schema: ObjectType< { + sniffOnStart: Type; + sniffInterval: Type; + sniffOnConnectionFault: Type; + hosts: Type; + username: Type; + password: Type; + serviceAccountToken: Type; + requestHeadersWhitelist: Type; + customHeaders: Type>; + shardTimeout: Type; + requestTimeout: Type; + pingTimeout: Type; + logQueries: Type; + ssl: ObjectType< { + verificationMode: Type<"none" | "certificate" | "full">; + certificateAuthorities: Type; + certificate: Type; + key: Type; + keyPassphrase: Type; + keystore: ObjectType< { + path: Type; + password: Type; + }>; + truststore: ObjectType< { + path: Type; + password: Type; + }>; + alwaysPresentCertificate: Type; + }>; + apiVersion: Type; + healthCheck: ObjectType< { + delay: Type; + }>; + ignoreVersionMismatch: ConditionalType; + skipStartupConnectionCheck: ConditionalType; }>; }; logging: { @@ -770,8 +774,6 @@ export interface CountResponse { // @public export class CspConfig implements ICspConfig { - // (undocumented) - #private; // Warning: (ae-forgotten-export) The symbol "CspConfigType" needs to be exported by the entry point index.d.ts // // @internal @@ -988,7 +990,7 @@ export type ExecutionContextStart = ExecutionContextSetup; // @public export interface FakeRequest { - headers: Headers; + headers: Headers_2; } // @public (undocumented) @@ -1046,11 +1048,12 @@ export type HandlerFunction = (context: T, ...args: any[]) => export type HandlerParameters> = T extends (context: any, ...args: infer U) => any ? U : never; // @public -export type Headers = { +type Headers_2 = { [header in KnownHeaders]?: string | string[] | undefined; } & { [header: string]: string | string[] | undefined; }; +export { Headers_2 as Headers } // @public (undocumented) export interface HttpAuth { @@ -1315,8 +1318,8 @@ export type KibanaExecutionContext = { // @public export class KibanaRequest { // @internal (undocumented) - protected readonly [requestSymbol]: Request; - constructor(request: Request, params: Params, query: Query, body: Body, withoutSecretHeaders: boolean); + protected readonly [requestSymbol]: Request_2; + constructor(request: Request_2, params: Params, query: Query, body: Body, withoutSecretHeaders: boolean); // (undocumented) readonly auth: { isAuthenticated: boolean; @@ -1327,21 +1330,21 @@ export class KibanaRequest(req: Request, routeSchemas?: RouteValidator | RouteValidatorFullConfig, withoutSecretHeaders?: boolean): KibanaRequest; - readonly headers: Headers; + static from(req: Request_2, routeSchemas?: RouteValidator | RouteValidatorFullConfig, withoutSecretHeaders?: boolean): KibanaRequest; + readonly headers: Headers_2; readonly id: string; readonly isSystemRequest: boolean; // (undocumented) readonly params: Params; // (undocumented) readonly query: Query; - readonly rewrittenUrl?: URL; + readonly rewrittenUrl?: URL_2; readonly route: RecursiveReadonly>; // (undocumented) readonly socket: IKibanaSocket; - readonly url: URL; + readonly url: URL_2; readonly uuid: string; - } +} // @public export interface KibanaRequestEvents { @@ -1415,7 +1418,7 @@ export interface LoggingServiceSetup { configure(config$: Observable): void; } -export { LogLevel } +export { LogLevel_2 as LogLevel } export { LogMeta } @@ -1597,7 +1600,7 @@ export interface OpsServerMetrics { export { PackageInfo } // @public -export interface Plugin { +interface Plugin_2 { // (undocumented) setup(core: CoreSetup, plugins: TPluginsSetup): TSetup; // (undocumented) @@ -1605,10 +1608,11 @@ export interface Plugin { - // Warning: (ae-unresolved-link) The @link reference could not be resolved: Reexported declarations are not supported + // Warning: (ae-unresolved-link) The @link reference could not be resolved: This type of declaration is not supported yet by the resolver deprecations?: ConfigDeprecationProvider; exposeToBrowser?: { [P in keyof T]?: boolean; @@ -1621,7 +1625,7 @@ export interface PluginConfigDescriptor { export type PluginConfigSchema = Type; // @public -export type PluginInitializer = (core: PluginInitializerContext) => Plugin | PrebootPlugin | AsyncPlugin; +export type PluginInitializer = (core: PluginInitializerContext) => Plugin_2 | PrebootPlugin | AsyncPlugin; // @public export interface PluginInitializerContext { @@ -1640,7 +1644,7 @@ export interface PluginInitializerContext { instanceUuid: string; configs: readonly string[]; }; - // Warning: (ae-unresolved-link) The @link reference could not be resolved: Reexported declarations are not supported + // Warning: (ae-unresolved-link) The @link reference could not be resolved: This type of declaration is not supported yet by the resolver logger: LoggerFactory; // (undocumented) opaqueId: PluginOpaqueId; @@ -1648,7 +1652,7 @@ export interface PluginInitializerContext { // @public export interface PluginManifest { - // Warning: (ae-unresolved-link) The @link reference could not be resolved: Reexported declarations are not supported + // Warning: (ae-unresolved-link) The @link reference could not be resolved: This type of declaration is not supported yet by the resolver readonly configPath: ConfigPath; readonly description?: string; // @deprecated @@ -2072,7 +2076,7 @@ export class SavedObjectsClient { removeReferencesTo(type: string, id: string, options?: SavedObjectsRemoveReferencesToOptions): Promise; resolve(type: string, id: string, options?: SavedObjectsBaseOptions): Promise>; update(type: string, id: string, attributes: Partial, options?: SavedObjectsUpdateOptions): Promise>; - updateObjectsSpaces(objects: SavedObjectsUpdateObjectsSpacesObject[], spacesToAdd: string[], spacesToRemove: string[], options?: SavedObjectsUpdateObjectsSpacesOptions): Promise; + updateObjectsSpaces(objects: SavedObjectsUpdateObjectsSpacesObject[], spacesToAdd: string[], spacesToRemove: string[], options?: SavedObjectsUpdateObjectsSpacesOptions): Promise; } // @public @@ -2251,17 +2255,15 @@ export interface SavedObjectsExportByTypeOptions extends SavedObjectExportBaseOp // @public (undocumented) export class SavedObjectsExporter { - // (undocumented) - #private; constructor({ savedObjectsClient, typeRegistry, exportSizeLimit, logger, }: { savedObjectsClient: SavedObjectsClientContract; typeRegistry: ISavedObjectTypeRegistry; exportSizeLimit: number; logger: Logger; }); - exportByObjects(options: SavedObjectsExportByObjectOptions): Promise; - exportByTypes(options: SavedObjectsExportByTypeOptions): Promise; - } + exportByObjects(options: SavedObjectsExportByObjectOptions): Promise; + exportByTypes(options: SavedObjectsExportByTypeOptions): Promise; +} // @public (undocumented) export class SavedObjectsExportError extends Error { @@ -2404,8 +2406,6 @@ export interface SavedObjectsImportConflictError { // @public (undocumented) export class SavedObjectsImporter { - // (undocumented) - #private; constructor({ savedObjectsClient, typeRegistry, importSizeLimit, }: { savedObjectsClient: SavedObjectsClientContract; typeRegistry: ISavedObjectTypeRegistry; @@ -2655,7 +2655,7 @@ export class SavedObjectsRepository { bulkUpdate(objects: Array>, options?: SavedObjectsBulkUpdateOptions): Promise>; checkConflicts(objects?: SavedObjectsCheckConflictsObject[], options?: SavedObjectsBaseOptions): Promise; closePointInTime(id: string, options?: SavedObjectsClosePointInTimeOptions): Promise; - collectMultiNamespaceReferences(objects: SavedObjectsCollectMultiNamespaceReferencesObject[], options?: SavedObjectsCollectMultiNamespaceReferencesOptions): Promise; + collectMultiNamespaceReferences(objects: SavedObjectsCollectMultiNamespaceReferencesObject[], options?: SavedObjectsCollectMultiNamespaceReferencesOptions): Promise; create(type: string, attributes: T, options?: SavedObjectsCreateOptions): Promise>; createPointInTimeFinder(findOptions: SavedObjectsCreatePointInTimeFinderOptions, dependencies?: SavedObjectsCreatePointInTimeFinderDependencies): ISavedObjectsPointInTimeFinder; // Warning: (ae-forgotten-export) The symbol "IKibanaMigrator" needs to be exported by the entry point index.d.ts @@ -2672,8 +2672,8 @@ export class SavedObjectsRepository { removeReferencesTo(type: string, id: string, options?: SavedObjectsRemoveReferencesToOptions): Promise; resolve(type: string, id: string, options?: SavedObjectsBaseOptions): Promise>; update(type: string, id: string, attributes: Partial, options?: SavedObjectsUpdateOptions): Promise>; - updateObjectsSpaces(objects: SavedObjectsUpdateObjectsSpacesObject[], spacesToAdd: string[], spacesToRemove: string[], options?: SavedObjectsUpdateObjectsSpacesOptions): Promise; - } + updateObjectsSpaces(objects: SavedObjectsUpdateObjectsSpacesObject[], spacesToAdd: string[], spacesToRemove: string[], options?: SavedObjectsUpdateObjectsSpacesOptions): Promise; +} // @public export interface SavedObjectsRepositoryFactory { @@ -2705,7 +2705,7 @@ export class SavedObjectsSerializer { isRawSavedObject(doc: SavedObjectsRawDoc, options?: SavedObjectsRawDocParseOptions): boolean; rawToSavedObject(doc: SavedObjectsRawDoc, options?: SavedObjectsRawDocParseOptions): SavedObjectSanitizedDoc; savedObjectToRaw(savedObj: SavedObjectSanitizedDoc): SavedObjectsRawDoc; - } +} // @public export interface SavedObjectsServiceSetup { @@ -2851,7 +2851,7 @@ export class SavedObjectTypeRegistry { isShareable(type: string): boolean; isSingleNamespace(type: string): boolean; registerType(type: SavedObjectsType): void; - } +} // @public export type SavedObjectUnsanitizedDoc = SavedObjectDoc & Partial; @@ -3053,7 +3053,6 @@ export interface UserProvidedValues { // @public export const validBodyOutput: readonly ["data", "stream"]; - // Warnings were encountered during analysis: // // src/core/server/elasticsearch/client/types.ts:93:7 - (ae-forgotten-export) The symbol "Explanation" needs to be exported by the entry point index.d.ts diff --git a/src/dev/notice/bundled_notices.js b/src/dev/notice/bundled_notices.js index 7ab2a5b3f03f..00b044e9053f 100644 --- a/src/dev/notice/bundled_notices.js +++ b/src/dev/notice/bundled_notices.js @@ -7,18 +7,20 @@ */ import { resolve } from 'path'; -import { readFile } from 'fs'; +import { readFile } from 'fs/promises'; +import { promisify } from 'util'; -import { fromNode as fcb } from 'bluebird'; import glob from 'glob'; +const globAsync = promisify(glob); + export async function getBundledNotices(packageDirectory) { const pattern = resolve(packageDirectory, '*{LICENSE,NOTICE}*'); - const paths = await fcb((cb) => glob(pattern, cb)); + const paths = await globAsync(pattern); return Promise.all( paths.map(async (path) => ({ path, - text: await fcb((cb) => readFile(path, 'utf8', cb)), + text: await readFile(path, 'utf8'), })) ); } diff --git a/src/dev/precommit_hook/get_files_for_commit.js b/src/dev/precommit_hook/get_files_for_commit.js index 44c8c9d5e6bc..366575ad15ae 100644 --- a/src/dev/precommit_hook/get_files_for_commit.js +++ b/src/dev/precommit_hook/get_files_for_commit.js @@ -6,8 +6,7 @@ * Side Public License, v 1. */ -import SimpleGit from 'simple-git'; -import { fromNode as fcb } from 'bluebird'; +import SimpleGit from 'simple-git/promise'; import { REPO_ROOT } from '@kbn/utils'; import { File } from '../file'; @@ -22,7 +21,7 @@ import { File } from '../file'; export async function getFilesForCommit(gitRef) { const simpleGit = new SimpleGit(REPO_ROOT); const gitRefForDiff = gitRef ? gitRef : '--cached'; - const output = await fcb((cb) => simpleGit.diff(['--name-status', gitRefForDiff], cb)); + const output = await simpleGit.diff(['--name-status', gitRefForDiff]); return ( output diff --git a/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.tsx b/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.tsx index 1f4cd3952e7a..611a426dd4d7 100644 --- a/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.tsx +++ b/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { Subscription } from 'rxjs'; -import { PanelState, ViewMode } from '../../../services/embeddable'; +import { ViewMode } from '../../../services/embeddable'; import { DashboardContainer, DashboardReactContextValue } from '../dashboard_container'; import { DashboardGrid } from '../grid'; import { context } from '../../../services/kibana_react'; @@ -26,7 +26,7 @@ interface State { useMargins: boolean; title: string; description?: string; - panels: { [key: string]: PanelState }; + panelCount: number; isEmbeddedExternally?: boolean; } @@ -48,7 +48,7 @@ export class DashboardViewport extends React.Component { - const { isFullScreenMode, useMargins, title, description, isEmbeddedExternally } = + const { isFullScreenMode, useMargins, title, description, isEmbeddedExternally, panels } = this.props.container.getInput(); if (this.mounted) { this.setState({ + panelCount: Object.values(panels).length, + isEmbeddedExternally, isFullScreenMode, description, useMargins, title, - isEmbeddedExternally, }); } }); @@ -94,13 +95,13 @@ export class DashboardViewport extends React.Component
{ - if (nextUrl.includes(DASHBOARD_STATE_STORAGE_KEY)) { - return replaceUrlHashQuery(nextUrl, (query) => { - delete query[DASHBOARD_STATE_STORAGE_KEY]; - return query; - }); - } - return nextUrl; - }, true); + if (!awaitingRemoval) { + awaitingRemoval = true; + kbnUrlStateStorage.kbnUrlControls.updateAsync((nextUrl) => { + if (nextUrl.includes(DASHBOARD_STATE_STORAGE_KEY)) { + return replaceUrlHashQuery(nextUrl, (query) => { + delete query[DASHBOARD_STATE_STORAGE_KEY]; + return query; + }); + } + awaitingRemoval = false; + return nextUrl; + }, true); + } return { ..._.omit(rawAppStateInUrl, ['panels', 'query']), diff --git a/src/plugins/data/common/search/aggs/agg_type.ts b/src/plugins/data/common/search/aggs/agg_type.ts index 917f80d3b781..3f91eadd19eb 100644 --- a/src/plugins/data/common/search/aggs/agg_type.ts +++ b/src/plugins/data/common/search/aggs/agg_type.ts @@ -53,6 +53,7 @@ export interface AggTypeConfig< json?: boolean; decorateAggConfig?: () => any; postFlightRequest?: PostFlightRequestFn; + hasPrecisionError?: (aggBucket: Record) => boolean; getSerializedFormat?: (agg: TAggConfig) => SerializedFieldFormat; getValue?: (agg: TAggConfig, bucket: any) => any; getKey?: (bucket: any, key: any, agg: TAggConfig) => any; @@ -180,6 +181,9 @@ export class AggType< * is created, giving the agg type a chance to modify the agg config */ decorateAggConfig: () => any; + + hasPrecisionError?: (aggBucket: Record) => boolean; + /** * A function that needs to be called after the main request has been made * and should return an updated response @@ -283,6 +287,7 @@ export class AggType< this.getResponseAggs = config.getResponseAggs || (() => {}); this.decorateAggConfig = config.decorateAggConfig || (() => ({})); this.postFlightRequest = config.postFlightRequest || identity; + this.hasPrecisionError = config.hasPrecisionError; this.getSerializedFormat = config.getSerializedFormat || diff --git a/src/plugins/data/common/search/aggs/buckets/terms.test.ts b/src/plugins/data/common/search/aggs/buckets/terms.test.ts index 50aa4eb2b035..524606f7c562 100644 --- a/src/plugins/data/common/search/aggs/buckets/terms.test.ts +++ b/src/plugins/data/common/search/aggs/buckets/terms.test.ts @@ -286,7 +286,19 @@ describe('Terms Agg', () => { { typesRegistry: mockAggTypesRegistry() } ); const { [BUCKET_TYPES.TERMS]: params } = aggConfigs.aggs[0].toDsl(); + expect(params.order).toEqual({ 'test-orderAgg.50': 'desc' }); }); + + test('should override "hasPrecisionError" for the "terms" bucket type', () => { + const aggConfigs = getAggConfigs(); + const { type } = aggConfigs.aggs[0]; + + expect(type.hasPrecisionError).toBeInstanceOf(Function); + + expect(type.hasPrecisionError!({})).toBeFalsy(); + expect(type.hasPrecisionError!({ doc_count_error_upper_bound: 0 })).toBeFalsy(); + expect(type.hasPrecisionError!({ doc_count_error_upper_bound: -1 })).toBeTruthy(); + }); }); }); diff --git a/src/plugins/data/common/search/aggs/buckets/terms.ts b/src/plugins/data/common/search/aggs/buckets/terms.ts index b9329bcb25af..b3872d29beaa 100644 --- a/src/plugins/data/common/search/aggs/buckets/terms.ts +++ b/src/plugins/data/common/search/aggs/buckets/terms.ts @@ -85,6 +85,7 @@ export const getTermsBucketAgg = () => }; }, createFilter: createFilterTerms, + hasPrecisionError: (aggBucket) => Boolean(aggBucket?.doc_count_error_upper_bound), postFlightRequest: async ( resp, aggConfigs, diff --git a/src/plugins/data/common/search/search_source/mocks.ts b/src/plugins/data/common/search/search_source/mocks.ts index a0897a2dacf2..dee5c09a6b85 100644 --- a/src/plugins/data/common/search/search_source/mocks.ts +++ b/src/plugins/data/common/search/search_source/mocks.ts @@ -14,7 +14,7 @@ import { SearchSource } from './search_source'; import { ISearchStartSearchSource, ISearchSource, SearchSourceFields } from './types'; export const searchSourceInstanceMock: MockedKeys = { - setPreferredSearchStrategyId: jest.fn(), + setOverwriteDataViewType: jest.fn(), setFields: jest.fn().mockReturnThis(), setField: jest.fn().mockReturnThis(), removeField: jest.fn().mockReturnThis(), diff --git a/src/plugins/data/common/search/search_source/search_source.ts b/src/plugins/data/common/search/search_source/search_source.ts index 50752523403c..a3979ffa6e94 100644 --- a/src/plugins/data/common/search/search_source/search_source.ts +++ b/src/plugins/data/common/search/search_source/search_source.ts @@ -124,7 +124,8 @@ export interface SearchSourceDependencies extends FetchHandlers { /** @public **/ export class SearchSource { private id: string = uniqueId('data_source'); - private searchStrategyId?: string; + private shouldOverwriteDataViewType: boolean = false; + private overwriteDataViewType?: string; private parent?: SearchSource; private requestStartHandlers: Array< (searchSource: SearchSource, options?: ISearchOptions) => Promise @@ -149,11 +150,22 @@ export class SearchSource { *****/ /** - * internal, dont use - * @param searchStrategyId + * Used to make the search source overwrite the actual data view type for the + * specific requests done. This should only be needed very rarely, since it means + * e.g. we'd be treating a rollup index pattern as a regular one. Be very sure + * you understand the consequences of using this method before using it. + * + * @param overwriteType If `false` is passed in it will disable the overwrite, otherwise + * the passed in value will be used as the data view type for this search source. */ - setPreferredSearchStrategyId(searchStrategyId: string) { - this.searchStrategyId = searchStrategyId; + setOverwriteDataViewType(overwriteType: string | undefined | false) { + if (overwriteType === false) { + this.shouldOverwriteDataViewType = false; + this.overwriteDataViewType = undefined; + } else { + this.shouldOverwriteDataViewType = true; + this.overwriteDataViewType = overwriteType; + } } /** @@ -609,11 +621,7 @@ export class SearchSource { } private getIndexType(index?: IIndexPattern) { - if (this.searchStrategyId) { - return this.searchStrategyId === 'default' ? undefined : this.searchStrategyId; - } else { - return index?.type; - } + return this.shouldOverwriteDataViewType ? this.overwriteDataViewType : index?.type; } private readonly getFieldName = (fld: string | Record): string => diff --git a/src/plugins/data/common/search/tabify/index.ts b/src/plugins/data/common/search/tabify/index.ts index 279ff705f231..3a4b094826e7 100644 --- a/src/plugins/data/common/search/tabify/index.ts +++ b/src/plugins/data/common/search/tabify/index.ts @@ -9,3 +9,4 @@ export { tabifyDocs, flattenHit } from './tabify_docs'; export { tabifyAggResponse } from './tabify'; export { tabifyGetColumns } from './get_columns'; +export { checkColumnForPrecisionError } from './utils'; diff --git a/src/plugins/data/common/search/tabify/response_writer.test.ts b/src/plugins/data/common/search/tabify/response_writer.test.ts index 603ccc0f493c..cee297d255db 100644 --- a/src/plugins/data/common/search/tabify/response_writer.test.ts +++ b/src/plugins/data/common/search/tabify/response_writer.test.ts @@ -166,6 +166,7 @@ describe('TabbedAggResponseWriter class', () => { field: 'geo.src', source: 'esaggs', sourceParams: { + hasPrecisionError: false, enabled: true, id: '1', indexPatternId: '1234', @@ -193,6 +194,7 @@ describe('TabbedAggResponseWriter class', () => { }, source: 'esaggs', sourceParams: { + hasPrecisionError: false, appliedTimeRange: undefined, enabled: true, id: '2', @@ -227,6 +229,7 @@ describe('TabbedAggResponseWriter class', () => { field: 'geo.src', source: 'esaggs', sourceParams: { + hasPrecisionError: false, enabled: true, id: '1', indexPatternId: '1234', @@ -254,6 +257,7 @@ describe('TabbedAggResponseWriter class', () => { }, source: 'esaggs', sourceParams: { + hasPrecisionError: false, appliedTimeRange: undefined, enabled: true, id: '2', diff --git a/src/plugins/data/common/search/tabify/response_writer.ts b/src/plugins/data/common/search/tabify/response_writer.ts index a0ba07598e53..6af0576b9ed4 100644 --- a/src/plugins/data/common/search/tabify/response_writer.ts +++ b/src/plugins/data/common/search/tabify/response_writer.ts @@ -10,7 +10,7 @@ import { isEmpty } from 'lodash'; import { IAggConfigs } from '../aggs'; import { tabifyGetColumns } from './get_columns'; -import { TabbedResponseWriterOptions, TabbedAggColumn, TabbedAggRow } from './types'; +import type { TabbedResponseWriterOptions, TabbedAggColumn, TabbedAggRow } from './types'; import { Datatable, DatatableColumn } from '../../../../expressions/common/expression_types/specs'; interface BufferColumn { @@ -80,6 +80,7 @@ export class TabbedAggResponseWriter { params: column.aggConfig.toSerializedFieldFormat(), source: 'esaggs', sourceParams: { + hasPrecisionError: Boolean(column.hasPrecisionError), indexPatternId: column.aggConfig.getIndexPattern()?.id, appliedTimeRange: column.aggConfig.params.field?.name && diff --git a/src/plugins/data/common/search/tabify/tabify.ts b/src/plugins/data/common/search/tabify/tabify.ts index a4d9551da75d..d3273accff97 100644 --- a/src/plugins/data/common/search/tabify/tabify.ts +++ b/src/plugins/data/common/search/tabify/tabify.ts @@ -42,8 +42,14 @@ export function tabifyAggResponse( switch (agg.type.type) { case AggGroupNames.Buckets: - const aggBucket = get(bucket, agg.id); + const aggBucket = get(bucket, agg.id) as Record; const tabifyBuckets = new TabifyBuckets(aggBucket, agg.params, respOpts?.timeRange); + const precisionError = agg.type.hasPrecisionError?.(aggBucket); + + if (precisionError) { + // "сolumn" mutation, we have to do this here as this value is filled in based on aggBucket value + column.hasPrecisionError = true; + } if (tabifyBuckets.length) { tabifyBuckets.forEach((subBucket, tabifyBucketKey) => { diff --git a/src/plugins/data/common/search/tabify/types.ts b/src/plugins/data/common/search/tabify/types.ts index 758a2dfb181f..9fadb0ef860e 100644 --- a/src/plugins/data/common/search/tabify/types.ts +++ b/src/plugins/data/common/search/tabify/types.ts @@ -41,6 +41,7 @@ export interface TabbedAggColumn { aggConfig: IAggConfig; id: string; name: string; + hasPrecisionError?: boolean; } /** @public **/ diff --git a/src/plugins/data/common/search/tabify/utils.test.ts b/src/plugins/data/common/search/tabify/utils.test.ts new file mode 100644 index 000000000000..ed29ef58ec0b --- /dev/null +++ b/src/plugins/data/common/search/tabify/utils.test.ts @@ -0,0 +1,46 @@ +/* + * 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 { checkColumnForPrecisionError } from './utils'; +import type { DatatableColumn } from '../../../../expressions'; + +describe('tabify utils', () => { + describe('checkDatatableForPrecisionError', () => { + test('should return true if there is a precision error in the column', () => { + expect( + checkColumnForPrecisionError({ + meta: { + sourceParams: { + hasPrecisionError: true, + }, + }, + } as unknown as DatatableColumn) + ).toBeTruthy(); + }); + test('should return false if there is no precision error in the column', () => { + expect( + checkColumnForPrecisionError({ + meta: { + sourceParams: { + hasPrecisionError: false, + }, + }, + } as unknown as DatatableColumn) + ).toBeFalsy(); + }); + test('should return false if precision error is not defined', () => { + expect( + checkColumnForPrecisionError({ + meta: { + sourceParams: {}, + }, + } as unknown as DatatableColumn) + ).toBeFalsy(); + }); + }); +}); diff --git a/src/plugins/data/common/search/tabify/utils.ts b/src/plugins/data/common/search/tabify/utils.ts new file mode 100644 index 000000000000..1a4f87e2fed7 --- /dev/null +++ b/src/plugins/data/common/search/tabify/utils.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 type { DatatableColumn } from '../../../../expressions'; + +/** @public **/ +export const checkColumnForPrecisionError = (column: DatatableColumn) => + column.meta.sourceParams?.hasPrecisionError; diff --git a/src/plugins/data/public/index.ts b/src/plugins/data/public/index.ts index 0b749d90f715..a54a9c7f35e3 100644 --- a/src/plugins/data/public/index.ts +++ b/src/plugins/data/public/index.ts @@ -139,6 +139,7 @@ import { // tabify tabifyAggResponse, tabifyGetColumns, + checkColumnForPrecisionError, } from '../common'; export { AggGroupLabels, AggGroupNames, METRIC_TYPES, BUCKET_TYPES } from '../common'; @@ -246,6 +247,7 @@ export const search = { getResponseInspectorStats, tabifyAggResponse, tabifyGetColumns, + checkColumnForPrecisionError, }; /* diff --git a/src/plugins/data/public/search/index.ts b/src/plugins/data/public/search/index.ts index 821f16e0cf68..2cd7993e3b18 100644 --- a/src/plugins/data/public/search/index.ts +++ b/src/plugins/data/public/search/index.ts @@ -36,6 +36,7 @@ export { parseSearchSourceJSON, SearchSource, SortDirection, + checkColumnForPrecisionError, } from '../../common/search'; export type { ISessionService, diff --git a/src/plugins/data_views/common/data_views/data_views.ts b/src/plugins/data_views/common/data_views/data_views.ts index 7882f8d7ca43..b54bcf3471d4 100644 --- a/src/plugins/data_views/common/data_views/data_views.ts +++ b/src/plugins/data_views/common/data_views/data_views.ts @@ -230,7 +230,7 @@ export class DataViewsService { * @param force */ setDefault = async (id: string | null, force = false) => { - if (force || !this.config.get('defaultIndex')) { + if (force || !(await this.config.get('defaultIndex'))) { await this.config.set('defaultIndex', id); } }; diff --git a/src/plugins/discover/public/application/main/components/chart/discover_chart.test.tsx b/src/plugins/discover/public/application/main/components/chart/discover_chart.test.tsx index cb6d96f049c5..673d831f3fc9 100644 --- a/src/plugins/discover/public/application/main/components/chart/discover_chart.test.tsx +++ b/src/plugins/discover/public/application/main/components/chart/discover_chart.test.tsx @@ -23,7 +23,7 @@ import { VIEW_MODE } from '../../../../components/view_mode_toggle'; setHeaderActionMenuMounter(jest.fn()); -function getProps(timefield?: string) { +function getProps(isTimeBased: boolean = false) { const searchSourceMock = createSearchSourceMock({}); const services = discoverServiceMock; services.data.query.timefilter.timefilter.getAbsoluteTime = () => { @@ -85,6 +85,7 @@ function getProps(timefield?: string) { }) as DataCharts$; return { + isTimeBased, resetSavedSearch: jest.fn(), savedSearch: savedSearchMock, savedSearchDataChart$: charts$, @@ -94,7 +95,6 @@ function getProps(timefield?: string) { services, state: { columns: [] }, stateContainer: {} as GetStateReturn, - timefield, viewMode: VIEW_MODE.DOCUMENT_LEVEL, setDiscoverViewMode: jest.fn(), }; @@ -106,7 +106,7 @@ describe('Discover chart', () => { expect(component.find('[data-test-subj="discoverChartOptionsToggle"]').exists()).toBeFalsy(); }); test('render with filefield', () => { - const component = mountWithIntl(); + const component = mountWithIntl(); expect(component.find('[data-test-subj="discoverChartOptionsToggle"]').exists()).toBeTruthy(); }); }); diff --git a/src/plugins/discover/public/application/main/components/chart/discover_chart.tsx b/src/plugins/discover/public/application/main/components/chart/discover_chart.tsx index 1c382dbdf6b5..abda176ab7b7 100644 --- a/src/plugins/discover/public/application/main/components/chart/discover_chart.tsx +++ b/src/plugins/discover/public/application/main/components/chart/discover_chart.tsx @@ -37,7 +37,7 @@ export function DiscoverChart({ services, state, stateContainer, - timefield, + isTimeBased, viewMode, setDiscoverViewMode, }: { @@ -48,7 +48,7 @@ export function DiscoverChart({ services: DiscoverServices; state: AppState; stateContainer: GetStateReturn; - timefield?: string; + isTimeBased: boolean; viewMode: VIEW_MODE; setDiscoverViewMode: (viewMode: VIEW_MODE) => void; }) { @@ -123,7 +123,7 @@ export function DiscoverChart({ /> )} - {timefield && ( + {isTimeBased && ( - {timefield && !state.hideChart && ( + {isTimeBased && !state.hideChart && (
(chartRef.current.element = element)} diff --git a/src/plugins/discover/public/application/main/components/layout/discover_layout.tsx b/src/plugins/discover/public/application/main/components/layout/discover_layout.tsx index d9d0c2f064bd..d71e99fd2b9a 100644 --- a/src/plugins/discover/public/application/main/components/layout/discover_layout.tsx +++ b/src/plugins/discover/public/application/main/components/layout/discover_layout.tsx @@ -49,6 +49,7 @@ import { DOCUMENTS_VIEW_CLICK, FIELD_STATISTICS_VIEW_CLICK, } from '../../../components/field_stats_table/constants'; +import { DataViewType } from '../../../../../../data_views/common'; /** * Local storage key for sidebar persistence state @@ -122,8 +123,12 @@ export function DiscoverLayout({ useSavedSearchAliasMatchRedirect({ savedSearch, spaces, history }); - const timeField = useMemo(() => { - return indexPattern.type !== 'rollup' ? indexPattern.timeFieldName : undefined; + // We treat rollup v1 data views as non time based in Discover, since we query them + // in a non time based way using the regular _search API, since the internal + // representation of those documents does not have the time field that _field_caps + // reports us. + const isTimeBased = useMemo(() => { + return indexPattern.type !== DataViewType.ROLLUP && indexPattern.isTimeBased(); }, [indexPattern]); const initialSidebarClosed = Boolean(storage.get(SIDEBAR_CLOSED_KEY)); @@ -276,7 +281,7 @@ export function DiscoverLayout({ > {resultState === 'none' && ( diff --git a/src/plugins/discover/public/application/main/components/no_results/no_results.test.tsx b/src/plugins/discover/public/application/main/components/no_results/no_results.test.tsx index 1f6a2235b916..ef63e178ecef 100644 --- a/src/plugins/discover/public/application/main/components/no_results/no_results.test.tsx +++ b/src/plugins/discover/public/application/main/components/no_results/no_results.test.tsx @@ -62,7 +62,7 @@ describe('DiscoverNoResults', () => { describe('timeFieldName', () => { test('renders time range feedback', () => { const result = mountAndFindSubjects({ - timeFieldName: 'awesome_time_field', + isTimeBased: true, }); expect(result).toMatchInlineSnapshot(` Object { @@ -94,7 +94,7 @@ describe('DiscoverNoResults', () => { test('renders error message', () => { const error = new Error('Fatal error'); const result = mountAndFindSubjects({ - timeFieldName: 'awesome_time_field', + isTimeBased: true, error, }); expect(result).toMatchInlineSnapshot(` diff --git a/src/plugins/discover/public/application/main/components/no_results/no_results.tsx b/src/plugins/discover/public/application/main/components/no_results/no_results.tsx index 38dce654f0da..558760f9c003 100644 --- a/src/plugins/discover/public/application/main/components/no_results/no_results.tsx +++ b/src/plugins/discover/public/application/main/components/no_results/no_results.tsx @@ -22,7 +22,7 @@ import './_no_results.scss'; import { NoResultsIllustration } from './assets/no_results_illustration'; export interface DiscoverNoResultsProps { - timeFieldName?: string; + isTimeBased?: boolean; error?: Error; data?: DataPublicPluginStart; hasQuery?: boolean; @@ -31,7 +31,7 @@ export interface DiscoverNoResultsProps { } export function DiscoverNoResults({ - timeFieldName, + isTimeBased, error, data, hasFilters, @@ -54,7 +54,7 @@ export function DiscoverNoResults({ - {!!timeFieldName && getTimeFieldMessage()} + {isTimeBased && getTimeFieldMessage()} {(hasFilters || hasQuery) && ( { const history = useHistory(); - const showDatePicker = useMemo(() => indexPattern.isTimeBased(), [indexPattern]); + const showDatePicker = useMemo( + () => indexPattern.isTimeBased() && indexPattern.type !== DataViewType.ROLLUP, + [indexPattern] + ); const { TopNavMenu } = services.navigation.ui; const onOpenSavedSearch = useCallback( diff --git a/src/plugins/discover/public/application/main/components/top_nav/open_options_popover.scss b/src/plugins/discover/public/application/main/components/top_nav/open_options_popover.scss index f68b2bfe74a9..28c68506aedc 100644 --- a/src/plugins/discover/public/application/main/components/top_nav/open_options_popover.scss +++ b/src/plugins/discover/public/application/main/components/top_nav/open_options_popover.scss @@ -1,5 +1,5 @@ -$dscOptionsPopoverWidth: $euiSizeL * 12; +$dscOptionsPopoverWidth: $euiSizeL * 14; .dscOptionsPopover { width: $dscOptionsPopoverWidth; -} \ No newline at end of file +} diff --git a/src/plugins/discover/public/application/main/components/top_nav/open_options_popover.test.tsx b/src/plugins/discover/public/application/main/components/top_nav/open_options_popover.test.tsx index c9564a3ed029..8363bfdc5761 100644 --- a/src/plugins/discover/public/application/main/components/top_nav/open_options_popover.test.tsx +++ b/src/plugins/discover/public/application/main/components/top_nav/open_options_popover.test.tsx @@ -35,7 +35,7 @@ import { OptionsPopover } from './open_options_popover'; test('should display the correct text if datagrid is selected', () => { const element = document.createElement('div'); const component = mountWithIntl(); - expect(findTestSubject(component, 'docTableMode').text()).toBe('New table'); + expect(findTestSubject(component, 'docTableMode').text()).toBe('Document Explorer'); }); test('should display the correct text if legacy table is selected', () => { @@ -45,5 +45,5 @@ test('should display the correct text if legacy table is selected', () => { uiSettings.set('doc_table:legacy', true); const element = document.createElement('div'); const component = mountWithIntl(); - expect(findTestSubject(component, 'docTableMode').text()).toBe('Classic table'); + expect(findTestSubject(component, 'docTableMode').text()).toBe('Classic'); }); diff --git a/src/plugins/discover/public/application/main/components/top_nav/open_options_popover.tsx b/src/plugins/discover/public/application/main/components/top_nav/open_options_popover.tsx index 1b567813c6f7..a68888acb1f4 100644 --- a/src/plugins/discover/public/application/main/components/top_nav/open_options_popover.tsx +++ b/src/plugins/discover/public/application/main/components/top_nav/open_options_popover.tsx @@ -41,11 +41,11 @@ export function OptionsPopover(props: OptionsPopoverProps) { const isLegacy = uiSettings.get(DOC_TABLE_LEGACY); const mode = isLegacy - ? i18n.translate('discover.openOptionsPopover.legacyTableText', { - defaultMessage: 'Classic table', + ? i18n.translate('discover.openOptionsPopover.classicDiscoverText', { + defaultMessage: 'Classic', }) - : i18n.translate('discover.openOptionsPopover.dataGridText', { - defaultMessage: 'New table', + : i18n.translate('discover.openOptionsPopover.documentExplorerText', { + defaultMessage: 'Document Explorer', }); return ( @@ -60,8 +60,8 @@ export function OptionsPopover(props: OptionsPopoverProps) { viewModeLabel: ( ), @@ -72,21 +72,33 @@ export function OptionsPopover(props: OptionsPopoverProps) { - + {isLegacy ? ( + + ) : ( + + )} - - - {i18n.translate('discover.openOptionsPopover.goToAdvancedSettings', { - defaultMessage: 'Get started', - })} - + {isLegacy && ( + <> + + + {i18n.translate('discover.openOptionsPopover.tryDocumentExplorer', { + defaultMessage: 'Try Document Explorer', + })} + + + )} - {i18n.translate('discover.openOptionsPopover.gotToAllSettings', { - defaultMessage: 'All Discover options', + {i18n.translate('discover.openOptionsPopover.gotToSettings', { + defaultMessage: 'View Discover settings', })} diff --git a/src/plugins/discover/public/application/main/utils/fetch_all.ts b/src/plugins/discover/public/application/main/utils/fetch_all.ts index efaa349181fb..471616c9d426 100644 --- a/src/plugins/discover/public/application/main/utils/fetch_all.ts +++ b/src/plugins/discover/public/application/main/utils/fetch_all.ts @@ -26,6 +26,7 @@ import { DataPublicPluginStart } from '../../../../../data/public'; import { SavedSearchData } from './use_saved_search'; import { DiscoverServices } from '../../../build_services'; import { ReduxLikeStateContainer } from '../../../../../kibana_utils/common'; +import { DataViewType } from '../../../../../data_views/common'; export function fetchAll( dataSubjects: SavedSearchData, @@ -72,16 +73,17 @@ export function fetchAll( }, }; + const isChartVisible = + !hideChart && indexPattern.isTimeBased() && indexPattern.type !== DataViewType.ROLLUP; + const all = forkJoin({ documents: fetchDocuments(dataSubjects, searchSource.createCopy(), subFetchDeps), - totalHits: - hideChart || !indexPattern.timeFieldName - ? fetchTotalHits(dataSubjects, searchSource.createCopy(), subFetchDeps) - : of(null), - chart: - !hideChart && indexPattern.timeFieldName - ? fetchChart(dataSubjects, searchSource.createCopy(), subFetchDeps) - : of(null), + totalHits: !isChartVisible + ? fetchTotalHits(dataSubjects, searchSource.createCopy(), subFetchDeps) + : of(null), + chart: isChartVisible + ? fetchChart(dataSubjects, searchSource.createCopy(), subFetchDeps) + : of(null), }); all.subscribe( diff --git a/src/plugins/discover/public/application/main/utils/fetch_documents.ts b/src/plugins/discover/public/application/main/utils/fetch_documents.ts index 0c80aee3f909..b23dd3a0ed93 100644 --- a/src/plugins/discover/public/application/main/utils/fetch_documents.ts +++ b/src/plugins/discover/public/application/main/utils/fetch_documents.ts @@ -38,6 +38,13 @@ export const fetchDocuments = ( searchSource.setField('trackTotalHits', false); searchSource.setField('highlightAll', true); searchSource.setField('version', true); + if (searchSource.getField('index')?.type === 'rollup') { + // We treat that index pattern as "normal" even if it was a rollup index pattern, + // since the rollup endpoint does not support querying individual documents, but we + // can get them from the regular _search API that will be used if the index pattern + // not a rollup index pattern. + searchSource.setOverwriteDataViewType(undefined); + } sendLoadingMsg(documents$); diff --git a/src/plugins/discover/public/application/main/utils/fetch_total_hits.ts b/src/plugins/discover/public/application/main/utils/fetch_total_hits.ts index b80dfa9b31e7..197e00ce0449 100644 --- a/src/plugins/discover/public/application/main/utils/fetch_total_hits.ts +++ b/src/plugins/discover/public/application/main/utils/fetch_total_hits.ts @@ -13,6 +13,7 @@ import { isCompleteResponse, ISearchSource, } from '../../../../../data/public'; +import { DataViewType } from '../../../../../data_views/common'; import { Adapters } from '../../../../../inspector/common'; import { FetchStatus } from '../../types'; import { SavedSearchData } from './use_saved_search'; @@ -36,13 +37,18 @@ export function fetchTotalHits( } ) { const { totalHits$ } = data$; - const indexPattern = searchSource.getField('index'); searchSource.setField('trackTotalHits', true); - searchSource.setField('filter', data.query.timefilter.timefilter.createFilter(indexPattern!)); searchSource.setField('size', 0); searchSource.removeField('sort'); searchSource.removeField('fields'); searchSource.removeField('aggs'); + if (searchSource.getField('index')?.type === DataViewType.ROLLUP) { + // We treat that index pattern as "normal" even if it was a rollup index pattern, + // since the rollup endpoint does not support querying individual documents, but we + // can get them from the regular _search API that will be used if the index pattern + // not a rollup index pattern. + searchSource.setOverwriteDataViewType(undefined); + } sendLoadingMsg(totalHits$); diff --git a/src/plugins/discover/public/application/main/utils/update_search_source.ts b/src/plugins/discover/public/application/main/utils/update_search_source.ts index a08f180f1816..1ee15790077c 100644 --- a/src/plugins/discover/public/application/main/utils/update_search_source.ts +++ b/src/plugins/discover/public/application/main/utils/update_search_source.ts @@ -8,6 +8,7 @@ import { SORT_DEFAULT_ORDER_SETTING } from '../../../../common'; import { IndexPattern, ISearchSource } from '../../../../../data/common'; +import { DataViewType } from '../../../../../data_views/common'; import type { SortOrder } from '../../../services/saved_searches'; import { DiscoverServices } from '../../../build_services'; import { getSortForSearchSource } from '../../../components/doc_table'; @@ -44,14 +45,9 @@ export function updateSearchSource( indexPattern, uiSettings.get(SORT_DEFAULT_ORDER_SETTING) ); - searchSource - .setField('trackTotalHits', true) - .setField('sort', usedSort) - // Even when searching rollups, we want to use the default strategy so that we get back a - // document-like response. - .setPreferredSearchStrategyId('default'); + searchSource.setField('trackTotalHits', true).setField('sort', usedSort); - if (indexPattern.type !== 'rollup') { + if (indexPattern.type !== DataViewType.ROLLUP) { // Set the date range filter fields from timeFilter using the absolute format. Search sessions requires that it be converted from a relative range searchSource.setField('filter', data.query.timefilter.timefilter.createFilter(indexPattern)); } diff --git a/src/plugins/discover/public/services/saved_searches/get_saved_searches.test.ts b/src/plugins/discover/public/services/saved_searches/get_saved_searches.test.ts index 1ac5f2d9653a..1159320c9a09 100644 --- a/src/plugins/discover/public/services/saved_searches/get_saved_searches.test.ts +++ b/src/plugins/discover/public/services/saved_searches/get_saved_searches.test.ts @@ -124,8 +124,8 @@ describe('getSavedSearch', () => { "serialize": [MockFunction], "setField": [MockFunction], "setFields": [MockFunction], + "setOverwriteDataViewType": [MockFunction], "setParent": [MockFunction], - "setPreferredSearchStrategyId": [MockFunction], }, "sharingSavedObjectProps": Object { "aliasTargetId": undefined, diff --git a/src/plugins/discover/public/services/saved_searches/saved_searches_utils.test.ts b/src/plugins/discover/public/services/saved_searches/saved_searches_utils.test.ts index 3d7d053bd1ec..f2ad8b92adbc 100644 --- a/src/plugins/discover/public/services/saved_searches/saved_searches_utils.test.ts +++ b/src/plugins/discover/public/services/saved_searches/saved_searches_utils.test.ts @@ -68,9 +68,10 @@ describe('saved_searches_utils', () => { "history": Array [], "id": "data_source1", "inheritOptions": Object {}, + "overwriteDataViewType": undefined, "parent": undefined, "requestStartHandlers": Array [], - "searchStrategyId": undefined, + "shouldOverwriteDataViewType": false, }, "sharingSavedObjectProps": Object {}, "sort": Array [], diff --git a/src/plugins/discover/server/ui_settings.ts b/src/plugins/discover/server/ui_settings.ts index df06260d45d2..e9aa51a7384b 100644 --- a/src/plugins/discover/server/ui_settings.ts +++ b/src/plugins/discover/server/ui_settings.ts @@ -158,14 +158,14 @@ export const getUiSettings: () => Record = () => ({ schema: schema.arrayOf(schema.string()), }, [DOC_TABLE_LEGACY]: { - name: i18n.translate('discover.advancedSettings.docTableVersionName', { - defaultMessage: 'Use classic table', + name: i18n.translate('discover.advancedSettings.disableDocumentExplorer', { + defaultMessage: 'Document Explorer or classic view', }), value: true, - description: i18n.translate('discover.advancedSettings.docTableVersionDescription', { + description: i18n.translate('discover.advancedSettings.disableDocumentExplorerDescription', { defaultMessage: - 'Discover uses a new table layout that includes better data sorting, drag-and-drop columns, and a full screen view. ' + - 'Turn on this option to use the classic table. Turn off to use the new table. ', + 'To use the new Document Explorer instead of the classic view, turn off this option. ' + + 'The Document Explorer offers better data sorting, resizable columns, and a full screen view.', }), category: ['discover'], schema: schema.boolean(), diff --git a/src/plugins/kibana_react/public/code_editor/languages/constants.ts b/src/plugins/kibana_react/public/code_editor/languages/constants.ts index af80e4ccc56e..510cc91cf5e7 100644 --- a/src/plugins/kibana_react/public/code_editor/languages/constants.ts +++ b/src/plugins/kibana_react/public/code_editor/languages/constants.ts @@ -10,3 +10,4 @@ export { LANG as CssLang } from './css/constants'; export { LANG as MarkdownLang } from './markdown/constants'; export { LANG as YamlLang } from './yaml/constants'; export { LANG as HandlebarsLang } from './handlebars/constants'; +export { LANG as HJsonLang } from './hjson/constants'; diff --git a/src/plugins/kibana_react/public/code_editor/languages/hjson/constants.ts b/src/plugins/kibana_react/public/code_editor/languages/hjson/constants.ts new file mode 100644 index 000000000000..61e851e0b6f5 --- /dev/null +++ b/src/plugins/kibana_react/public/code_editor/languages/hjson/constants.ts @@ -0,0 +1,9 @@ +/* + * 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 const LANG = 'hjson'; diff --git a/src/plugins/kibana_react/public/code_editor/languages/hjson/index.ts b/src/plugins/kibana_react/public/code_editor/languages/hjson/index.ts new file mode 100644 index 000000000000..ff3c08267da9 --- /dev/null +++ b/src/plugins/kibana_react/public/code_editor/languages/hjson/index.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 { LangModuleType } from '@kbn/monaco'; +import { languageConfiguration, lexerRules } from './language'; +import { LANG } from './constants'; + +export const Lang: LangModuleType = { ID: LANG, languageConfiguration, lexerRules }; diff --git a/src/plugins/kibana_react/public/code_editor/languages/hjson/language.ts b/src/plugins/kibana_react/public/code_editor/languages/hjson/language.ts new file mode 100644 index 000000000000..d93cdfe4c4a2 --- /dev/null +++ b/src/plugins/kibana_react/public/code_editor/languages/hjson/language.ts @@ -0,0 +1,90 @@ +/* + * 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 { monaco } from '@kbn/monaco'; + +export const languageConfiguration: monaco.languages.LanguageConfiguration = { + brackets: [ + ['{', '}'], + ['[', ']'], + ], + autoClosingPairs: [ + { open: '{', close: '}' }, + { open: '[', close: ']' }, + { open: '"', close: '"', notIn: ['string'] }, + ], + comments: { + lineComment: '//', + blockComment: ['/*', '*/'], + }, +}; + +export const lexerRules: monaco.languages.IMonarchLanguage = { + defaultToken: '', + tokenPostfix: '', + escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/, + digits: /-?(?:0|[1-9]\d*)(?:(?:\.\d+)?(?:[eE][+-]?\d+)?)?/, + symbols: /[,:]+/, + tokenizer: { + root: [ + [/(@digits)n?/, 'number'], + [/(@symbols)n?/, 'delimiter'], + + { include: '@keyword' }, + { include: '@url' }, + { include: '@whitespace' }, + { include: '@brackets' }, + { include: '@keyName' }, + { include: '@string' }, + ], + + keyword: [[/(?:true|false|null)\b/, 'keyword']], + + url: [ + [ + /(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})/, + 'string', + ], + ], + + keyName: [[/(?:[^,\{\[\}\]\s]+|"(?:[^"\\]|\\.)*")\s*(?=:)/, 'variable']], + + brackets: [[/{/, '@push'], [/}/, '@pop'], [/[[(]/], [/[\])]/]], + + whitespace: [ + [/[ \t\r\n]+/, ''], + [/\/\*/, 'comment', '@comment'], + [/\/\/.*$/, 'comment'], + ], + + comment: [ + [/[^\/*]+/, 'comment'], + [/\*\//, 'comment', '@pop'], + [/[\/*]/, 'comment'], + ], + + string: [ + [/(?:[^,\{\[\}\]\s]+|"(?:[^"\\]|\\.)*")\s*/, 'string'], + [/"""/, 'string', '@stringLiteral'], + [/"/, 'string', '@stringDouble'], + ], + + stringDouble: [ + [/[^\\"]+/, 'string'], + [/@escapes/, 'string.escape'], + [/\\./, 'string.escape.invalid'], + [/"/, 'string', '@pop'], + ], + + stringLiteral: [ + [/"""/, 'string', '@pop'], + [/\\""""/, 'string', '@pop'], + [/./, 'string'], + ], + }, +} as monaco.languages.IMonarchLanguage; diff --git a/src/plugins/kibana_react/public/code_editor/languages/index.ts b/src/plugins/kibana_react/public/code_editor/languages/index.ts index b797ea44d1f9..f862997fdc2e 100644 --- a/src/plugins/kibana_react/public/code_editor/languages/index.ts +++ b/src/plugins/kibana_react/public/code_editor/languages/index.ts @@ -10,5 +10,6 @@ import { Lang as CssLang } from './css'; import { Lang as HandlebarsLang } from './handlebars'; import { Lang as MarkdownLang } from './markdown'; import { Lang as YamlLang } from './yaml'; +import { Lang as HJson } from './hjson'; -export { CssLang, HandlebarsLang, MarkdownLang, YamlLang }; +export { CssLang, HandlebarsLang, MarkdownLang, YamlLang, HJson }; diff --git a/src/plugins/kibana_react/public/code_editor/register_languages.ts b/src/plugins/kibana_react/public/code_editor/register_languages.ts index a32318a7e4b2..62eccdabb5d9 100644 --- a/src/plugins/kibana_react/public/code_editor/register_languages.ts +++ b/src/plugins/kibana_react/public/code_editor/register_languages.ts @@ -6,9 +6,10 @@ * Side Public License, v 1. */ import { registerLanguage } from '@kbn/monaco'; -import { CssLang, HandlebarsLang, MarkdownLang, YamlLang } from './languages'; +import { CssLang, HandlebarsLang, MarkdownLang, YamlLang, HJson } from './languages'; registerLanguage(CssLang); registerLanguage(HandlebarsLang); registerLanguage(MarkdownLang); registerLanguage(YamlLang); +registerLanguage(HJson); diff --git a/src/plugins/kibana_usage_collection/server/collectors/application_usage/schema.ts b/src/plugins/kibana_usage_collection/server/collectors/application_usage/schema.ts index 7c112083875d..adfe8da335a1 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/application_usage/schema.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/application_usage/schema.ts @@ -150,6 +150,7 @@ export const applicationUsageSchema = { 'observability-overview': commonSchema, osquery: commonSchema, security_account: commonSchema, + reportingRedirect: commonSchema, security_access_agreement: commonSchema, security_capture_url: commonSchema, // It's a forward app so we'll likely never report it security_logged_out: commonSchema, diff --git a/src/plugins/saved_objects/public/saved_object/saved_object.test.ts b/src/plugins/saved_objects/public/saved_object/saved_object.test.ts index bd8d69d6b693..01fc75df459b 100644 --- a/src/plugins/saved_objects/public/saved_object/saved_object.test.ts +++ b/src/plugins/saved_objects/public/saved_object/saved_object.test.ts @@ -6,7 +6,6 @@ * Side Public License, v 1. */ -import Bluebird from 'bluebird'; import { createSavedObjectClass } from './saved_object'; import { SavedObject, @@ -55,16 +54,16 @@ describe('Saved Object', () => { */ function stubESResponse(mockDocResponse: SimpleSavedObject) { // Stub out search for duplicate title: - savedObjectsClientStub.get = jest.fn().mockReturnValue(Bluebird.resolve(mockDocResponse)); - savedObjectsClientStub.update = jest.fn().mockReturnValue(Bluebird.resolve(mockDocResponse)); + savedObjectsClientStub.get = jest.fn().mockReturnValue(Promise.resolve(mockDocResponse)); + savedObjectsClientStub.update = jest.fn().mockReturnValue(Promise.resolve(mockDocResponse)); savedObjectsClientStub.find = jest .fn() - .mockReturnValue(Bluebird.resolve({ savedObjects: [], total: 0 })); + .mockReturnValue(Promise.resolve({ savedObjects: [], total: 0 })); savedObjectsClientStub.bulkGet = jest .fn() - .mockReturnValue(Bluebird.resolve({ savedObjects: [mockDocResponse] })); + .mockReturnValue(Promise.resolve({ savedObjects: [mockDocResponse] })); } function stubSavedObjectsClientCreate( @@ -73,7 +72,7 @@ describe('Saved Object', () => { ) { savedObjectsClientStub.create = jest .fn() - .mockReturnValue(resolve ? Bluebird.resolve(resp) : Bluebird.reject(resp)); + .mockReturnValue(resolve ? Promise.resolve(resp) : Promise.reject(resp)); } /** @@ -262,7 +261,7 @@ describe('Saved Object', () => { return createInitializedSavedObject({ type: 'dashboard', id: myId }).then((savedObject) => { savedObjectsClientStub.create = jest.fn().mockImplementation(() => { expect(savedObject.id).toBe(myId); - return Bluebird.resolve({ id: myId }); + return Promise.resolve({ id: myId }); }); savedObject.copyOnSave = false; @@ -296,7 +295,7 @@ describe('Saved Object', () => { return createInitializedSavedObject({ type: 'dashboard', id }).then((savedObject) => { savedObjectsClientStub.create = jest.fn().mockImplementation(() => { expect(savedObject.isSaving).toBe(true); - return Bluebird.resolve({ + return Promise.resolve({ type: 'dashboard', id, _version: 'foo', @@ -315,7 +314,7 @@ describe('Saved Object', () => { return createInitializedSavedObject({ type: 'dashboard' }).then((savedObject) => { savedObjectsClientStub.create = jest.fn().mockImplementation(() => { expect(savedObject.isSaving).toBe(true); - return Bluebird.reject(''); + return Promise.reject(''); }); expect(savedObject.isSaving).toBe(false); @@ -745,7 +744,7 @@ describe('Saved Object', () => { }, }); savedObject.searchSource!.setField('index', indexPattern); - return Bluebird.resolve(indexPattern); + return Promise.resolve(indexPattern); }); expect(!!savedObject.searchSource!.getField('index')).toBe(false); diff --git a/src/plugins/telemetry/schema/oss_plugins.json b/src/plugins/telemetry/schema/oss_plugins.json index 21273482dd2b..60c5bbd4346e 100644 --- a/src/plugins/telemetry/schema/oss_plugins.json +++ b/src/plugins/telemetry/schema/oss_plugins.json @@ -4232,6 +4232,137 @@ } } }, + "reportingRedirect": { + "properties": { + "appId": { + "type": "keyword", + "_meta": { + "description": "The application being tracked" + } + }, + "viewId": { + "type": "keyword", + "_meta": { + "description": "Always `main`" + } + }, + "clicks_total": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application since we started counting them" + } + }, + "clicks_7_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application over the last 7 days" + } + }, + "clicks_30_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application over the last 30 days" + } + }, + "clicks_90_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application over the last 90 days" + } + }, + "minutes_on_screen_total": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen since we started counting them." + } + }, + "minutes_on_screen_7_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen over the last 7 days" + } + }, + "minutes_on_screen_30_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen over the last 30 days" + } + }, + "minutes_on_screen_90_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen over the last 90 days" + } + }, + "views": { + "type": "array", + "items": { + "properties": { + "appId": { + "type": "keyword", + "_meta": { + "description": "The application being tracked" + } + }, + "viewId": { + "type": "keyword", + "_meta": { + "description": "The application view being tracked" + } + }, + "clicks_total": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application sub view since we started counting them" + } + }, + "clicks_7_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the active application sub view over the last 7 days" + } + }, + "clicks_30_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the active application sub view over the last 30 days" + } + }, + "clicks_90_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the active application sub view over the last 90 days" + } + }, + "minutes_on_screen_total": { + "type": "float", + "_meta": { + "description": "Minutes the application sub view is active and on-screen since we started counting them." + } + }, + "minutes_on_screen_7_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen active application sub view over the last 7 days" + } + }, + "minutes_on_screen_30_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen active application sub view over the last 30 days" + } + }, + "minutes_on_screen_90_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen active application sub view over the last 90 days" + } + } + } + } + } + } + }, "security_access_agreement": { "properties": { "appId": { diff --git a/src/plugins/telemetry/server/fetcher.ts b/src/plugins/telemetry/server/fetcher.ts index 97180f351986..77770227a887 100644 --- a/src/plugins/telemetry/server/fetcher.ts +++ b/src/plugins/telemetry/server/fetcher.ts @@ -16,7 +16,6 @@ import { SavedObjectsClientContract, SavedObjectsClient, CoreStart, - ICustomClusterClient, } from '../../../core/server'; import { getTelemetryChannelEndpoint, @@ -53,7 +52,6 @@ export class FetcherTask { private isSending = false; private internalRepository?: SavedObjectsClientContract; private telemetryCollectionManager?: TelemetryCollectionManagerPluginStart; - private elasticsearchClient?: ICustomClusterClient; constructor(initializerContext: PluginInitializerContext) { this.config$ = initializerContext.config.create(); @@ -67,7 +65,6 @@ export class FetcherTask { ) { this.internalRepository = new SavedObjectsClient(savedObjects.createInternalRepository()); this.telemetryCollectionManager = telemetryCollectionManager; - this.elasticsearchClient = elasticsearch.createClient('telemetry-fetcher'); this.intervalId = timer(this.initialCheckDelayMs, this.checkIntervalMs).subscribe(() => this.sendIfDue() @@ -78,9 +75,6 @@ export class FetcherTask { if (this.intervalId) { this.intervalId.unsubscribe(); } - if (this.elasticsearchClient) { - this.elasticsearchClient.close(); - } } private async areAllCollectorsReady() { diff --git a/src/plugins/vis_type_markdown/server/index.ts b/src/plugins/vis_type_markdown/server/index.ts index d9665a090231..cc1c995a185f 100644 --- a/src/plugins/vis_type_markdown/server/index.ts +++ b/src/plugins/vis_type_markdown/server/index.ts @@ -13,7 +13,7 @@ import { configSchema, ConfigSchema } from '../config'; export const config: PluginConfigDescriptor = { schema: configSchema, deprecations: ({ renameFromRoot }) => [ - renameFromRoot('markdown_vis.enabled', 'vis_type_markdown.enabled'), + renameFromRoot('markdown_vis.enabled', 'vis_type_markdown.enabled', { level: 'warning' }), ], }; diff --git a/src/plugins/vis_types/timelion/server/handlers/chain_runner.js b/src/plugins/vis_types/timelion/server/handlers/chain_runner.js index 3710d015f3f6..fac1a68acc90 100644 --- a/src/plugins/vis_types/timelion/server/handlers/chain_runner.js +++ b/src/plugins/vis_types/timelion/server/handlers/chain_runner.js @@ -7,7 +7,6 @@ */ import _ from 'lodash'; -import Bluebird from 'bluebird'; import { i18n } from '@kbn/i18n'; import moment from 'moment'; @@ -42,7 +41,7 @@ export default function chainRunner(tlConfig) { function resolveArgument(item) { if (Array.isArray(item)) { - return Bluebird.all(_.map(item, resolveArgument)); + return Promise.all(_.map(item, resolveArgument)); } if (_.isObject(item)) { @@ -51,7 +50,7 @@ export default function chainRunner(tlConfig) { const itemFunctionDef = tlConfig.getFunction(item.function); if (itemFunctionDef.cacheKey && queryCache[itemFunctionDef.cacheKey(item)]) { stats.queryCount++; - return Bluebird.resolve(_.cloneDeep(queryCache[itemFunctionDef.cacheKey(item)])); + return Promise.resolve(_.cloneDeep(queryCache[itemFunctionDef.cacheKey(item)])); } return invoke(item.function, item.arguments); } @@ -94,7 +93,7 @@ export default function chainRunner(tlConfig) { args = _.map(args, resolveArgument); - return Bluebird.all(args).then(function (args) { + return Promise.all(args).then(function (args) { args.byName = indexArguments(functionDef, args); return functionDef.fn(args, tlConfig); }); @@ -128,7 +127,7 @@ export default function chainRunner(tlConfig) { return args; }); }); - return Bluebird.all(seriesList).then(function (args) { + return Promise.all(seriesList).then(function (args) { const list = _.chain(args).map('list').flatten().value(); const seriesList = _.merge.apply(this, _.flatten([{}, args])); seriesList.list = list; @@ -158,22 +157,22 @@ export default function chainRunner(tlConfig) { }) .value(); - return Bluebird.settle(promises).then(function (resolvedDatasources) { + return Promise.allSettled(promises).then(function (resolvedDatasources) { stats.queryTime = new Date().getTime(); _.each(queries, function (query, i) { const functionDef = tlConfig.getFunction(query.function); const resolvedDatasource = resolvedDatasources[i]; - if (resolvedDatasource.isRejected()) { - if (resolvedDatasource.reason().isBoom) { - throw resolvedDatasource.reason(); + if (resolvedDatasource.status === 'rejected') { + if (resolvedDatasource.reason.isBoom) { + throw resolvedDatasource.reason; } else { - throwWithCell(query.cell, resolvedDatasource.reason()); + throwWithCell(query.cell, resolvedDatasource.reason); } } - queryCache[functionDef.cacheKey(query)] = resolvedDatasource.value(); + queryCache[functionDef.cacheKey(query)] = resolvedDatasource.value; }); stats.cacheCount = _.keys(queryCache).length; diff --git a/src/plugins/vis_types/timelion/server/lib/alter.js b/src/plugins/vis_types/timelion/server/lib/alter.js index 2e234f3405c2..47a57f213cdb 100644 --- a/src/plugins/vis_types/timelion/server/lib/alter.js +++ b/src/plugins/vis_types/timelion/server/lib/alter.js @@ -6,7 +6,6 @@ * Side Public License, v 1. */ -import Bluebird from 'bluebird'; import _ from 'lodash'; /* @param {Array} args @@ -18,7 +17,7 @@ import _ from 'lodash'; export default function alter(args, fn) { // In theory none of the args should ever be promises. This is probably a waste. - return Bluebird.all(args) + return Promise.all(args) .then(function (args) { const seriesList = args.shift(); diff --git a/src/plugins/vis_types/timelion/server/routes/run.ts b/src/plugins/vis_types/timelion/server/routes/run.ts index b8c0ce4ea659..d615302253a1 100644 --- a/src/plugins/vis_types/timelion/server/routes/run.ts +++ b/src/plugins/vis_types/timelion/server/routes/run.ts @@ -8,7 +8,6 @@ import { IRouter, Logger, CoreSetup } from 'kibana/server'; import { schema } from '@kbn/config-schema'; -import Bluebird from 'bluebird'; import _ from 'lodash'; // @ts-ignore import chainRunnerFn from '../handlers/chain_runner.js'; @@ -96,7 +95,7 @@ export function runRoute( }); try { const chainRunner = chainRunnerFn(tlConfig); - const sheet = await Bluebird.all(chainRunner.processRequest(request.body)); + const sheet = await Promise.all(await chainRunner.processRequest(request.body)); return response.ok({ body: { sheet, diff --git a/src/plugins/vis_types/timelion/server/series_functions/quandl.js b/src/plugins/vis_types/timelion/server/series_functions/quandl.js index 7e3a0f6de9ab..3c209879d7a4 100644 --- a/src/plugins/vis_types/timelion/server/series_functions/quandl.js +++ b/src/plugins/vis_types/timelion/server/series_functions/quandl.js @@ -10,7 +10,6 @@ import { i18n } from '@kbn/i18n'; import _ from 'lodash'; import fetch from 'node-fetch'; import moment from 'moment'; -fetch.Promise = require('bluebird'); import Datasource from '../lib/classes/datasource'; diff --git a/src/plugins/vis_types/timelion/server/series_functions/static.js b/src/plugins/vis_types/timelion/server/series_functions/static.js index b5e8dd6df668..afc1bd5afbbb 100644 --- a/src/plugins/vis_types/timelion/server/series_functions/static.js +++ b/src/plugins/vis_types/timelion/server/series_functions/static.js @@ -9,7 +9,6 @@ import { i18n } from '@kbn/i18n'; import _ from 'lodash'; import Datasource from '../lib/classes/datasource'; -import Bluebird from 'bluebird'; export default new Datasource('static', { aliases: ['value'], @@ -51,7 +50,7 @@ export default new Datasource('static', { }); } - return Bluebird.resolve({ + return Promise.resolve({ type: 'seriesList', list: [ { diff --git a/src/plugins/vis_types/timelion/server/series_functions/worldbank_indicators.js b/src/plugins/vis_types/timelion/server/series_functions/worldbank_indicators.js index ba28a8234552..c2eb07890a10 100644 --- a/src/plugins/vis_types/timelion/server/series_functions/worldbank_indicators.js +++ b/src/plugins/vis_types/timelion/server/series_functions/worldbank_indicators.js @@ -9,7 +9,6 @@ import { i18n } from '@kbn/i18n'; import _ from 'lodash'; import worldbank from './worldbank.js'; -import Bluebird from 'bluebird'; import Datasource from '../lib/classes/datasource'; export default new Datasource('worldbank_indicators', { @@ -61,9 +60,11 @@ export default new Datasource('worldbank_indicators', { return worldbank.timelionFn(wbArgs, tlConfig); }); - return Bluebird.map(seriesLists, function (seriesList) { - return seriesList.list[0]; - }).then(function (list) { + return Promise.all( + seriesLists.map(function (seriesList) { + return seriesList.list[0]; + }) + ).then(function (list) { return { type: 'seriesList', list: list, diff --git a/src/plugins/vis_types/timelion/server/series_functions/yaxis.test.js b/src/plugins/vis_types/timelion/server/series_functions/yaxis.test.js index 6d627832544d..d68aa7ac7011 100644 --- a/src/plugins/vis_types/timelion/server/series_functions/yaxis.test.js +++ b/src/plugins/vis_types/timelion/server/series_functions/yaxis.test.js @@ -7,7 +7,6 @@ */ import fn from './yaxis'; -import Bluebird from 'bluebird'; const expect = require('chai').expect; import invoke from './helpers/invoke_series_fn.js'; @@ -25,7 +24,7 @@ describe('yaxis.js', () => { }); it('puts odd numbers of the left, even on the right, by default', () => { - return Bluebird.all([ + return Promise.all([ invoke(fn, [seriesList, 1]).then((r) => { expect(r.output.list[0]._global.yaxes[0].position).to.equal('left'); }), @@ -39,7 +38,7 @@ describe('yaxis.js', () => { }); it('it lets you override default positions', () => { - return Bluebird.all([ + return Promise.all([ invoke(fn, [seriesList, 1, null, null, 'right']).then((r) => { expect(r.output.list[0]._global.yaxes[0].position).to.equal('right'); }), @@ -50,7 +49,7 @@ describe('yaxis.js', () => { }); it('sets the minimum (default: no min)', () => { - return Bluebird.all([ + return Promise.all([ invoke(fn, [seriesList, 1, null]).then((r) => { expect(r.output.list[0]._global.yaxes[0].min).to.equal(null); }), @@ -61,7 +60,7 @@ describe('yaxis.js', () => { }); it('sets the max (default: no max)', () => { - return Bluebird.all([ + return Promise.all([ invoke(fn, [seriesList, 1, null]).then((r) => { expect(r.output.list[0]._global.yaxes[0].max).to.equal(undefined); }), @@ -72,7 +71,7 @@ describe('yaxis.js', () => { }); it('sets the units (default: no unit', () => { - return Bluebird.all([ + return Promise.all([ invoke(fn, [seriesList, 1, null, null, null, null, null, null]).then((r) => { expect(r.output.list[0]._global.yaxes[0].units).to.equal(undefined); }), diff --git a/src/plugins/vis_types/timeseries/server/lib/vis_data/get_series_data.ts b/src/plugins/vis_types/timeseries/server/lib/vis_data/get_series_data.ts index a9a3825f5a9d..6f96c0d23cad 100644 --- a/src/plugins/vis_types/timeseries/server/lib/vis_data/get_series_data.ts +++ b/src/plugins/vis_types/timeseries/server/lib/vis_data/get_series_data.ts @@ -36,7 +36,10 @@ export async function getSeriesData( fieldFormatService, } = services; - const panelIndex = await cachedIndexPatternFetcher(panel.index_pattern); + const panelIndex = await cachedIndexPatternFetcher( + panel.index_pattern, + !panel.use_kibana_indexes + ); const strategy = await searchStrategyRegistry.getViableStrategy(requestContext, req, panelIndex); diff --git a/src/plugins/vis_types/timeseries/server/lib/vis_data/get_table_data.ts b/src/plugins/vis_types/timeseries/server/lib/vis_data/get_table_data.ts index 3b53147dc6f9..35b6a78d0579 100644 --- a/src/plugins/vis_types/timeseries/server/lib/vis_data/get_table_data.ts +++ b/src/plugins/vis_types/timeseries/server/lib/vis_data/get_table_data.ts @@ -31,7 +31,10 @@ export async function getTableData( panel: Panel, services: VisTypeTimeseriesRequestServices ) { - const panelIndex = await services.cachedIndexPatternFetcher(panel.index_pattern); + const panelIndex = await services.cachedIndexPatternFetcher( + panel.index_pattern, + !panel.use_kibana_indexes + ); const strategy = await services.searchStrategyRegistry.getViableStrategy( requestContext, diff --git a/src/plugins/vis_types/vega/kibana.json b/src/plugins/vis_types/vega/kibana.json index 1a499e284c1a..cedd73cc6d39 100644 --- a/src/plugins/vis_types/vega/kibana.json +++ b/src/plugins/vis_types/vega/kibana.json @@ -5,7 +5,7 @@ "ui": true, "requiredPlugins": ["data", "visualizations", "mapsEms", "expressions", "inspector"], "optionalPlugins": ["home","usageCollection"], - "requiredBundles": ["kibanaUtils", "kibanaReact", "visDefaultEditor", "esUiShared"], + "requiredBundles": ["kibanaUtils", "kibanaReact", "visDefaultEditor"], "owner": { "name": "Vis Editors", "githubTeam": "kibana-vis-editors" diff --git a/src/plugins/vis_types/vega/public/components/vega_editor.scss b/src/plugins/vis_types/vega/public/components/vega_editor.scss index 709aaa2030f6..4381c0097f96 100644 --- a/src/plugins/vis_types/vega/public/components/vega_editor.scss +++ b/src/plugins/vis_types/vega/public/components/vega_editor.scss @@ -1,18 +1,28 @@ .visEditor--vega { .visEditorSidebar__config { padding: 0; + display: flex; + flex-direction: row; + overflow: hidden; + + min-height: $euiSize * 15; + + @include euiBreakpoint('xs', 's', 'm') { + max-height: $euiSize * 15; + } } } .vgaEditor { - @include euiBreakpoint('xs', 's', 'm') { - @include euiScrollBar; - max-height: $euiSize * 15; - overflow-y: auto; + width: 100%; + flex-grow: 1; + + .kibanaCodeEditor { + width: 100%; } } -.vgaEditor__aceEditorActions { +.vgaEditor__editorActions { position: absolute; z-index: $euiZLevel1; top: $euiSizeS; diff --git a/src/plugins/vis_types/vega/public/components/vega_vis_editor.tsx b/src/plugins/vis_types/vega/public/components/vega_vis_editor.tsx index d2f586eac988..46e5e331c945 100644 --- a/src/plugins/vis_types/vega/public/components/vega_vis_editor.tsx +++ b/src/plugins/vis_types/vega/public/components/vega_vis_editor.tsx @@ -6,14 +6,16 @@ * Side Public License, v 1. */ -import React, { useCallback } from 'react'; -import compactStringify from 'json-stringify-pretty-compact'; +import { XJsonLang } from '@kbn/monaco'; +import useMount from 'react-use/lib/useMount'; import hjson from 'hjson'; -import 'brace/mode/hjson'; + +import React, { useCallback, useState } from 'react'; +import compactStringify from 'json-stringify-pretty-compact'; import { i18n } from '@kbn/i18n'; import { VisEditorOptionsProps } from 'src/plugins/visualizations/public'; -import { EuiCodeEditor } from '../../../../es_ui_shared/public'; +import { CodeEditor, HJsonLang } from '../../../../kibana_react/public'; import { getNotifications } from '../services'; import { VisParams } from '../vega_fn'; import { VegaHelpMenu } from './vega_help_menu'; @@ -21,20 +23,6 @@ import { VegaActionsMenu } from './vega_actions_menu'; import './vega_editor.scss'; -const aceOptions = { - maxLines: Infinity, - highlightActiveLine: false, - showPrintMargin: false, - tabSize: 2, - useSoftTabs: true, - wrap: true, -}; - -const hjsonStringifyOptions = { - bracesSameLine: true, - keepWsc: true, -}; - function format( value: string, stringify: typeof hjson.stringify | typeof compactStringify, @@ -42,7 +30,11 @@ function format( ) { try { const spec = hjson.parse(value, { legacyRoot: false, keepWsc: true }); - return stringify(spec, options); + + return { + value: stringify(spec, options), + isValid: true, + }; } catch (err) { // This is a common case - user tries to format an invalid HJSON text getNotifications().toasts.addError(err, { @@ -51,44 +43,82 @@ function format( }), }); - return value; + return { value, isValid: false }; } } function VegaVisEditor({ stateParams, setValue }: VisEditorOptionsProps) { - const onChange = useCallback( - (value: string) => { + const [languageId, setLanguageId] = useState(); + + useMount(() => { + let specLang = XJsonLang.ID; + try { + JSON.parse(stateParams.spec); + } catch { + specLang = HJsonLang; + } + setLanguageId(specLang); + }); + + const setSpec = useCallback( + (value: string, specLang?: string) => { setValue('spec', value); + if (specLang) { + setLanguageId(specLang); + } }, [setValue] ); - const formatJson = useCallback( - () => setValue('spec', format(stateParams.spec, compactStringify)), - [setValue, stateParams.spec] - ); + const onChange = useCallback((value: string) => setSpec(value), [setSpec]); - const formatHJson = useCallback( - () => setValue('spec', format(stateParams.spec, hjson.stringify, hjsonStringifyOptions)), - [setValue, stateParams.spec] - ); + const formatJson = useCallback(() => { + const { value, isValid } = format(stateParams.spec, compactStringify); + + if (isValid) { + setSpec(value, XJsonLang.ID); + } + }, [setSpec, stateParams.spec]); + + const formatHJson = useCallback(() => { + const { value, isValid } = format(stateParams.spec, hjson.stringify, { + bracesSameLine: true, + keepWsc: true, + }); + + if (isValid) { + setSpec(value, HJsonLang); + } + }, [setSpec, stateParams.spec]); + + if (!languageId) { + return null; + } return ( -
- -
+
+
+
); } diff --git a/test/accessibility/apps/dashboard.ts b/test/accessibility/apps/dashboard.ts index 54eb5e7df417..847f7b9eff3e 100644 --- a/test/accessibility/apps/dashboard.ts +++ b/test/accessibility/apps/dashboard.ts @@ -45,6 +45,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('add a visualization', async () => { + await testSubjects.setValue('savedObjectFinderSearchInput', '[Flights]'); await testSubjects.click('savedObjectTitle[Flights]-Delay-Buckets'); await a11y.testAppSnapshot(); }); @@ -85,6 +86,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('Add one more saved object to cancel it', async () => { + await testSubjects.setValue('savedObjectFinderSearchInput', '[Flights]'); await testSubjects.click('savedObjectTitle[Flights]-Destination-Weather'); await a11y.testAppSnapshot(); }); diff --git a/test/api_integration/apis/kql_telemetry/kql_telemetry.ts b/test/api_integration/apis/kql_telemetry/kql_telemetry.ts index 4825b454bc42..310b99a5fb78 100644 --- a/test/api_integration/apis/kql_telemetry/kql_telemetry.ts +++ b/test/api_integration/apis/kql_telemetry/kql_telemetry.ts @@ -7,7 +7,6 @@ */ import expect from '@kbn/expect'; -import Bluebird from 'bluebird'; import { get } from 'lodash'; import { FtrProviderContext } from '../../ftr_provider_context'; @@ -89,7 +88,7 @@ export default function ({ getService }: FtrProviderContext) { }); it('should only accept literal boolean values for the opt_in POST body param', function () { - return Bluebird.all([ + return Promise.all([ supertest .post('/api/kibana/kql_opt_in_stats') .set('content-type', 'application/json') diff --git a/test/examples/embeddables/adding_children.ts b/test/examples/embeddables/adding_children.ts index ee06622a33f5..dcc7467689a1 100644 --- a/test/examples/embeddables/adding_children.ts +++ b/test/examples/embeddables/adding_children.ts @@ -23,6 +23,8 @@ export default function ({ getService }: PluginFunctionalProviderContext) { await testSubjects.click('embeddablePanelToggleMenuIcon'); await testSubjects.click('embeddablePanelAction-ACTION_ADD_PANEL'); await testSubjects.waitForDeleted('savedObjectFinderLoadingIndicator'); + await testSubjects.click('savedObjectFinderFilterButton'); + await testSubjects.click('savedObjectFinderFilter-todo'); await testSubjects.click('savedObjectTitleGarbage'); await testSubjects.moveMouseTo('euiFlyoutCloseButton'); await flyout.ensureClosed('dashboardAddPanel'); diff --git a/test/examples/index_pattern_field_editor_example/index.ts b/test/examples/index_pattern_field_editor_example/index.ts index 0cd23a33c847..06460a268624 100644 --- a/test/examples/index_pattern_field_editor_example/index.ts +++ b/test/examples/index_pattern_field_editor_example/index.ts @@ -14,6 +14,7 @@ export default function ({ getPageObjects, loadTestFile, }: PluginFunctionalProviderContext) { + const esArchiver = getService('esArchiver'); const browser = getService('browser'); const es = getService('es'); const PageObjects = getPageObjects(['common', 'header', 'settings']); @@ -21,6 +22,7 @@ export default function ({ describe('index pattern field editor example', function () { this.tags('ciGroup2'); before(async () => { + await esArchiver.emptyKibanaIndex(); await browser.setWindowSize(1300, 900); await es.transport.request({ path: '/blogs/_doc', diff --git a/test/examples/index_pattern_field_editor_example/index_pattern_field_editor_example.ts b/test/examples/index_pattern_field_editor_example/index_pattern_field_editor_example.ts index fa4308ae7288..5744c8e64f5c 100644 --- a/test/examples/index_pattern_field_editor_example/index_pattern_field_editor_example.ts +++ b/test/examples/index_pattern_field_editor_example/index_pattern_field_editor_example.ts @@ -12,8 +12,7 @@ import { PluginFunctionalProviderContext } from 'test/plugin_functional/services export default function ({ getService }: PluginFunctionalProviderContext) { const testSubjects = getService('testSubjects'); - // FAILING: https://github.com/elastic/kibana/issues/116463 - describe.skip('', () => { + describe('', () => { it('finds an index pattern', async () => { await testSubjects.existOrFail('indexPatternTitle'); }); diff --git a/test/functional/apps/dashboard/dashboard_filtering.ts b/test/functional/apps/dashboard/dashboard_filtering.ts index acb04b4946fa..73a53281df16 100644 --- a/test/functional/apps/dashboard/dashboard_filtering.ts +++ b/test/functional/apps/dashboard/dashboard_filtering.ts @@ -28,8 +28,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const dashboardPanelActions = getService('dashboardPanelActions'); const PageObjects = getPageObjects(['common', 'dashboard', 'header', 'visualize', 'timePicker']); - // Failing: See https://github.com/elastic/kibana/issues/92522 - describe.skip('dashboard filtering', function () { + describe('dashboard filtering', function () { this.tags('includeFirefox'); const populateDashboard = async () => { @@ -115,13 +114,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('saved search is filtered', async () => { - await dashboardExpect.savedSearchRowCount(0); + await dashboardExpect.savedSearchRowsMissing(); }); - // TODO: Uncomment once https://github.com/elastic/kibana/issues/22561 is fixed - // it('timelion is filtered', async () => { - // await dashboardExpect.timelionLegendCount(0); - // }); + it('timelion is filtered', async () => { + await dashboardExpect.timelionLegendCount(0); + }); it('vega is filtered', async () => { await dashboardExpect.vegaTextsDoNotExist(['5,000']); @@ -177,13 +175,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('saved search is filtered', async () => { - await dashboardExpect.savedSearchRowCount(0); + await dashboardExpect.savedSearchRowsMissing(); }); - // TODO: Uncomment once https://github.com/elastic/kibana/issues/22561 is fixed - // it('timelion is filtered', async () => { - // await dashboardExpect.timelionLegendCount(0); - // }); + it('timelion is filtered', async () => { + await dashboardExpect.timelionLegendCount(0); + }); it('vega is filtered', async () => { await dashboardExpect.vegaTextsDoNotExist(['5,000']); @@ -206,7 +203,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('area, bar and heatmap charts', async () => { - await dashboardExpect.seriesElementCount(3); + await dashboardExpect.seriesElementCount(2); }); it('data tables', async () => { @@ -238,7 +235,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('saved searches', async () => { - await dashboardExpect.savedSearchRowCount(1); + await dashboardExpect.savedSearchRowsExist(); }); it('vega', async () => { diff --git a/test/functional/apps/management/_index_pattern_create_delete.js b/test/functional/apps/management/_index_pattern_create_delete.js index acb554fa7310..62612ad5a908 100644 --- a/test/functional/apps/management/_index_pattern_create_delete.js +++ b/test/functional/apps/management/_index_pattern_create_delete.js @@ -9,6 +9,7 @@ import expect from '@kbn/expect'; export default function ({ getService, getPageObjects }) { + const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); const browser = getService('browser'); const log = getService('log'); @@ -18,16 +19,11 @@ export default function ({ getService, getPageObjects }) { const PageObjects = getPageObjects(['settings', 'common', 'header']); describe('creating and deleting default index', function describeIndexTests() { - before(function () { - // Delete .kibana index and then wait for Kibana to re-create it - return kibanaServer.uiSettings - .replace({}) - .then(function () { - return PageObjects.settings.navigateTo(); - }) - .then(function () { - return PageObjects.settings.clickKibanaIndexPatterns(); - }); + before(async function () { + await esArchiver.emptyKibanaIndex(); + await kibanaServer.uiSettings.replace({}); + await PageObjects.settings.navigateTo(); + await PageObjects.settings.clickKibanaIndexPatterns(); }); describe('can open and close editor', function () { @@ -39,17 +35,16 @@ export default function ({ getService, getPageObjects }) { }); }); - // FLAKY: https://github.com/elastic/kibana/issues/107831 - describe.skip('validation', function () { + describe('validation', function () { it('can display errors', async function () { await PageObjects.settings.clickAddNewIndexPatternButton(); - await PageObjects.settings.setIndexPatternField('log*'); + await PageObjects.settings.setIndexPatternField('log-fake*'); await (await PageObjects.settings.getSaveIndexPatternButton()).click(); await find.byClassName('euiFormErrorText'); }); it('can resolve errors and submit', async function () { - await PageObjects.settings.selectTimeFieldOption('@timestamp'); + await PageObjects.settings.setIndexPatternField('log*'); await (await PageObjects.settings.getSaveIndexPatternButton()).click(); await PageObjects.settings.removeIndexPattern(); }); diff --git a/test/functional/apps/management/_mgmt_import_saved_objects.js b/test/functional/apps/management/_mgmt_import_saved_objects.js index cf30b6f4ccf0..95b0bbb7ed03 100644 --- a/test/functional/apps/management/_mgmt_import_saved_objects.js +++ b/test/functional/apps/management/_mgmt_import_saved_objects.js @@ -39,6 +39,7 @@ export default function ({ getService, getPageObjects }) { await PageObjects.savedObjects.clickConfirmChanges(); await PageObjects.savedObjects.clickImportDone(); await PageObjects.savedObjects.waitTableIsLoaded(); + await PageObjects.savedObjects.searchForObject('mysaved'); //instead of asserting on count- am asserting on the titles- which is more accurate than count. const objects = await PageObjects.savedObjects.getRowTitles(); diff --git a/test/functional/apps/management/_runtime_fields.js b/test/functional/apps/management/_runtime_fields.js index 09fa924b0b87..3a70df81b55d 100644 --- a/test/functional/apps/management/_runtime_fields.js +++ b/test/functional/apps/management/_runtime_fields.js @@ -16,8 +16,7 @@ export default function ({ getService, getPageObjects }) { const PageObjects = getPageObjects(['settings']); const testSubjects = getService('testSubjects'); - // FLAKY: https://github.com/elastic/kibana/issues/95376 - describe.skip('runtime fields', function () { + describe('runtime fields', function () { this.tags(['skipFirefox']); before(async function () { @@ -60,7 +59,7 @@ export default function ({ getService, getPageObjects }) { await PageObjects.settings.filterField(fieldName); await testSubjects.click('editFieldFormat'); await PageObjects.settings.setFieldType('Long'); - await PageObjects.settings.changeFieldScript('emit(6);'); + await PageObjects.settings.setFieldScript('emit(6);'); await testSubjects.find('changeWarning'); await PageObjects.settings.clickSaveField(); await PageObjects.settings.confirmSave(); diff --git a/test/functional/apps/management/_scripted_fields_preview.js b/test/functional/apps/management/_scripted_fields_preview.js index 6347531b0cda..12a6cb9537c8 100644 --- a/test/functional/apps/management/_scripted_fields_preview.js +++ b/test/functional/apps/management/_scripted_fields_preview.js @@ -13,10 +13,11 @@ export default function ({ getService, getPageObjects }) { const PageObjects = getPageObjects(['settings']); const SCRIPTED_FIELD_NAME = 'myScriptedField'; - // FLAKY: https://github.com/elastic/kibana/issues/89475 - describe.skip('scripted fields preview', () => { + describe('scripted fields preview', () => { before(async function () { await browser.setWindowSize(1200, 800); + await PageObjects.settings.navigateTo(); + await PageObjects.settings.clickKibanaIndexPatterns(); await PageObjects.settings.createIndexPattern(); await PageObjects.settings.navigateTo(); diff --git a/test/functional/apps/visualize/_timelion.ts b/test/functional/apps/visualize/_timelion.ts index afbcba7df521..f8991e17319b 100644 --- a/test/functional/apps/visualize/_timelion.ts +++ b/test/functional/apps/visualize/_timelion.ts @@ -265,8 +265,11 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await monacoEditor.typeCodeEditorValue('.es(index=', 'timelionCodeEditor'); // wait for index patterns will be loaded await common.sleep(500); - const suggestions = await timelion.getSuggestionItemsText(); - expect(suggestions[0].includes('log')).to.eql(true); + // other suggestions might be shown for a short amount of time - retry until metric suggestions show up + await retry.try(async () => { + const suggestions = await timelion.getSuggestionItemsText(); + expect(suggestions[0].includes('log')).to.eql(true); + }); }); it('should show field suggestions for timefield argument when index pattern set', async () => { @@ -275,9 +278,12 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { '.es(index=logstash-*, timefield=', 'timelionCodeEditor' ); - const suggestions = await timelion.getSuggestionItemsText(); - expect(suggestions.length).to.eql(4); - expect(suggestions[0].includes('@timestamp')).to.eql(true); + // other suggestions might be shown for a short amount of time - retry until metric suggestions show up + await retry.try(async () => { + const suggestions = await timelion.getSuggestionItemsText(); + expect(suggestions.length).to.eql(4); + expect(suggestions[0].includes('@timestamp')).to.eql(true); + }); }); it('should show field suggestions for split argument when index pattern set', async () => { @@ -288,9 +294,12 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { ); // wait for split fields to load await common.sleep(300); - const suggestions = await timelion.getSuggestionItemsText(); + // other suggestions might be shown for a short amount of time - retry until metric suggestions show up + await retry.try(async () => { + const suggestions = await timelion.getSuggestionItemsText(); - expect(suggestions[0].includes('@message.raw')).to.eql(true); + expect(suggestions[0].includes('@message.raw')).to.eql(true); + }); }); it('should show field suggestions for metric argument when index pattern set', async () => { diff --git a/test/functional/fixtures/es_archiver/dashboard/current/kibana/data.json b/test/functional/fixtures/es_archiver/dashboard/current/kibana/data.json index 599ffbadaaea..45e26f1599b6 100644 --- a/test/functional/fixtures/es_archiver/dashboard/current/kibana/data.json +++ b/test/functional/fixtures/es_archiver/dashboard/current/kibana/data.json @@ -2316,7 +2316,7 @@ "title": "Filter Bytes Test: tsvb top n with bytes filter", "uiStateJSON": "{}", "version": 1, - "visState": "{\"title\":\"Filter Bytes Test: tsvb top n with bytes filter\",\"type\":\"metrics\",\"params\":{\"id\":\"61ca57f0-469d-11e7-af02-69e470af7417\",\"type\":\"top_n\",\"series\":[{\"id\":\"61ca57f1-469d-11e7-af02-69e470af7417\",\"color\":\"#68BC00\",\"split_mode\":\"filters\",\"metrics\":[{\"id\":\"482d6560-4194-11e8-a461-7d278185cba4\",\"type\":\"avg\",\"field\":\"bytes\"}],\"seperate_axis\":0,\"axis_position\":\"right\",\"formatter\":\"number\",\"chart_type\":\"line\",\"line_width\":1,\"point_size\":1,\"fill\":0.5,\"stacked\":\"none\",\"terms_field\":\"clientip\",\"filter\":{\"query\":\"Filter Bytes Test:>1000\",\"language\":\"lucene\"},\"override_index_pattern\":0,\"series_index_pattern\":\"logstash-*\",\"series_time_field\":\"utc_time\",\"series_interval\":\"1m\",\"value_template\":\"\",\"split_filters\":[{\"filter\":{\"query\":\"Filter Bytes Test:>100\",\"language\":\"lucene\"},\"label\":\"\",\"color\":\"#68BC00\",\"id\":\"39a107e0-4194-11e8-a461-7d278185cba4\"}],\"split_color_mode\":\"gradient\"},{\"id\":\"4fd5b150-4194-11e8-a461-7d278185cba4\",\"color\":\"#68BC00\",\"split_mode\":\"everything\",\"metrics\":[{\"id\":\"4fd5b151-4194-11e8-a461-7d278185cba4\",\"type\":\"avg\",\"field\":\"bytes\"}],\"seperate_axis\":0,\"axis_position\":\"right\",\"formatter\":\"number\",\"chart_type\":\"line\",\"line_width\":1,\"point_size\":1,\"fill\":0.5,\"stacked\":\"none\",\"filter\":{\"query\":\"Filter Bytes Test:>3000\",\"language\":\"lucene\"},\"split_color_mode\":\"gradient\"}],\"time_field\":\"@timestamp\",\"index_pattern\":\"logstash-*\",\"interval\":\"auto\",\"axis_position\":\"left\",\"axis_formatter\":\"number\",\"show_legend\":1,\"show_grid\":1,\"background_color_rules\":[{\"id\":\"06893260-4194-11e8-a461-7d278185cba4\"}],\"bar_color_rules\":[{\"id\":\"36a0e740-4194-11e8-a461-7d278185cba4\"}],\"use_kibana_indexes\":false,\"hide_last_value_indicator\":true},\"aggs\":[]}" + "visState":"{\"title\":\"Filter Bytes Test: tsvb top n with bytes filter\",\"type\":\"metrics\",\"aggs\":[],\"params\":{\"time_range_mode\":\"last_value\",\"id\":\"61ca57f0-469d-11e7-af02-69e470af7417\",\"type\":\"top_n\",\"series\":[{\"time_range_mode\":\"entire_time_range\",\"id\":\"61ca57f1-469d-11e7-af02-69e470af7417\",\"color\":\"#68BC00\",\"split_mode\":\"filters\",\"metrics\":[{\"id\":\"482d6560-4194-11e8-a461-7d278185cba4\",\"type\":\"avg\",\"field\":\"bytes\"}],\"seperate_axis\":0,\"axis_position\":\"right\",\"formatter\":\"number\",\"chart_type\":\"line\",\"line_width\":1,\"point_size\":1,\"fill\":0.5,\"stacked\":\"none\",\"terms_field\":\"clientip\",\"filter\":{\"query\":\"Filter Bytes Test:>1000\",\"language\":\"lucene\"},\"override_index_pattern\":0,\"series_index_pattern\":\"logstash-*\",\"series_time_field\":\"utc_time\",\"series_interval\":\"1m\",\"value_template\":\"\",\"split_filters\":[{\"filter\":{\"query\":\"Filter Bytes Test:>100\",\"language\":\"lucene\"},\"label\":\"\",\"color\":\"#68BC00\",\"id\":\"39a107e0-4194-11e8-a461-7d278185cba4\"}],\"split_color_mode\":\"gradient\"},{\"time_range_mode\":\"entire_time_range\",\"id\":\"4fd5b150-4194-11e8-a461-7d278185cba4\",\"color\":\"#68BC00\",\"split_mode\":\"everything\",\"metrics\":[{\"id\":\"4fd5b151-4194-11e8-a461-7d278185cba4\",\"type\":\"avg\",\"field\":\"bytes\"}],\"seperate_axis\":0,\"axis_position\":\"right\",\"formatter\":\"number\",\"chart_type\":\"line\",\"line_width\":1,\"point_size\":1,\"fill\":0.5,\"stacked\":\"none\",\"filter\":{\"query\":\"Filter Bytes Test:>3000\",\"language\":\"lucene\"},\"split_color_mode\":\"gradient\"}],\"time_field\":\"@timestamp\",\"index_pattern\":\"logstash-*\",\"interval\":\"auto\",\"axis_position\":\"left\",\"axis_formatter\":\"number\",\"show_legend\":1,\"show_grid\":1,\"background_color_rules\":[{\"id\":\"06893260-4194-11e8-a461-7d278185cba4\"}],\"bar_color_rules\":[{\"id\":\"36a0e740-4194-11e8-a461-7d278185cba4\"}],\"use_kibana_indexes\":false,\"hide_last_value_indicator\":true,\"axis_scale\":\"normal\",\"truncate_legend\":1,\"max_lines_legend\":1,\"tooltip_mode\":\"show_all\",\"drop_last_bucket\":1,\"isModelInvalid\":false}}" } }, "type": "_doc" @@ -2379,7 +2379,7 @@ "title": "Filter Bytes Test: tsvb time series with bytes filter split by clientip", "uiStateJSON": "{}", "version": 1, - "visState": "{\"title\":\"Filter Bytes Test: tsvb time series with bytes filter split by clientip\",\"type\":\"metrics\",\"params\":{\"id\":\"61ca57f0-469d-11e7-af02-69e470af7417\",\"type\":\"timeseries\",\"series\":[{\"id\":\"61ca57f1-469d-11e7-af02-69e470af7417\",\"color\":\"#68BC00\",\"split_mode\":\"terms\",\"metrics\":[{\"value\":\"\",\"id\":\"61ca57f2-469d-11e7-af02-69e470af7417\",\"type\":\"sum\",\"field\":\"bytes\"}],\"seperate_axis\":0,\"axis_position\":\"right\",\"formatter\":\"number\",\"chart_type\":\"line\",\"line_width\":1,\"point_size\":1,\"fill\":0.5,\"stacked\":\"none\",\"terms_field\":\"clientip\",\"filter\":{\"query\":\"Filter Bytes Test:>1000\",\"language\":\"lucene\"},\"split_color_mode\":\"gradient\"}],\"time_field\":\"@timestamp\",\"index_pattern\":\"logstash-*\",\"interval\":\"auto\",\"axis_position\":\"left\",\"axis_formatter\":\"number\",\"show_legend\":1,\"show_grid\":1,\"use_kibana_indexes\":false},\"aggs\":[]}" + "visState":"{\"title\":\"Filter Bytes Test: tsvb time series with bytes filter split by clientip\",\"type\":\"metrics\",\"aggs\":[],\"params\":{\"time_range_mode\":\"entire_time_range\",\"id\":\"61ca57f0-469d-11e7-af02-69e470af7417\",\"type\":\"timeseries\",\"series\":[{\"time_range_mode\":\"entire_time_range\",\"id\":\"61ca57f1-469d-11e7-af02-69e470af7417\",\"color\":\"#68BC00\",\"split_mode\":\"terms\",\"metrics\":[{\"value\":\"\",\"id\":\"61ca57f2-469d-11e7-af02-69e470af7417\",\"type\":\"sum\",\"field\":\"bytes\"}],\"seperate_axis\":0,\"axis_position\":\"right\",\"formatter\":\"number\",\"chart_type\":\"line\",\"line_width\":1,\"point_size\":1,\"fill\":0.5,\"stacked\":\"none\",\"terms_field\":\"clientip\",\"filter\":{\"query\":\"Filter Bytes Test:>1000\",\"language\":\"lucene\"},\"split_color_mode\":\"gradient\"}],\"time_field\":\"@timestamp\",\"index_pattern\":\"logstash-*\",\"interval\":\"auto\",\"axis_position\":\"left\",\"axis_formatter\":\"number\",\"show_legend\":1,\"show_grid\":1,\"use_kibana_indexes\":false,\"axis_scale\":\"normal\",\"truncate_legend\":1,\"max_lines_legend\":1,\"tooltip_mode\":\"show_all\",\"drop_last_bucket\":1,\"isModelInvalid\":false}}" } }, "type": "_doc" @@ -2600,45 +2600,6 @@ } } -{ - "type": "doc", - "value": { - "id": "visualization:63983430-4192-11e8-bb13-d53698fb349a", - "index": ".kibana", - "source": { - "coreMigrationVersion": "7.14.0", - "migrationVersion": { - "visualization": "7.14.0" - }, - "references": [ - { - "id": "0bf35f60-3dc9-11e8-8660-4d65aa086b3c", - "name": "kibanaSavedObjectMeta.searchSourceJSON.index", - "type": "index-pattern" - }, - { - "id": "0bf35f60-3dc9-11e8-8660-4d65aa086b3c", - "name": "kibanaSavedObjectMeta.searchSourceJSON.filter[0].meta.index", - "type": "index-pattern" - } - ], - "type": "visualization", - "updated_at": "2018-04-17T15:06:36.275Z", - "visualization": { - "description": "", - "kibanaSavedObjectMeta": { - "searchSourceJSON": "{\"filter\":[{\"meta\":{\"negate\":false,\"disabled\":false,\"alias\":null,\"type\":\"phrase\",\"key\":\"geo.src\",\"value\":\"US\",\"params\":{\"query\":\"US\",\"type\":\"phrase\"},\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.filter[0].meta.index\"},\"query\":{\"match\":{\"geo.src\":{\"query\":\"US\",\"type\":\"phrase\"}}},\"$state\":{\"store\":\"appState\"}}],\"query\":{\"query\":\"Filter Bytes Test:>5000\",\"language\":\"lucene\"},\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\"}" - }, - "title": "Filter Bytes Test: geo map with filter and query bytes > 5000 in US geo.src, heatmap setting", - "uiStateJSON": "{\"mapZoom\":7,\"mapCenter\":[42.98857645832184,-75.49804687500001]}", - "version": 1, - "visState": "{\"title\":\"Filter Bytes Test: geo map with filter and query bytes > 5000 in US geo.src, heatmap setting\",\"type\":\"tile_map\",\"params\":{\"mapType\":\"Heatmap\",\"isDesaturated\":true,\"addTooltip\":true,\"heatClusterSize\":1.5,\"legendPosition\":\"bottomright\",\"mapZoom\":2,\"mapCenter\":[0,0],\"wms\":{\"enabled\":false,\"options\":{\"format\":\"image/png\",\"transparent\":true},\"baseLayersAreLoaded\":{},\"tmsLayers\":[{\"id\":\"road_map\",\"url\":\"https://tiles-stage.elastic.co/v2/default/{z}/{x}/{y}.png?elastic_tile_service_tos=agree&my_app_name=kibana&my_app_version=6.3.0\",\"minZoom\":0,\"maxZoom\":10,\"attribution\":\"

© OpenStreetMap contributors | Elastic Maps Service

\",\"subdomains\":[]}],\"selectedTmsLayer\":{\"id\":\"road_map\",\"url\":\"https://tiles-stage.elastic.co/v2/default/{z}/{x}/{y}.png?elastic_tile_service_tos=agree&my_app_name=kibana&my_app_version=6.3.0\",\"minZoom\":0,\"maxZoom\":10,\"attribution\":\"

© OpenStreetMap contributors | Elastic Maps Service

\",\"subdomains\":[]}}},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"enabled\":true,\"type\":\"geohash_grid\",\"schema\":\"segment\",\"params\":{\"field\":\"geo.coordinates\",\"autoPrecision\":true,\"isFilteredByCollar\":true,\"useGeocentroid\":true,\"precision\":4}}]}" - } - }, - "type": "_doc" - } -} - { "type": "doc", "value": { @@ -2817,7 +2778,7 @@ "title": "Filter Bytes Test: tsvb metric with custom interval and bytes filter", "uiStateJSON": "{}", "version": 1, - "visState": "{\"title\":\"Filter Bytes Test: tsvb metric with custom interval and bytes filter\",\"type\":\"metrics\",\"params\":{\"id\":\"61ca57f0-469d-11e7-af02-69e470af7417\",\"type\":\"metric\",\"series\":[{\"id\":\"61ca57f1-469d-11e7-af02-69e470af7417\",\"color\":\"#68BC00\",\"split_mode\":\"everything\",\"metrics\":[{\"value\":\"\",\"id\":\"61ca57f2-469d-11e7-af02-69e470af7417\",\"type\":\"sum\",\"field\":\"bytes\"}],\"seperate_axis\":0,\"axis_position\":\"right\",\"formatter\":\"number\",\"chart_type\":\"line\",\"line_width\":1,\"point_size\":1,\"fill\":0.5,\"stacked\":\"none\",\"terms_field\":\"clientip\",\"filter\":{\"query\":\"Filter Bytes Test:>1000\",\"language\":\"lucene\"},\"override_index_pattern\":1,\"series_index_pattern\":\"logstash-*\",\"series_time_field\":\"utc_time\",\"series_interval\":\"1d\",\"value_template\":\"{{value}} custom template\",\"split_color_mode\":\"gradient\"}],\"time_field\":\"@timestamp\",\"index_pattern\":\"logstash-*\",\"interval\":\"auto\",\"axis_position\":\"left\",\"axis_formatter\":\"number\",\"show_legend\":1,\"show_grid\":1,\"background_color_rules\":[{\"id\":\"06893260-4194-11e8-a461-7d278185cba4\"}],\"use_kibana_indexes\":false,\"hide_last_value_indicator\":true},\"aggs\":[]}" + "visState":"{\"title\":\"Filter Bytes Test: tsvb metric with custom interval and bytes filter\",\"type\":\"metrics\",\"aggs\":[],\"params\":{\"time_range_mode\":\"last_value\",\"id\":\"61ca57f0-469d-11e7-af02-69e470af7417\",\"type\":\"metric\",\"series\":[{\"time_range_mode\":\"last_value\",\"id\":\"61ca57f1-469d-11e7-af02-69e470af7417\",\"color\":\"#68BC00\",\"split_mode\":\"everything\",\"metrics\":[{\"value\":\"\",\"id\":\"61ca57f2-469d-11e7-af02-69e470af7417\",\"type\":\"sum\",\"field\":\"bytes\"}],\"seperate_axis\":0,\"axis_position\":\"right\",\"formatter\":\"number\",\"chart_type\":\"line\",\"line_width\":1,\"point_size\":1,\"fill\":0.5,\"stacked\":\"none\",\"terms_field\":\"clientip\",\"filter\":{\"query\":\"Filter Bytes Test:>1000\",\"language\":\"lucene\"},\"override_index_pattern\":1,\"series_index_pattern\":\"logstash-*\",\"series_time_field\":\"utc_time\",\"series_interval\":\"1d\",\"value_template\":\"{{value}} custom template\",\"split_color_mode\":\"gradient\",\"series_drop_last_bucket\":1}],\"time_field\":\"@timestamp\",\"index_pattern\":\"logstash-*\",\"interval\":\"auto\",\"axis_position\":\"left\",\"axis_formatter\":\"number\",\"show_legend\":1,\"show_grid\":1,\"background_color_rules\":[{\"id\":\"06893260-4194-11e8-a461-7d278185cba4\"}],\"use_kibana_indexes\":false,\"hide_last_value_indicator\":true,\"axis_scale\":\"normal\",\"truncate_legend\":1,\"max_lines_legend\":1,\"tooltip_mode\":\"show_all\",\"drop_last_bucket\":0,\"isModelInvalid\":false,\"bar_color_rules\":[{\"id\":\"71f4e260-4186-11ec-8262-619fbabeae59\"}]}}" } }, "type": "_doc" @@ -2846,7 +2807,7 @@ "title": "Filter Bytes Test: tsvb markdown", "uiStateJSON": "{}", "version": 1, - "visState": "{\"title\":\"Filter Bytes Test: tsvb markdown\",\"type\":\"metrics\",\"params\":{\"id\":\"61ca57f0-469d-11e7-af02-69e470af7417\",\"type\":\"markdown\",\"series\":[{\"id\":\"61ca57f1-469d-11e7-af02-69e470af7417\",\"color\":\"#68BC00\",\"split_mode\":\"filters\",\"metrics\":[{\"id\":\"482d6560-4194-11e8-a461-7d278185cba4\",\"type\":\"avg\",\"field\":\"bytes\"}],\"seperate_axis\":0,\"axis_position\":\"right\",\"formatter\":\"number\",\"chart_type\":\"line\",\"line_width\":1,\"point_size\":1,\"fill\":0.5,\"stacked\":\"none\",\"terms_field\":\"clientip\",\"filter\":{\"query\":\"Filter Bytes Test:>1000\",\"language\":\"lucene\"},\"override_index_pattern\":0,\"series_index_pattern\":\"logstash-*\",\"series_time_field\":\"utc_time\",\"series_interval\":\"1m\",\"value_template\":\"\",\"split_filters\":[{\"filter\":{\"query\":\"bytes:>1000\",\"language\":\"lucene\"},\"label\":\"\",\"color\":\"#68BC00\",\"id\":\"39a107e0-4194-11e8-a461-7d278185cba4\"}],\"label\":\"\",\"var_name\":\"\",\"split_color_mode\":\"gradient\"}],\"time_field\":\"@timestamp\",\"index_pattern\":\"logstash-*\",\"interval\":\"auto\",\"axis_position\":\"left\",\"axis_formatter\":\"number\",\"show_legend\":1,\"show_grid\":1,\"background_color_rules\":[{\"id\":\"06893260-4194-11e8-a461-7d278185cba4\"}],\"bar_color_rules\":[{\"id\":\"36a0e740-4194-11e8-a461-7d278185cba4\"}],\"markdown\":\"{{bytes_1000.last.formatted}}\",\"use_kibana_indexes\":false,\"hide_last_value_indicator\":true},\"aggs\":[]}" + "visState":"{\"title\":\"Filter Bytes Test: tsvb markdown\",\"type\":\"metrics\",\"aggs\":[],\"params\":{\"time_range_mode\":\"last_value\",\"id\":\"61ca57f0-469d-11e7-af02-69e470af7417\",\"type\":\"markdown\",\"series\":[{\"time_range_mode\":\"last_value\",\"id\":\"61ca57f1-469d-11e7-af02-69e470af7417\",\"color\":\"#68BC00\",\"split_mode\":\"filters\",\"metrics\":[{\"id\":\"482d6560-4194-11e8-a461-7d278185cba4\",\"type\":\"avg\",\"field\":\"bytes\"}],\"seperate_axis\":0,\"axis_position\":\"right\",\"formatter\":\"number\",\"chart_type\":\"line\",\"line_width\":1,\"point_size\":1,\"fill\":0.5,\"stacked\":\"none\",\"terms_field\":\"clientip\",\"filter\":{\"query\":\"Filter Bytes Test:>1000\",\"language\":\"lucene\"},\"override_index_pattern\":0,\"series_index_pattern\":\"logstash-*\",\"series_time_field\":\"utc_time\",\"series_interval\":\"1m\",\"value_template\":\"\",\"split_filters\":[{\"filter\":{\"query\":\"bytes:>1000\",\"language\":\"lucene\"},\"label\":\"\",\"color\":\"#68BC00\",\"id\":\"39a107e0-4194-11e8-a461-7d278185cba4\"}],\"label\":\"\",\"var_name\":\"\",\"split_color_mode\":\"gradient\",\"series_drop_last_bucket\":1}],\"time_field\":\"@timestamp\",\"index_pattern\":\"logstash-*\",\"interval\":\"auto\",\"axis_position\":\"left\",\"axis_formatter\":\"number\",\"show_legend\":1,\"show_grid\":1,\"background_color_rules\":[{\"id\":\"06893260-4194-11e8-a461-7d278185cba4\"}],\"bar_color_rules\":[{\"id\":\"36a0e740-4194-11e8-a461-7d278185cba4\"}],\"markdown\":\"{{bytes_1000.last.formatted}}\",\"use_kibana_indexes\":false,\"hide_last_value_indicator\":true,\"axis_scale\":\"normal\",\"truncate_legend\":1,\"max_lines_legend\":1,\"tooltip_mode\":\"show_all\",\"drop_last_bucket\":1,\"isModelInvalid\":false}}" } }, "type": "_doc" diff --git a/test/functional/fixtures/es_archiver/date_nested/data.json b/test/functional/fixtures/es_archiver/date_nested/data.json index 0bdb3fc510a6..bb623f93627c 100644 --- a/test/functional/fixtures/es_archiver/date_nested/data.json +++ b/test/functional/fixtures/es_archiver/date_nested/data.json @@ -6,7 +6,7 @@ "source": { "index-pattern": { "fields":"[]", - "timeFieldName": "@timestamp", + "timeFieldName": "nested.timestamp", "title": "date-nested" }, "type": "index-pattern" diff --git a/test/functional/page_objects/common_page.ts b/test/functional/page_objects/common_page.ts index 3955e457b5ff..0150daec3afb 100644 --- a/test/functional/page_objects/common_page.ts +++ b/test/functional/page_objects/common_page.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { delay } from 'bluebird'; +import { setTimeout as setTimeoutAsync } from 'timers/promises'; import expect from '@kbn/expect'; // @ts-ignore import fetch from 'node-fetch'; @@ -214,7 +214,7 @@ export class CommonPageObject extends FtrService { async sleep(sleepMilliseconds: number) { this.log.debug(`... sleep(${sleepMilliseconds}) start`); - await delay(sleepMilliseconds); + await setTimeoutAsync(sleepMilliseconds); this.log.debug(`... sleep(${sleepMilliseconds}) end`); } diff --git a/test/functional/page_objects/login_page.ts b/test/functional/page_objects/login_page.ts index 5318a2b2d0c1..74e85e60d1a6 100644 --- a/test/functional/page_objects/login_page.ts +++ b/test/functional/page_objects/login_page.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { delay } from 'bluebird'; +import { setTimeout as setTimeoutAsync } from 'timers/promises'; import { FtrService } from '../ftr_provider_context'; export class LoginPageObject extends FtrService { @@ -40,7 +40,7 @@ export class LoginPageObject extends FtrService { async sleep(sleepMilliseconds: number) { this.log.debug(`... sleep(${sleepMilliseconds}) start`); - await delay(sleepMilliseconds); + await setTimeoutAsync(sleepMilliseconds); this.log.debug(`... sleep(${sleepMilliseconds}) end`); } diff --git a/test/functional/page_objects/management/saved_objects_page.ts b/test/functional/page_objects/management/saved_objects_page.ts index 21af7aa477ab..87d5537d53ca 100644 --- a/test/functional/page_objects/management/saved_objects_page.ts +++ b/test/functional/page_objects/management/saved_objects_page.ts @@ -7,7 +7,6 @@ */ import { keyBy } from 'lodash'; -import { map as mapAsync } from 'bluebird'; import { FtrService } from '../../ftr_provider_context'; export class SavedObjectsPageObject extends FtrService { @@ -201,51 +200,55 @@ export class SavedObjectsPageObject extends FtrService { async getElementsInTable() { const rows = await this.testSubjects.findAll('~savedObjectsTableRow'); - return mapAsync(rows, async (row) => { - const checkbox = await row.findByCssSelector('[data-test-subj*="checkboxSelectRow"]'); - // return the object type aria-label="index patterns" - const objectType = await row.findByTestSubject('objectType'); - const titleElement = await row.findByTestSubject('savedObjectsTableRowTitle'); - // not all rows have inspect button - Advanced Settings objects don't - // Advanced Settings has 2 actions, - // data-test-subj="savedObjectsTableAction-relationships" - // data-test-subj="savedObjectsTableAction-copy_saved_objects_to_space" - // Some other objects have the ... - // data-test-subj="euiCollapsedItemActionsButton" - // Maybe some objects still have the inspect element visible? - // !!! Also note that since we don't have spaces on OSS, the actions for the same object can be different depending on OSS or not - let menuElement = null; - let inspectElement = null; - let relationshipsElement = null; - let copySaveObjectsElement = null; - const actions = await row.findByClassName('euiTableRowCell--hasActions'); - // getting the innerHTML and checking if it 'includes' a string is faster than a timeout looking for each element - const actionsHTML = await actions.getAttribute('innerHTML'); - if (actionsHTML.includes('euiCollapsedItemActionsButton')) { - menuElement = await row.findByTestSubject('euiCollapsedItemActionsButton'); - } - if (actionsHTML.includes('savedObjectsTableAction-inspect')) { - inspectElement = await row.findByTestSubject('savedObjectsTableAction-inspect'); - } - if (actionsHTML.includes('savedObjectsTableAction-relationships')) { - relationshipsElement = await row.findByTestSubject('savedObjectsTableAction-relationships'); - } - if (actionsHTML.includes('savedObjectsTableAction-copy_saved_objects_to_space')) { - copySaveObjectsElement = await row.findByTestSubject( - 'savedObjectsTableAction-copy_saved_objects_to_space' - ); - } - return { - checkbox, - objectType: await objectType.getAttribute('aria-label'), - titleElement, - title: await titleElement.getVisibleText(), - menuElement, - inspectElement, - relationshipsElement, - copySaveObjectsElement, - }; - }); + return await Promise.all( + rows.map(async (row) => { + const checkbox = await row.findByCssSelector('[data-test-subj*="checkboxSelectRow"]'); + // return the object type aria-label="index patterns" + const objectType = await row.findByTestSubject('objectType'); + const titleElement = await row.findByTestSubject('savedObjectsTableRowTitle'); + // not all rows have inspect button - Advanced Settings objects don't + // Advanced Settings has 2 actions, + // data-test-subj="savedObjectsTableAction-relationships" + // data-test-subj="savedObjectsTableAction-copy_saved_objects_to_space" + // Some other objects have the ... + // data-test-subj="euiCollapsedItemActionsButton" + // Maybe some objects still have the inspect element visible? + // !!! Also note that since we don't have spaces on OSS, the actions for the same object can be different depending on OSS or not + let menuElement = null; + let inspectElement = null; + let relationshipsElement = null; + let copySaveObjectsElement = null; + const actions = await row.findByClassName('euiTableRowCell--hasActions'); + // getting the innerHTML and checking if it 'includes' a string is faster than a timeout looking for each element + const actionsHTML = await actions.getAttribute('innerHTML'); + if (actionsHTML.includes('euiCollapsedItemActionsButton')) { + menuElement = await row.findByTestSubject('euiCollapsedItemActionsButton'); + } + if (actionsHTML.includes('savedObjectsTableAction-inspect')) { + inspectElement = await row.findByTestSubject('savedObjectsTableAction-inspect'); + } + if (actionsHTML.includes('savedObjectsTableAction-relationships')) { + relationshipsElement = await row.findByTestSubject( + 'savedObjectsTableAction-relationships' + ); + } + if (actionsHTML.includes('savedObjectsTableAction-copy_saved_objects_to_space')) { + copySaveObjectsElement = await row.findByTestSubject( + 'savedObjectsTableAction-copy_saved_objects_to_space' + ); + } + return { + checkbox, + objectType: await objectType.getAttribute('aria-label'), + titleElement, + title: await titleElement.getVisibleText(), + menuElement, + inspectElement, + relationshipsElement, + copySaveObjectsElement, + }; + }) + ); } async getRowTitles() { @@ -259,35 +262,39 @@ export class SavedObjectsPageObject extends FtrService { async getRelationshipFlyout() { const rows = await this.testSubjects.findAll('relationshipsTableRow'); - return mapAsync(rows, async (row) => { - const objectType = await row.findByTestSubject('relationshipsObjectType'); - const relationship = await row.findByTestSubject('directRelationship'); - const titleElement = await row.findByTestSubject('relationshipsTitle'); - const inspectElement = await row.findByTestSubject('relationshipsTableAction-inspect'); - return { - objectType: await objectType.getAttribute('aria-label'), - relationship: await relationship.getVisibleText(), - titleElement, - title: await titleElement.getVisibleText(), - inspectElement, - }; - }); + return await Promise.all( + rows.map(async (row) => { + const objectType = await row.findByTestSubject('relationshipsObjectType'); + const relationship = await row.findByTestSubject('directRelationship'); + const titleElement = await row.findByTestSubject('relationshipsTitle'); + const inspectElement = await row.findByTestSubject('relationshipsTableAction-inspect'); + return { + objectType: await objectType.getAttribute('aria-label'), + relationship: await relationship.getVisibleText(), + titleElement, + title: await titleElement.getVisibleText(), + inspectElement, + }; + }) + ); } async getInvalidRelations() { const rows = await this.testSubjects.findAll('invalidRelationshipsTableRow'); - return mapAsync(rows, async (row) => { - const objectType = await row.findByTestSubject('relationshipsObjectType'); - const objectId = await row.findByTestSubject('relationshipsObjectId'); - const relationship = await row.findByTestSubject('directRelationship'); - const error = await row.findByTestSubject('relationshipsError'); - return { - type: await objectType.getVisibleText(), - id: await objectId.getVisibleText(), - relationship: await relationship.getVisibleText(), - error: await error.getVisibleText(), - }; - }); + return await Promise.all( + rows.map(async (row) => { + const objectType = await row.findByTestSubject('relationshipsObjectType'); + const objectId = await row.findByTestSubject('relationshipsObjectId'); + const relationship = await row.findByTestSubject('directRelationship'); + const error = await row.findByTestSubject('relationshipsError'); + return { + type: await objectType.getVisibleText(), + id: await objectId.getVisibleText(), + relationship: await relationship.getVisibleText(), + error: await error.getVisibleText(), + }; + }) + ); } async getTableSummary() { diff --git a/test/functional/page_objects/settings_page.ts b/test/functional/page_objects/settings_page.ts index d3443f9cf492..54728e1db3f5 100644 --- a/test/functional/page_objects/settings_page.ts +++ b/test/functional/page_objects/settings_page.ts @@ -6,7 +6,6 @@ * Side Public License, v 1. */ -import { map as mapAsync } from 'bluebird'; import expect from '@kbn/expect'; import { FtrService } from '../ftr_provider_context'; @@ -234,23 +233,29 @@ export class SettingsPageObject extends FtrService { async getFieldNames() { const fieldNameCells = await this.testSubjects.findAll('editIndexPattern > indexedFieldName'); - return await mapAsync(fieldNameCells, async (cell) => { - return (await cell.getVisibleText()).trim(); - }); + return await Promise.all( + fieldNameCells.map(async (cell) => { + return (await cell.getVisibleText()).trim(); + }) + ); } async getFieldTypes() { const fieldNameCells = await this.testSubjects.findAll('editIndexPattern > indexedFieldType'); - return await mapAsync(fieldNameCells, async (cell) => { - return (await cell.getVisibleText()).trim(); - }); + return await Promise.all( + fieldNameCells.map(async (cell) => { + return (await cell.getVisibleText()).trim(); + }) + ); } async getScriptedFieldLangs() { const fieldNameCells = await this.testSubjects.findAll('editIndexPattern > scriptedFieldLang'); - return await mapAsync(fieldNameCells, async (cell) => { - return (await cell.getVisibleText()).trim(); - }); + return await Promise.all( + fieldNameCells.map(async (cell) => { + return (await cell.getVisibleText()).trim(); + }) + ); } async setFieldTypeFilter(type: string) { @@ -327,9 +332,11 @@ export class SettingsPageObject extends FtrService { async getAllIndexPatternNames() { const indexPatterns = await this.getIndexPatternList(); - return await mapAsync(indexPatterns, async (index) => { - return await index.getVisibleText(); - }); + return await Promise.all( + indexPatterns.map(async (index) => { + return await index.getVisibleText(); + }) + ); } async isIndexPatternListEmpty() { @@ -437,7 +444,8 @@ export class SettingsPageObject extends FtrService { async setIndexPatternField(indexPatternName = 'logstash-*') { this.log.debug(`setIndexPatternField(${indexPatternName})`); const field = await this.getIndexPatternField(); - await field.clearValue(); + await field.clearValueWithKeyboard(); + if ( indexPatternName.charAt(0) === '*' && indexPatternName.charAt(indexPatternName.length - 1) === '*' @@ -565,9 +573,11 @@ export class SettingsPageObject extends FtrService { const table = await this.find.byClassName('euiTable'); await this.retry.waitFor('field filter to be added', async () => { const tableCells = await table.findAllByCssSelector('td'); - const fieldNames = await mapAsync(tableCells, async (cell) => { - return (await cell.getVisibleText()).trim(); - }); + const fieldNames = await Promise.all( + tableCells.map(async (cell) => { + return (await cell.getVisibleText()).trim(); + }) + ); return fieldNames.includes(name); }); } @@ -618,23 +628,9 @@ export class SettingsPageObject extends FtrService { async setFieldScript(script: string) { this.log.debug('set script = ' + script); - const valueRow = await this.toggleRow('valueRow'); - const getMonacoTextArea = async () => (await valueRow.findAllByCssSelector('textarea'))[0]; - this.retry.waitFor('monaco editor is ready', async () => !!(await getMonacoTextArea())); - const monacoTextArea = await getMonacoTextArea(); - await monacoTextArea.focus(); - this.browser.pressKeys(script); - } - - async changeFieldScript(script: string) { - this.log.debug('set script = ' + script); - const valueRow = await this.testSubjects.find('valueRow'); - const getMonacoTextArea = async () => (await valueRow.findAllByCssSelector('textarea'))[0]; - this.retry.waitFor('monaco editor is ready', async () => !!(await getMonacoTextArea())); - const monacoTextArea = await getMonacoTextArea(); - await monacoTextArea.focus(); - this.browser.pressKeys(this.browser.keys.DELETE.repeat(30)); - this.browser.pressKeys(script); + await this.toggleRow('valueRow'); + await this.monacoEditor.waitCodeEditorReady('valueRow'); + await this.monacoEditor.setCodeEditorValue(script); } async clickAddScriptedField() { diff --git a/test/functional/page_objects/vega_chart_page.ts b/test/functional/page_objects/vega_chart_page.ts index f83c5e193034..045e5eedb86f 100644 --- a/test/functional/page_objects/vega_chart_page.ts +++ b/test/functional/page_objects/vega_chart_page.ts @@ -19,6 +19,7 @@ export class VegaChartPageObject extends FtrService { private readonly testSubjects = this.ctx.getService('testSubjects'); private readonly browser = this.ctx.getService('browser'); private readonly retry = this.ctx.getService('retry'); + private readonly monacoEditor = this.ctx.getService('monacoEditor'); public getEditor() { return this.testSubjects.find('vega-editor'); @@ -36,63 +37,31 @@ export class VegaChartPageObject extends FtrService { return this.find.byCssSelector('[aria-label^="Y-axis"]'); } - public async getAceGutterContainer() { - const editor = await this.getEditor(); - return editor.findByClassName('ace_gutter'); - } - - public async getRawSpec() { - // Adapted from console_page.js:getVisibleTextFromAceEditor(). Is there a common utilities file? - const editor = await this.getEditor(); - const lines = await editor.findAllByClassName('ace_line_group'); - - return await Promise.all( - lines.map(async (line) => { - return await line.getVisibleText(); - }) - ); - } - public async getSpec() { - return (await this.getRawSpec()).join('\n'); - } - - public async focusEditor() { - const editor = await this.getEditor(); - const textarea = await editor.findByClassName('ace_content'); - - await textarea.click(); + return this.monacoEditor.getCodeEditorValue(); } public async fillSpec(newSpec: string) { await this.retry.try(async () => { await this.cleanSpec(); - await this.focusEditor(); - await this.browser.pressKeys(newSpec); + await this.monacoEditor.setCodeEditorValue(newSpec); expect(compareSpecs(await this.getSpec(), newSpec)).to.be(true); }); } public async typeInSpec(text: string) { - const aceGutter = await this.getAceGutterContainer(); + const editor = await this.testSubjects.find('vega-editor'); + const textarea = await editor.findByCssSelector('textarea'); - await aceGutter.doubleClick(); + await textarea.focus(); + await this.browser.pressKeys(this.browser.keys.RIGHT); await this.browser.pressKeys(this.browser.keys.RIGHT); - await this.browser.pressKeys(this.browser.keys.LEFT); - await this.browser.pressKeys(this.browser.keys.LEFT); - await this.browser.pressKeys(text); + await textarea.type(text); } public async cleanSpec() { - const aceGutter = await this.getAceGutterContainer(); - - await this.retry.try(async () => { - await aceGutter.doubleClick(); - await this.browser.pressKeys(this.browser.keys.BACK_SPACE); - - expect(await this.getSpec()).to.be(''); - }); + await this.monacoEditor.setCodeEditorValue(''); } public async getYAxisLabels() { diff --git a/test/functional/services/common/browser.ts b/test/functional/services/common/browser.ts index 73d92f8ff722..7581c17a58eb 100644 --- a/test/functional/services/common/browser.ts +++ b/test/functional/services/common/browser.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { delay } from 'bluebird'; +import { setTimeout as setTimeoutAsync } from 'timers/promises'; import { cloneDeepWith } from 'lodash'; import { Key, Origin, WebDriver } from 'selenium-webdriver'; // @ts-ignore internal modules are not typed @@ -303,7 +303,7 @@ class BrowserService extends FtrService { to ); // wait for 150ms to make sure the script has run - await delay(150); + await setTimeoutAsync(150); } /** diff --git a/test/functional/services/common/test_subjects.ts b/test/functional/services/common/test_subjects.ts index 3f47c6155f17..09c54af7b881 100644 --- a/test/functional/services/common/test_subjects.ts +++ b/test/functional/services/common/test_subjects.ts @@ -7,7 +7,6 @@ */ import testSubjSelector from '@kbn/test-subj-selector'; -import { map as mapAsync } from 'bluebird'; import { WebElementWrapper } from '../lib/web_element_wrapper'; import { FtrService } from '../../ftr_provider_context'; @@ -271,11 +270,11 @@ export class TestSubjects extends FtrService { private async _mapAll( selectorAll: string, - mapFn: (element: WebElementWrapper, index?: number, arrayLength?: number) => Promise + mapFn: (element: WebElementWrapper, index: number, array: WebElementWrapper[]) => Promise ): Promise { return await this.retry.try(async () => { const elements = await this.findAll(selectorAll); - return await mapAsync(elements, mapFn); + return await Promise.all(elements.map(mapFn)); }); } diff --git a/test/functional/services/dashboard/expectations.ts b/test/functional/services/dashboard/expectations.ts index 0a689c0091ed..d4b462d2a68f 100644 --- a/test/functional/services/dashboard/expectations.ts +++ b/test/functional/services/dashboard/expectations.ts @@ -155,30 +155,34 @@ export class DashboardExpectService extends FtrService { async emptyTagCloudFound() { this.log.debug(`DashboardExpect.emptyTagCloudFound()`); const tagCloudVisualizations = await this.testSubjects.findAll('tagCloudVisualization'); - const tagCloudsHaveContent = await Promise.all( - tagCloudVisualizations.map(async (tagCloud) => { - return await this.find.descendantExistsByCssSelector('text', tagCloud); - }) - ); - expect(tagCloudsHaveContent.indexOf(false)).to.be.greaterThan(-1); + if (tagCloudVisualizations.length > 0) { + const tagCloudsHaveContent = await Promise.all( + tagCloudVisualizations.map(async (tagCloud) => { + return await this.find.descendantExistsByCssSelector('text', tagCloud); + }) + ); + expect(tagCloudsHaveContent.indexOf(false)).to.be.greaterThan(-1); + } } async tagCloudWithValuesFound(values: string[]) { this.log.debug(`DashboardExpect.tagCloudWithValuesFound(${values})`); const tagCloudVisualizations = await this.testSubjects.findAll('tagCloudVisualization'); - const matches = await Promise.all( - tagCloudVisualizations.map(async (tagCloud) => { - const tagCloudData = await this.tagCloud.getTextTagByElement(tagCloud); - for (let i = 0; i < values.length; i++) { - const valueExists = tagCloudData.includes(values[i]); - if (!valueExists) { - return false; + if (tagCloudVisualizations.length > 0) { + const matches = await Promise.all( + tagCloudVisualizations.map(async (tagCloud) => { + const tagCloudData = await this.tagCloud.getTextTagByElement(tagCloud); + for (let i = 0; i < values.length; i++) { + const valueExists = tagCloudData.includes(values[i]); + if (!valueExists) { + return false; + } } - } - return true; - }) - ); - expect(matches.indexOf(true)).to.be.greaterThan(-1); + return true; + }) + ); + expect(matches.indexOf(true)).to.be.greaterThan(-1); + } } async goalAndGuageLabelsExist(labels: string[]) { @@ -232,6 +236,14 @@ export class DashboardExpectService extends FtrService { }); } + async savedSearchRowsExist() { + this.testSubjects.existOrFail('docTableExpandToggleColumn'); + } + + async savedSearchRowsMissing() { + this.testSubjects.missingOrFail('docTableExpandToggleColumn'); + } + async dataTableRowCount(expectedCount: number) { this.log.debug(`DashboardExpect.dataTableRowCount(${expectedCount})`); await this.retry.try(async () => { diff --git a/test/functional/services/lib/web_element_wrapper/web_element_wrapper.ts b/test/functional/services/lib/web_element_wrapper/web_element_wrapper.ts index 4b164402bfb7..d4fe5080bdfe 100644 --- a/test/functional/services/lib/web_element_wrapper/web_element_wrapper.ts +++ b/test/functional/services/lib/web_element_wrapper/web_element_wrapper.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { delay } from 'bluebird'; +import { setTimeout as setTimeoutAsync } from 'timers/promises'; import { WebElement, WebDriver, By, Key } from 'selenium-webdriver'; import { PNG } from 'pngjs'; import cheerio from 'cheerio'; @@ -121,7 +121,7 @@ export class WebElementWrapper { `finding element '${this.locator.toString()}' again, ${attemptsRemaining - 1} attempts left` ); - await delay(200); + await setTimeoutAsync(200); this._webElement = await this.driver.findElement(this.locator); return await this.retryCall(fn, attemptsRemaining - 1); } @@ -240,7 +240,7 @@ export class WebElementWrapper { const value = await this.getAttribute('value'); for (let i = 0; i <= value.length; i++) { await this.pressKeys(this.Keys.BACK_SPACE); - await delay(100); + await setTimeoutAsync(100); } } else { if (this.isChromium) { @@ -279,7 +279,7 @@ export class WebElementWrapper { for (const char of value) { await this.retryCall(async function type(wrapper) { await wrapper._webElement.sendKeys(char); - await delay(100); + await setTimeoutAsync(100); }); } } else { diff --git a/test/functional/services/monaco_editor.ts b/test/functional/services/monaco_editor.ts index 63a5a7105ddb..821c334b01c0 100644 --- a/test/functional/services/monaco_editor.ts +++ b/test/functional/services/monaco_editor.ts @@ -13,6 +13,11 @@ export class MonacoEditorService extends FtrService { private readonly browser = this.ctx.getService('browser'); private readonly testSubjects = this.ctx.getService('testSubjects'); + public async waitCodeEditorReady(containerTestSubjId: string) { + const editorContainer = await this.testSubjects.find(containerTestSubjId); + await editorContainer.findByCssSelector('textarea'); + } + public async getCodeEditorValue(nthIndex: number = 0) { let values: string[] = []; @@ -31,7 +36,7 @@ export class MonacoEditorService extends FtrService { public async typeCodeEditorValue(value: string, testSubjId: string) { const editor = await this.testSubjects.find(testSubjId); const textarea = await editor.findByCssSelector('textarea'); - textarea.type(value); + await textarea.type(value); } public async setCodeEditorValue(value: string, nthIndex = 0) { diff --git a/test/interactive_setup_api_integration/fixtures/test_helpers.ts b/test/interactive_setup_api_integration/fixtures/test_helpers.ts index f1e72785af02..6001f12b0a55 100644 --- a/test/interactive_setup_api_integration/fixtures/test_helpers.ts +++ b/test/interactive_setup_api_integration/fixtures/test_helpers.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { delay } from 'bluebird'; +import { setTimeout as setTimeoutAsync } from 'timers/promises'; import expect from '@kbn/expect'; @@ -19,7 +19,7 @@ export async function hasKibanaBooted(context: FtrProviderContext) { // Run 30 consecutive requests with 1.5s delay to check if Kibana is up and running. let kibanaHasBooted = false; for (const counter of [...Array(30).keys()]) { - await delay(1500); + await setTimeoutAsync(1500); try { expect((await supertest.get('/api/status').expect(200)).body).to.have.keys([ diff --git a/test/interpreter_functional/snapshots/baseline/combined_test2.json b/test/interpreter_functional/snapshots/baseline/combined_test2.json index 4870694e6adb..3b030ec8fb59 100644 --- a/test/interpreter_functional/snapshots/baseline/combined_test2.json +++ b/test/interpreter_functional/snapshots/baseline/combined_test2.json @@ -1 +1 @@ -{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"} \ No newline at end of file +{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/baseline/combined_test3.json b/test/interpreter_functional/snapshots/baseline/combined_test3.json index 8e6d59933716..2ddf40eb7900 100644 --- a/test/interpreter_functional/snapshots/baseline/combined_test3.json +++ b/test/interpreter_functional/snapshots/baseline/combined_test3.json @@ -1 +1 @@ -{"as":"metricVis","type":"render","value":{"visConfig":{"dimensions":{"bucket":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"metrics":[{"accessor":1,"format":{"id":"number","params":{}},"type":"vis_dimension"}]},"metric":{"labels":{"show":true},"metricColorMode":"None","palette":null,"percentageMode":false,"style":{"bgColor":false,"css":"font-family:'Open Sans', Helvetica, Arial, sans-serif;font-weight:normal;font-style:normal;text-decoration:none;text-align:center;font-size:60px;line-height:1","labelColor":false,"spec":{"fontFamily":"'Open Sans', Helvetica, Arial, sans-serif","fontSize":"60px","fontStyle":"normal","fontWeight":"normal","lineHeight":"1","textAlign":"center","textDecoration":"none"},"type":"style"}}},"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"},"visType":"metric"}} \ No newline at end of file +{"as":"metricVis","type":"render","value":{"visConfig":{"dimensions":{"bucket":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"metrics":[{"accessor":1,"format":{"id":"number","params":{}},"type":"vis_dimension"}]},"metric":{"labels":{"show":true},"metricColorMode":"None","palette":null,"percentageMode":false,"style":{"bgColor":false,"css":"font-family:'Open Sans', Helvetica, Arial, sans-serif;font-weight:normal;font-style:normal;text-decoration:none;text-align:center;font-size:60px;line-height:1","labelColor":false,"spec":{"fontFamily":"'Open Sans', Helvetica, Arial, sans-serif","fontSize":"60px","fontStyle":"normal","fontWeight":"normal","lineHeight":"1","textAlign":"center","textDecoration":"none"},"type":"style"}}},"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"},"visType":"metric"}} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/baseline/final_output_test.json b/test/interpreter_functional/snapshots/baseline/final_output_test.json index 8e6d59933716..2ddf40eb7900 100644 --- a/test/interpreter_functional/snapshots/baseline/final_output_test.json +++ b/test/interpreter_functional/snapshots/baseline/final_output_test.json @@ -1 +1 @@ -{"as":"metricVis","type":"render","value":{"visConfig":{"dimensions":{"bucket":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"metrics":[{"accessor":1,"format":{"id":"number","params":{}},"type":"vis_dimension"}]},"metric":{"labels":{"show":true},"metricColorMode":"None","palette":null,"percentageMode":false,"style":{"bgColor":false,"css":"font-family:'Open Sans', Helvetica, Arial, sans-serif;font-weight:normal;font-style:normal;text-decoration:none;text-align:center;font-size:60px;line-height:1","labelColor":false,"spec":{"fontFamily":"'Open Sans', Helvetica, Arial, sans-serif","fontSize":"60px","fontStyle":"normal","fontWeight":"normal","lineHeight":"1","textAlign":"center","textDecoration":"none"},"type":"style"}}},"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"},"visType":"metric"}} \ No newline at end of file +{"as":"metricVis","type":"render","value":{"visConfig":{"dimensions":{"bucket":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"metrics":[{"accessor":1,"format":{"id":"number","params":{}},"type":"vis_dimension"}]},"metric":{"labels":{"show":true},"metricColorMode":"None","palette":null,"percentageMode":false,"style":{"bgColor":false,"css":"font-family:'Open Sans', Helvetica, Arial, sans-serif;font-weight:normal;font-style:normal;text-decoration:none;text-align:center;font-size:60px;line-height:1","labelColor":false,"spec":{"fontFamily":"'Open Sans', Helvetica, Arial, sans-serif","fontSize":"60px","fontStyle":"normal","fontWeight":"normal","lineHeight":"1","textAlign":"center","textDecoration":"none"},"type":"style"}}},"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"},"visType":"metric"}} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/baseline/metric_all_data.json b/test/interpreter_functional/snapshots/baseline/metric_all_data.json index f176dfdb83e5..fb16bf98ce76 100644 --- a/test/interpreter_functional/snapshots/baseline/metric_all_data.json +++ b/test/interpreter_functional/snapshots/baseline/metric_all_data.json @@ -1 +1 @@ -{"as":"metricVis","type":"render","value":{"visConfig":{"dimensions":{"bucket":{"accessor":2,"format":{"id":"string","params":{}},"type":"vis_dimension"},"metrics":[{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"}]},"metric":{"labels":{"show":true},"metricColorMode":"None","palette":null,"percentageMode":false,"style":{"bgColor":false,"css":"font-family:'Open Sans', Helvetica, Arial, sans-serif;font-weight:normal;font-style:normal;text-decoration:none;text-align:center;font-size:60px;line-height:1","labelColor":false,"spec":{"fontFamily":"'Open Sans', Helvetica, Arial, sans-serif","fontSize":"60px","fontStyle":"normal","fontWeight":"normal","lineHeight":"1","textAlign":"center","textDecoration":"none"},"type":"style"}}},"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"},{"id":"col-2-1","meta":{"field":"bytes","index":"logstash-*","params":{"id":"bytes","params":null},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{"field":"bytes"},"schema":"metric","type":"max"},"type":"number"},"name":"Max bytes"}],"rows":[{"col-0-2":"200","col-1-1":12891,"col-2-1":19986},{"col-0-2":"404","col-1-1":696,"col-2-1":19881},{"col-0-2":"503","col-1-1":417,"col-2-1":0}],"type":"datatable"},"visType":"metric"}} \ No newline at end of file +{"as":"metricVis","type":"render","value":{"visConfig":{"dimensions":{"bucket":{"accessor":2,"format":{"id":"string","params":{}},"type":"vis_dimension"},"metrics":[{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"}]},"metric":{"labels":{"show":true},"metricColorMode":"None","palette":null,"percentageMode":false,"style":{"bgColor":false,"css":"font-family:'Open Sans', Helvetica, Arial, sans-serif;font-weight:normal;font-style:normal;text-decoration:none;text-align:center;font-size:60px;line-height:1","labelColor":false,"spec":{"fontFamily":"'Open Sans', Helvetica, Arial, sans-serif","fontSize":"60px","fontStyle":"normal","fontWeight":"normal","lineHeight":"1","textAlign":"center","textDecoration":"none"},"type":"style"}}},"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"},{"id":"col-2-1","meta":{"field":"bytes","index":"logstash-*","params":{"id":"bytes","params":null},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"1","indexPatternId":"logstash-*","params":{"field":"bytes"},"schema":"metric","type":"max"},"type":"number"},"name":"Max bytes"}],"rows":[{"col-0-2":"200","col-1-1":12891,"col-2-1":19986},{"col-0-2":"404","col-1-1":696,"col-2-1":19881},{"col-0-2":"503","col-1-1":417,"col-2-1":0}],"type":"datatable"},"visType":"metric"}} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/baseline/metric_empty_data.json b/test/interpreter_functional/snapshots/baseline/metric_empty_data.json index f9df8409edfc..d667cc6088a3 100644 --- a/test/interpreter_functional/snapshots/baseline/metric_empty_data.json +++ b/test/interpreter_functional/snapshots/baseline/metric_empty_data.json @@ -1 +1 @@ -{"as":"metricVis","type":"render","value":{"visConfig":{"dimensions":{"metrics":[{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"}]},"metric":{"labels":{"show":true},"metricColorMode":"None","palette":null,"percentageMode":false,"style":{"bgColor":false,"css":"font-family:'Open Sans', Helvetica, Arial, sans-serif;font-weight:normal;font-style:normal;text-decoration:none;text-align:center;font-size:60px;line-height:1","labelColor":false,"spec":{"fontFamily":"'Open Sans', Helvetica, Arial, sans-serif","fontSize":"60px","fontStyle":"normal","fontWeight":"normal","lineHeight":"1","textAlign":"center","textDecoration":"none"},"type":"style"}}},"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"},{"id":"col-2-1","meta":{"field":"bytes","index":"logstash-*","params":{"id":"bytes","params":null},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{"field":"bytes"},"schema":"metric","type":"max"},"type":"number"},"name":"Max bytes"}],"rows":[],"type":"datatable"},"visType":"metric"}} \ No newline at end of file +{"as":"metricVis","type":"render","value":{"visConfig":{"dimensions":{"metrics":[{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"}]},"metric":{"labels":{"show":true},"metricColorMode":"None","palette":null,"percentageMode":false,"style":{"bgColor":false,"css":"font-family:'Open Sans', Helvetica, Arial, sans-serif;font-weight:normal;font-style:normal;text-decoration:none;text-align:center;font-size:60px;line-height:1","labelColor":false,"spec":{"fontFamily":"'Open Sans', Helvetica, Arial, sans-serif","fontSize":"60px","fontStyle":"normal","fontWeight":"normal","lineHeight":"1","textAlign":"center","textDecoration":"none"},"type":"style"}}},"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"},{"id":"col-2-1","meta":{"field":"bytes","index":"logstash-*","params":{"id":"bytes","params":null},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"1","indexPatternId":"logstash-*","params":{"field":"bytes"},"schema":"metric","type":"max"},"type":"number"},"name":"Max bytes"}],"rows":[],"type":"datatable"},"visType":"metric"}} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/baseline/metric_multi_metric_data.json b/test/interpreter_functional/snapshots/baseline/metric_multi_metric_data.json index ab19a031e8c7..6ef90caf3da3 100644 --- a/test/interpreter_functional/snapshots/baseline/metric_multi_metric_data.json +++ b/test/interpreter_functional/snapshots/baseline/metric_multi_metric_data.json @@ -1 +1 @@ -{"as":"metricVis","type":"render","value":{"visConfig":{"dimensions":{"metrics":[{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},{"accessor":1,"format":{"id":"string","params":{}},"type":"vis_dimension"}]},"metric":{"labels":{"show":true},"metricColorMode":"None","palette":null,"percentageMode":false,"style":{"bgColor":false,"css":"font-family:'Open Sans', Helvetica, Arial, sans-serif;font-weight:normal;font-style:normal;text-decoration:none;text-align:center;font-size:60px;line-height:1","labelColor":false,"spec":{"fontFamily":"'Open Sans', Helvetica, Arial, sans-serif","fontSize":"60px","fontStyle":"normal","fontWeight":"normal","lineHeight":"1","textAlign":"center","textDecoration":"none"},"type":"style"}}},"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"},{"id":"col-2-1","meta":{"field":"bytes","index":"logstash-*","params":{"id":"bytes","params":null},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{"field":"bytes"},"schema":"metric","type":"max"},"type":"number"},"name":"Max bytes"}],"rows":[{"col-0-2":"200","col-1-1":12891,"col-2-1":19986},{"col-0-2":"404","col-1-1":696,"col-2-1":19881},{"col-0-2":"503","col-1-1":417,"col-2-1":0}],"type":"datatable"},"visType":"metric"}} \ No newline at end of file +{"as":"metricVis","type":"render","value":{"visConfig":{"dimensions":{"metrics":[{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},{"accessor":1,"format":{"id":"string","params":{}},"type":"vis_dimension"}]},"metric":{"labels":{"show":true},"metricColorMode":"None","palette":null,"percentageMode":false,"style":{"bgColor":false,"css":"font-family:'Open Sans', Helvetica, Arial, sans-serif;font-weight:normal;font-style:normal;text-decoration:none;text-align:center;font-size:60px;line-height:1","labelColor":false,"spec":{"fontFamily":"'Open Sans', Helvetica, Arial, sans-serif","fontSize":"60px","fontStyle":"normal","fontWeight":"normal","lineHeight":"1","textAlign":"center","textDecoration":"none"},"type":"style"}}},"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"},{"id":"col-2-1","meta":{"field":"bytes","index":"logstash-*","params":{"id":"bytes","params":null},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"1","indexPatternId":"logstash-*","params":{"field":"bytes"},"schema":"metric","type":"max"},"type":"number"},"name":"Max bytes"}],"rows":[{"col-0-2":"200","col-1-1":12891,"col-2-1":19986},{"col-0-2":"404","col-1-1":696,"col-2-1":19881},{"col-0-2":"503","col-1-1":417,"col-2-1":0}],"type":"datatable"},"visType":"metric"}} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/baseline/metric_percentage_mode.json b/test/interpreter_functional/snapshots/baseline/metric_percentage_mode.json index 2112c5bccf50..bc1ec6278dc3 100644 --- a/test/interpreter_functional/snapshots/baseline/metric_percentage_mode.json +++ b/test/interpreter_functional/snapshots/baseline/metric_percentage_mode.json @@ -1 +1 @@ -{"as":"metricVis","type":"render","value":{"visConfig":{"dimensions":{"metrics":[{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"}]},"metric":{"labels":{"show":true},"metricColorMode":"None","palette":{"colors":["rgb(0,0,0,0)","rgb(100, 100, 100)"],"continuity":"none","gradient":false,"range":"number","rangeMax":10000,"rangeMin":0,"stops":[0,10000]},"percentageMode":true,"style":{"bgColor":false,"css":"font-family:'Open Sans', Helvetica, Arial, sans-serif;font-weight:normal;font-style:normal;text-decoration:none;text-align:center;font-size:60px;line-height:1","labelColor":false,"spec":{"fontFamily":"'Open Sans', Helvetica, Arial, sans-serif","fontSize":"60px","fontStyle":"normal","fontWeight":"normal","lineHeight":"1","textAlign":"center","textDecoration":"none"},"type":"style"}}},"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"},{"id":"col-2-1","meta":{"field":"bytes","index":"logstash-*","params":{"id":"bytes","params":null},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{"field":"bytes"},"schema":"metric","type":"max"},"type":"number"},"name":"Max bytes"}],"rows":[{"col-0-2":"200","col-1-1":12891,"col-2-1":19986},{"col-0-2":"404","col-1-1":696,"col-2-1":19881},{"col-0-2":"503","col-1-1":417,"col-2-1":0}],"type":"datatable"},"visType":"metric"}} \ No newline at end of file +{"as":"metricVis","type":"render","value":{"visConfig":{"dimensions":{"metrics":[{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"}]},"metric":{"labels":{"show":true},"metricColorMode":"None","palette":{"colors":["rgb(0,0,0,0)","rgb(100, 100, 100)"],"continuity":"none","gradient":false,"range":"number","rangeMax":10000,"rangeMin":0,"stops":[0,10000]},"percentageMode":true,"style":{"bgColor":false,"css":"font-family:'Open Sans', Helvetica, Arial, sans-serif;font-weight:normal;font-style:normal;text-decoration:none;text-align:center;font-size:60px;line-height:1","labelColor":false,"spec":{"fontFamily":"'Open Sans', Helvetica, Arial, sans-serif","fontSize":"60px","fontStyle":"normal","fontWeight":"normal","lineHeight":"1","textAlign":"center","textDecoration":"none"},"type":"style"}}},"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"},{"id":"col-2-1","meta":{"field":"bytes","index":"logstash-*","params":{"id":"bytes","params":null},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"1","indexPatternId":"logstash-*","params":{"field":"bytes"},"schema":"metric","type":"max"},"type":"number"},"name":"Max bytes"}],"rows":[{"col-0-2":"200","col-1-1":12891,"col-2-1":19986},{"col-0-2":"404","col-1-1":696,"col-2-1":19881},{"col-0-2":"503","col-1-1":417,"col-2-1":0}],"type":"datatable"},"visType":"metric"}} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/baseline/metric_single_metric_data.json b/test/interpreter_functional/snapshots/baseline/metric_single_metric_data.json index 6bacc8f885e1..b5cc75694b4b 100644 --- a/test/interpreter_functional/snapshots/baseline/metric_single_metric_data.json +++ b/test/interpreter_functional/snapshots/baseline/metric_single_metric_data.json @@ -1 +1 @@ -{"as":"metricVis","type":"render","value":{"visConfig":{"dimensions":{"metrics":[{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"}]},"metric":{"labels":{"show":true},"metricColorMode":"None","palette":null,"percentageMode":false,"style":{"bgColor":false,"css":"font-family:'Open Sans', Helvetica, Arial, sans-serif;font-weight:normal;font-style:normal;text-decoration:none;text-align:center;font-size:60px;line-height:1","labelColor":false,"spec":{"fontFamily":"'Open Sans', Helvetica, Arial, sans-serif","fontSize":"60px","fontStyle":"normal","fontWeight":"normal","lineHeight":"1","textAlign":"center","textDecoration":"none"},"type":"style"}}},"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"},{"id":"col-2-1","meta":{"field":"bytes","index":"logstash-*","params":{"id":"bytes","params":null},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{"field":"bytes"},"schema":"metric","type":"max"},"type":"number"},"name":"Max bytes"}],"rows":[{"col-0-2":"200","col-1-1":12891,"col-2-1":19986},{"col-0-2":"404","col-1-1":696,"col-2-1":19881},{"col-0-2":"503","col-1-1":417,"col-2-1":0}],"type":"datatable"},"visType":"metric"}} \ No newline at end of file +{"as":"metricVis","type":"render","value":{"visConfig":{"dimensions":{"metrics":[{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"}]},"metric":{"labels":{"show":true},"metricColorMode":"None","palette":null,"percentageMode":false,"style":{"bgColor":false,"css":"font-family:'Open Sans', Helvetica, Arial, sans-serif;font-weight:normal;font-style:normal;text-decoration:none;text-align:center;font-size:60px;line-height:1","labelColor":false,"spec":{"fontFamily":"'Open Sans', Helvetica, Arial, sans-serif","fontSize":"60px","fontStyle":"normal","fontWeight":"normal","lineHeight":"1","textAlign":"center","textDecoration":"none"},"type":"style"}}},"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"},{"id":"col-2-1","meta":{"field":"bytes","index":"logstash-*","params":{"id":"bytes","params":null},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"1","indexPatternId":"logstash-*","params":{"field":"bytes"},"schema":"metric","type":"max"},"type":"number"},"name":"Max bytes"}],"rows":[{"col-0-2":"200","col-1-1":12891,"col-2-1":19986},{"col-0-2":"404","col-1-1":696,"col-2-1":19881},{"col-0-2":"503","col-1-1":417,"col-2-1":0}],"type":"datatable"},"visType":"metric"}} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/baseline/partial_test_1.json b/test/interpreter_functional/snapshots/baseline/partial_test_1.json index 9877a0d3138c..5b081f4d0713 100644 --- a/test/interpreter_functional/snapshots/baseline/partial_test_1.json +++ b/test/interpreter_functional/snapshots/baseline/partial_test_1.json @@ -1 +1 @@ -{"as":"tagcloud","type":"render","value":{"syncColors":false,"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"},"visParams":{"bucket":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"maxFontSize":72,"metric":{"accessor":1,"format":{"id":"number","params":{}},"type":"vis_dimension"},"minFontSize":18,"orientation":"single","palette":{"name":"custom","params":{"colors":["#882E72","#B178A6","#D6C1DE","#1965B0","#5289C7","#7BAFDE","#4EB265","#90C987","#CAE0AB","#F7EE55","#F6C141","#F1932D","#E8601C","#DC050C"],"continuity":"above","gradient":false,"range":"percent","rangeMax":100,"rangeMin":0,"stops":[]},"type":"palette"},"scale":"linear","showLabel":true},"visType":"tagcloud"}} \ No newline at end of file +{"as":"tagcloud","type":"render","value":{"syncColors":false,"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"},"visParams":{"bucket":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"maxFontSize":72,"metric":{"accessor":1,"format":{"id":"number","params":{}},"type":"vis_dimension"},"minFontSize":18,"orientation":"single","palette":{"name":"custom","params":{"colors":["#882E72","#B178A6","#D6C1DE","#1965B0","#5289C7","#7BAFDE","#4EB265","#90C987","#CAE0AB","#F7EE55","#F6C141","#F1932D","#E8601C","#DC050C"],"continuity":"above","gradient":false,"range":"percent","rangeMax":100,"rangeMin":0,"stops":[]},"type":"palette"},"scale":"linear","showLabel":true},"visType":"tagcloud"}} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/baseline/partial_test_2.json b/test/interpreter_functional/snapshots/baseline/partial_test_2.json index 8e6d59933716..2ddf40eb7900 100644 --- a/test/interpreter_functional/snapshots/baseline/partial_test_2.json +++ b/test/interpreter_functional/snapshots/baseline/partial_test_2.json @@ -1 +1 @@ -{"as":"metricVis","type":"render","value":{"visConfig":{"dimensions":{"bucket":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"metrics":[{"accessor":1,"format":{"id":"number","params":{}},"type":"vis_dimension"}]},"metric":{"labels":{"show":true},"metricColorMode":"None","palette":null,"percentageMode":false,"style":{"bgColor":false,"css":"font-family:'Open Sans', Helvetica, Arial, sans-serif;font-weight:normal;font-style:normal;text-decoration:none;text-align:center;font-size:60px;line-height:1","labelColor":false,"spec":{"fontFamily":"'Open Sans', Helvetica, Arial, sans-serif","fontSize":"60px","fontStyle":"normal","fontWeight":"normal","lineHeight":"1","textAlign":"center","textDecoration":"none"},"type":"style"}}},"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"},"visType":"metric"}} \ No newline at end of file +{"as":"metricVis","type":"render","value":{"visConfig":{"dimensions":{"bucket":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"metrics":[{"accessor":1,"format":{"id":"number","params":{}},"type":"vis_dimension"}]},"metric":{"labels":{"show":true},"metricColorMode":"None","palette":null,"percentageMode":false,"style":{"bgColor":false,"css":"font-family:'Open Sans', Helvetica, Arial, sans-serif;font-weight:normal;font-style:normal;text-decoration:none;text-align:center;font-size:60px;line-height:1","labelColor":false,"spec":{"fontFamily":"'Open Sans', Helvetica, Arial, sans-serif","fontSize":"60px","fontStyle":"normal","fontWeight":"normal","lineHeight":"1","textAlign":"center","textDecoration":"none"},"type":"style"}}},"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"},"visType":"metric"}} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/baseline/step_output_test2.json b/test/interpreter_functional/snapshots/baseline/step_output_test2.json index 4870694e6adb..3b030ec8fb59 100644 --- a/test/interpreter_functional/snapshots/baseline/step_output_test2.json +++ b/test/interpreter_functional/snapshots/baseline/step_output_test2.json @@ -1 +1 @@ -{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"} \ No newline at end of file +{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/baseline/step_output_test3.json b/test/interpreter_functional/snapshots/baseline/step_output_test3.json index 8e6d59933716..2ddf40eb7900 100644 --- a/test/interpreter_functional/snapshots/baseline/step_output_test3.json +++ b/test/interpreter_functional/snapshots/baseline/step_output_test3.json @@ -1 +1 @@ -{"as":"metricVis","type":"render","value":{"visConfig":{"dimensions":{"bucket":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"metrics":[{"accessor":1,"format":{"id":"number","params":{}},"type":"vis_dimension"}]},"metric":{"labels":{"show":true},"metricColorMode":"None","palette":null,"percentageMode":false,"style":{"bgColor":false,"css":"font-family:'Open Sans', Helvetica, Arial, sans-serif;font-weight:normal;font-style:normal;text-decoration:none;text-align:center;font-size:60px;line-height:1","labelColor":false,"spec":{"fontFamily":"'Open Sans', Helvetica, Arial, sans-serif","fontSize":"60px","fontStyle":"normal","fontWeight":"normal","lineHeight":"1","textAlign":"center","textDecoration":"none"},"type":"style"}}},"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"},"visType":"metric"}} \ No newline at end of file +{"as":"metricVis","type":"render","value":{"visConfig":{"dimensions":{"bucket":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"metrics":[{"accessor":1,"format":{"id":"number","params":{}},"type":"vis_dimension"}]},"metric":{"labels":{"show":true},"metricColorMode":"None","palette":null,"percentageMode":false,"style":{"bgColor":false,"css":"font-family:'Open Sans', Helvetica, Arial, sans-serif;font-weight:normal;font-style:normal;text-decoration:none;text-align:center;font-size:60px;line-height:1","labelColor":false,"spec":{"fontFamily":"'Open Sans', Helvetica, Arial, sans-serif","fontSize":"60px","fontStyle":"normal","fontWeight":"normal","lineHeight":"1","textAlign":"center","textDecoration":"none"},"type":"style"}}},"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"},"visType":"metric"}} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/baseline/tagcloud_all_data.json b/test/interpreter_functional/snapshots/baseline/tagcloud_all_data.json index 5ddf081c54d9..8f079b49ed98 100644 --- a/test/interpreter_functional/snapshots/baseline/tagcloud_all_data.json +++ b/test/interpreter_functional/snapshots/baseline/tagcloud_all_data.json @@ -1 +1 @@ -{"as":"tagcloud","type":"render","value":{"syncColors":false,"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"},"visParams":{"bucket":{"accessor":1,"format":{"id":"string","params":{}},"type":"vis_dimension"},"maxFontSize":72,"metric":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"minFontSize":18,"orientation":"single","palette":{"name":"custom","params":{"colors":["#882E72","#B178A6","#D6C1DE","#1965B0","#5289C7","#7BAFDE","#4EB265","#90C987","#CAE0AB","#F7EE55","#F6C141","#F1932D","#E8601C","#DC050C"],"continuity":"above","gradient":false,"range":"percent","rangeMax":100,"rangeMin":0,"stops":[]},"type":"palette"},"scale":"linear","showLabel":true},"visType":"tagcloud"}} \ No newline at end of file +{"as":"tagcloud","type":"render","value":{"syncColors":false,"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"},"visParams":{"bucket":{"accessor":1,"format":{"id":"string","params":{}},"type":"vis_dimension"},"maxFontSize":72,"metric":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"minFontSize":18,"orientation":"single","palette":{"name":"custom","params":{"colors":["#882E72","#B178A6","#D6C1DE","#1965B0","#5289C7","#7BAFDE","#4EB265","#90C987","#CAE0AB","#F7EE55","#F6C141","#F1932D","#E8601C","#DC050C"],"continuity":"above","gradient":false,"range":"percent","rangeMax":100,"rangeMin":0,"stops":[]},"type":"palette"},"scale":"linear","showLabel":true},"visType":"tagcloud"}} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/baseline/tagcloud_empty_data.json b/test/interpreter_functional/snapshots/baseline/tagcloud_empty_data.json index 723ebb6e9f46..e0026b189949 100644 --- a/test/interpreter_functional/snapshots/baseline/tagcloud_empty_data.json +++ b/test/interpreter_functional/snapshots/baseline/tagcloud_empty_data.json @@ -1 +1 @@ -{"as":"tagcloud","type":"render","value":{"syncColors":false,"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[],"type":"datatable"},"visParams":{"maxFontSize":72,"metric":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"minFontSize":18,"orientation":"single","palette":{"name":"custom","params":{"colors":["#882E72","#B178A6","#D6C1DE","#1965B0","#5289C7","#7BAFDE","#4EB265","#90C987","#CAE0AB","#F7EE55","#F6C141","#F1932D","#E8601C","#DC050C"],"continuity":"above","gradient":false,"range":"percent","rangeMax":100,"rangeMin":0,"stops":[]},"type":"palette"},"scale":"linear","showLabel":true},"visType":"tagcloud"}} \ No newline at end of file +{"as":"tagcloud","type":"render","value":{"syncColors":false,"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[],"type":"datatable"},"visParams":{"maxFontSize":72,"metric":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"minFontSize":18,"orientation":"single","palette":{"name":"custom","params":{"colors":["#882E72","#B178A6","#D6C1DE","#1965B0","#5289C7","#7BAFDE","#4EB265","#90C987","#CAE0AB","#F7EE55","#F6C141","#F1932D","#E8601C","#DC050C"],"continuity":"above","gradient":false,"range":"percent","rangeMax":100,"rangeMin":0,"stops":[]},"type":"palette"},"scale":"linear","showLabel":true},"visType":"tagcloud"}} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/baseline/tagcloud_fontsize.json b/test/interpreter_functional/snapshots/baseline/tagcloud_fontsize.json index 1655451d41d0..4eef2bcb1fc4 100644 --- a/test/interpreter_functional/snapshots/baseline/tagcloud_fontsize.json +++ b/test/interpreter_functional/snapshots/baseline/tagcloud_fontsize.json @@ -1 +1 @@ -{"as":"tagcloud","type":"render","value":{"syncColors":false,"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"},"visParams":{"bucket":{"accessor":1,"format":{"id":"string","params":{}},"type":"vis_dimension"},"maxFontSize":40,"metric":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"minFontSize":20,"orientation":"single","palette":{"name":"custom","params":{"colors":["#882E72","#B178A6","#D6C1DE","#1965B0","#5289C7","#7BAFDE","#4EB265","#90C987","#CAE0AB","#F7EE55","#F6C141","#F1932D","#E8601C","#DC050C"],"continuity":"above","gradient":false,"range":"percent","rangeMax":100,"rangeMin":0,"stops":[]},"type":"palette"},"scale":"linear","showLabel":true},"visType":"tagcloud"}} \ No newline at end of file +{"as":"tagcloud","type":"render","value":{"syncColors":false,"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"},"visParams":{"bucket":{"accessor":1,"format":{"id":"string","params":{}},"type":"vis_dimension"},"maxFontSize":40,"metric":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"minFontSize":20,"orientation":"single","palette":{"name":"custom","params":{"colors":["#882E72","#B178A6","#D6C1DE","#1965B0","#5289C7","#7BAFDE","#4EB265","#90C987","#CAE0AB","#F7EE55","#F6C141","#F1932D","#E8601C","#DC050C"],"continuity":"above","gradient":false,"range":"percent","rangeMax":100,"rangeMin":0,"stops":[]},"type":"palette"},"scale":"linear","showLabel":true},"visType":"tagcloud"}} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/baseline/tagcloud_metric_data.json b/test/interpreter_functional/snapshots/baseline/tagcloud_metric_data.json index f0bfd56ac99b..26ca82acd756 100644 --- a/test/interpreter_functional/snapshots/baseline/tagcloud_metric_data.json +++ b/test/interpreter_functional/snapshots/baseline/tagcloud_metric_data.json @@ -1 +1 @@ -{"as":"tagcloud","type":"render","value":{"syncColors":false,"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"},"visParams":{"maxFontSize":72,"metric":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"minFontSize":18,"orientation":"single","palette":{"name":"custom","params":{"colors":["#882E72","#B178A6","#D6C1DE","#1965B0","#5289C7","#7BAFDE","#4EB265","#90C987","#CAE0AB","#F7EE55","#F6C141","#F1932D","#E8601C","#DC050C"],"continuity":"above","gradient":false,"range":"percent","rangeMax":100,"rangeMin":0,"stops":[]},"type":"palette"},"scale":"linear","showLabel":true},"visType":"tagcloud"}} \ No newline at end of file +{"as":"tagcloud","type":"render","value":{"syncColors":false,"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"},"visParams":{"maxFontSize":72,"metric":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"minFontSize":18,"orientation":"single","palette":{"name":"custom","params":{"colors":["#882E72","#B178A6","#D6C1DE","#1965B0","#5289C7","#7BAFDE","#4EB265","#90C987","#CAE0AB","#F7EE55","#F6C141","#F1932D","#E8601C","#DC050C"],"continuity":"above","gradient":false,"range":"percent","rangeMax":100,"rangeMin":0,"stops":[]},"type":"palette"},"scale":"linear","showLabel":true},"visType":"tagcloud"}} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/baseline/tagcloud_options.json b/test/interpreter_functional/snapshots/baseline/tagcloud_options.json index ba034fa2e435..d13cc180e1e7 100644 --- a/test/interpreter_functional/snapshots/baseline/tagcloud_options.json +++ b/test/interpreter_functional/snapshots/baseline/tagcloud_options.json @@ -1 +1 @@ -{"as":"tagcloud","type":"render","value":{"syncColors":false,"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"},"visParams":{"bucket":{"accessor":1,"format":{"id":"string","params":{}},"type":"vis_dimension"},"maxFontSize":72,"metric":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"minFontSize":18,"orientation":"multiple","palette":{"name":"custom","params":{"colors":["#882E72","#B178A6","#D6C1DE","#1965B0","#5289C7","#7BAFDE","#4EB265","#90C987","#CAE0AB","#F7EE55","#F6C141","#F1932D","#E8601C","#DC050C"],"continuity":"above","gradient":false,"range":"percent","rangeMax":100,"rangeMin":0,"stops":[]},"type":"palette"},"scale":"log","showLabel":true},"visType":"tagcloud"}} \ No newline at end of file +{"as":"tagcloud","type":"render","value":{"syncColors":false,"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"hasPrecisionError":false,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"},"visParams":{"bucket":{"accessor":1,"format":{"id":"string","params":{}},"type":"vis_dimension"},"maxFontSize":72,"metric":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"minFontSize":18,"orientation":"multiple","palette":{"name":"custom","params":{"colors":["#882E72","#B178A6","#D6C1DE","#1965B0","#5289C7","#7BAFDE","#4EB265","#90C987","#CAE0AB","#F7EE55","#F6C141","#F1932D","#E8601C","#DC050C"],"continuity":"above","gradient":false,"range":"percent","rangeMax":100,"rangeMin":0,"stops":[]},"type":"palette"},"scale":"log","showLabel":true},"visType":"tagcloud"}} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/session/combined_test0.json b/test/interpreter_functional/snapshots/session/combined_test0.json deleted file mode 100644 index 8f00d72df8ab..000000000000 --- a/test/interpreter_functional/snapshots/session/combined_test0.json +++ /dev/null @@ -1 +0,0 @@ -{"filters":[],"query":[],"timeRange":null,"type":"kibana_context"} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/session/combined_test1.json b/test/interpreter_functional/snapshots/session/combined_test1.json deleted file mode 100644 index 8f00d72df8ab..000000000000 --- a/test/interpreter_functional/snapshots/session/combined_test1.json +++ /dev/null @@ -1 +0,0 @@ -{"filters":[],"query":[],"timeRange":null,"type":"kibana_context"} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/session/combined_test2.json b/test/interpreter_functional/snapshots/session/combined_test2.json deleted file mode 100644 index 4870694e6adb..000000000000 --- a/test/interpreter_functional/snapshots/session/combined_test2.json +++ /dev/null @@ -1 +0,0 @@ -{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/session/combined_test3.json b/test/interpreter_functional/snapshots/session/combined_test3.json deleted file mode 100644 index 8e6d59933716..000000000000 --- a/test/interpreter_functional/snapshots/session/combined_test3.json +++ /dev/null @@ -1 +0,0 @@ -{"as":"metricVis","type":"render","value":{"visConfig":{"dimensions":{"bucket":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"metrics":[{"accessor":1,"format":{"id":"number","params":{}},"type":"vis_dimension"}]},"metric":{"labels":{"show":true},"metricColorMode":"None","palette":null,"percentageMode":false,"style":{"bgColor":false,"css":"font-family:'Open Sans', Helvetica, Arial, sans-serif;font-weight:normal;font-style:normal;text-decoration:none;text-align:center;font-size:60px;line-height:1","labelColor":false,"spec":{"fontFamily":"'Open Sans', Helvetica, Arial, sans-serif","fontSize":"60px","fontStyle":"normal","fontWeight":"normal","lineHeight":"1","textAlign":"center","textDecoration":"none"},"type":"style"}}},"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"},"visType":"metric"}} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/session/final_output_test.json b/test/interpreter_functional/snapshots/session/final_output_test.json deleted file mode 100644 index 8e6d59933716..000000000000 --- a/test/interpreter_functional/snapshots/session/final_output_test.json +++ /dev/null @@ -1 +0,0 @@ -{"as":"metricVis","type":"render","value":{"visConfig":{"dimensions":{"bucket":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"metrics":[{"accessor":1,"format":{"id":"number","params":{}},"type":"vis_dimension"}]},"metric":{"labels":{"show":true},"metricColorMode":"None","palette":null,"percentageMode":false,"style":{"bgColor":false,"css":"font-family:'Open Sans', Helvetica, Arial, sans-serif;font-weight:normal;font-style:normal;text-decoration:none;text-align:center;font-size:60px;line-height:1","labelColor":false,"spec":{"fontFamily":"'Open Sans', Helvetica, Arial, sans-serif","fontSize":"60px","fontStyle":"normal","fontWeight":"normal","lineHeight":"1","textAlign":"center","textDecoration":"none"},"type":"style"}}},"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"},"visType":"metric"}} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/session/metric_all_data.json b/test/interpreter_functional/snapshots/session/metric_all_data.json deleted file mode 100644 index f176dfdb83e5..000000000000 --- a/test/interpreter_functional/snapshots/session/metric_all_data.json +++ /dev/null @@ -1 +0,0 @@ -{"as":"metricVis","type":"render","value":{"visConfig":{"dimensions":{"bucket":{"accessor":2,"format":{"id":"string","params":{}},"type":"vis_dimension"},"metrics":[{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"}]},"metric":{"labels":{"show":true},"metricColorMode":"None","palette":null,"percentageMode":false,"style":{"bgColor":false,"css":"font-family:'Open Sans', Helvetica, Arial, sans-serif;font-weight:normal;font-style:normal;text-decoration:none;text-align:center;font-size:60px;line-height:1","labelColor":false,"spec":{"fontFamily":"'Open Sans', Helvetica, Arial, sans-serif","fontSize":"60px","fontStyle":"normal","fontWeight":"normal","lineHeight":"1","textAlign":"center","textDecoration":"none"},"type":"style"}}},"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"},{"id":"col-2-1","meta":{"field":"bytes","index":"logstash-*","params":{"id":"bytes","params":null},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{"field":"bytes"},"schema":"metric","type":"max"},"type":"number"},"name":"Max bytes"}],"rows":[{"col-0-2":"200","col-1-1":12891,"col-2-1":19986},{"col-0-2":"404","col-1-1":696,"col-2-1":19881},{"col-0-2":"503","col-1-1":417,"col-2-1":0}],"type":"datatable"},"visType":"metric"}} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/session/metric_empty_data.json b/test/interpreter_functional/snapshots/session/metric_empty_data.json deleted file mode 100644 index f9df8409edfc..000000000000 --- a/test/interpreter_functional/snapshots/session/metric_empty_data.json +++ /dev/null @@ -1 +0,0 @@ -{"as":"metricVis","type":"render","value":{"visConfig":{"dimensions":{"metrics":[{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"}]},"metric":{"labels":{"show":true},"metricColorMode":"None","palette":null,"percentageMode":false,"style":{"bgColor":false,"css":"font-family:'Open Sans', Helvetica, Arial, sans-serif;font-weight:normal;font-style:normal;text-decoration:none;text-align:center;font-size:60px;line-height:1","labelColor":false,"spec":{"fontFamily":"'Open Sans', Helvetica, Arial, sans-serif","fontSize":"60px","fontStyle":"normal","fontWeight":"normal","lineHeight":"1","textAlign":"center","textDecoration":"none"},"type":"style"}}},"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"},{"id":"col-2-1","meta":{"field":"bytes","index":"logstash-*","params":{"id":"bytes","params":null},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{"field":"bytes"},"schema":"metric","type":"max"},"type":"number"},"name":"Max bytes"}],"rows":[],"type":"datatable"},"visType":"metric"}} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/session/metric_invalid_data.json b/test/interpreter_functional/snapshots/session/metric_invalid_data.json deleted file mode 100644 index f23b9b091577..000000000000 --- a/test/interpreter_functional/snapshots/session/metric_invalid_data.json +++ /dev/null @@ -1 +0,0 @@ -"[metricVis] > [visdimension] > Column name or index provided is invalid" \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/session/metric_multi_metric_data.json b/test/interpreter_functional/snapshots/session/metric_multi_metric_data.json deleted file mode 100644 index ab19a031e8c7..000000000000 --- a/test/interpreter_functional/snapshots/session/metric_multi_metric_data.json +++ /dev/null @@ -1 +0,0 @@ -{"as":"metricVis","type":"render","value":{"visConfig":{"dimensions":{"metrics":[{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},{"accessor":1,"format":{"id":"string","params":{}},"type":"vis_dimension"}]},"metric":{"labels":{"show":true},"metricColorMode":"None","palette":null,"percentageMode":false,"style":{"bgColor":false,"css":"font-family:'Open Sans', Helvetica, Arial, sans-serif;font-weight:normal;font-style:normal;text-decoration:none;text-align:center;font-size:60px;line-height:1","labelColor":false,"spec":{"fontFamily":"'Open Sans', Helvetica, Arial, sans-serif","fontSize":"60px","fontStyle":"normal","fontWeight":"normal","lineHeight":"1","textAlign":"center","textDecoration":"none"},"type":"style"}}},"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"},{"id":"col-2-1","meta":{"field":"bytes","index":"logstash-*","params":{"id":"bytes","params":null},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{"field":"bytes"},"schema":"metric","type":"max"},"type":"number"},"name":"Max bytes"}],"rows":[{"col-0-2":"200","col-1-1":12891,"col-2-1":19986},{"col-0-2":"404","col-1-1":696,"col-2-1":19881},{"col-0-2":"503","col-1-1":417,"col-2-1":0}],"type":"datatable"},"visType":"metric"}} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/session/metric_percentage_mode.json b/test/interpreter_functional/snapshots/session/metric_percentage_mode.json deleted file mode 100644 index 2112c5bccf50..000000000000 --- a/test/interpreter_functional/snapshots/session/metric_percentage_mode.json +++ /dev/null @@ -1 +0,0 @@ -{"as":"metricVis","type":"render","value":{"visConfig":{"dimensions":{"metrics":[{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"}]},"metric":{"labels":{"show":true},"metricColorMode":"None","palette":{"colors":["rgb(0,0,0,0)","rgb(100, 100, 100)"],"continuity":"none","gradient":false,"range":"number","rangeMax":10000,"rangeMin":0,"stops":[0,10000]},"percentageMode":true,"style":{"bgColor":false,"css":"font-family:'Open Sans', Helvetica, Arial, sans-serif;font-weight:normal;font-style:normal;text-decoration:none;text-align:center;font-size:60px;line-height:1","labelColor":false,"spec":{"fontFamily":"'Open Sans', Helvetica, Arial, sans-serif","fontSize":"60px","fontStyle":"normal","fontWeight":"normal","lineHeight":"1","textAlign":"center","textDecoration":"none"},"type":"style"}}},"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"},{"id":"col-2-1","meta":{"field":"bytes","index":"logstash-*","params":{"id":"bytes","params":null},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{"field":"bytes"},"schema":"metric","type":"max"},"type":"number"},"name":"Max bytes"}],"rows":[{"col-0-2":"200","col-1-1":12891,"col-2-1":19986},{"col-0-2":"404","col-1-1":696,"col-2-1":19881},{"col-0-2":"503","col-1-1":417,"col-2-1":0}],"type":"datatable"},"visType":"metric"}} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/session/metric_single_metric_data.json b/test/interpreter_functional/snapshots/session/metric_single_metric_data.json deleted file mode 100644 index 6bacc8f885e1..000000000000 --- a/test/interpreter_functional/snapshots/session/metric_single_metric_data.json +++ /dev/null @@ -1 +0,0 @@ -{"as":"metricVis","type":"render","value":{"visConfig":{"dimensions":{"metrics":[{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"}]},"metric":{"labels":{"show":true},"metricColorMode":"None","palette":null,"percentageMode":false,"style":{"bgColor":false,"css":"font-family:'Open Sans', Helvetica, Arial, sans-serif;font-weight:normal;font-style:normal;text-decoration:none;text-align:center;font-size:60px;line-height:1","labelColor":false,"spec":{"fontFamily":"'Open Sans', Helvetica, Arial, sans-serif","fontSize":"60px","fontStyle":"normal","fontWeight":"normal","lineHeight":"1","textAlign":"center","textDecoration":"none"},"type":"style"}}},"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"},{"id":"col-2-1","meta":{"field":"bytes","index":"logstash-*","params":{"id":"bytes","params":null},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{"field":"bytes"},"schema":"metric","type":"max"},"type":"number"},"name":"Max bytes"}],"rows":[{"col-0-2":"200","col-1-1":12891,"col-2-1":19986},{"col-0-2":"404","col-1-1":696,"col-2-1":19881},{"col-0-2":"503","col-1-1":417,"col-2-1":0}],"type":"datatable"},"visType":"metric"}} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/session/partial_test_1.json b/test/interpreter_functional/snapshots/session/partial_test_1.json deleted file mode 100644 index 9877a0d3138c..000000000000 --- a/test/interpreter_functional/snapshots/session/partial_test_1.json +++ /dev/null @@ -1 +0,0 @@ -{"as":"tagcloud","type":"render","value":{"syncColors":false,"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"},"visParams":{"bucket":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"maxFontSize":72,"metric":{"accessor":1,"format":{"id":"number","params":{}},"type":"vis_dimension"},"minFontSize":18,"orientation":"single","palette":{"name":"custom","params":{"colors":["#882E72","#B178A6","#D6C1DE","#1965B0","#5289C7","#7BAFDE","#4EB265","#90C987","#CAE0AB","#F7EE55","#F6C141","#F1932D","#E8601C","#DC050C"],"continuity":"above","gradient":false,"range":"percent","rangeMax":100,"rangeMin":0,"stops":[]},"type":"palette"},"scale":"linear","showLabel":true},"visType":"tagcloud"}} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/session/partial_test_2.json b/test/interpreter_functional/snapshots/session/partial_test_2.json deleted file mode 100644 index 8e6d59933716..000000000000 --- a/test/interpreter_functional/snapshots/session/partial_test_2.json +++ /dev/null @@ -1 +0,0 @@ -{"as":"metricVis","type":"render","value":{"visConfig":{"dimensions":{"bucket":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"metrics":[{"accessor":1,"format":{"id":"number","params":{}},"type":"vis_dimension"}]},"metric":{"labels":{"show":true},"metricColorMode":"None","palette":null,"percentageMode":false,"style":{"bgColor":false,"css":"font-family:'Open Sans', Helvetica, Arial, sans-serif;font-weight:normal;font-style:normal;text-decoration:none;text-align:center;font-size:60px;line-height:1","labelColor":false,"spec":{"fontFamily":"'Open Sans', Helvetica, Arial, sans-serif","fontSize":"60px","fontStyle":"normal","fontWeight":"normal","lineHeight":"1","textAlign":"center","textDecoration":"none"},"type":"style"}}},"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"},"visType":"metric"}} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/session/step_output_test0.json b/test/interpreter_functional/snapshots/session/step_output_test0.json deleted file mode 100644 index 8f00d72df8ab..000000000000 --- a/test/interpreter_functional/snapshots/session/step_output_test0.json +++ /dev/null @@ -1 +0,0 @@ -{"filters":[],"query":[],"timeRange":null,"type":"kibana_context"} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/session/step_output_test1.json b/test/interpreter_functional/snapshots/session/step_output_test1.json deleted file mode 100644 index 8f00d72df8ab..000000000000 --- a/test/interpreter_functional/snapshots/session/step_output_test1.json +++ /dev/null @@ -1 +0,0 @@ -{"filters":[],"query":[],"timeRange":null,"type":"kibana_context"} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/session/step_output_test2.json b/test/interpreter_functional/snapshots/session/step_output_test2.json deleted file mode 100644 index 4870694e6adb..000000000000 --- a/test/interpreter_functional/snapshots/session/step_output_test2.json +++ /dev/null @@ -1 +0,0 @@ -{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/session/step_output_test3.json b/test/interpreter_functional/snapshots/session/step_output_test3.json deleted file mode 100644 index 8e6d59933716..000000000000 --- a/test/interpreter_functional/snapshots/session/step_output_test3.json +++ /dev/null @@ -1 +0,0 @@ -{"as":"metricVis","type":"render","value":{"visConfig":{"dimensions":{"bucket":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"metrics":[{"accessor":1,"format":{"id":"number","params":{}},"type":"vis_dimension"}]},"metric":{"labels":{"show":true},"metricColorMode":"None","palette":null,"percentageMode":false,"style":{"bgColor":false,"css":"font-family:'Open Sans', Helvetica, Arial, sans-serif;font-weight:normal;font-style:normal;text-decoration:none;text-align:center;font-size:60px;line-height:1","labelColor":false,"spec":{"fontFamily":"'Open Sans', Helvetica, Arial, sans-serif","fontSize":"60px","fontStyle":"normal","fontWeight":"normal","lineHeight":"1","textAlign":"center","textDecoration":"none"},"type":"style"}}},"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"},"visType":"metric"}} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/session/tagcloud_all_data.json b/test/interpreter_functional/snapshots/session/tagcloud_all_data.json deleted file mode 100644 index 5ddf081c54d9..000000000000 --- a/test/interpreter_functional/snapshots/session/tagcloud_all_data.json +++ /dev/null @@ -1 +0,0 @@ -{"as":"tagcloud","type":"render","value":{"syncColors":false,"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"},"visParams":{"bucket":{"accessor":1,"format":{"id":"string","params":{}},"type":"vis_dimension"},"maxFontSize":72,"metric":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"minFontSize":18,"orientation":"single","palette":{"name":"custom","params":{"colors":["#882E72","#B178A6","#D6C1DE","#1965B0","#5289C7","#7BAFDE","#4EB265","#90C987","#CAE0AB","#F7EE55","#F6C141","#F1932D","#E8601C","#DC050C"],"continuity":"above","gradient":false,"range":"percent","rangeMax":100,"rangeMin":0,"stops":[]},"type":"palette"},"scale":"linear","showLabel":true},"visType":"tagcloud"}} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/session/tagcloud_empty_data.json b/test/interpreter_functional/snapshots/session/tagcloud_empty_data.json deleted file mode 100644 index 723ebb6e9f46..000000000000 --- a/test/interpreter_functional/snapshots/session/tagcloud_empty_data.json +++ /dev/null @@ -1 +0,0 @@ -{"as":"tagcloud","type":"render","value":{"syncColors":false,"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[],"type":"datatable"},"visParams":{"maxFontSize":72,"metric":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"minFontSize":18,"orientation":"single","palette":{"name":"custom","params":{"colors":["#882E72","#B178A6","#D6C1DE","#1965B0","#5289C7","#7BAFDE","#4EB265","#90C987","#CAE0AB","#F7EE55","#F6C141","#F1932D","#E8601C","#DC050C"],"continuity":"above","gradient":false,"range":"percent","rangeMax":100,"rangeMin":0,"stops":[]},"type":"palette"},"scale":"linear","showLabel":true},"visType":"tagcloud"}} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/session/tagcloud_fontsize.json b/test/interpreter_functional/snapshots/session/tagcloud_fontsize.json deleted file mode 100644 index 1655451d41d0..000000000000 --- a/test/interpreter_functional/snapshots/session/tagcloud_fontsize.json +++ /dev/null @@ -1 +0,0 @@ -{"as":"tagcloud","type":"render","value":{"syncColors":false,"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"},"visParams":{"bucket":{"accessor":1,"format":{"id":"string","params":{}},"type":"vis_dimension"},"maxFontSize":40,"metric":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"minFontSize":20,"orientation":"single","palette":{"name":"custom","params":{"colors":["#882E72","#B178A6","#D6C1DE","#1965B0","#5289C7","#7BAFDE","#4EB265","#90C987","#CAE0AB","#F7EE55","#F6C141","#F1932D","#E8601C","#DC050C"],"continuity":"above","gradient":false,"range":"percent","rangeMax":100,"rangeMin":0,"stops":[]},"type":"palette"},"scale":"linear","showLabel":true},"visType":"tagcloud"}} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/session/tagcloud_invalid_data.json b/test/interpreter_functional/snapshots/session/tagcloud_invalid_data.json deleted file mode 100644 index b5ae1a2cb59f..000000000000 --- a/test/interpreter_functional/snapshots/session/tagcloud_invalid_data.json +++ /dev/null @@ -1 +0,0 @@ -"[tagcloud] > [visdimension] > Column name or index provided is invalid" \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/session/tagcloud_metric_data.json b/test/interpreter_functional/snapshots/session/tagcloud_metric_data.json deleted file mode 100644 index f0bfd56ac99b..000000000000 --- a/test/interpreter_functional/snapshots/session/tagcloud_metric_data.json +++ /dev/null @@ -1 +0,0 @@ -{"as":"tagcloud","type":"render","value":{"syncColors":false,"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"},"visParams":{"maxFontSize":72,"metric":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"minFontSize":18,"orientation":"single","palette":{"name":"custom","params":{"colors":["#882E72","#B178A6","#D6C1DE","#1965B0","#5289C7","#7BAFDE","#4EB265","#90C987","#CAE0AB","#F7EE55","#F6C141","#F1932D","#E8601C","#DC050C"],"continuity":"above","gradient":false,"range":"percent","rangeMax":100,"rangeMin":0,"stops":[]},"type":"palette"},"scale":"linear","showLabel":true},"visType":"tagcloud"}} \ No newline at end of file diff --git a/test/interpreter_functional/snapshots/session/tagcloud_options.json b/test/interpreter_functional/snapshots/session/tagcloud_options.json deleted file mode 100644 index ba034fa2e435..000000000000 --- a/test/interpreter_functional/snapshots/session/tagcloud_options.json +++ /dev/null @@ -1 +0,0 @@ -{"as":"tagcloud","type":"render","value":{"syncColors":false,"visData":{"columns":[{"id":"col-0-2","meta":{"field":"response.raw","index":"logstash-*","params":{"id":"terms","params":{"id":"string","missingBucketLabel":"Missing","otherBucketLabel":"Other"}},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"2","indexPatternId":"logstash-*","params":{"field":"response.raw","missingBucket":false,"missingBucketLabel":"Missing","order":"desc","orderBy":"1","otherBucket":false,"otherBucketLabel":"Other","size":4},"schema":"segment","type":"terms"},"type":"string"},"name":"response.raw: Descending"},{"id":"col-1-1","meta":{"field":null,"index":"logstash-*","params":{"id":"number"},"source":"esaggs","sourceParams":{"appliedTimeRange":null,"enabled":true,"id":"1","indexPatternId":"logstash-*","params":{},"schema":"metric","type":"count"},"type":"number"},"name":"Count"}],"rows":[{"col-0-2":"200","col-1-1":12891},{"col-0-2":"404","col-1-1":696},{"col-0-2":"503","col-1-1":417}],"type":"datatable"},"visParams":{"bucket":{"accessor":1,"format":{"id":"string","params":{}},"type":"vis_dimension"},"maxFontSize":72,"metric":{"accessor":0,"format":{"id":"string","params":{}},"type":"vis_dimension"},"minFontSize":18,"orientation":"multiple","palette":{"name":"custom","params":{"colors":["#882E72","#B178A6","#D6C1DE","#1965B0","#5289C7","#7BAFDE","#4EB265","#90C987","#CAE0AB","#F7EE55","#F6C141","#F1932D","#E8601C","#DC050C"],"continuity":"above","gradient":false,"range":"percent","rangeMax":100,"rangeMin":0,"stops":[]},"type":"palette"},"scale":"log","showLabel":true},"visType":"tagcloud"}} \ No newline at end of file diff --git a/vars/kibanaPipeline.groovy b/vars/kibanaPipeline.groovy index daf6ca7a8e99..8a7596a59117 100644 --- a/vars/kibanaPipeline.groovy +++ b/vars/kibanaPipeline.groovy @@ -93,7 +93,7 @@ def withFunctionalTestEnv(List additionalEnvs = [], Closure closure) { def corsTestServerPort = "64${parallelId}3" // needed for https://github.com/elastic/kibana/issues/107246 def proxyTestServerPort = "64${parallelId}4" - def apmActive = githubPr.isPr() ? "false" : "true" + def contextPropagationOnly = githubPr.isPr() ? "true" : "false" withEnv([ "CI_GROUP=${parallelId}", @@ -109,7 +109,8 @@ def withFunctionalTestEnv(List additionalEnvs = [], Closure closure) { "KBN_NP_PLUGINS_BUILT=true", "FLEET_PACKAGE_REGISTRY_PORT=${fleetPackageRegistryPort}", "ALERTING_PROXY_PORT=${alertingProxyPort}", - "ELASTIC_APM_ACTIVE=${apmActive}", + "ELASTIC_APM_ACTIVE=true", + "ELASTIC_APM_CONTEXT_PROPAGATION_ONLY=${contextPropagationOnly}", "ELASTIC_APM_TRANSACTION_SAMPLE_RATE=0.1", ] + additionalEnvs) { closure() diff --git a/x-pack/plugins/alerting/README.md b/x-pack/plugins/alerting/README.md index 343960aee9df..9c4f27fa945b 100644 --- a/x-pack/plugins/alerting/README.md +++ b/x-pack/plugins/alerting/README.md @@ -75,29 +75,6 @@ To change the schedule for the invalidation task, use the kibana.yml configurati To change the default delay for the API key invalidation, use the kibana.yml configuration option `xpack.alerting.invalidateApiKeysTask.removalDelay`. -## Plugin Status - -The plugin status of the Alerting Framework is customized by including information about checking for failures during framework decryption: - -```js -core.status.set( - combineLatest([ - core.status.derivedStatus$, - getHealthStatusStream(startPlugins.taskManager), - ]).pipe( - map(([derivedStatus, healthStatus]) => { - if (healthStatus.level > derivedStatus.level) { - return healthStatus as ServiceStatus; - } else { - return derivedStatus; - } - }) - ) - ); -``` - -To check for framework decryption failures, we use the task `alerting_health_check`, which runs every 60 minutes by default. To change the default schedule, use the kibana.yml configuration option `xpack.alerting.healthCheck.interval`. - ## Rule Types ### Methods diff --git a/x-pack/plugins/alerting/server/health/get_state.test.ts b/x-pack/plugins/alerting/server/health/get_state.test.ts deleted file mode 100644 index f4306b8250b8..000000000000 --- a/x-pack/plugins/alerting/server/health/get_state.test.ts +++ /dev/null @@ -1,328 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { ServiceStatusLevels } from '../../../../../src/core/server'; -import { taskManagerMock } from '../../../task_manager/server/mocks'; -import { - getHealthStatusStream, - getHealthServiceStatusWithRetryAndErrorHandling, - MAX_RETRY_ATTEMPTS, -} from './get_state'; -import { ConcreteTaskInstance, TaskStatus } from '../../../task_manager/server'; -import { HealthStatus } from '../types'; -import { loggingSystemMock, savedObjectsServiceMock } from 'src/core/server/mocks'; - -jest.mock('./get_health', () => ({ - getAlertingHealthStatus: jest.fn().mockReturnValue({ - state: { - runs: 0, - health_status: 'warn', - }, - }), -})); - -const tick = () => new Promise((resolve) => setImmediate(resolve)); - -const getHealthCheckTask = (overrides = {}): ConcreteTaskInstance => ({ - id: 'test', - attempts: 0, - status: TaskStatus.Running, - version: '123', - runAt: new Date(), - scheduledAt: new Date(), - startedAt: new Date(), - retryAt: new Date(Date.now() + 5 * 60 * 1000), - state: { - runs: 1, - health_status: HealthStatus.OK, - }, - taskType: 'alerting:alerting_health_check', - params: { - alertId: '1', - }, - ownerId: null, - ...overrides, -}); - -const logger = loggingSystemMock.create().get(); -const savedObjects = savedObjectsServiceMock.createStartContract(); - -describe('getHealthServiceStatusWithRetryAndErrorHandling', () => { - beforeEach(() => jest.useFakeTimers()); - - it('should get status at each interval', async () => { - const mockTaskManager = taskManagerMock.createStart(); - mockTaskManager.get.mockResolvedValue(getHealthCheckTask()); - const pollInterval = 100; - - getHealthStatusStream( - mockTaskManager, - logger, - savedObjects, - Promise.resolve({ - healthCheck: { - interval: '5m', - }, - invalidateApiKeysTask: { - interval: '5m', - removalDelay: '1h', - }, - maxEphemeralActionsPerAlert: 100, - defaultRuleTaskTimeout: '20m', - }), - pollInterval - ).subscribe(); - - // should fire before poll interval passes - // should fire once each poll interval - expect(mockTaskManager.get).toHaveBeenCalledTimes(1); - jest.advanceTimersByTime(pollInterval); - expect(mockTaskManager.get).toHaveBeenCalledTimes(2); - jest.advanceTimersByTime(pollInterval); - expect(mockTaskManager.get).toHaveBeenCalledTimes(3); - jest.advanceTimersByTime(pollInterval); - expect(mockTaskManager.get).toHaveBeenCalledTimes(4); - }); - - it('should retry on error', async () => { - const mockTaskManager = taskManagerMock.createStart(); - mockTaskManager.get.mockRejectedValue(new Error('Failure')); - const retryDelay = 10; - const pollInterval = 100; - - getHealthStatusStream( - mockTaskManager, - logger, - savedObjects, - Promise.resolve({ - healthCheck: { - interval: '5m', - }, - invalidateApiKeysTask: { - interval: '5m', - removalDelay: '1h', - }, - maxEphemeralActionsPerAlert: 100, - defaultRuleTaskTimeout: '20m', - }), - pollInterval, - retryDelay - ).subscribe(); - - expect(mockTaskManager.get).toHaveBeenCalledTimes(1); - jest.advanceTimersByTime(pollInterval); - expect(mockTaskManager.get).toHaveBeenCalledTimes(2); - - // Retry on failure - let numTimesCalled = 1; - for (let i = 0; i < MAX_RETRY_ATTEMPTS; i++) { - await tick(); - jest.advanceTimersByTime(retryDelay); - expect(mockTaskManager.get).toHaveBeenCalledTimes(numTimesCalled++ + 2); - } - - // Once we've exceeded max retries, should not try again - await tick(); - jest.advanceTimersByTime(retryDelay); - expect(mockTaskManager.get).toHaveBeenCalledTimes(numTimesCalled + 1); - - // Once another poll interval passes, should call fn again - await tick(); - jest.advanceTimersByTime(pollInterval - MAX_RETRY_ATTEMPTS * retryDelay); - expect(mockTaskManager.get).toHaveBeenCalledTimes(numTimesCalled + 2); - }); - - it('should return healthy status when health status is "ok"', async () => { - const mockTaskManager = taskManagerMock.createStart(); - mockTaskManager.get.mockResolvedValue(getHealthCheckTask()); - - const status = await getHealthServiceStatusWithRetryAndErrorHandling( - mockTaskManager, - logger, - savedObjects, - Promise.resolve({ - healthCheck: { - interval: '5m', - }, - invalidateApiKeysTask: { - interval: '5m', - removalDelay: '1h', - }, - maxEphemeralActionsPerAlert: 100, - defaultRuleTaskTimeout: '20m', - }) - ).toPromise(); - - expect(status.level).toEqual(ServiceStatusLevels.available); - expect(status.summary).toEqual('Alerting framework is available'); - }); - - it('should return degraded status when health status is "warn"', async () => { - const mockTaskManager = taskManagerMock.createStart(); - mockTaskManager.get.mockResolvedValue( - getHealthCheckTask({ - state: { - runs: 1, - health_status: HealthStatus.Warning, - }, - }) - ); - - const status = await getHealthServiceStatusWithRetryAndErrorHandling( - mockTaskManager, - logger, - savedObjects, - Promise.resolve({ - healthCheck: { - interval: '5m', - }, - invalidateApiKeysTask: { - interval: '5m', - removalDelay: '1h', - }, - maxEphemeralActionsPerAlert: 100, - defaultRuleTaskTimeout: '20m', - }) - ).toPromise(); - - expect(status.level).toEqual(ServiceStatusLevels.degraded); - expect(status.summary).toEqual('Alerting framework is degraded'); - }); - - it('should return unavailable status when health status is "error"', async () => { - const mockTaskManager = taskManagerMock.createStart(); - mockTaskManager.get.mockResolvedValue( - getHealthCheckTask({ - state: { - runs: 1, - health_status: HealthStatus.Error, - }, - }) - ); - - const status = await getHealthServiceStatusWithRetryAndErrorHandling( - mockTaskManager, - logger, - savedObjects, - Promise.resolve({ - healthCheck: { - interval: '5m', - }, - invalidateApiKeysTask: { - interval: '5m', - removalDelay: '1h', - }, - maxEphemeralActionsPerAlert: 100, - defaultRuleTaskTimeout: '20m', - }) - ).toPromise(); - - expect(status.level).toEqual(ServiceStatusLevels.degraded); - expect(status.summary).toEqual('Alerting framework is degraded'); - expect(status.meta).toBeUndefined(); - }); - - it('should retry on error and return healthy status if retry succeeds', async () => { - const retryDelay = 10; - const mockTaskManager = taskManagerMock.createStart(); - mockTaskManager.get - .mockRejectedValueOnce(new Error('Failure')) - .mockResolvedValue(getHealthCheckTask()); - - getHealthServiceStatusWithRetryAndErrorHandling( - mockTaskManager, - logger, - savedObjects, - Promise.resolve({ - healthCheck: { - interval: '5m', - }, - invalidateApiKeysTask: { - interval: '5m', - removalDelay: '1h', - }, - maxEphemeralActionsPerAlert: 100, - defaultRuleTaskTimeout: '20m', - }), - retryDelay - ).subscribe((status) => { - expect(status.level).toEqual(ServiceStatusLevels.available); - expect(logger.warn).toHaveBeenCalledTimes(1); - expect(status.summary).toEqual('Alerting framework is available'); - }); - - await tick(); - jest.advanceTimersByTime(retryDelay * 2); - }); - - it('should retry on error and return unavailable status if retry fails', async () => { - const retryDelay = 10; - const err = new Error('Failure'); - const mockTaskManager = taskManagerMock.createStart(); - mockTaskManager.get.mockRejectedValue(err); - - getHealthServiceStatusWithRetryAndErrorHandling( - mockTaskManager, - logger, - savedObjects, - Promise.resolve({ - healthCheck: { - interval: '5m', - }, - invalidateApiKeysTask: { - interval: '5m', - removalDelay: '1h', - }, - maxEphemeralActionsPerAlert: 100, - defaultRuleTaskTimeout: '20m', - }), - retryDelay - ).subscribe((status) => { - expect(status.level).toEqual(ServiceStatusLevels.degraded); - expect(status.summary).toEqual('Alerting framework is degraded'); - expect(status.meta).toEqual({ error: err }); - }); - - for (let i = 0; i < MAX_RETRY_ATTEMPTS + 1; i++) { - await tick(); - jest.advanceTimersByTime(retryDelay); - } - expect(mockTaskManager.get).toHaveBeenCalledTimes(MAX_RETRY_ATTEMPTS + 1); - }); - - it('should schedule a new health check task if it does not exist without throwing an error', async () => { - const mockTaskManager = taskManagerMock.createStart(); - mockTaskManager.get.mockRejectedValue({ - output: { - statusCode: 404, - message: 'Not Found', - }, - }); - - const status = await getHealthServiceStatusWithRetryAndErrorHandling( - mockTaskManager, - logger, - savedObjects, - Promise.resolve({ - healthCheck: { - interval: '5m', - }, - invalidateApiKeysTask: { - interval: '5m', - removalDelay: '1h', - }, - maxEphemeralActionsPerAlert: 100, - defaultRuleTaskTimeout: '20m', - }) - ).toPromise(); - - expect(mockTaskManager.ensureScheduled).toHaveBeenCalledTimes(1); - expect(status.level).toEqual(ServiceStatusLevels.degraded); - expect(status.summary).toEqual('Alerting framework is degraded'); - expect(status.meta).toBeUndefined(); - }); -}); diff --git a/x-pack/plugins/alerting/server/health/get_state.ts b/x-pack/plugins/alerting/server/health/get_state.ts deleted file mode 100644 index 34f897ad5b73..000000000000 --- a/x-pack/plugins/alerting/server/health/get_state.ts +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { i18n } from '@kbn/i18n'; -import { defer, of, interval, Observable, throwError, timer } from 'rxjs'; -import { catchError, mergeMap, retryWhen, startWith, switchMap } from 'rxjs/operators'; -import { - Logger, - SavedObjectsServiceStart, - ServiceStatus, - ServiceStatusLevels, -} from '../../../../../src/core/server'; -import { TaskManagerStartContract } from '../../../task_manager/server'; -import { HEALTH_TASK_ID, scheduleAlertingHealthCheck } from './task'; -import { HealthStatus } from '../types'; -import { getAlertingHealthStatus } from './get_health'; -import { AlertsConfig } from '../config'; - -export const MAX_RETRY_ATTEMPTS = 3; -const HEALTH_STATUS_INTERVAL = 60000 * 5; // Five minutes -const RETRY_DELAY = 5000; // Wait 5 seconds before retrying on errors - -async function getLatestTaskState( - taskManager: TaskManagerStartContract, - logger: Logger, - savedObjects: SavedObjectsServiceStart, - config: Promise -) { - try { - return await taskManager.get(HEALTH_TASK_ID); - } catch (err) { - // if task is not found - if (err?.output?.statusCode === 404) { - await scheduleAlertingHealthCheck(logger, config, taskManager); - return await getAlertingHealthStatus(savedObjects); - } - throw err; - } -} - -const LEVEL_SUMMARY = { - [ServiceStatusLevels.available.toString()]: i18n.translate( - 'xpack.alerting.server.healthStatus.available', - { - defaultMessage: 'Alerting framework is available', - } - ), - [ServiceStatusLevels.degraded.toString()]: i18n.translate( - 'xpack.alerting.server.healthStatus.degraded', - { - defaultMessage: 'Alerting framework is degraded', - } - ), - [ServiceStatusLevels.unavailable.toString()]: i18n.translate( - 'xpack.alerting.server.healthStatus.unavailable', - { - defaultMessage: 'Alerting framework is unavailable', - } - ), -}; - -const getHealthServiceStatus = async ( - taskManager: TaskManagerStartContract, - logger: Logger, - savedObjects: SavedObjectsServiceStart, - config: Promise -): Promise> => { - const doc = await getLatestTaskState(taskManager, logger, savedObjects, config); - const level = - doc.state?.health_status === HealthStatus.OK - ? ServiceStatusLevels.available - : ServiceStatusLevels.degraded; - return { - level, - summary: LEVEL_SUMMARY[level.toString()], - }; -}; - -export const getHealthServiceStatusWithRetryAndErrorHandling = ( - taskManager: TaskManagerStartContract, - logger: Logger, - savedObjects: SavedObjectsServiceStart, - config: Promise, - retryDelay?: number -): Observable> => { - return defer(() => getHealthServiceStatus(taskManager, logger, savedObjects, config)).pipe( - retryWhen((errors) => { - return errors.pipe( - mergeMap((error, i) => { - const retryAttempt = i + 1; - if (retryAttempt > MAX_RETRY_ATTEMPTS) { - return throwError(error); - } - return timer(retryDelay ?? RETRY_DELAY); - }) - ); - }), - catchError((error) => { - logger.warn(`Alerting framework is degraded due to the error: ${error}`); - return of({ - level: ServiceStatusLevels.degraded, - summary: LEVEL_SUMMARY[ServiceStatusLevels.degraded.toString()], - meta: { error }, - }); - }) - ); -}; - -export const getHealthStatusStream = ( - taskManager: TaskManagerStartContract, - logger: Logger, - savedObjects: SavedObjectsServiceStart, - config: Promise, - healthStatusInterval?: number, - retryDelay?: number -): Observable> => - interval(healthStatusInterval ?? HEALTH_STATUS_INTERVAL).pipe( - // Emit an initial check - startWith( - getHealthServiceStatusWithRetryAndErrorHandling( - taskManager, - logger, - savedObjects, - config, - retryDelay - ) - ), - // On each interval do a new check - switchMap(() => - getHealthServiceStatusWithRetryAndErrorHandling( - taskManager, - logger, - savedObjects, - config, - retryDelay - ) - ) - ); diff --git a/x-pack/plugins/alerting/server/health/index.ts b/x-pack/plugins/alerting/server/health/index.ts index 8ac0e7be6867..f7f8e15b6f36 100644 --- a/x-pack/plugins/alerting/server/health/index.ts +++ b/x-pack/plugins/alerting/server/health/index.ts @@ -5,5 +5,4 @@ * 2.0. */ -export { getHealthStatusStream } from './get_state'; export { scheduleAlertingHealthCheck, initializeAlertingHealth } from './task'; diff --git a/x-pack/plugins/alerting/server/lib/get_security_health.test.ts b/x-pack/plugins/alerting/server/lib/get_security_health.test.ts new file mode 100644 index 000000000000..1253e0c3379b --- /dev/null +++ b/x-pack/plugins/alerting/server/lib/get_security_health.test.ts @@ -0,0 +1,84 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { getSecurityHealth } from './get_security_health'; + +const createDependencies = ( + isSecurityEnabled: boolean | null, + canEncrypt: boolean, + apiKeysEnabled: boolean +) => { + const isEsSecurityEnabled = async () => isSecurityEnabled; + const isAbleToEncrypt = async () => canEncrypt; + const areApikeysEnabled = async () => apiKeysEnabled; + + const deps: [() => Promise, () => Promise, () => Promise] = [ + isEsSecurityEnabled, + isAbleToEncrypt, + areApikeysEnabled, + ]; + + return deps; +}; + +describe('Get security health', () => { + describe('Correctly returns the overall security health', () => { + test('When ES security enabled status cannot be determined', async () => { + const deps = createDependencies(null, true, true); + const securityHealth = await getSecurityHealth(...deps); + expect(securityHealth).toEqual({ + isSufficientlySecure: false, + hasPermanentEncryptionKey: true, + }); + }); + + test('When ES security is disabled', async () => { + const deps = createDependencies(false, true, true); + const securityHealth = await getSecurityHealth(...deps); + expect(securityHealth).toEqual({ + isSufficientlySecure: true, + hasPermanentEncryptionKey: true, + }); + }); + + test('When ES security is enabled, and API keys are disabled', async () => { + const deps = createDependencies(true, true, false); + const securityHealth = await getSecurityHealth(...deps); + expect(securityHealth).toEqual({ + isSufficientlySecure: false, + hasPermanentEncryptionKey: true, + }); + }); + + test('When ES security is enabled, and API keys are enabled', async () => { + const deps = createDependencies(true, true, true); + const securityHealth = await getSecurityHealth(...deps); + expect(securityHealth).toEqual({ + isSufficientlySecure: true, + hasPermanentEncryptionKey: true, + }); + }); + + test('With encryption enabled', async () => { + const deps = createDependencies(true, true, true); + const securityHealth = await getSecurityHealth(...deps); + expect(securityHealth).toEqual({ + isSufficientlySecure: true, + hasPermanentEncryptionKey: true, + }); + }); + + test('With encryption disabled', async () => { + const deps = createDependencies(true, false, true); + const securityHealth = await getSecurityHealth(...deps); + expect(securityHealth).toEqual({ + isSufficientlySecure: true, + hasPermanentEncryptionKey: false, + }); + }); + }); +}); diff --git a/x-pack/plugins/alerting/server/lib/get_security_health.ts b/x-pack/plugins/alerting/server/lib/get_security_health.ts new file mode 100644 index 000000000000..1a2097221433 --- /dev/null +++ b/x-pack/plugins/alerting/server/lib/get_security_health.ts @@ -0,0 +1,38 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export interface SecurityHealth { + isSufficientlySecure: boolean; + hasPermanentEncryptionKey: boolean; +} + +export const getSecurityHealth = async ( + isEsSecurityEnabled: () => Promise, + isAbleToEncrypt: () => Promise, + areApiKeysEnabled: () => Promise +) => { + const esSecurityIsEnabled = await isEsSecurityEnabled(); + const apiKeysAreEnabled = await areApiKeysEnabled(); + const ableToEncrypt = await isAbleToEncrypt(); + + let isSufficientlySecure: boolean; + + if (esSecurityIsEnabled === null) { + isSufficientlySecure = false; + } else { + // if esSecurityIsEnabled = true, then areApiKeysEnabled must be true to enable alerting + // if esSecurityIsEnabled = false, then it does not matter what areApiKeysEnabled is + isSufficientlySecure = !esSecurityIsEnabled || (esSecurityIsEnabled && apiKeysAreEnabled); + } + + const securityHealth: SecurityHealth = { + isSufficientlySecure, + hasPermanentEncryptionKey: ableToEncrypt, + }; + + return securityHealth; +}; diff --git a/x-pack/plugins/alerting/server/mocks.ts b/x-pack/plugins/alerting/server/mocks.ts index 639ba166e00a..7fb748a30503 100644 --- a/x-pack/plugins/alerting/server/mocks.ts +++ b/x-pack/plugins/alerting/server/mocks.ts @@ -19,6 +19,7 @@ export { rulesClientMock }; const createSetupMock = () => { const mock: jest.Mocked = { registerType: jest.fn(), + getSecurityHealth: jest.fn(), }; return mock; }; diff --git a/x-pack/plugins/alerting/server/plugin.ts b/x-pack/plugins/alerting/server/plugin.ts index f0703defbca3..bd3eab19d220 100644 --- a/x-pack/plugins/alerting/server/plugin.ts +++ b/x-pack/plugins/alerting/server/plugin.ts @@ -65,6 +65,7 @@ import { AlertsConfig } from './config'; import { getHealth } from './health/get_health'; import { AlertingAuthorizationClientFactory } from './alerting_authorization_client_factory'; import { AlertingAuthorization } from './authorization'; +import { getSecurityHealth, SecurityHealth } from './lib/get_security_health'; export const EVENT_LOG_PROVIDER = 'alerting'; export const EVENT_LOG_ACTIONS = { @@ -99,6 +100,7 @@ export interface PluginSetupContract { RecoveryActionGroupId > ): void; + getSecurityHealth: () => Promise; } export interface PluginStartContract { @@ -242,29 +244,6 @@ export class AlertingPlugin { }); core.status.set(serviceStatus$); - // core.getStartServices().then(async ([coreStart, startPlugins]) => { - // combineLatest([ - // core.status.derivedStatus$, - // getHealthStatusStream( - // startPlugins.taskManager, - // this.logger, - // coreStart.savedObjects, - // this.config - // ), - // ]) - // .pipe( - // map(([derivedStatus, healthStatus]) => { - // if (healthStatus.level > derivedStatus.level) { - // return healthStatus as ServiceStatus; - // } else { - // return derivedStatus; - // } - // }), - // share() - // ) - // .subscribe(serviceStatus$); - // }); - initializeAlertingHealth(this.logger, plugins.taskManager, core.getStartServices()); core.http.registerRouteHandlerContext( @@ -315,6 +294,16 @@ export class AlertingPlugin { ruleTypeRegistry.register(alertType); } }, + getSecurityHealth: async () => { + return await getSecurityHealth( + async () => (this.licenseState ? this.licenseState.getIsSecurityEnabled() : null), + async () => plugins.encryptedSavedObjects.canEncrypt, + async () => { + const [, { security }] = await core.getStartServices(); + return security?.authc.apiKeys.areAPIKeysEnabled() ?? false; + } + ); + }, }; } diff --git a/x-pack/plugins/alerting/server/routes/health.ts b/x-pack/plugins/alerting/server/routes/health.ts index fa09213dada3..4f3ed2b54261 100644 --- a/x-pack/plugins/alerting/server/routes/health.ts +++ b/x-pack/plugins/alerting/server/routes/health.ts @@ -14,6 +14,7 @@ import { BASE_ALERTING_API_PATH, AlertingFrameworkHealth, } from '../types'; +import { getSecurityHealth } from '../lib/get_security_health'; const rewriteBodyRes: RewriteResponseCase = ({ isSufficientlySecure, @@ -44,23 +45,16 @@ export const healthRoute = ( router.handleLegacyErrors( verifyAccessAndContext(licenseState, async function (context, req, res) { try { - const isEsSecurityEnabled: boolean | null = licenseState.getIsSecurityEnabled(); - const areApiKeysEnabled = await context.alerting.areApiKeysEnabled(); const alertingFrameworkHeath = await context.alerting.getFrameworkHealth(); - let isSufficientlySecure; - if (isEsSecurityEnabled === null) { - isSufficientlySecure = false; - } else { - // if isEsSecurityEnabled = true, then areApiKeysEnabled must be true to enable alerting - // if isEsSecurityEnabled = false, then it does not matter what areApiKeysEnabled is - isSufficientlySecure = - !isEsSecurityEnabled || (isEsSecurityEnabled && areApiKeysEnabled); - } + const securityHealth = await getSecurityHealth( + async () => (licenseState ? licenseState.getIsSecurityEnabled() : null), + async () => encryptedSavedObjects.canEncrypt, + context.alerting.areApiKeysEnabled + ); const frameworkHealth: AlertingFrameworkHealth = { - isSufficientlySecure, - hasPermanentEncryptionKey: encryptedSavedObjects.canEncrypt, + ...securityHealth, alertingFrameworkHeath, }; diff --git a/x-pack/plugins/alerting/server/routes/legacy/health.ts b/x-pack/plugins/alerting/server/routes/legacy/health.ts index 8c654f103ea8..abea724b63c6 100644 --- a/x-pack/plugins/alerting/server/routes/legacy/health.ts +++ b/x-pack/plugins/alerting/server/routes/legacy/health.ts @@ -12,6 +12,7 @@ import { verifyApiAccess } from '../../lib/license_api_access'; import { AlertingFrameworkHealth } from '../../types'; import { EncryptedSavedObjectsPluginSetup } from '../../../../encrypted_saved_objects/server'; import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; +import { getSecurityHealth } from '../../lib/get_security_health'; export function healthRoute( router: AlertingRouter, @@ -31,22 +32,16 @@ export function healthRoute( } trackLegacyRouteUsage('health', usageCounter); try { - const isEsSecurityEnabled: boolean | null = licenseState.getIsSecurityEnabled(); const alertingFrameworkHeath = await context.alerting.getFrameworkHealth(); - const areApiKeysEnabled = await context.alerting.areApiKeysEnabled(); - let isSufficientlySecure; - if (isEsSecurityEnabled === null) { - isSufficientlySecure = false; - } else { - // if isEsSecurityEnabled = true, then areApiKeysEnabled must be true to enable alerting - // if isEsSecurityEnabled = false, then it does not matter what areApiKeysEnabled is - isSufficientlySecure = !isEsSecurityEnabled || (isEsSecurityEnabled && areApiKeysEnabled); - } + const securityHealth = await getSecurityHealth( + async () => (licenseState ? licenseState.getIsSecurityEnabled() : null), + async () => encryptedSavedObjects.canEncrypt, + context.alerting.areApiKeysEnabled + ); const frameworkHealth: AlertingFrameworkHealth = { - isSufficientlySecure, - hasPermanentEncryptionKey: encryptedSavedObjects.canEncrypt, + ...securityHealth, alertingFrameworkHeath, }; diff --git a/x-pack/plugins/alerting/server/rules_client/rules_client.ts b/x-pack/plugins/alerting/server/rules_client/rules_client.ts index d8a42aa78d91..e10af37e0936 100644 --- a/x-pack/plugins/alerting/server/rules_client/rules_client.ts +++ b/x-pack/plugins/alerting/server/rules_client/rules_client.ts @@ -377,10 +377,11 @@ export class RulesClient { if (data.enabled) { let scheduledTask; try { - scheduledTask = await this.scheduleAlert( + scheduledTask = await this.scheduleRule( createdAlert.id, rawAlert.alertTypeId, - data.schedule + data.schedule, + true ); } catch (e) { // Cleanup data, something went wrong scheduling the task @@ -1149,10 +1150,11 @@ export class RulesClient { ); throw e; } - const scheduledTask = await this.scheduleAlert( + const scheduledTask = await this.scheduleRule( id, attributes.alertTypeId, - attributes.schedule as IntervalSchedule + attributes.schedule as IntervalSchedule, + false ); await this.unsecuredSavedObjectsClient.update('alert', id, { scheduledTaskId: scheduledTask.id, @@ -1563,9 +1565,15 @@ export class RulesClient { return this.spaceId; } - private async scheduleAlert(id: string, alertTypeId: string, schedule: IntervalSchedule) { - return await this.taskManager.schedule({ - taskType: `alerting:${alertTypeId}`, + private async scheduleRule( + id: string, + ruleTypeId: string, + schedule: IntervalSchedule, + throwOnConflict: boolean // whether to throw conflict errors or swallow them + ) { + const taskInstance = { + id, // use the same ID for task document as the rule + taskType: `alerting:${ruleTypeId}`, schedule, params: { alertId: id, @@ -1577,7 +1585,15 @@ export class RulesClient { alertInstances: {}, }, scope: ['alerting'], - }); + }; + try { + return await this.taskManager.schedule(taskInstance); + } catch (err) { + if (err.statusCode === 409 && !throwOnConflict) { + return taskInstance; + } + throw err; + } } private injectReferencesIntoActions( diff --git a/x-pack/plugins/alerting/server/rules_client/tests/create.test.ts b/x-pack/plugins/alerting/server/rules_client/tests/create.test.ts index fc8f272702e0..aa8ecfd73bb6 100644 --- a/x-pack/plugins/alerting/server/rules_client/tests/create.test.ts +++ b/x-pack/plugins/alerting/server/rules_client/tests/create.test.ts @@ -441,6 +441,7 @@ describe('create()', () => { expect(taskManager.schedule.mock.calls[0]).toMatchInlineSnapshot(` Array [ Object { + "id": "1", "params": Object { "alertId": "1", "spaceId": "default", @@ -1923,6 +1924,52 @@ describe('create()', () => { }); }); + test('fails if task scheduling fails due to conflict', async () => { + const data = getMockData(); + unsecuredSavedObjectsClient.create.mockResolvedValueOnce({ + id: '1', + type: 'alert', + attributes: { + alertTypeId: '123', + schedule: { interval: '10s' }, + params: { + bar: true, + }, + actions: [ + { + group: 'default', + actionRef: 'action_0', + actionTypeId: 'test', + params: { + foo: true, + }, + }, + ], + }, + references: [ + { + name: 'action_0', + type: 'action', + id: '1', + }, + ], + }); + taskManager.schedule.mockRejectedValueOnce( + Object.assign(new Error('Conflict!'), { statusCode: 409 }) + ); + unsecuredSavedObjectsClient.delete.mockResolvedValueOnce({}); + await expect(rulesClient.create({ data })).rejects.toThrowErrorMatchingInlineSnapshot( + `"Conflict!"` + ); + expect(unsecuredSavedObjectsClient.delete).toHaveBeenCalledTimes(1); + expect(unsecuredSavedObjectsClient.delete.mock.calls[0]).toMatchInlineSnapshot(` + Array [ + "alert", + "1", + ] + `); + }); + test('attempts to remove saved object if scheduling failed', async () => { const data = getMockData(); unsecuredSavedObjectsClient.create.mockResolvedValueOnce({ diff --git a/x-pack/plugins/alerting/server/rules_client/tests/enable.test.ts b/x-pack/plugins/alerting/server/rules_client/tests/enable.test.ts index 5e3f148c2fc1..afa7db98cab0 100644 --- a/x-pack/plugins/alerting/server/rules_client/tests/enable.test.ts +++ b/x-pack/plugins/alerting/server/rules_client/tests/enable.test.ts @@ -98,7 +98,7 @@ describe('enable()', () => { }, }); taskManager.schedule.mockResolvedValue({ - id: 'task-123', + id: '1', scheduledAt: new Date(), attempts: 0, status: TaskStatus.Idle, @@ -113,27 +113,6 @@ describe('enable()', () => { }); describe('authorization', () => { - beforeEach(() => { - encryptedSavedObjects.getDecryptedAsInternalUser.mockResolvedValue(existingAlert); - unsecuredSavedObjectsClient.get.mockResolvedValue(existingAlert); - rulesClientParams.createAPIKey.mockResolvedValue({ - apiKeysEnabled: false, - }); - taskManager.schedule.mockResolvedValue({ - id: 'task-123', - scheduledAt: new Date(), - attempts: 0, - status: TaskStatus.Idle, - runAt: new Date(), - state: {}, - params: {}, - taskType: '', - startedAt: null, - retryAt: null, - ownerId: null, - }); - }); - test('ensures user is authorised to enable this type of alert under the consumer', async () => { await rulesClient.enable({ id: '1' }); @@ -203,7 +182,7 @@ describe('enable()', () => { }); }); - test('enables an alert', async () => { + test('enables a rule', async () => { const createdAt = new Date().toISOString(); unsecuredSavedObjectsClient.create.mockResolvedValueOnce({ ...existingAlert, @@ -270,6 +249,7 @@ describe('enable()', () => { } ); expect(taskManager.schedule).toHaveBeenCalledWith({ + id: '1', taskType: `alerting:myType`, params: { alertId: '1', @@ -286,7 +266,7 @@ describe('enable()', () => { scope: ['alerting'], }); expect(unsecuredSavedObjectsClient.update).toHaveBeenCalledWith('alert', '1', { - scheduledTaskId: 'task-123', + scheduledTaskId: '1', }); }); @@ -477,4 +457,95 @@ describe('enable()', () => { expect(rulesClientParams.createAPIKey).toHaveBeenCalled(); expect(unsecuredSavedObjectsClient.update).toHaveBeenCalled(); }); + + test('enables a rule if conflict errors received when scheduling a task', async () => { + const createdAt = new Date().toISOString(); + unsecuredSavedObjectsClient.create.mockResolvedValueOnce({ + ...existingAlert, + attributes: { + ...existingAlert.attributes, + enabled: true, + apiKey: null, + apiKeyOwner: null, + updatedBy: 'elastic', + }, + }); + unsecuredSavedObjectsClient.create.mockResolvedValueOnce({ + id: '1', + type: 'api_key_pending_invalidation', + attributes: { + apiKeyId: '123', + createdAt, + }, + references: [], + }); + taskManager.schedule.mockRejectedValueOnce( + Object.assign(new Error('Conflict!'), { statusCode: 409 }) + ); + + await rulesClient.enable({ id: '1' }); + expect(unsecuredSavedObjectsClient.get).not.toHaveBeenCalled(); + expect(encryptedSavedObjects.getDecryptedAsInternalUser).toHaveBeenCalledWith('alert', '1', { + namespace: 'default', + }); + expect(unsecuredSavedObjectsClient.create).not.toBeCalledWith('api_key_pending_invalidation'); + expect(rulesClientParams.createAPIKey).toHaveBeenCalled(); + expect(unsecuredSavedObjectsClient.update).toHaveBeenCalledWith( + 'alert', + '1', + { + schedule: { interval: '10s' }, + alertTypeId: 'myType', + consumer: 'myApp', + enabled: true, + meta: { + versionApiKeyLastmodified: kibanaVersion, + }, + updatedAt: '2019-02-12T21:01:22.479Z', + updatedBy: 'elastic', + apiKey: null, + apiKeyOwner: null, + actions: [ + { + group: 'default', + id: '1', + actionTypeId: '1', + actionRef: '1', + params: { + foo: true, + }, + }, + ], + executionStatus: { + status: 'pending', + lastDuration: 0, + lastExecutionDate: '2019-02-12T21:01:22.479Z', + error: null, + }, + }, + { + version: '123', + } + ); + expect(taskManager.schedule).toHaveBeenCalledWith({ + id: '1', + taskType: `alerting:myType`, + params: { + alertId: '1', + spaceId: 'default', + }, + schedule: { + interval: '10s', + }, + state: { + alertInstances: {}, + alertTypeState: {}, + previousStartedAt: null, + }, + scope: ['alerting'], + }); + expect(unsecuredSavedObjectsClient.update).toHaveBeenCalledWith('alert', '1', { + scheduledTaskId: '1', + }); + }); }); diff --git a/x-pack/plugins/apm/common/anomaly_detection/apm_ml_anomaly_query.ts b/x-pack/plugins/apm/common/anomaly_detection/apm_ml_anomaly_query.ts new file mode 100644 index 000000000000..00fb4b5ee4a5 --- /dev/null +++ b/x-pack/plugins/apm/common/anomaly_detection/apm_ml_anomaly_query.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { ApmMlDetectorIndex } from './apm_ml_detectors'; + +export function apmMlAnomalyQuery(detectorIndex: ApmMlDetectorIndex) { + return [ + { + bool: { + filter: [ + { + terms: { + result_type: ['model_plot', 'record'], + }, + }, + { + term: { detector_index: detectorIndex }, + }, + ], + }, + }, + ]; +} diff --git a/x-pack/plugins/reporting/public/utils.ts b/x-pack/plugins/apm/common/anomaly_detection/apm_ml_detectors.ts similarity index 57% rename from x-pack/plugins/reporting/public/utils.ts rename to x-pack/plugins/apm/common/anomaly_detection/apm_ml_detectors.ts index f39c7ef2174e..7c6823212240 100644 --- a/x-pack/plugins/reporting/public/utils.ts +++ b/x-pack/plugins/apm/common/anomaly_detection/apm_ml_detectors.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { REACT_ROUTER_REDIRECT_APP_PATH } from './constants'; - -export const isRedirectAppPath = (pathname: string) => { - return pathname.startsWith(REACT_ROUTER_REDIRECT_APP_PATH); -}; +export const enum ApmMlDetectorIndex { + txLatency = 0, + txThroughput = 1, + txFailureRate = 2, +} diff --git a/x-pack/plugins/apm/common/anomaly_detection.ts b/x-pack/plugins/apm/common/anomaly_detection/index.ts similarity index 93% rename from x-pack/plugins/apm/common/anomaly_detection.ts rename to x-pack/plugins/apm/common/anomaly_detection/index.ts index 43a779407d2a..cdb1c62b9eed 100644 --- a/x-pack/plugins/apm/common/anomaly_detection.ts +++ b/x-pack/plugins/apm/common/anomaly_detection/index.ts @@ -6,12 +6,12 @@ */ import { i18n } from '@kbn/i18n'; -import { ANOMALY_SEVERITY } from './ml_constants'; +import { ANOMALY_SEVERITY } from '../ml_constants'; import { getSeverityType, getSeverityColor as mlGetSeverityColor, -} from '../../ml/common'; -import { ServiceHealthStatus } from './service_health_status'; +} from '../../../ml/common'; +import { ServiceHealthStatus } from '../service_health_status'; export interface ServiceAnomalyStats { transactionType?: string; diff --git a/x-pack/plugins/apm/dev_docs/routing_and_linking.md b/x-pack/plugins/apm/dev_docs/routing_and_linking.md index 1f6160a6c4a9..562af3d01ef7 100644 --- a/x-pack/plugins/apm/dev_docs/routing_and_linking.md +++ b/x-pack/plugins/apm/dev_docs/routing_and_linking.md @@ -6,7 +6,7 @@ This document describes routing in the APM plugin. ### Server-side -Route definitions for APM's server-side API are in the [server/routes directory](../server/routes). Routes are created with [the `createApmServerRoute` function](../server/routes/create_apm_server_route.ts). Routes are added to the API in [the `registerRoutes` function](../server/routes/register_routes.ts), which is initialized in the plugin `setup` lifecycle method. +Route definitions for APM's server-side API are in the [server/routes directory](../server/routes). Routes are created with [the `createApmServerRoute` function](../server/routes/apm_routes/create_apm_server_route.ts). Routes are added to the API in [the `registerRoutes` function](../server/routes/apm_routes/register_apm_server_routes.ts), which is initialized in the plugin `setup` lifecycle method. The path and query string parameters are defined in the calls to `createApmServerRoute` with io-ts types, so that each route has its parameters type checked. diff --git a/x-pack/plugins/apm/ftr_e2e/cypress/integration/read_only_user/errors/error_details.spec.ts b/x-pack/plugins/apm/ftr_e2e/cypress/integration/read_only_user/errors/error_details.spec.ts new file mode 100644 index 000000000000..f3d3d75cad00 --- /dev/null +++ b/x-pack/plugins/apm/ftr_e2e/cypress/integration/read_only_user/errors/error_details.spec.ts @@ -0,0 +1,90 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import url from 'url'; +import { synthtrace } from '../../../../synthtrace'; +import { generateData } from './generate_data'; + +const start = '2021-10-10T00:00:00.000Z'; +const end = '2021-10-10T00:15:00.000Z'; +const errorDetailsPageHref = url.format({ + pathname: + '/app/apm/services/opbeans-java/errors/0000000000000000000000000Error%201', + query: { + rangeFrom: start, + rangeTo: end, + }, +}); + +describe('Error details', () => { + beforeEach(() => { + cy.loginAsReadOnlyUser(); + }); + + describe('when data is loaded', () => { + before(async () => { + await synthtrace.index( + generateData({ + from: new Date(start).getTime(), + to: new Date(end).getTime(), + }) + ); + }); + + after(async () => { + await synthtrace.clean(); + }); + + describe('when error has no occurrences', () => { + it('shows empty an message', () => { + cy.visit( + url.format({ + pathname: + '/app/apm/services/opbeans-java/errors/0000000000000000000000000Error%201', + query: { + rangeFrom: start, + rangeTo: end, + kuery: 'service.name: "opbeans-node"', + }, + }) + ); + cy.contains('No data to display'); + }); + }); + + describe('when error has data', () => { + it('shows errors distribution chart', () => { + cy.visit(errorDetailsPageHref); + cy.contains('Error group 00000'); + cy.get('[data-test-subj="errorDistribution"]').contains('Occurrences'); + }); + + it('shows a Stacktrace and Metadata tabs', () => { + cy.visit(errorDetailsPageHref); + cy.contains('button', 'Exception stack trace'); + cy.contains('button', 'Metadata'); + }); + + describe('when clicking on related transaction sample', () => { + it('should redirects to the transaction details page', () => { + cy.visit(errorDetailsPageHref); + cy.contains('Error group 00000'); + cy.contains('a', 'GET /apple 🍎').click(); + cy.url().should('include', 'opbeans-java/transactions/view'); + }); + }); + + describe('when clicking on View x occurences in discover', () => { + it('should redirects the user to discover', () => { + cy.visit(errorDetailsPageHref); + cy.contains('span', 'Discover').click(); + cy.url().should('include', 'app/discover'); + }); + }); + }); + }); +}); diff --git a/x-pack/plugins/apm/ftr_e2e/cypress/integration/read_only_user/service_inventory/service_inventory.spec.ts b/x-pack/plugins/apm/ftr_e2e/cypress/integration/read_only_user/service_inventory/service_inventory.spec.ts index 1122e3c88a31..f74a1d122e42 100644 --- a/x-pack/plugins/apm/ftr_e2e/cypress/integration/read_only_user/service_inventory/service_inventory.spec.ts +++ b/x-pack/plugins/apm/ftr_e2e/cypress/integration/read_only_user/service_inventory/service_inventory.spec.ts @@ -93,11 +93,14 @@ describe('When navigating to the service inventory', () => { cy.wait(aliasNames); }); - // FAILING, @caue.marcondes will be fixing soon - it.skip('when selecting a different time range and clicking the refresh button', () => { + it.skip('when selecting a different time range and clicking the update button', () => { cy.wait(aliasNames); - cy.changeTimeRange('Last 30 days'); + cy.selectAbsoluteTimeRange( + 'Oct 10, 2021 @ 01:00:00.000', + 'Oct 10, 2021 @ 01:30:00.000' + ); + cy.contains('Update').click(); cy.wait(aliasNames); cy.contains('Refresh').click(); diff --git a/x-pack/plugins/apm/ftr_e2e/cypress/support/commands.ts b/x-pack/plugins/apm/ftr_e2e/cypress/support/commands.ts index 519cb0aa31cd..cb66d6db809f 100644 --- a/x-pack/plugins/apm/ftr_e2e/cypress/support/commands.ts +++ b/x-pack/plugins/apm/ftr_e2e/cypress/support/commands.ts @@ -42,6 +42,22 @@ Cypress.Commands.add('changeTimeRange', (value: string) => { cy.contains(value).click(); }); +Cypress.Commands.add( + 'selectAbsoluteTimeRange', + (start: string, end: string) => { + cy.get('[data-test-subj="superDatePickerstartDatePopoverButton"]').click(); + cy.get('[data-test-subj="superDatePickerAbsoluteDateInput"]') + .eq(0) + .clear() + .type(start, { force: true }); + cy.get('[data-test-subj="superDatePickerendDatePopoverButton"]').click(); + cy.get('[data-test-subj="superDatePickerAbsoluteDateInput"]') + .eq(1) + .clear() + .type(end, { force: true }); + } +); + Cypress.Commands.add( 'expectAPIsToHaveBeenCalledWith', ({ diff --git a/x-pack/plugins/apm/ftr_e2e/cypress/support/types.d.ts b/x-pack/plugins/apm/ftr_e2e/cypress/support/types.d.ts index 2d9ef090eef6..413f38be892f 100644 --- a/x-pack/plugins/apm/ftr_e2e/cypress/support/types.d.ts +++ b/x-pack/plugins/apm/ftr_e2e/cypress/support/types.d.ts @@ -11,6 +11,7 @@ declare namespace Cypress { loginAsPowerUser(): void; loginAs(params: { username: string; password: string }): void; changeTimeRange(value: string): void; + selectAbsoluteTimeRange(start: string, end: string): void; expectAPIsToHaveBeenCalledWith(params: { apisIntercepted: string[]; value: string; diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/ClientMetrics/Metrics.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/ClientMetrics/Metrics.tsx index 3a9100a0712a..ded242e2ce55 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/ClientMetrics/Metrics.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/ClientMetrics/Metrics.tsx @@ -55,7 +55,7 @@ export function Metrics() { (callApmApi) => { if (uxQuery) { return callApmApi({ - endpoint: 'GET /api/apm/rum/client-metrics', + endpoint: 'GET /internal/apm/ux/client-metrics', params: { query: { ...uxQuery, diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/ImpactfulMetrics/JSErrors.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/ImpactfulMetrics/JSErrors.tsx index b8bdc36ed4e0..7f481d1c14dc 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/ImpactfulMetrics/JSErrors.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/ImpactfulMetrics/JSErrors.tsx @@ -41,7 +41,7 @@ export function JSErrors() { (callApmApi) => { if (start && end && serviceName) { return callApmApi({ - endpoint: 'GET /api/apm/rum-client/js-errors', + endpoint: 'GET /internal/apm/ux/js-errors', params: { query: { start, diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/PageLoadDistribution/index.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/PageLoadDistribution/index.tsx index f75d0fd093b5..6798fbe90e4d 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/PageLoadDistribution/index.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/PageLoadDistribution/index.tsx @@ -51,7 +51,7 @@ export function PageLoadDistribution() { (callApmApi) => { if (start && end && serviceName) { return callApmApi({ - endpoint: 'GET /api/apm/rum-client/page-load-distribution', + endpoint: 'GET /internal/apm/ux/page-load-distribution', params: { query: { start, diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/PageLoadDistribution/use_breakdowns.ts b/x-pack/plugins/apm/public/components/app/RumDashboard/PageLoadDistribution/use_breakdowns.ts index 0cfa293c8784..ee3acac73211 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/PageLoadDistribution/use_breakdowns.ts +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/PageLoadDistribution/use_breakdowns.ts @@ -24,7 +24,7 @@ export const useBreakdowns = ({ percentileRange, field, value }: Props) => { (callApmApi) => { if (start && end && field && value) { return callApmApi({ - endpoint: 'GET /api/apm/rum-client/page-load-distribution/breakdown', + endpoint: 'GET /internal/apm/ux/page-load-distribution/breakdown', params: { query: { start, diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/PageViewsTrend/index.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/PageViewsTrend/index.tsx index 581260f5931e..16605a83505f 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/PageViewsTrend/index.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/PageViewsTrend/index.tsx @@ -39,7 +39,7 @@ export function PageViewsTrend() { (callApmApi) => { if (start && end && serviceName) { return callApmApi({ - endpoint: 'GET /api/apm/rum-client/page-view-trends', + endpoint: 'GET /internal/apm/ux/page-view-trends', params: { query: { start, diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/Panels/WebApplicationSelect.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/Panels/WebApplicationSelect.tsx index 5b1cca0ec44f..ecba89b2651a 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/Panels/WebApplicationSelect.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/Panels/WebApplicationSelect.tsx @@ -20,7 +20,7 @@ export function WebApplicationSelect() { (callApmApi) => { if (start && end) { return callApmApi({ - endpoint: 'GET /api/apm/rum-client/services', + endpoint: 'GET /internal/apm/ux/services', params: { query: { start, diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/URLFilter/URLSearch/use_url_search.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/URLFilter/URLSearch/use_url_search.tsx index 7b6b093c7036..8228ab4c6e83 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/URLFilter/URLSearch/use_url_search.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/URLFilter/URLSearch/use_url_search.tsx @@ -38,7 +38,7 @@ export const useUrlSearch = ({ popoverIsOpen, query }: Props) => { (callApmApi) => { if (uxQuery && popoverIsOpen) { return callApmApi({ - endpoint: 'GET /api/apm/rum-client/url-search', + endpoint: 'GET /internal/apm/ux/url-search', params: { query: { ...uxQuery, diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/UXMetrics/KeyUXMetrics.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/UXMetrics/KeyUXMetrics.tsx index b8766e8b5ce6..4eaf0dccc322 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/UXMetrics/KeyUXMetrics.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/UXMetrics/KeyUXMetrics.tsx @@ -56,7 +56,7 @@ export function KeyUXMetrics({ data, loading }: Props) { (callApmApi) => { if (uxQuery) { return callApmApi({ - endpoint: 'GET /api/apm/rum-client/long-task-metrics', + endpoint: 'GET /internal/apm/ux/long-task-metrics', params: { query: { ...uxQuery, diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/UXMetrics/index.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/UXMetrics/index.tsx index 673f045ecfb9..ab6843f94ee4 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/UXMetrics/index.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/UXMetrics/index.tsx @@ -34,7 +34,7 @@ export function UXMetrics() { (callApmApi) => { if (uxQuery) { return callApmApi({ - endpoint: 'GET /api/apm/rum-client/web-core-vitals', + endpoint: 'GET /internal/apm/ux/web-core-vitals', params: { query: uxQuery, }, diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdown/index.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdown/index.tsx index f044890a9b64..7a19690a4582 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdown/index.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdown/index.tsx @@ -23,7 +23,7 @@ export function VisitorBreakdown() { if (start && end && serviceName) { return callApmApi({ - endpoint: 'GET /api/apm/rum-client/visitor-breakdown', + endpoint: 'GET /internal/apm/ux/visitor-breakdown', params: { query: { start, diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/ux_overview_fetchers.ts b/x-pack/plugins/apm/public/components/app/RumDashboard/ux_overview_fetchers.ts index 34dd2d53daf8..61310a5c5ad2 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/ux_overview_fetchers.ts +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/ux_overview_fetchers.ts @@ -21,7 +21,7 @@ export const fetchUxOverviewDate = async ({ serviceName, }: FetchDataParams): Promise => { const data = await callApmApi({ - endpoint: 'GET /api/apm/rum-client/web-core-vitals', + endpoint: 'GET /internal/apm/ux/web-core-vitals', signal: null, params: { query: { diff --git a/x-pack/plugins/apm/public/components/app/Settings/schema/confirm_switch_modal.tsx b/x-pack/plugins/apm/public/components/app/Settings/schema/confirm_switch_modal.tsx index a13f31e8a656..1847ea90bd7f 100644 --- a/x-pack/plugins/apm/public/components/app/Settings/schema/confirm_switch_modal.tsx +++ b/x-pack/plugins/apm/public/components/app/Settings/schema/confirm_switch_modal.tsx @@ -58,12 +58,6 @@ export function ConfirmSwitchModal({ }} confirmButtonDisabled={!isConfirmChecked} > -

- {i18n.translate('xpack.apm.settings.schema.confirm.descriptionText', { - defaultMessage: - 'Please note Stack monitoring is not currently supported with Fleet-managed APM.', - })} -

{!hasUnsupportedConfigs && (

{i18n.translate( diff --git a/x-pack/plugins/apm/public/components/app/error_group_details/Distribution/index.tsx b/x-pack/plugins/apm/public/components/app/error_group_details/Distribution/index.tsx index 4c6aa7827809..8aa132bb8559 100644 --- a/x-pack/plugins/apm/public/components/app/error_group_details/Distribution/index.tsx +++ b/x-pack/plugins/apm/public/components/app/error_group_details/Distribution/index.tsx @@ -56,7 +56,7 @@ export function ErrorDistribution({ distribution, title, fetchStatus }: Props) { data: distribution.currentPeriod, color: theme.eui.euiColorVis1, title: i18n.translate('xpack.apm.errorGroup.chart.ocurrences', { - defaultMessage: 'Occurences', + defaultMessage: 'Occurrences', }), }, ...(comparisonEnabled diff --git a/x-pack/plugins/apm/public/components/app/error_group_details/detail_view/index.tsx b/x-pack/plugins/apm/public/components/app/error_group_details/detail_view/index.tsx index d4ffd8ece9d4..5438fce7c488 100644 --- a/x-pack/plugins/apm/public/components/app/error_group_details/detail_view/index.tsx +++ b/x-pack/plugins/apm/public/components/app/error_group_details/detail_view/index.tsx @@ -72,12 +72,14 @@ export function DetailView({ errorGroup, urlParams, kuery }: Props) { const history = useHistory(); const { transaction, error, occurrencesCount } = errorGroup; + const { detailTab, comparisonType, comparisonEnabled } = urlParams; + if (!error) { return null; } const tabs = getTabs(error); - const currentTab = getCurrentTab(tabs, urlParams.detailTab) as ErrorTab; + const currentTab = getCurrentTab(tabs, detailTab) as ErrorTab; const errorUrl = error.error.page?.url || error.url?.full; @@ -139,6 +141,8 @@ export function DetailView({ errorGroup, urlParams, kuery }: Props) { transactionName={transaction.transaction.name} transactionType={transaction.transaction.type} serviceName={transaction.service.name} + comparisonType={comparisonType} + comparisonEnabled={comparisonEnabled} > diff --git a/x-pack/plugins/apm/public/components/app/error_group_details/index.tsx b/x-pack/plugins/apm/public/components/app/error_group_details/index.tsx index f3bd8812dfd3..0765e0dd0106 100644 --- a/x-pack/plugins/apm/public/components/app/error_group_details/index.tsx +++ b/x-pack/plugins/apm/public/components/app/error_group_details/index.tsx @@ -26,6 +26,7 @@ import { useApmRouter } from '../../../hooks/use_apm_router'; import { useErrorGroupDistributionFetcher } from '../../../hooks/use_error_group_distribution_fetcher'; import { useFetcher } from '../../../hooks/use_fetcher'; import { useTimeRange } from '../../../hooks/use_time_range'; +import type { APIReturnType } from '../../../services/rest/createCallApmApi'; import { DetailView } from './detail_view'; import { ErrorDistribution } from './Distribution'; @@ -50,6 +51,15 @@ const Culprit = euiStyled.div` font-family: ${({ theme }) => theme.eui.euiCodeFontFamily}; `; +type ErrorDistributionAPIResponse = + APIReturnType<'GET /internal/apm/services/{serviceName}/errors/distribution'>; + +const emptyState: ErrorDistributionAPIResponse = { + currentPeriod: [], + previousPeriod: [], + bucketSize: 0, +}; + function getShortGroupId(errorGroupId?: string) { if (!errorGroupId) { return NOT_AVAILABLE_LABEL; @@ -210,7 +220,7 @@ export function ErrorGroupDetails() { )} { # ... ) - ELASTIC_APM = {curlyOpen} + ELASTIC_APM = { # Set the required service name. Allowed characters: # a-z, A-Z, 0-9, -, _, and space 'SERVICE_NAME': '', @@ -191,7 +191,7 @@ describe('getCommands', () => { # Set the service environment 'ENVIRONMENT': 'production', - {curlyClose} + } # To send performance metrics, add our tracing middleware: MIDDLEWARE = ( @@ -216,7 +216,7 @@ describe('getCommands', () => { # ... ) - ELASTIC_APM = {curlyOpen} + ELASTIC_APM = { # Set the required service name. Allowed characters: # a-z, A-Z, 0-9, -, _, and space 'SERVICE_NAME': '', @@ -229,7 +229,7 @@ describe('getCommands', () => { # Set the service environment 'ENVIRONMENT': 'production', - {curlyClose} + } # To send performance metrics, add our tracing middleware: MIDDLEWARE = ( @@ -254,7 +254,7 @@ describe('getCommands', () => { # or configure to use ELASTIC_APM in your application's settings from elasticapm.contrib.flask import ElasticAPM - app.config['ELASTIC_APM'] = {curlyOpen} + app.config['ELASTIC_APM'] = { # Set the required service name. Allowed characters: # a-z, A-Z, 0-9, -, _, and space 'SERVICE_NAME': '', @@ -267,7 +267,7 @@ describe('getCommands', () => { # Set the service environment 'ENVIRONMENT': 'production', - {curlyClose} + } apm = ElasticAPM(app)" `); @@ -289,7 +289,7 @@ describe('getCommands', () => { # or configure to use ELASTIC_APM in your application's settings from elasticapm.contrib.flask import ElasticAPM - app.config['ELASTIC_APM'] = {curlyOpen} + app.config['ELASTIC_APM'] = { # Set the required service name. Allowed characters: # a-z, A-Z, 0-9, -, _, and space 'SERVICE_NAME': '', @@ -302,7 +302,7 @@ describe('getCommands', () => { # Set the service environment 'ENVIRONMENT': 'production', - {curlyClose} + } apm = ElasticAPM(app)" `); diff --git a/x-pack/plugins/apm/server/index.ts b/x-pack/plugins/apm/server/index.ts index bd30f9e21268..416a873bac0a 100644 --- a/x-pack/plugins/apm/server/index.ts +++ b/x-pack/plugins/apm/server/index.ts @@ -116,7 +116,7 @@ export type { APMPluginSetup } from './types'; export type { APMServerRouteRepository, APIEndpoint, -} from './routes/get_global_apm_server_route_repository'; +} from './routes/apm_routes/get_global_apm_server_route_repository'; export type { APMRouteHandlerResources } from './routes/typings'; export type { ProcessorEvent } from '../common/processor_event'; diff --git a/x-pack/plugins/apm/server/lib/anomaly_detection/create_anomaly_detection_jobs.ts b/x-pack/plugins/apm/server/lib/anomaly_detection/create_anomaly_detection_jobs.ts index 9d6abad0ff6a..7277a12c2bf1 100644 --- a/x-pack/plugins/apm/server/lib/anomaly_detection/create_anomaly_detection_jobs.ts +++ b/x-pack/plugins/apm/server/lib/anomaly_detection/create_anomaly_detection_jobs.ts @@ -5,21 +5,21 @@ * 2.0. */ +import Boom from '@hapi/boom'; import { Logger } from 'kibana/server'; -import uuid from 'uuid/v4'; import { snakeCase } from 'lodash'; -import Boom from '@hapi/boom'; import moment from 'moment'; +import uuid from 'uuid/v4'; import { ML_ERRORS } from '../../../common/anomaly_detection'; -import { ProcessorEvent } from '../../../common/processor_event'; -import { environmentQuery } from '../../../common/utils/environment_query'; -import { Setup } from '../helpers/setup_request'; import { - TRANSACTION_DURATION, + METRICSET_NAME, PROCESSOR_EVENT, } from '../../../common/elasticsearch_fieldnames'; -import { APM_ML_JOB_GROUP, ML_MODULE_ID_APM_TRANSACTION } from './constants'; +import { ProcessorEvent } from '../../../common/processor_event'; +import { environmentQuery } from '../../../common/utils/environment_query'; import { withApmSpan } from '../../utils/with_apm_span'; +import { Setup } from '../helpers/setup_request'; +import { APM_ML_JOB_GROUP, ML_MODULE_ID_APM_TRANSACTION } from './constants'; import { getAnomalyDetectionJobs } from './get_anomaly_detection_jobs'; export async function createAnomalyDetectionJobs( @@ -92,8 +92,8 @@ async function createAnomalyDetectionJob({ query: { bool: { filter: [ - { term: { [PROCESSOR_EVENT]: ProcessorEvent.transaction } }, - { exists: { field: TRANSACTION_DURATION } }, + { term: { [PROCESSOR_EVENT]: ProcessorEvent.metric } }, + { term: { [METRICSET_NAME]: 'transaction' } }, ...environmentQuery(environment), ], }, @@ -105,7 +105,7 @@ async function createAnomalyDetectionJob({ job_tags: { environment, // identifies this as an APM ML job & facilitates future migrations - apm_ml_version: 2, + apm_ml_version: 3, }, }, }, diff --git a/x-pack/plugins/apm/server/lib/helpers/create_es_client/call_async_with_debug.ts b/x-pack/plugins/apm/server/lib/helpers/create_es_client/call_async_with_debug.ts index fb58357d6843..a9799c0cfb60 100644 --- a/x-pack/plugins/apm/server/lib/helpers/create_es_client/call_async_with_debug.ts +++ b/x-pack/plugins/apm/server/lib/helpers/create_es_client/call_async_with_debug.ts @@ -11,7 +11,7 @@ import chalk from 'chalk'; import { KibanaRequest } from '../../../../../../../src/core/server'; import { RequestStatus } from '../../../../../../../src/plugins/inspector'; import { WrappedElasticsearchClientError } from '../../../../../observability/server'; -import { inspectableEsQueriesMap } from '../../../routes/register_routes'; +import { inspectableEsQueriesMap } from '../../../routes/apm_routes/register_apm_server_routes'; import { getInspectResponse } from '../../../../../observability/server'; function formatObj(obj: Record) { diff --git a/x-pack/plugins/apm/server/lib/service_map/get_service_anomalies.ts b/x-pack/plugins/apm/server/lib/service_map/get_service_anomalies.ts index 2ed1966dcacb..2aa2f5c6eead 100644 --- a/x-pack/plugins/apm/server/lib/service_map/get_service_anomalies.ts +++ b/x-pack/plugins/apm/server/lib/service_map/get_service_anomalies.ts @@ -22,6 +22,8 @@ import { rangeQuery } from '../../../../observability/server'; import { withApmSpan } from '../../utils/with_apm_span'; import { getMlJobsWithAPMGroup } from '../anomaly_detection/get_ml_jobs_with_apm_group'; import { Setup } from '../helpers/setup_request'; +import { apmMlAnomalyQuery } from '../../../common/anomaly_detection/apm_ml_anomaly_query'; +import { ApmMlDetectorIndex } from '../../../common/anomaly_detection/apm_ml_detectors'; export const DEFAULT_ANOMALIES: ServiceAnomaliesResponse = { mlJobIds: [], @@ -56,7 +58,7 @@ export async function getServiceAnomalies({ query: { bool: { filter: [ - { terms: { result_type: ['model_plot', 'record'] } }, + ...apmMlAnomalyQuery(ApmMlDetectorIndex.txLatency), ...rangeQuery( Math.min(end - 30 * 60 * 1000, start), end, diff --git a/x-pack/plugins/apm/server/lib/transactions/get_anomaly_data/fetcher.ts b/x-pack/plugins/apm/server/lib/transactions/get_anomaly_data/fetcher.ts index 2fcbf5842d74..dd723f24abe1 100644 --- a/x-pack/plugins/apm/server/lib/transactions/get_anomaly_data/fetcher.ts +++ b/x-pack/plugins/apm/server/lib/transactions/get_anomaly_data/fetcher.ts @@ -12,6 +12,8 @@ import { rangeQuery } from '../../../../../observability/server'; import { asMutableArray } from '../../../../common/utils/as_mutable_array'; import { withApmSpan } from '../../../utils/with_apm_span'; import { Setup } from '../../helpers/setup_request'; +import { apmMlAnomalyQuery } from '../../../../common/anomaly_detection/apm_ml_anomaly_query'; +import { ApmMlDetectorIndex } from '../../../../common/anomaly_detection/apm_ml_detectors'; export type ESResponse = Exclude< PromiseReturnType, @@ -40,7 +42,7 @@ export function anomalySeriesFetcher({ query: { bool: { filter: [ - { terms: { result_type: ['model_plot', 'record'] } }, + ...apmMlAnomalyQuery(ApmMlDetectorIndex.txLatency), { term: { partition_field_value: serviceName } }, { term: { by_field_value: transactionType } }, ...rangeQuery(start, end, 'timestamp'), diff --git a/x-pack/plugins/apm/server/plugin.ts b/x-pack/plugins/apm/server/plugin.ts index 4e2ee4f37a8e..b273fc867e5a 100644 --- a/x-pack/plugins/apm/server/plugin.ts +++ b/x-pack/plugins/apm/server/plugin.ts @@ -38,8 +38,8 @@ import { APMPluginSetupDependencies, APMPluginStartDependencies, } from './types'; -import { registerRoutes } from './routes/register_routes'; -import { getGlobalApmServerRouteRepository } from './routes/get_global_apm_server_route_repository'; +import { registerRoutes } from './routes/apm_routes/register_apm_server_routes'; +import { getGlobalApmServerRouteRepository } from './routes/apm_routes/get_global_apm_server_route_repository'; import { PROCESSOR_EVENT, SERVICE_ENVIRONMENT, diff --git a/x-pack/plugins/apm/server/routes/alerts/chart_preview.ts b/x-pack/plugins/apm/server/routes/alerts/chart_preview.ts index 23a794bb7976..cae35c7f06a8 100644 --- a/x-pack/plugins/apm/server/routes/alerts/chart_preview.ts +++ b/x-pack/plugins/apm/server/routes/alerts/chart_preview.ts @@ -10,8 +10,8 @@ import { getTransactionDurationChartPreview } from '../../lib/alerts/chart_previ import { getTransactionErrorCountChartPreview } from '../../lib/alerts/chart_preview/get_transaction_error_count'; import { getTransactionErrorRateChartPreview } from '../../lib/alerts/chart_preview/get_transaction_error_rate'; import { setupRequest } from '../../lib/helpers/setup_request'; -import { createApmServerRoute } from '../create_apm_server_route'; -import { createApmServerRouteRepository } from '../create_apm_server_route_repository'; +import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; +import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; import { environmentRt, rangeRt } from '../default_api_types'; const alertParamsRt = t.intersection([ diff --git a/x-pack/plugins/apm/server/routes/create_apm_server_route.ts b/x-pack/plugins/apm/server/routes/apm_routes/create_apm_server_route.ts similarity index 97% rename from x-pack/plugins/apm/server/routes/create_apm_server_route.ts rename to x-pack/plugins/apm/server/routes/apm_routes/create_apm_server_route.ts index 86330a87a8c5..b00b1ad6a1fa 100644 --- a/x-pack/plugins/apm/server/routes/create_apm_server_route.ts +++ b/x-pack/plugins/apm/server/routes/apm_routes/create_apm_server_route.ts @@ -5,7 +5,7 @@ * 2.0. */ import { createServerRouteFactory } from '@kbn/server-route-repository'; -import { APMRouteCreateOptions, APMRouteHandlerResources } from './typings'; +import { APMRouteCreateOptions, APMRouteHandlerResources } from '../typings'; export const createApmServerRoute = createServerRouteFactory< APMRouteHandlerResources, diff --git a/x-pack/plugins/apm/server/routes/create_apm_server_route_repository.ts b/x-pack/plugins/apm/server/routes/apm_routes/create_apm_server_route_repository.ts similarity index 97% rename from x-pack/plugins/apm/server/routes/create_apm_server_route_repository.ts rename to x-pack/plugins/apm/server/routes/apm_routes/create_apm_server_route_repository.ts index b7cbe890c57d..43a5c2e33c9f 100644 --- a/x-pack/plugins/apm/server/routes/create_apm_server_route_repository.ts +++ b/x-pack/plugins/apm/server/routes/apm_routes/create_apm_server_route_repository.ts @@ -5,7 +5,7 @@ * 2.0. */ import { createServerRouteRepository } from '@kbn/server-route-repository'; -import { APMRouteCreateOptions, APMRouteHandlerResources } from './typings'; +import { APMRouteCreateOptions, APMRouteHandlerResources } from '../typings'; export function createApmServerRouteRepository() { return createServerRouteRepository< diff --git a/x-pack/plugins/apm/server/routes/get_global_apm_server_route_repository.ts b/x-pack/plugins/apm/server/routes/apm_routes/get_global_apm_server_route_repository.ts similarity index 57% rename from x-pack/plugins/apm/server/routes/get_global_apm_server_route_repository.ts rename to x-pack/plugins/apm/server/routes/apm_routes/get_global_apm_server_route_repository.ts index 0c5be4890ba0..fa8bc1e54ebf 100644 --- a/x-pack/plugins/apm/server/routes/get_global_apm_server_route_repository.ts +++ b/x-pack/plugins/apm/server/routes/apm_routes/get_global_apm_server_route_repository.ts @@ -10,33 +10,33 @@ import type { EndpointOf, } from '@kbn/server-route-repository'; import { PickByValue } from 'utility-types'; -import { alertsChartPreviewRouteRepository } from './alerts/chart_preview'; -import { backendsRouteRepository } from './backends'; -import { correlationsRouteRepository } from './correlations'; -import { createApmServerRouteRepository } from './create_apm_server_route_repository'; -import { environmentsRouteRepository } from './environments'; -import { errorsRouteRepository } from './errors'; -import { apmFleetRouteRepository } from './fleet'; -import { dataViewRouteRepository } from './data_view'; -import { latencyDistributionRouteRepository } from './latency_distribution'; -import { metricsRouteRepository } from './metrics'; -import { observabilityOverviewRouteRepository } from './observability_overview'; -import { rumRouteRepository } from './rum_client'; -import { fallbackToTransactionsRouteRepository } from './fallback_to_transactions'; -import { serviceRouteRepository } from './services'; -import { serviceMapRouteRepository } from './service_map'; -import { serviceNodeRouteRepository } from './service_nodes'; -import { agentConfigurationRouteRepository } from './settings/agent_configuration'; -import { anomalyDetectionRouteRepository } from './settings/anomaly_detection'; -import { apmIndicesRouteRepository } from './settings/apm_indices'; -import { customLinkRouteRepository } from './settings/custom_link'; -import { sourceMapsRouteRepository } from './source_maps'; -import { traceRouteRepository } from './traces'; -import { transactionRouteRepository } from './transactions'; -import { APMRouteHandlerResources } from './typings'; -import { historicalDataRouteRepository } from './historical_data'; -import { eventMetadataRouteRepository } from './event_metadata'; -import { suggestionsRouteRepository } from './suggestions'; +import { correlationsRouteRepository } from '../correlations'; +import { alertsChartPreviewRouteRepository } from '../alerts/chart_preview'; +import { backendsRouteRepository } from '../backends/route'; +import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; +import { environmentsRouteRepository } from '../environments'; +import { errorsRouteRepository } from '../errors'; +import { apmFleetRouteRepository } from '../fleet'; +import { dataViewRouteRepository } from '../data_view'; +import { latencyDistributionRouteRepository } from '../latency_distribution'; +import { metricsRouteRepository } from '../metrics'; +import { observabilityOverviewRouteRepository } from '../observability_overview'; +import { rumRouteRepository } from '../rum_client'; +import { fallbackToTransactionsRouteRepository } from '../fallback_to_transactions'; +import { serviceRouteRepository } from '../services'; +import { serviceMapRouteRepository } from '../service_map'; +import { serviceNodeRouteRepository } from '../service_nodes'; +import { agentConfigurationRouteRepository } from '../settings/agent_configuration'; +import { anomalyDetectionRouteRepository } from '../settings/anomaly_detection'; +import { apmIndicesRouteRepository } from '../settings/apm_indices'; +import { customLinkRouteRepository } from '../settings/custom_link'; +import { sourceMapsRouteRepository } from '../source_maps'; +import { traceRouteRepository } from '../traces'; +import { transactionRouteRepository } from '../transactions'; +import { APMRouteHandlerResources } from '../typings'; +import { historicalDataRouteRepository } from '../historical_data'; +import { eventMetadataRouteRepository } from '../event_metadata'; +import { suggestionsRouteRepository } from '../suggestions'; const getTypedGlobalApmServerRouteRepository = () => { const repository = createApmServerRouteRepository() diff --git a/x-pack/plugins/apm/server/routes/register_routes/index.test.ts b/x-pack/plugins/apm/server/routes/apm_routes/register_apm_server_routes.test.ts similarity index 99% rename from x-pack/plugins/apm/server/routes/register_routes/index.test.ts rename to x-pack/plugins/apm/server/routes/apm_routes/register_apm_server_routes.test.ts index fd554ce1f335..371652cdab95 100644 --- a/x-pack/plugins/apm/server/routes/register_routes/index.test.ts +++ b/x-pack/plugins/apm/server/routes/apm_routes/register_apm_server_routes.test.ts @@ -12,7 +12,7 @@ import * as t from 'io-ts'; import { CoreSetup, Logger } from 'src/core/server'; import { APMConfig } from '../..'; import { APMRouteCreateOptions, APMRouteHandlerResources } from '../typings'; -import { registerRoutes } from './index'; +import { registerRoutes } from './register_apm_server_routes'; type RegisterRouteDependencies = Parameters[0]; diff --git a/x-pack/plugins/apm/server/routes/register_routes/index.ts b/x-pack/plugins/apm/server/routes/apm_routes/register_apm_server_routes.ts similarity index 100% rename from x-pack/plugins/apm/server/routes/register_routes/index.ts rename to x-pack/plugins/apm/server/routes/apm_routes/register_apm_server_routes.ts diff --git a/x-pack/plugins/apm/server/lib/backends/get_error_rate_charts_for_backend.ts b/x-pack/plugins/apm/server/routes/backends/get_error_rate_charts_for_backend.ts similarity index 94% rename from x-pack/plugins/apm/server/lib/backends/get_error_rate_charts_for_backend.ts rename to x-pack/plugins/apm/server/routes/backends/get_error_rate_charts_for_backend.ts index aa20b4b58633..378db134e7cf 100644 --- a/x-pack/plugins/apm/server/lib/backends/get_error_rate_charts_for_backend.ts +++ b/x-pack/plugins/apm/server/routes/backends/get_error_rate_charts_for_backend.ts @@ -13,8 +13,8 @@ import { import { environmentQuery } from '../../../common/utils/environment_query'; import { kqlQuery, rangeQuery } from '../../../../observability/server'; import { ProcessorEvent } from '../../../common/processor_event'; -import { Setup } from '../helpers/setup_request'; -import { getMetricsDateHistogramParams } from '../helpers/metrics'; +import { Setup } from '../../lib/helpers/setup_request'; +import { getMetricsDateHistogramParams } from '../../lib/helpers/metrics'; import { getOffsetInMs } from '../../../common/utils/get_offset_in_ms'; export async function getErrorRateChartsForBackend({ diff --git a/x-pack/plugins/apm/server/lib/backends/get_latency_charts_for_backend.ts b/x-pack/plugins/apm/server/routes/backends/get_latency_charts_for_backend.ts similarity index 94% rename from x-pack/plugins/apm/server/lib/backends/get_latency_charts_for_backend.ts rename to x-pack/plugins/apm/server/routes/backends/get_latency_charts_for_backend.ts index 9ef238fa1314..8f72d83fcc0b 100644 --- a/x-pack/plugins/apm/server/lib/backends/get_latency_charts_for_backend.ts +++ b/x-pack/plugins/apm/server/routes/backends/get_latency_charts_for_backend.ts @@ -13,8 +13,8 @@ import { import { environmentQuery } from '../../../common/utils/environment_query'; import { kqlQuery, rangeQuery } from '../../../../observability/server'; import { ProcessorEvent } from '../../../common/processor_event'; -import { Setup } from '../helpers/setup_request'; -import { getMetricsDateHistogramParams } from '../helpers/metrics'; +import { Setup } from '../../lib/helpers/setup_request'; +import { getMetricsDateHistogramParams } from '../../lib/helpers/metrics'; import { getOffsetInMs } from '../../../common/utils/get_offset_in_ms'; export async function getLatencyChartsForBackend({ diff --git a/x-pack/plugins/apm/server/lib/backends/get_metadata_for_backend.ts b/x-pack/plugins/apm/server/routes/backends/get_metadata_for_backend.ts similarity index 96% rename from x-pack/plugins/apm/server/lib/backends/get_metadata_for_backend.ts rename to x-pack/plugins/apm/server/routes/backends/get_metadata_for_backend.ts index 912014602dd1..1f40b975a8f9 100644 --- a/x-pack/plugins/apm/server/lib/backends/get_metadata_for_backend.ts +++ b/x-pack/plugins/apm/server/routes/backends/get_metadata_for_backend.ts @@ -9,7 +9,7 @@ import { maybe } from '../../../common/utils/maybe'; import { ProcessorEvent } from '../../../common/processor_event'; import { SPAN_DESTINATION_SERVICE_RESOURCE } from '../../../common/elasticsearch_fieldnames'; import { rangeQuery } from '../../../../observability/server'; -import { Setup } from '../helpers/setup_request'; +import { Setup } from '../../lib/helpers/setup_request'; export async function getMetadataForBackend({ setup, diff --git a/x-pack/plugins/apm/server/lib/backends/get_throughput_charts_for_backend.ts b/x-pack/plugins/apm/server/routes/backends/get_throughput_charts_for_backend.ts similarity index 95% rename from x-pack/plugins/apm/server/lib/backends/get_throughput_charts_for_backend.ts rename to x-pack/plugins/apm/server/routes/backends/get_throughput_charts_for_backend.ts index 5a7e06683f25..64fdc3eb264f 100644 --- a/x-pack/plugins/apm/server/lib/backends/get_throughput_charts_for_backend.ts +++ b/x-pack/plugins/apm/server/routes/backends/get_throughput_charts_for_backend.ts @@ -12,9 +12,9 @@ import { import { environmentQuery } from '../../../common/utils/environment_query'; import { kqlQuery, rangeQuery } from '../../../../observability/server'; import { ProcessorEvent } from '../../../common/processor_event'; -import { Setup } from '../helpers/setup_request'; +import { Setup } from '../../lib/helpers/setup_request'; import { getOffsetInMs } from '../../../common/utils/get_offset_in_ms'; -import { getBucketSize } from '../helpers/get_bucket_size'; +import { getBucketSize } from '../../lib/helpers/get_bucket_size'; export async function getThroughputChartsForBackend({ backendName, diff --git a/x-pack/plugins/apm/server/lib/backends/get_top_backends.ts b/x-pack/plugins/apm/server/routes/backends/get_top_backends.ts similarity index 78% rename from x-pack/plugins/apm/server/lib/backends/get_top_backends.ts rename to x-pack/plugins/apm/server/routes/backends/get_top_backends.ts index 15fb58345e5c..725171839666 100644 --- a/x-pack/plugins/apm/server/lib/backends/get_top_backends.ts +++ b/x-pack/plugins/apm/server/routes/backends/get_top_backends.ts @@ -8,9 +8,9 @@ import { kqlQuery } from '../../../../observability/server'; import { NodeType } from '../../../common/connections'; import { environmentQuery } from '../../../common/utils/environment_query'; -import { getConnectionStats } from '../connections/get_connection_stats'; -import { getConnectionStatsItemsWithRelativeImpact } from '../connections/get_connection_stats/get_connection_stats_items_with_relative_impact'; -import { Setup } from '../helpers/setup_request'; +import { getConnectionStats } from '../../lib/connections/get_connection_stats'; +import { getConnectionStatsItemsWithRelativeImpact } from '../../lib/connections/get_connection_stats/get_connection_stats_items_with_relative_impact'; +import { Setup } from '../../lib/helpers/setup_request'; export async function getTopBackends({ setup, diff --git a/x-pack/plugins/apm/server/lib/backends/get_upstream_services_for_backend.ts b/x-pack/plugins/apm/server/routes/backends/get_upstream_services_for_backend.ts similarity index 79% rename from x-pack/plugins/apm/server/lib/backends/get_upstream_services_for_backend.ts rename to x-pack/plugins/apm/server/routes/backends/get_upstream_services_for_backend.ts index adc461f88221..31204c960c87 100644 --- a/x-pack/plugins/apm/server/lib/backends/get_upstream_services_for_backend.ts +++ b/x-pack/plugins/apm/server/routes/backends/get_upstream_services_for_backend.ts @@ -8,9 +8,9 @@ import { kqlQuery } from '../../../../observability/server'; import { SPAN_DESTINATION_SERVICE_RESOURCE } from '../../../common/elasticsearch_fieldnames'; import { environmentQuery } from '../../../common/utils/environment_query'; -import { getConnectionStats } from '../connections/get_connection_stats'; -import { getConnectionStatsItemsWithRelativeImpact } from '../connections/get_connection_stats/get_connection_stats_items_with_relative_impact'; -import { Setup } from '../helpers/setup_request'; +import { getConnectionStats } from '../../lib/connections/get_connection_stats'; +import { getConnectionStatsItemsWithRelativeImpact } from '../../lib/connections/get_connection_stats/get_connection_stats_items_with_relative_impact'; +import { Setup } from '../../lib/helpers/setup_request'; export async function getUpstreamServicesForBackend({ setup, diff --git a/x-pack/plugins/apm/server/routes/backends.ts b/x-pack/plugins/apm/server/routes/backends/route.ts similarity index 89% rename from x-pack/plugins/apm/server/routes/backends.ts rename to x-pack/plugins/apm/server/routes/backends/route.ts index 4dcd8a1db957..58160477994b 100644 --- a/x-pack/plugins/apm/server/routes/backends.ts +++ b/x-pack/plugins/apm/server/routes/backends/route.ts @@ -7,16 +7,21 @@ import * as t from 'io-ts'; import { toNumberRt } from '@kbn/io-ts-utils/to_number_rt'; -import { setupRequest } from '../lib/helpers/setup_request'; -import { environmentRt, kueryRt, offsetRt, rangeRt } from './default_api_types'; -import { createApmServerRoute } from './create_apm_server_route'; -import { createApmServerRouteRepository } from './create_apm_server_route_repository'; -import { getMetadataForBackend } from '../lib/backends/get_metadata_for_backend'; -import { getLatencyChartsForBackend } from '../lib/backends/get_latency_charts_for_backend'; -import { getTopBackends } from '../lib/backends/get_top_backends'; -import { getUpstreamServicesForBackend } from '../lib/backends/get_upstream_services_for_backend'; -import { getThroughputChartsForBackend } from '../lib/backends/get_throughput_charts_for_backend'; -import { getErrorRateChartsForBackend } from '../lib/backends/get_error_rate_charts_for_backend'; +import { setupRequest } from '../../lib/helpers/setup_request'; +import { + environmentRt, + kueryRt, + offsetRt, + rangeRt, +} from '../default_api_types'; +import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; +import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; +import { getMetadataForBackend } from './get_metadata_for_backend'; +import { getLatencyChartsForBackend } from './get_latency_charts_for_backend'; +import { getTopBackends } from './get_top_backends'; +import { getUpstreamServicesForBackend } from './get_upstream_services_for_backend'; +import { getThroughputChartsForBackend } from './get_throughput_charts_for_backend'; +import { getErrorRateChartsForBackend } from './get_error_rate_charts_for_backend'; const topBackendsRoute = createApmServerRoute({ endpoint: 'GET /internal/apm/backends/top_backends', diff --git a/x-pack/plugins/apm/server/routes/correlations.ts b/x-pack/plugins/apm/server/routes/correlations.ts index ac6835fdd647..f6ca064b4385 100644 --- a/x-pack/plugins/apm/server/routes/correlations.ts +++ b/x-pack/plugins/apm/server/routes/correlations.ts @@ -24,8 +24,8 @@ import { fetchFieldsStats } from '../lib/correlations/queries/field_stats/get_fi import { withApmSpan } from '../utils/with_apm_span'; -import { createApmServerRoute } from './create_apm_server_route'; -import { createApmServerRouteRepository } from './create_apm_server_route_repository'; +import { createApmServerRoute } from './apm_routes/create_apm_server_route'; +import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; import { environmentRt, kueryRt, rangeRt } from './default_api_types'; const INVALID_LICENSE = i18n.translate('xpack.apm.correlations.license.text', { diff --git a/x-pack/plugins/apm/server/routes/data_view.ts b/x-pack/plugins/apm/server/routes/data_view.ts index 5b06b51078ec..3590ef9db9bd 100644 --- a/x-pack/plugins/apm/server/routes/data_view.ts +++ b/x-pack/plugins/apm/server/routes/data_view.ts @@ -6,10 +6,10 @@ */ import { createStaticDataView } from '../lib/data_view/create_static_data_view'; -import { createApmServerRouteRepository } from './create_apm_server_route_repository'; +import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; import { setupRequest } from '../lib/helpers/setup_request'; import { getDynamicDataView } from '../lib/data_view/get_dynamic_data_view'; -import { createApmServerRoute } from './create_apm_server_route'; +import { createApmServerRoute } from './apm_routes/create_apm_server_route'; const staticDataViewRoute = createApmServerRoute({ endpoint: 'POST /internal/apm/data_view/static', diff --git a/x-pack/plugins/apm/server/routes/environments.ts b/x-pack/plugins/apm/server/routes/environments.ts index e54ad79f177c..38328a63a411 100644 --- a/x-pack/plugins/apm/server/routes/environments.ts +++ b/x-pack/plugins/apm/server/routes/environments.ts @@ -11,8 +11,8 @@ import { getSearchAggregatedTransactions } from '../lib/helpers/transactions'; import { setupRequest } from '../lib/helpers/setup_request'; import { getEnvironments } from '../lib/environments/get_environments'; import { rangeRt } from './default_api_types'; -import { createApmServerRoute } from './create_apm_server_route'; -import { createApmServerRouteRepository } from './create_apm_server_route_repository'; +import { createApmServerRoute } from './apm_routes/create_apm_server_route'; +import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; const environmentsRoute = createApmServerRoute({ endpoint: 'GET /internal/apm/environments', diff --git a/x-pack/plugins/apm/server/routes/errors.ts b/x-pack/plugins/apm/server/routes/errors.ts index 3a6e07acd14b..02df03f10808 100644 --- a/x-pack/plugins/apm/server/routes/errors.ts +++ b/x-pack/plugins/apm/server/routes/errors.ts @@ -6,7 +6,7 @@ */ import * as t from 'io-ts'; -import { createApmServerRoute } from './create_apm_server_route'; +import { createApmServerRoute } from './apm_routes/create_apm_server_route'; import { getErrorDistribution } from '../lib/errors/distribution/get_distribution'; import { getErrorGroupSample } from '../lib/errors/get_error_group_sample'; import { getErrorGroups } from '../lib/errors/get_error_groups'; @@ -17,7 +17,7 @@ import { rangeRt, comparisonRangeRt, } from './default_api_types'; -import { createApmServerRouteRepository } from './create_apm_server_route_repository'; +import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; const errorsRoute = createApmServerRoute({ endpoint: 'GET /internal/apm/services/{serviceName}/errors', diff --git a/x-pack/plugins/apm/server/routes/event_metadata.ts b/x-pack/plugins/apm/server/routes/event_metadata.ts index 00241d2ef1c6..3a40e445007e 100644 --- a/x-pack/plugins/apm/server/routes/event_metadata.ts +++ b/x-pack/plugins/apm/server/routes/event_metadata.ts @@ -6,8 +6,8 @@ */ import * as t from 'io-ts'; -import { createApmServerRouteRepository } from './create_apm_server_route_repository'; -import { createApmServerRoute } from './create_apm_server_route'; +import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; +import { createApmServerRoute } from './apm_routes/create_apm_server_route'; import { getEventMetadata } from '../lib/event_metadata/get_event_metadata'; import { processorEventRt } from '../../common/processor_event'; import { setupRequest } from '../lib/helpers/setup_request'; diff --git a/x-pack/plugins/apm/server/routes/fallback_to_transactions.ts b/x-pack/plugins/apm/server/routes/fallback_to_transactions.ts index 99c6a290e34b..53e3ebae0d4f 100644 --- a/x-pack/plugins/apm/server/routes/fallback_to_transactions.ts +++ b/x-pack/plugins/apm/server/routes/fallback_to_transactions.ts @@ -8,8 +8,8 @@ import * as t from 'io-ts'; import { getIsUsingTransactionEvents } from '../lib/helpers/transactions/get_is_using_transaction_events'; import { setupRequest } from '../lib/helpers/setup_request'; -import { createApmServerRoute } from './create_apm_server_route'; -import { createApmServerRouteRepository } from './create_apm_server_route_repository'; +import { createApmServerRoute } from './apm_routes/create_apm_server_route'; +import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; import { kueryRt, rangeRt } from './default_api_types'; const fallbackToTransactionsRoute = createApmServerRoute({ diff --git a/x-pack/plugins/apm/server/routes/fleet.ts b/x-pack/plugins/apm/server/routes/fleet.ts index e18aefcd6e0d..a6e0cb09d894 100644 --- a/x-pack/plugins/apm/server/routes/fleet.ts +++ b/x-pack/plugins/apm/server/routes/fleet.ts @@ -24,8 +24,8 @@ import { getUnsupportedApmServerSchema } from '../lib/fleet/get_unsupported_apm_ import { isSuperuser } from '../lib/fleet/is_superuser'; import { getInternalSavedObjectsClient } from '../lib/helpers/get_internal_saved_objects_client'; import { setupRequest } from '../lib/helpers/setup_request'; -import { createApmServerRoute } from './create_apm_server_route'; -import { createApmServerRouteRepository } from './create_apm_server_route_repository'; +import { createApmServerRoute } from './apm_routes/create_apm_server_route'; +import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; const hasFleetDataRoute = createApmServerRoute({ endpoint: 'GET /internal/apm/fleet/has_data', diff --git a/x-pack/plugins/apm/server/routes/historical_data/index.ts b/x-pack/plugins/apm/server/routes/historical_data/index.ts index fb67dc4f5b64..f488669fffa1 100644 --- a/x-pack/plugins/apm/server/routes/historical_data/index.ts +++ b/x-pack/plugins/apm/server/routes/historical_data/index.ts @@ -6,8 +6,8 @@ */ import { setupRequest } from '../../lib/helpers/setup_request'; -import { createApmServerRoute } from '../create_apm_server_route'; -import { createApmServerRouteRepository } from '../create_apm_server_route_repository'; +import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; +import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; import { hasHistoricalAgentData } from './has_historical_agent_data'; const hasDataRoute = createApmServerRoute({ diff --git a/x-pack/plugins/apm/server/routes/latency_distribution.ts b/x-pack/plugins/apm/server/routes/latency_distribution.ts index ba646c0fc92b..826898784835 100644 --- a/x-pack/plugins/apm/server/routes/latency_distribution.ts +++ b/x-pack/plugins/apm/server/routes/latency_distribution.ts @@ -9,8 +9,8 @@ import * as t from 'io-ts'; import { toNumberRt } from '@kbn/io-ts-utils/to_number_rt'; import { getOverallLatencyDistribution } from '../lib/latency/get_overall_latency_distribution'; import { setupRequest } from '../lib/helpers/setup_request'; -import { createApmServerRoute } from './create_apm_server_route'; -import { createApmServerRouteRepository } from './create_apm_server_route_repository'; +import { createApmServerRoute } from './apm_routes/create_apm_server_route'; +import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; import { environmentRt, kueryRt, rangeRt } from './default_api_types'; const latencyOverallDistributionRoute = createApmServerRoute({ diff --git a/x-pack/plugins/apm/server/routes/metrics.ts b/x-pack/plugins/apm/server/routes/metrics.ts index 8b6b16a26f1d..1817c3e1546b 100644 --- a/x-pack/plugins/apm/server/routes/metrics.ts +++ b/x-pack/plugins/apm/server/routes/metrics.ts @@ -8,8 +8,8 @@ import * as t from 'io-ts'; import { setupRequest } from '../lib/helpers/setup_request'; import { getMetricsChartDataByAgent } from '../lib/metrics/get_metrics_chart_data_by_agent'; -import { createApmServerRoute } from './create_apm_server_route'; -import { createApmServerRouteRepository } from './create_apm_server_route_repository'; +import { createApmServerRoute } from './apm_routes/create_apm_server_route'; +import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; import { environmentRt, kueryRt, rangeRt } from './default_api_types'; const metricsChartsRoute = createApmServerRoute({ diff --git a/x-pack/plugins/apm/server/routes/observability_overview.ts b/x-pack/plugins/apm/server/routes/observability_overview.ts index b4fb4804a9bd..2df3212d8da7 100644 --- a/x-pack/plugins/apm/server/routes/observability_overview.ts +++ b/x-pack/plugins/apm/server/routes/observability_overview.ts @@ -14,8 +14,8 @@ import { getHasData } from '../lib/observability_overview/has_data'; import { rangeRt } from './default_api_types'; import { getSearchAggregatedTransactions } from '../lib/helpers/transactions'; import { withApmSpan } from '../utils/with_apm_span'; -import { createApmServerRouteRepository } from './create_apm_server_route_repository'; -import { createApmServerRoute } from './create_apm_server_route'; +import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; +import { createApmServerRoute } from './apm_routes/create_apm_server_route'; const observabilityOverviewHasDataRoute = createApmServerRoute({ endpoint: 'GET /internal/apm/observability_overview/has_data', diff --git a/x-pack/plugins/apm/server/routes/rum_client.ts b/x-pack/plugins/apm/server/routes/rum_client.ts index c465e0e02da1..e84a281a7ce1 100644 --- a/x-pack/plugins/apm/server/routes/rum_client.ts +++ b/x-pack/plugins/apm/server/routes/rum_client.ts @@ -19,8 +19,8 @@ import { getUrlSearch } from '../lib/rum_client/get_url_search'; import { getVisitorBreakdown } from '../lib/rum_client/get_visitor_breakdown'; import { getWebCoreVitals } from '../lib/rum_client/get_web_core_vitals'; import { hasRumData } from '../lib/rum_client/has_rum_data'; -import { createApmServerRoute } from './create_apm_server_route'; -import { createApmServerRouteRepository } from './create_apm_server_route_repository'; +import { createApmServerRoute } from './apm_routes/create_apm_server_route'; +import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; import { rangeRt } from './default_api_types'; import { UxUIFilters } from '../../typings/ui_filters'; import { APMRouteHandlerResources } from '../routes/typings'; @@ -65,7 +65,7 @@ const uxQueryRt = t.intersection([ ]); const rumClientMetricsRoute = createApmServerRoute({ - endpoint: 'GET /api/apm/rum/client-metrics', + endpoint: 'GET /internal/apm/ux/client-metrics', params: t.type({ query: uxQueryRt, }), @@ -88,7 +88,7 @@ const rumClientMetricsRoute = createApmServerRoute({ }); const rumPageLoadDistributionRoute = createApmServerRoute({ - endpoint: 'GET /api/apm/rum-client/page-load-distribution', + endpoint: 'GET /internal/apm/ux/page-load-distribution', params: t.type({ query: t.intersection([uxQueryRt, percentileRangeRt]), }), @@ -114,7 +114,7 @@ const rumPageLoadDistributionRoute = createApmServerRoute({ }); const rumPageLoadDistBreakdownRoute = createApmServerRoute({ - endpoint: 'GET /api/apm/rum-client/page-load-distribution/breakdown', + endpoint: 'GET /internal/apm/ux/page-load-distribution/breakdown', params: t.type({ query: t.intersection([ uxQueryRt, @@ -145,7 +145,7 @@ const rumPageLoadDistBreakdownRoute = createApmServerRoute({ }); const rumPageViewsTrendRoute = createApmServerRoute({ - endpoint: 'GET /api/apm/rum-client/page-view-trends', + endpoint: 'GET /internal/apm/ux/page-view-trends', params: t.type({ query: t.intersection([uxQueryRt, t.partial({ breakdowns: t.string })]), }), @@ -168,7 +168,7 @@ const rumPageViewsTrendRoute = createApmServerRoute({ }); const rumServicesRoute = createApmServerRoute({ - endpoint: 'GET /api/apm/rum-client/services', + endpoint: 'GET /internal/apm/ux/services', params: t.type({ query: t.intersection([uiFiltersRt, rangeRt]), }), @@ -184,7 +184,7 @@ const rumServicesRoute = createApmServerRoute({ }); const rumVisitorsBreakdownRoute = createApmServerRoute({ - endpoint: 'GET /api/apm/rum-client/visitor-breakdown', + endpoint: 'GET /internal/apm/ux/visitor-breakdown', params: t.type({ query: uxQueryRt, }), @@ -206,7 +206,7 @@ const rumVisitorsBreakdownRoute = createApmServerRoute({ }); const rumWebCoreVitals = createApmServerRoute({ - endpoint: 'GET /api/apm/rum-client/web-core-vitals', + endpoint: 'GET /internal/apm/ux/web-core-vitals', params: t.type({ query: uxQueryRt, }), @@ -229,7 +229,7 @@ const rumWebCoreVitals = createApmServerRoute({ }); const rumLongTaskMetrics = createApmServerRoute({ - endpoint: 'GET /api/apm/rum-client/long-task-metrics', + endpoint: 'GET /internal/apm/ux/long-task-metrics', params: t.type({ query: uxQueryRt, }), @@ -252,7 +252,7 @@ const rumLongTaskMetrics = createApmServerRoute({ }); const rumUrlSearch = createApmServerRoute({ - endpoint: 'GET /api/apm/rum-client/url-search', + endpoint: 'GET /internal/apm/ux/url-search', params: t.type({ query: uxQueryRt, }), @@ -275,7 +275,7 @@ const rumUrlSearch = createApmServerRoute({ }); const rumJSErrors = createApmServerRoute({ - endpoint: 'GET /api/apm/rum-client/js-errors', + endpoint: 'GET /internal/apm/ux/js-errors', params: t.type({ query: t.intersection([ uiFiltersRt, diff --git a/x-pack/plugins/apm/server/routes/service_map.ts b/x-pack/plugins/apm/server/routes/service_map.ts index 3711ee20d814..e75b4ec832d8 100644 --- a/x-pack/plugins/apm/server/routes/service_map.ts +++ b/x-pack/plugins/apm/server/routes/service_map.ts @@ -15,8 +15,8 @@ import { setupRequest } from '../lib/helpers/setup_request'; import { getServiceMap } from '../lib/service_map/get_service_map'; import { getServiceMapBackendNodeInfo } from '../lib/service_map/get_service_map_backend_node_info'; import { getServiceMapServiceNodeInfo } from '../lib/service_map/get_service_map_service_node_info'; -import { createApmServerRoute } from './create_apm_server_route'; -import { createApmServerRouteRepository } from './create_apm_server_route_repository'; +import { createApmServerRoute } from './apm_routes/create_apm_server_route'; +import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; import { environmentRt, rangeRt } from './default_api_types'; const serviceMapRoute = createApmServerRoute({ diff --git a/x-pack/plugins/apm/server/routes/service_nodes.ts b/x-pack/plugins/apm/server/routes/service_nodes.ts index 2081b794f8ab..61d58bfa3cf3 100644 --- a/x-pack/plugins/apm/server/routes/service_nodes.ts +++ b/x-pack/plugins/apm/server/routes/service_nodes.ts @@ -6,8 +6,8 @@ */ import * as t from 'io-ts'; -import { createApmServerRouteRepository } from './create_apm_server_route_repository'; -import { createApmServerRoute } from './create_apm_server_route'; +import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; +import { createApmServerRoute } from './apm_routes/create_apm_server_route'; import { setupRequest } from '../lib/helpers/setup_request'; import { getServiceNodes } from '../lib/service_nodes'; import { rangeRt, kueryRt } from './default_api_types'; diff --git a/x-pack/plugins/apm/server/routes/services.ts b/x-pack/plugins/apm/server/routes/services.ts index 60036a9a3da7..cb557f56d816 100644 --- a/x-pack/plugins/apm/server/routes/services.ts +++ b/x-pack/plugins/apm/server/routes/services.ts @@ -34,8 +34,8 @@ import { getServiceProfilingStatistics } from '../lib/services/profiling/get_ser import { getServiceProfilingTimeline } from '../lib/services/profiling/get_service_profiling_timeline'; import { getServiceInfrastructure } from '../lib/services/get_service_infrastructure'; import { withApmSpan } from '../utils/with_apm_span'; -import { createApmServerRoute } from './create_apm_server_route'; -import { createApmServerRouteRepository } from './create_apm_server_route_repository'; +import { createApmServerRoute } from './apm_routes/create_apm_server_route'; +import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; import { comparisonRangeRt, environmentRt, diff --git a/x-pack/plugins/apm/server/routes/settings/agent_configuration.ts b/x-pack/plugins/apm/server/routes/settings/agent_configuration.ts index 5385cd74cd77..563fa40c6c0d 100644 --- a/x-pack/plugins/apm/server/routes/settings/agent_configuration.ts +++ b/x-pack/plugins/apm/server/routes/settings/agent_configuration.ts @@ -17,7 +17,7 @@ import { findExactConfiguration } from '../../lib/settings/agent_configuration/f import { listConfigurations } from '../../lib/settings/agent_configuration/list_configurations'; import { getEnvironments } from '../../lib/settings/agent_configuration/get_environments'; import { deleteConfiguration } from '../../lib/settings/agent_configuration/delete_configuration'; -import { createApmServerRoute } from '../create_apm_server_route'; +import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; import { getAgentNameByService } from '../../lib/settings/agent_configuration/get_agent_name_by_service'; import { markAppliedByAgent } from '../../lib/settings/agent_configuration/mark_applied_by_agent'; import { @@ -25,7 +25,7 @@ import { agentConfigurationIntakeRt, } from '../../../common/agent_configuration/runtime_types/agent_configuration_intake_rt'; import { getSearchAggregatedTransactions } from '../../lib/helpers/transactions'; -import { createApmServerRouteRepository } from '../create_apm_server_route_repository'; +import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; import { syncAgentConfigsToApmPackagePolicies } from '../../lib/fleet/sync_agent_configs_to_apm_package_policies'; // get list of configurations diff --git a/x-pack/plugins/apm/server/routes/settings/anomaly_detection.ts b/x-pack/plugins/apm/server/routes/settings/anomaly_detection.ts index f614f35810c5..e8b2ef5e119c 100644 --- a/x-pack/plugins/apm/server/routes/settings/anomaly_detection.ts +++ b/x-pack/plugins/apm/server/routes/settings/anomaly_detection.ts @@ -10,7 +10,7 @@ import Boom from '@hapi/boom'; import { maxSuggestions } from '../../../../observability/common'; import { isActivePlatinumLicense } from '../../../common/license_check'; import { ML_ERRORS } from '../../../common/anomaly_detection'; -import { createApmServerRoute } from '../create_apm_server_route'; +import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; import { getAnomalyDetectionJobs } from '../../lib/anomaly_detection/get_anomaly_detection_jobs'; import { createAnomalyDetectionJobs } from '../../lib/anomaly_detection/create_anomaly_detection_jobs'; import { setupRequest } from '../../lib/helpers/setup_request'; @@ -19,7 +19,7 @@ import { hasLegacyJobs } from '../../lib/anomaly_detection/has_legacy_jobs'; import { getSearchAggregatedTransactions } from '../../lib/helpers/transactions'; import { notifyFeatureUsage } from '../../feature'; import { withApmSpan } from '../../utils/with_apm_span'; -import { createApmServerRouteRepository } from '../create_apm_server_route_repository'; +import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; // get ML anomaly detection jobs for each environment const anomalyDetectionJobsRoute = createApmServerRoute({ diff --git a/x-pack/plugins/apm/server/routes/settings/apm_indices.ts b/x-pack/plugins/apm/server/routes/settings/apm_indices.ts index 156f4d1af0bb..ed99f0c8862f 100644 --- a/x-pack/plugins/apm/server/routes/settings/apm_indices.ts +++ b/x-pack/plugins/apm/server/routes/settings/apm_indices.ts @@ -6,8 +6,8 @@ */ import * as t from 'io-ts'; -import { createApmServerRouteRepository } from '../create_apm_server_route_repository'; -import { createApmServerRoute } from '../create_apm_server_route'; +import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; +import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; import { getApmIndices, getApmIndexSettings, diff --git a/x-pack/plugins/apm/server/routes/settings/custom_link.ts b/x-pack/plugins/apm/server/routes/settings/custom_link.ts index af880898176b..044b56c3c273 100644 --- a/x-pack/plugins/apm/server/routes/settings/custom_link.ts +++ b/x-pack/plugins/apm/server/routes/settings/custom_link.ts @@ -21,8 +21,8 @@ import { import { deleteCustomLink } from '../../lib/settings/custom_link/delete_custom_link'; import { getTransaction } from '../../lib/settings/custom_link/get_transaction'; import { listCustomLinks } from '../../lib/settings/custom_link/list_custom_links'; -import { createApmServerRoute } from '../create_apm_server_route'; -import { createApmServerRouteRepository } from '../create_apm_server_route_repository'; +import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; +import { createApmServerRouteRepository } from '../apm_routes/create_apm_server_route_repository'; const customLinkTransactionRoute = createApmServerRoute({ endpoint: 'GET /internal/apm/settings/custom_links/transaction', diff --git a/x-pack/plugins/apm/server/routes/source_maps.ts b/x-pack/plugins/apm/server/routes/source_maps.ts index d009b68c6919..602a3a725eac 100644 --- a/x-pack/plugins/apm/server/routes/source_maps.ts +++ b/x-pack/plugins/apm/server/routes/source_maps.ts @@ -16,8 +16,8 @@ import { getCleanedBundleFilePath, } from '../lib/fleet/source_maps'; import { getInternalSavedObjectsClient } from '../lib/helpers/get_internal_saved_objects_client'; -import { createApmServerRoute } from './create_apm_server_route'; -import { createApmServerRouteRepository } from './create_apm_server_route_repository'; +import { createApmServerRoute } from './apm_routes/create_apm_server_route'; +import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; import { stringFromBufferRt } from '../utils/string_from_buffer_rt'; export const sourceMapRt = t.intersection([ diff --git a/x-pack/plugins/apm/server/routes/suggestions.ts b/x-pack/plugins/apm/server/routes/suggestions.ts index 4834d894f364..9b8952d09d16 100644 --- a/x-pack/plugins/apm/server/routes/suggestions.ts +++ b/x-pack/plugins/apm/server/routes/suggestions.ts @@ -10,8 +10,8 @@ import { maxSuggestions } from '../../../observability/common'; import { getSuggestions } from '../lib/suggestions/get_suggestions'; import { getSearchAggregatedTransactions } from '../lib/helpers/transactions'; import { setupRequest } from '../lib/helpers/setup_request'; -import { createApmServerRoute } from './create_apm_server_route'; -import { createApmServerRouteRepository } from './create_apm_server_route_repository'; +import { createApmServerRoute } from './apm_routes/create_apm_server_route'; +import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; const suggestionsRoute = createApmServerRoute({ endpoint: 'GET /internal/apm/suggestions', diff --git a/x-pack/plugins/apm/server/routes/traces.ts b/x-pack/plugins/apm/server/routes/traces.ts index cc800c348b16..5fdac470a81e 100644 --- a/x-pack/plugins/apm/server/routes/traces.ts +++ b/x-pack/plugins/apm/server/routes/traces.ts @@ -9,11 +9,11 @@ import * as t from 'io-ts'; import { setupRequest } from '../lib/helpers/setup_request'; import { getTraceItems } from '../lib/traces/get_trace_items'; import { getTopTransactionGroupList } from '../lib/transaction_groups'; -import { createApmServerRoute } from './create_apm_server_route'; +import { createApmServerRoute } from './apm_routes/create_apm_server_route'; import { environmentRt, kueryRt, rangeRt } from './default_api_types'; import { getSearchAggregatedTransactions } from '../lib/helpers/transactions'; import { getRootTransactionByTraceId } from '../lib/transactions/get_transaction_by_trace'; -import { createApmServerRouteRepository } from './create_apm_server_route_repository'; +import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; import { getTransaction } from '../lib/transactions/get_transaction'; const tracesRoute = createApmServerRoute({ diff --git a/x-pack/plugins/apm/server/routes/transactions.ts b/x-pack/plugins/apm/server/routes/transactions.ts index 4f4ca7eb1ba8..c0d83bac6e8e 100644 --- a/x-pack/plugins/apm/server/routes/transactions.ts +++ b/x-pack/plugins/apm/server/routes/transactions.ts @@ -21,8 +21,8 @@ import { getTransactionTraceSamples } from '../lib/transactions/trace_samples'; import { getAnomalySeries } from '../lib/transactions/get_anomaly_data'; import { getLatencyPeriods } from '../lib/transactions/get_latency_charts'; import { getErrorRatePeriods } from '../lib/transaction_groups/get_error_rate'; -import { createApmServerRoute } from './create_apm_server_route'; -import { createApmServerRouteRepository } from './create_apm_server_route_repository'; +import { createApmServerRoute } from './apm_routes/create_apm_server_route'; +import { createApmServerRouteRepository } from './apm_routes/create_apm_server_route_repository'; import { comparisonRangeRt, environmentRt, diff --git a/x-pack/plugins/canvas/canvas_plugin_src/elements/index.ts b/x-pack/plugins/canvas/canvas_plugin_src/elements/index.ts index 667854bf3e7e..b73957b50019 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/elements/index.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/elements/index.ts @@ -32,6 +32,7 @@ import { verticalBarChart } from './vert_bar_chart'; import { verticalProgressBar } from './vertical_progress_bar'; import { verticalProgressPill } from './vertical_progress_pill'; import { tagCloud } from './tag_cloud'; +import { metricVis } from './metric_vis'; import { SetupInitializer } from '../plugin'; import { ElementFactory } from '../../types'; @@ -73,3 +74,9 @@ export const initializeElements: SetupInitializer = (core, plu ]; return applyElementStrings(specs); }; + +// For testing purpose. Will be removed after exposing `metricVis` element. +export const initializeElementsSpec: SetupInitializer = (core, plugins) => { + const specs = initializeElements(core, plugins); + return [...applyElementStrings([metricVis]), ...specs]; +}; diff --git a/x-pack/plugins/canvas/canvas_plugin_src/elements/metric_vis/index.ts b/x-pack/plugins/canvas/canvas_plugin_src/elements/metric_vis/index.ts new file mode 100644 index 000000000000..3f01a8ccb3e7 --- /dev/null +++ b/x-pack/plugins/canvas/canvas_plugin_src/elements/metric_vis/index.ts @@ -0,0 +1,20 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { ElementFactory } from '../../../types'; + +export const metricVis: ElementFactory = () => ({ + name: 'metricVis', + displayName: '(New) Metric Vis', + type: 'chart', + help: 'Metric visualization', + icon: 'visMetric', + expression: `filters + | demodata + | head 1 + | metricVis metric={visdimension "percent_uptime"} colorMode="Labels" + | render`, +}); diff --git a/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/__stories__/palette.stories.tsx b/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/__stories__/palette.stories.tsx index ed9a47ad9748..27bec2675087 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/__stories__/palette.stories.tsx +++ b/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/__stories__/palette.stories.tsx @@ -29,6 +29,7 @@ storiesOf('arguments/Palette', module).add('default', () => ( }} onValueChange={action('onValueChange')} renderError={action('renderError')} + typeInstance={{}} />

)); diff --git a/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/index.ts b/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/index.ts index dd013116bb80..c6a220062227 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/index.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/index.ts @@ -16,7 +16,7 @@ import { imageUpload } from './image_upload'; // @ts-expect-error untyped local import { number } from './number'; import { numberFormatInitializer } from './number_format'; -import { palette } from './palette'; +import { palette, stopsPalette } from './palette'; // @ts-expect-error untyped local import { percentage } from './percentage'; // @ts-expect-error untyped local @@ -42,6 +42,7 @@ export const args = [ imageUpload, number, palette, + stopsPalette, percentage, range, select, diff --git a/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/palette.tsx b/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/palette.tsx deleted file mode 100644 index d01424af3a58..000000000000 --- a/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/palette.tsx +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React, { FC } from 'react'; -import PropTypes from 'prop-types'; -import { get } from 'lodash'; -import { getType } from '@kbn/interpreter/common'; -import { ExpressionAstFunction, ExpressionAstExpression } from 'src/plugins/expressions'; -import { PalettePicker } from '../../../public/components/palette_picker'; -import { templateFromReactComponent } from '../../../public/lib/template_from_react_component'; -import { ArgumentStrings } from '../../../i18n'; -import { identifyPalette, ColorPalette } from '../../../common/lib'; - -const { Palette: strings } = ArgumentStrings; - -interface Props { - onValueChange: (value: ExpressionAstExpression) => void; - argValue: ExpressionAstExpression; - renderError: () => void; - argId?: string; -} - -export const PaletteArgInput: FC = ({ onValueChange, argId, argValue, renderError }) => { - // TODO: This is weird, its basically a reimplementation of what the interpretter would return. - // Probably a better way todo this, and maybe a better way to handle template type objects in general? - const astToPalette = ({ chain }: { chain: ExpressionAstFunction[] }): ColorPalette | null => { - if (chain.length !== 1 || chain[0].function !== 'palette') { - renderError(); - return null; - } - - try { - const colors = chain[0].arguments._.map((astObj) => { - if (getType(astObj) !== 'string') { - renderError(); - } - return astObj; - }) as string[]; - - const gradient = get(chain[0].arguments.gradient, '[0]') as boolean; - const palette = identifyPalette({ colors, gradient }); - - if (palette) { - return palette; - } - - return { - id: 'custom', - label: strings.getCustomPaletteLabel(), - colors, - gradient, - } as any as ColorPalette; - } catch (e) { - renderError(); - } - return null; - }; - - const handleChange = (palette: ColorPalette): void => { - const astObj: ExpressionAstExpression = { - type: 'expression', - chain: [ - { - type: 'function', - function: 'palette', - arguments: { - _: palette.colors, - gradient: [palette.gradient], - }, - }, - ], - }; - - onValueChange(astObj); - }; - - const palette = astToPalette(argValue); - - if (!palette) { - renderError(); - return null; - } - - return ; -}; - -PaletteArgInput.propTypes = { - argId: PropTypes.string, - onValueChange: PropTypes.func.isRequired, - argValue: PropTypes.any.isRequired, - renderError: PropTypes.func, -}; - -export const palette = () => ({ - name: 'palette', - displayName: strings.getDisplayName(), - help: strings.getHelp(), - default: - '{palette #882E72 #B178A6 #D6C1DE #1965B0 #5289C7 #7BAFDE #4EB265 #90C987 #CAE0AB #F7EE55 #F6C141 #F1932D #E8601C #DC050C}', - simpleTemplate: templateFromReactComponent(PaletteArgInput), -}); diff --git a/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/palette/index.tsx b/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/palette/index.tsx new file mode 100644 index 000000000000..2eb756d34fff --- /dev/null +++ b/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/palette/index.tsx @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { PaletteArgInput, SimplePaletteArgInput, palette, stopsPalette } from './palette'; diff --git a/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/palette/palette.tsx b/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/palette/palette.tsx new file mode 100644 index 000000000000..eddefb8dadd2 --- /dev/null +++ b/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/palette/palette.tsx @@ -0,0 +1,121 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC } from 'react'; +import PropTypes from 'prop-types'; +import { ExpressionAstExpression } from 'src/plugins/expressions'; +import { templateFromReactComponent } from '../../../../public/lib/template_from_react_component'; +import { ArgumentStrings } from '../../../../i18n'; +import { ColorPalette } from '../../../../common/lib'; +import { astToPalette } from './utils'; +import { ColorPaletteName, getPaletteType } from './palette_types'; +import { CustomColorPalette } from '../../../../public/components/palette_picker'; + +const { Palette: strings, StopsPalette: stopsPaletteStrings } = ArgumentStrings; + +interface Props { + onValueChange: (value: ExpressionAstExpression) => void; + argValue: ExpressionAstExpression; + renderError: () => void; + argId?: string; + typeInstance: { + options?: { + type?: ColorPaletteName; + }; + }; +} + +export const PaletteArgInput: FC = ({ + onValueChange, + argId, + argValue, + renderError, + typeInstance, +}) => { + const handleChange = (palette: ColorPalette | CustomColorPalette): void => { + let colorStopsPaletteConfig = {}; + if (palette.stops?.length) { + colorStopsPaletteConfig = { + stop: palette.stops, + ...(palette.range ? { range: [palette.range] } : {}), + ...(palette.continuity ? { continuity: [palette.continuity] } : {}), + }; + } + + const astObj: ExpressionAstExpression = { + type: 'expression', + chain: [ + { + type: 'function', + function: 'palette', + arguments: { + _: palette.colors, + gradient: [palette.gradient], + ...colorStopsPaletteConfig, + }, + }, + ], + }; + + onValueChange(astObj); + }; + + const palette = astToPalette(argValue, renderError); + if (!palette) { + renderError(); + return null; + } + + const PalettePicker = getPaletteType(typeInstance.options?.type); + return ; +}; + +export const SimplePaletteArgInput: FC = (props) => { + const { typeInstance } = props; + const { type, ...restOptions } = typeInstance.options ?? {}; + return ( + + ); +}; + +export const StopsPaletteArgInput: FC = (props) => ( + +); + +PaletteArgInput.propTypes = { + argId: PropTypes.string, + onValueChange: PropTypes.func.isRequired, + argValue: PropTypes.any.isRequired, + renderError: PropTypes.func, +}; + +const defaultPaletteOptions = { + default: + '{palette #882E72 #B178A6 #D6C1DE #1965B0 #5289C7 #7BAFDE #4EB265 #90C987 #CAE0AB #F7EE55 #F6C141 #F1932D #E8601C #DC050C}', +}; + +export const palette = () => ({ + name: 'palette', + displayName: strings.getDisplayName(), + help: strings.getHelp(), + simpleTemplate: templateFromReactComponent(SimplePaletteArgInput), + ...defaultPaletteOptions, +}); + +export const stopsPalette = () => ({ + name: 'stops_palette', + help: stopsPaletteStrings.getHelp(), + displayName: stopsPaletteStrings.getDisplayName(), + template: templateFromReactComponent(StopsPaletteArgInput), + ...defaultPaletteOptions, +}); diff --git a/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/palette/palette_types.ts b/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/palette/palette_types.ts new file mode 100644 index 000000000000..8a0ec11af344 --- /dev/null +++ b/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/palette/palette_types.ts @@ -0,0 +1,21 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { PalettePicker, StopsPalettePicker } from '../../../../public/components/palette_picker'; + +const DEFAULT_PALETTE = 'default'; +const STOPS_PALETTE = 'stops'; + +export type ColorPaletteName = typeof DEFAULT_PALETTE | typeof STOPS_PALETTE; + +const paletteTypes = { + [DEFAULT_PALETTE]: PalettePicker, + [STOPS_PALETTE]: StopsPalettePicker, +}; + +export const getPaletteType = (type: ColorPaletteName = DEFAULT_PALETTE) => + paletteTypes[type] ?? paletteTypes[DEFAULT_PALETTE]; diff --git a/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/palette/utils.ts b/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/palette/utils.ts new file mode 100644 index 000000000000..5734bf7ce4f6 --- /dev/null +++ b/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/palette/utils.ts @@ -0,0 +1,91 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { getType } from '@kbn/interpreter/common'; +import { ExpressionAstArgument, ExpressionAstFunction } from 'src/plugins/expressions'; +import { identifyPalette, ColorPalette, identifyPartialPalette } from '../../../../common/lib'; +import { ArgumentStrings } from '../../../../i18n'; + +const { Palette: strings } = ArgumentStrings; + +export const CUSTOM_PALETTE = 'custom'; + +interface PaletteParams { + colors: string[]; + gradient: boolean; + stops?: number[]; +} + +export const createCustomPalette = ( + paletteParams: PaletteParams +): ColorPalette => ({ + id: CUSTOM_PALETTE, + label: strings.getCustomPaletteLabel(), + ...paletteParams, +}); + +type UnboxArray = T extends Array ? U : T; + +function reduceElementsWithType( + arr: any[], + arg: ExpressionAstArgument, + type: string, + onError: () => void +) { + if (getType(arg) !== type) { + onError(); + } + return [...arr, arg as UnboxArray]; +} + +// TODO: This is weird, its basically a reimplementation of what the interpretter would return. +// Probably a better way todo this, and maybe a better way to handle template type objects in general? +export const astToPalette = ( + { chain }: { chain: ExpressionAstFunction[] }, + onError: () => void +): ColorPalette | ColorPalette | null => { + if (chain.length !== 1 || chain[0].function !== 'palette') { + onError(); + return null; + } + + const { _, stop: argStops, gradient: argGradient, ...restArgs } = chain[0].arguments ?? {}; + + try { + const colors = + _?.reduce((args, arg) => { + return reduceElementsWithType(args, arg, 'string', onError); + }, []) ?? []; + + const stops = + argStops?.reduce((args, arg) => { + return reduceElementsWithType(args, arg, 'number', onError); + }, []) ?? []; + + const gradient = !!argGradient?.[0]; + const palette = (stops.length ? identifyPartialPalette : identifyPalette)({ colors, gradient }); + const restPreparedArgs = Object.keys(restArgs).reduce< + Record + >((acc, argName) => { + acc[argName] = restArgs[argName]?.length > 1 ? restArgs[argName] : restArgs[argName]?.[0]; + return acc; + }, {}); + + if (palette) { + return { + ...palette, + ...restPreparedArgs, + stops, + }; + } + + return createCustomPalette({ colors, gradient, stops, ...restPreparedArgs }); + } catch (e) { + onError(); + } + return null; +}; diff --git a/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/vis_dimension.tsx b/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/vis_dimension.tsx index df75704ababb..312457b658ad 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/vis_dimension.tsx +++ b/x-pack/plugins/canvas/canvas_plugin_src/uis/arguments/vis_dimension.tsx @@ -31,9 +31,6 @@ const VisDimensionArgInput: React.FC = ({ onValueChange, argId, columns, -}: { - // @todo define types - [key: string]: any; }) => { const [value, setValue] = useState(argValue); const confirm = typeInstance?.options?.confirm; diff --git a/x-pack/plugins/canvas/canvas_plugin_src/uis/datasources/esdocs.js b/x-pack/plugins/canvas/canvas_plugin_src/uis/datasources/esdocs.js index 817851b53c18..150b7c061688 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/uis/datasources/esdocs.js +++ b/x-pack/plugins/canvas/canvas_plugin_src/uis/datasources/esdocs.js @@ -5,7 +5,7 @@ * 2.0. */ -import React from 'react'; +import React, { useEffect, useCallback } from 'react'; import PropTypes from 'prop-types'; import { EuiFormRow, @@ -27,13 +27,16 @@ import { DataSourceStrings, LUCENE_QUERY_URL } from '../../../i18n'; const { ESDocs: strings } = DataSourceStrings; const EsdocsDatasource = ({ args, updateArgs, defaultIndex }) => { - const setArg = (name, value) => { - updateArgs && - updateArgs({ - ...args, - ...setSimpleArg(name, value), - }); - }; + const setArg = useCallback( + (name, value) => { + updateArgs && + updateArgs({ + ...args, + ...setSimpleArg(name, value), + }); + }, + [args, updateArgs] + ); // TODO: This is a terrible way of doing defaults. We need to find a way to read the defaults for the function // and set them for the data source UI. @@ -73,6 +76,12 @@ const EsdocsDatasource = ({ args, updateArgs, defaultIndex }) => { const index = getIndex(); + useEffect(() => { + if (getSimpleArg('index', args)[0] !== index) { + setArg('index', index); + } + }, [args, index, setArg]); + const sortOptions = [ { value: 'asc', text: strings.getAscendingOption() }, { value: 'desc', text: strings.getDescendingOption() }, diff --git a/x-pack/plugins/canvas/canvas_plugin_src/uis/models/index.js b/x-pack/plugins/canvas/canvas_plugin_src/uis/models/index.js index 0762f70b1985..8fadc9e2e6c8 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/uis/models/index.js +++ b/x-pack/plugins/canvas/canvas_plugin_src/uis/models/index.js @@ -8,5 +8,6 @@ import { pointseries } from './point_series'; import { math } from './math'; import { tagcloud } from './tagcloud'; +import { metricVis } from './metric_vis'; -export const modelSpecs = [pointseries, math, tagcloud]; +export const modelSpecs = [pointseries, math, tagcloud, metricVis]; diff --git a/x-pack/plugins/canvas/canvas_plugin_src/uis/models/metric_vis.ts b/x-pack/plugins/canvas/canvas_plugin_src/uis/models/metric_vis.ts new file mode 100644 index 000000000000..9796c4553978 --- /dev/null +++ b/x-pack/plugins/canvas/canvas_plugin_src/uis/models/metric_vis.ts @@ -0,0 +1,79 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { get } from 'lodash'; + +import { ViewStrings } from '../../../i18n'; +import { getState, getValue } from '../../../public/lib/resolved_arg'; + +const { MetricVis: strings } = ViewStrings; + +export const metricVis = () => ({ + name: 'metricVis', + displayName: strings.getDisplayName(), + args: [ + { + name: 'metric', + displayName: strings.getMetricColumnDisplayName(), + help: strings.getMetricColumnHelp(), + argType: 'vis_dimension', + multi: true, + default: `{visdimension}`, + }, + { + name: 'bucket', + displayName: strings.getBucketColumnDisplayName(), + help: strings.getBucketColumnHelp(), + argType: 'vis_dimension', + default: `{visdimension}`, + }, + { + name: 'palette', + argType: 'stops_palette', + }, + { + name: 'font', + displayName: strings.getFontColumnDisplayName(), + help: strings.getFontColumnHelp(), + argType: 'font', + default: `{font size=60 align="center"}`, + }, + { + name: 'colorMode', + displayName: strings.getColorModeColumnDisplayName(), + help: strings.getColorModeColumnHelp(), + argType: 'select', + default: 'Labels', + options: { + choices: [ + { value: 'None', name: strings.getColorModeNoneOption() }, + { value: 'Labels', name: strings.getColorModeLabelOption() }, + { value: 'Background', name: strings.getColorModeBackgroundOption() }, + ], + }, + }, + { + name: 'showLabels', + displayName: strings.getShowLabelsColumnDisplayName(), + help: strings.getShowLabelsColumnHelp(), + argType: 'toggle', + default: true, + }, + { + name: 'percentageMode', + displayName: strings.getPercentageModeColumnDisplayName(), + help: strings.getPercentageModeColumnHelp(), + argType: 'toggle', + }, + ], + resolve({ context }: any) { + if (getState(context) !== 'ready') { + return { columns: [] }; + } + return { columns: get(getValue(context), 'columns', []) }; + }, +}); diff --git a/x-pack/plugins/canvas/common/lib/palettes.ts b/x-pack/plugins/canvas/common/lib/palettes.ts index e9c2f23b62df..2e7eac1e1a84 100644 --- a/x-pack/plugins/canvas/common/lib/palettes.ts +++ b/x-pack/plugins/canvas/common/lib/palettes.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { isEqual } from 'lodash'; +import { difference, isEqual } from 'lodash'; import { LibStrings } from '../../i18n'; const { Palettes: strings } = LibStrings; @@ -19,11 +19,14 @@ export type PaletteID = typeof palettes[number]['id']; * An interface representing a color palette in Canvas, with a textual label and a set of * hex values. */ -export interface ColorPalette { - id: PaletteID; +export interface ColorPalette { + id: PaletteID | AdditionalPaletteID; label: string; colors: string[]; gradient: boolean; + stops?: number[]; + range?: 'number' | 'percent'; + continuity?: 'above' | 'below' | 'all' | 'none'; } // This function allows one to create a strongly-typed palette for inclusion in @@ -52,6 +55,15 @@ export const identifyPalette = ( }); }; +export const identifyPartialPalette = ( + input: Pick +): ColorPalette | undefined => { + return palettes.find((palette) => { + const { colors, gradient } = palette; + return gradient === input.gradient && difference(input.colors, colors).length === 0; + }); +}; + export const paulTor14 = createPalette({ id: 'paul_tor_14', label: 'Paul Tor 14', diff --git a/x-pack/plugins/canvas/i18n/elements/element_strings.test.ts b/x-pack/plugins/canvas/i18n/elements/element_strings.test.ts index 8070e86b7d7f..6589bf36cbec 100644 --- a/x-pack/plugins/canvas/i18n/elements/element_strings.test.ts +++ b/x-pack/plugins/canvas/i18n/elements/element_strings.test.ts @@ -6,10 +6,10 @@ */ import { getElementStrings } from './element_strings'; -import { initializeElements } from '../../canvas_plugin_src/elements'; +import { initializeElementsSpec } from '../../canvas_plugin_src/elements'; import { coreMock } from '../../../../../src/core/public/mocks'; -const elementSpecs = initializeElements(coreMock.createSetup() as any, {} as any); +const elementSpecs = initializeElementsSpec(coreMock.createSetup() as any, {} as any); describe('ElementStrings', () => { const elementStrings = getElementStrings(); diff --git a/x-pack/plugins/canvas/i18n/elements/element_strings.ts b/x-pack/plugins/canvas/i18n/elements/element_strings.ts index e1540572f4af..c97dd1b434d5 100644 --- a/x-pack/plugins/canvas/i18n/elements/element_strings.ts +++ b/x-pack/plugins/canvas/i18n/elements/element_strings.ts @@ -230,4 +230,12 @@ export const getElementStrings = (): ElementStringDict => ({ defaultMessage: 'Tagcloud visualization', }), }, + metricVis: { + displayName: i18n.translate('xpack.canvas.elements.metricVisDisplayName', { + defaultMessage: '(New) Metric Vis', + }), + help: i18n.translate('xpack.canvas.elements.metricVisHelpText', { + defaultMessage: 'Metric visualization', + }), + }, }); diff --git a/x-pack/plugins/canvas/i18n/ui.ts b/x-pack/plugins/canvas/i18n/ui.ts index 30a09d51ffab..4856de96885e 100644 --- a/x-pack/plugins/canvas/i18n/ui.ts +++ b/x-pack/plugins/canvas/i18n/ui.ts @@ -328,6 +328,16 @@ export const ArgumentStrings = { defaultMessage: 'Select column', }), }, + StopsPalette: { + getDisplayName: () => + i18n.translate('xpack.canvas.uis.arguments.stopsPaletteTitle', { + defaultMessage: 'Palette picker with bounds', + }), + getHelp: () => + i18n.translate('xpack.canvas.uis.arguments.stopsPaletteLabel', { + defaultMessage: 'Provides colors for the values, based on the bounds', + }), + }, }; export const DataSourceStrings = { @@ -1273,4 +1283,70 @@ export const ViewStrings = { defaultMessage: 'Bucket dimension configuration', }), }, + MetricVis: { + getDisplayName: () => + i18n.translate('xpack.canvas.uis.views.metricVisTitle', { + defaultMessage: 'Metric Vis', + }), + getMetricColumnDisplayName: () => + i18n.translate('xpack.canvas.uis.views.metricVis.args.metricDisplayName', { + defaultMessage: 'Metric', + }), + getMetricColumnHelp: () => + i18n.translate('xpack.canvas.uis.views.metricVis.args.metricHelp', { + defaultMessage: 'Metric dimension configuration', + }), + getBucketColumnDisplayName: () => + i18n.translate('xpack.canvas.uis.views.metricVis.args.bucketDisplayName', { + defaultMessage: 'Bucket', + }), + getBucketColumnHelp: () => + i18n.translate('xpack.canvas.uis.views.metricVis.args.bucketHelp', { + defaultMessage: 'Bucket dimension configuration', + }), + getFontColumnDisplayName: () => + i18n.translate('xpack.canvas.uis.views.metricVis.args.fontDisplayName', { + defaultMessage: 'Font', + }), + getFontColumnHelp: () => + i18n.translate('xpack.canvas.uis.views.metricVis.args.fontHelp', { + defaultMessage: 'Metric font configuration', + }), + getPercentageModeColumnDisplayName: () => + i18n.translate('xpack.canvas.uis.views.metricVis.args.percentageModeDisplayName', { + defaultMessage: 'Enable percentage mode', + }), + getPercentageModeColumnHelp: () => + i18n.translate('xpack.canvas.uis.views.metricVis.args.percentageModeHelp', { + defaultMessage: 'Shows metric in percentage mode.', + }), + getShowLabelsColumnDisplayName: () => + i18n.translate('xpack.canvas.uis.views.metricVis.args.showLabelsDisplayName', { + defaultMessage: 'Show metric labels', + }), + getShowLabelsColumnHelp: () => + i18n.translate('xpack.canvas.uis.views.metricVis.args.showLabelsHelp', { + defaultMessage: 'Shows labels under the metric values.', + }), + getColorModeColumnDisplayName: () => + i18n.translate('xpack.canvas.uis.views.metricVis.args.colorModeDisplayName', { + defaultMessage: 'Metric color mode', + }), + getColorModeColumnHelp: () => + i18n.translate('xpack.canvas.uis.views.metricVis.args.colorModeHelp', { + defaultMessage: 'Which part of metric to fill with color.', + }), + getColorModeNoneOption: () => + i18n.translate('xpack.canvas.uis.views.metricVis.args.colorMode.noneOption', { + defaultMessage: 'None', + }), + getColorModeLabelOption: () => + i18n.translate('xpack.canvas.uis.views.metricVis.args.colorMode.labelsOption', { + defaultMessage: 'Labels', + }), + getColorModeBackgroundOption: () => + i18n.translate('xpack.canvas.uis.views.metricVis.args.colorMode.backgroundOption', { + defaultMessage: 'Background', + }), + }, }; diff --git a/x-pack/plugins/canvas/public/components/arg_form/arg_form.js b/x-pack/plugins/canvas/public/components/arg_form/arg_form.js index 1e79b8152c9d..0bbac0e4dd25 100644 --- a/x-pack/plugins/canvas/public/components/arg_form/arg_form.js +++ b/x-pack/plugins/canvas/public/components/arg_form/arg_form.js @@ -5,7 +5,7 @@ * 2.0. */ -import React, { useRef, useEffect } from 'react'; +import React, { useRef, useEffect, useState } from 'react'; import PropTypes from 'prop-types'; import { ErrorBoundary } from '../enhance/error_boundary'; import { ArgSimpleForm } from './arg_simple_form'; @@ -39,11 +39,9 @@ export const ArgForm = (props) => { onValueRemove, workpad, assets, - renderError, - setRenderError, resolvedArgValue, } = props; - + const [renderError, setRenderError] = useState(false); const isMounted = useRef(); useEffect(() => { @@ -62,21 +60,15 @@ export const ArgForm = (props) => { {({ error, resetErrorState }) => { const { template, simpleTemplate } = argTypeInstance.argType; const hasError = Boolean(error) || renderError; - const argumentProps = { ...templateProps, resolvedArgValue, defaultValue: argTypeInstance.default, renderError: () => { - // TODO: don't do this - // It's an ugly hack to avoid React's render cycle and ensure the error happens on the next tick - // This is important; Otherwise we end up updating state in the middle of a render cycle - Promise.resolve().then(() => { - // Provide templates with a renderError method, and wrap the error in a known error type - // to stop Kibana's window.error from being called - isMounted.current && setRenderError(true); - }); + // Provide templates with a renderError method, and wrap the error in a known error type + // to stop Kibana's window.error from being called + isMounted.current && setRenderError(true); }, error: hasError, setLabel: (label) => isMounted.current && setLabel(label), @@ -154,7 +146,5 @@ ArgForm.propTypes = { expand: PropTypes.bool, setExpand: PropTypes.func, onValueRemove: PropTypes.func, - renderError: PropTypes.bool.isRequired, - setRenderError: PropTypes.func.isRequired, resolvedArgValue: PropTypes.any, }; diff --git a/x-pack/plugins/canvas/public/components/arg_form/arg_template_form.tsx b/x-pack/plugins/canvas/public/components/arg_form/arg_template_form.tsx index aec68993df98..172b3f1a590e 100644 --- a/x-pack/plugins/canvas/public/components/arg_form/arg_template_form.tsx +++ b/x-pack/plugins/canvas/public/components/arg_form/arg_template_form.tsx @@ -7,14 +7,17 @@ import React, { useState, useEffect, useCallback, useRef } from 'react'; import usePrevious from 'react-use/lib/usePrevious'; +import useEffectOnce from 'react-use/lib/useEffectOnce'; import { RenderToDom } from '../render_to_dom'; import { ExpressionFormHandlers } from '../../../common/lib/expression_form_handlers'; +import { UpdatePropsRef } from '../../../types/arguments'; interface ArgTemplateFormProps { template?: ( domNode: HTMLElement, config: ArgTemplateFormProps['argumentProps'], - handlers: ArgTemplateFormProps['handlers'] + handlers: ArgTemplateFormProps['handlers'], + onMount?: (ref: UpdatePropsRef | null) => void ) => void; argumentProps: { valueMissing?: boolean; @@ -42,11 +45,27 @@ export const ArgTemplateForm: React.FunctionComponent = ({ errorTemplate, }) => { const [updatedHandlers, setHandlers] = useState(mergeWithFormHandlers(handlers)); - const previousError = usePrevious(error); + const [mounted, setMounted] = useState(false); + const prevError = usePrevious(error); + const prevMounted = usePrevious(mounted); + const mountedArgumentRef = useRef>(); + const domNodeRef = useRef(); + + useEffectOnce(() => () => { + mountedArgumentRef.current = undefined; + }); + const renderTemplate = useCallback( - (domNode) => template && template(domNode, argumentProps, updatedHandlers), - [template, argumentProps, updatedHandlers] + (domNode) => + template && + template(domNode, argumentProps, updatedHandlers, (ref) => { + if (!mountedArgumentRef.current && ref) { + mountedArgumentRef.current = ref; + setMounted(true); + } + }), + [argumentProps, template, updatedHandlers] ); const renderErrorTemplate = useCallback( @@ -59,22 +78,30 @@ export const ArgTemplateForm: React.FunctionComponent = ({ }, [handlers]); useEffect(() => { - if (previousError !== error) { + if (!prevError && error) { updatedHandlers.destroy(); } - }, [previousError, error, updatedHandlers]); + }, [prevError, error, updatedHandlers]); useEffect(() => { - if (!error) { + if ((!error && prevError && mounted) || (mounted && !prevMounted && !error)) { renderTemplate(domNodeRef.current); } - }, [error, renderTemplate, domNodeRef]); + }, [error, mounted, prevError, prevMounted, renderTemplate]); + + useEffect(() => { + if (mountedArgumentRef.current) { + mountedArgumentRef.current?.updateProps(argumentProps); + } + }, [argumentProps]); if (error) { + mountedArgumentRef.current = undefined; return renderErrorTemplate(); } if (!template) { + mountedArgumentRef.current = undefined; return null; } @@ -82,7 +109,7 @@ export const ArgTemplateForm: React.FunctionComponent = ({ { domNodeRef.current = domNode; - renderTemplate(domNode); + setMounted(true); }} /> ); diff --git a/x-pack/plugins/canvas/public/components/arg_form/index.js b/x-pack/plugins/canvas/public/components/arg_form/index.js index 5dbc6c33db70..4ba510c12055 100644 --- a/x-pack/plugins/canvas/public/components/arg_form/index.js +++ b/x-pack/plugins/canvas/public/components/arg_form/index.js @@ -19,12 +19,10 @@ export const ArgForm = (props) => { const { argTypeInstance, label: labelFromProps, templateProps } = props; const [label, setLabel] = useState(getLabel(labelFromProps, argTypeInstance)); const [resolvedArgValue, setResolvedArgValue] = useState(null); - const [renderError, setRenderError] = useState(false); const workpad = useSelector(getWorkpadInfo); const assets = useSelector(getAssets); useEffect(() => { - setRenderError(false); setResolvedArgValue(); }, [templateProps?.argValue]); @@ -37,8 +35,6 @@ export const ArgForm = (props) => { setLabel={setLabel} resolvedArgValue={resolvedArgValue} setResolvedArgValue={setResolvedArgValue} - renderError={renderError} - setRenderError={setRenderError} /> ); }; diff --git a/x-pack/plugins/canvas/public/components/function_form/function_form.tsx b/x-pack/plugins/canvas/public/components/function_form/function_form.tsx index abe31f010510..491bb6becf98 100644 --- a/x-pack/plugins/canvas/public/components/function_form/function_form.tsx +++ b/x-pack/plugins/canvas/public/components/function_form/function_form.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { FunctionFormComponent } from './function_form_component'; +import { FunctionFormComponent as Component } from './function_form_component'; import { FunctionUnknown } from './function_unknown'; import { FunctionFormContextPending } from './function_form_context_pending'; import { FunctionFormContextError } from './function_form_context_error'; @@ -56,5 +56,5 @@ export const FunctionForm: React.FunctionComponent = (props) ); } - return ; + return ; }; diff --git a/x-pack/plugins/canvas/public/components/function_form/index.tsx b/x-pack/plugins/canvas/public/components/function_form/index.tsx index aff019d1cb69..47c6925f6fbb 100644 --- a/x-pack/plugins/canvas/public/components/function_form/index.tsx +++ b/x-pack/plugins/canvas/public/components/function_form/index.tsx @@ -6,8 +6,9 @@ */ import React, { useCallback } from 'react'; -import { useDispatch, useSelector } from 'react-redux'; +import { shallowEqual, useDispatch, useSelector } from 'react-redux'; import { Ast } from '@kbn/interpreter/common'; +import deepEqual from 'react-fast-compare'; import { ExpressionAstExpression, ExpressionValue, @@ -49,15 +50,21 @@ interface FunctionFormProps { export const FunctionForm: React.FunctionComponent = (props) => { const { expressionIndex, argType, nextArgType } = props; const dispatch = useDispatch(); - const context = useSelector((state) => - getContextForIndex(state, expressionIndex) + const context = useSelector( + (state) => getContextForIndex(state, expressionIndex), + deepEqual ); - const element = useSelector((state) => - getSelectedElement(state) + const element = useSelector( + (state) => getSelectedElement(state), + deepEqual ); - const pageId = useSelector((state) => getSelectedPage(state)); - const assets = useSelector((state) => getAssets(state)); - const filterGroups = useSelector((state) => getGlobalFilterGroups(state)); + const pageId = useSelector((state) => getSelectedPage(state), shallowEqual); + const assets = useSelector((state) => getAssets(state), shallowEqual); + const filterGroups = useSelector( + (state) => getGlobalFilterGroups(state), + shallowEqual + ); + const addArgument = useCallback( (argName: string, argValue: string | Ast | null) => () => { dispatch( @@ -131,7 +138,6 @@ export const FunctionForm: React.FunctionComponent = (props) }, [assets, onAssetAddDispatch] ); - return ( - i18n.translate('xpack.canvas.palettePicker.emptyPaletteLabel', { - defaultMessage: 'None', - }), - getNoPaletteFoundErrorTitle: () => - i18n.translate('xpack.canvas.palettePicker.noPaletteFoundErrorTitle', { - defaultMessage: 'Color palette not found', - }), -}; - -interface RequiredProps { - id?: string; - onChange?: (palette: ColorPalette) => void; - palette: ColorPalette; - clearable?: false; -} - -interface ClearableProps { - id?: string; - onChange?: (palette: ColorPalette | null) => void; - palette: ColorPalette | null; - clearable: true; -} - -type Props = RequiredProps | ClearableProps; - -const findPalette = (colorPalette: ColorPalette | null, colorPalettes: ColorPalette[] = []) => { - const palette = colorPalettes.filter((cp) => cp.id === colorPalette?.id)[0] ?? null; - if (palette === null) { - return colorPalettes.filter((cp) => isEqual(cp.colors, colorPalette?.colors))[0] ?? null; - } - - return palette; -}; - -export const PalettePicker: FC = (props) => { - const colorPalettes: EuiColorPalettePickerPaletteProps[] = palettes.map((item) => ({ - value: item.id, - title: item.label, - type: item.gradient ? 'gradient' : 'fixed', - palette: item.colors, - })); - - if (props.clearable) { - const { palette, onChange = () => {} } = props; - - colorPalettes.unshift({ - value: 'clear', - title: strings.getEmptyPaletteLabel(), - type: 'text', - }); - - const onPickerChange = (value: string) => { - const canvasPalette = palettes.find((item) => item.id === value); - onChange(canvasPalette || null); - }; - - const foundPalette = findPalette(palette, palettes); - - return ( - - ); - } - - const { palette, onChange = () => {} } = props; - - const onPickerChange = (value: string) => { - const canvasPalette = palettes.find((item) => item.id === value); - - if (!canvasPalette) { - throw new Error(strings.getNoPaletteFoundErrorTitle()); - } - - onChange(canvasPalette); - }; - - const foundPalette = findPalette(palette, palettes); - - return ( - - ); -}; - -PalettePicker.propTypes = { - id: PropTypes.string, - palette: PropTypes.object, - onChange: PropTypes.func, - clearable: PropTypes.bool, -}; diff --git a/x-pack/plugins/canvas/public/components/palette_picker/__stories__/__snapshots__/palette_picker.stories.storyshot b/x-pack/plugins/canvas/public/components/palette_picker/palette_picker/__stories__/__snapshots__/palette_picker.stories.storyshot similarity index 100% rename from x-pack/plugins/canvas/public/components/palette_picker/__stories__/__snapshots__/palette_picker.stories.storyshot rename to x-pack/plugins/canvas/public/components/palette_picker/palette_picker/__stories__/__snapshots__/palette_picker.stories.storyshot diff --git a/x-pack/plugins/canvas/public/components/palette_picker/__stories__/palette_picker.stories.tsx b/x-pack/plugins/canvas/public/components/palette_picker/palette_picker/__stories__/palette_picker.stories.tsx similarity index 76% rename from x-pack/plugins/canvas/public/components/palette_picker/__stories__/palette_picker.stories.tsx rename to x-pack/plugins/canvas/public/components/palette_picker/palette_picker/__stories__/palette_picker.stories.tsx index d097556285a6..3c1b5f3537ac 100644 --- a/x-pack/plugins/canvas/public/components/palette_picker/__stories__/palette_picker.stories.tsx +++ b/x-pack/plugins/canvas/public/components/palette_picker/palette_picker/__stories__/palette_picker.stories.tsx @@ -8,12 +8,13 @@ import React, { FC, useState } from 'react'; import { action } from '@storybook/addon-actions'; import { storiesOf } from '@storybook/react'; -import { PalettePicker } from '../palette_picker'; +import { PalettePicker } from '../../palette_picker'; -import { paulTor14, ColorPalette } from '../../../../common/lib/palettes'; +import { paulTor14, ColorPalette } from '../../../../../common/lib/palettes'; +import { CustomColorPalette } from '../../types'; const Interactive: FC = () => { - const [palette, setPalette] = useState(paulTor14); + const [palette, setPalette] = useState(paulTor14); return ; }; diff --git a/x-pack/plugins/canvas/public/components/palette_picker/palette_picker/clearable_palette_picker.tsx b/x-pack/plugins/canvas/public/components/palette_picker/palette_picker/clearable_palette_picker.tsx new file mode 100644 index 000000000000..1dd4d7355050 --- /dev/null +++ b/x-pack/plugins/canvas/public/components/palette_picker/palette_picker/clearable_palette_picker.tsx @@ -0,0 +1,48 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiColorPalettePicker } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import React, { FC } from 'react'; +import { ClearableComponentProps } from '../types'; +import { findPalette, prepareColorPalette } from '../utils'; + +const strings = { + getEmptyPaletteLabel: () => + i18n.translate('xpack.canvas.palettePicker.emptyPaletteLabel', { + defaultMessage: 'None', + }), +}; + +export const ClearablePalettePicker: FC = (props) => { + const { palette, palettes, onChange = () => {} } = props; + const colorPalettes = palettes.map(prepareColorPalette); + + const onPickerChange = (value: string) => { + const canvasPalette = palettes.find((item) => item.id === value); + onChange(canvasPalette || null); + }; + + const foundPalette = findPalette(palette ?? null, palettes); + + return ( + + ); +}; diff --git a/x-pack/plugins/canvas/public/components/palette_picker/palette_picker/default_palette_picker.tsx b/x-pack/plugins/canvas/public/components/palette_picker/palette_picker/default_palette_picker.tsx new file mode 100644 index 000000000000..c63964075e5b --- /dev/null +++ b/x-pack/plugins/canvas/public/components/palette_picker/palette_picker/default_palette_picker.tsx @@ -0,0 +1,45 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiColorPalettePicker } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import React, { FC } from 'react'; +import { RequiredComponentProps } from '../types'; +import { findPalette, prepareColorPalette } from '../utils'; + +const strings = { + getNoPaletteFoundErrorTitle: () => + i18n.translate('xpack.canvas.palettePicker.noPaletteFoundErrorTitle', { + defaultMessage: 'Color palette not found', + }), +}; + +export const DefaultPalettePicker: FC = (props) => { + const { palette, palettes, onChange = () => {} } = props; + const colorPalettes = palettes.map(prepareColorPalette); + + const onPickerChange = (value: string) => { + const canvasPalette = palettes.find((item) => item.id === value); + if (!canvasPalette) { + throw new Error(strings.getNoPaletteFoundErrorTitle()); + } + + onChange(canvasPalette); + }; + + const foundPalette = findPalette(palette ?? null, palettes); + + return ( + + ); +}; diff --git a/x-pack/plugins/reporting/public/constants.ts b/x-pack/plugins/canvas/public/components/palette_picker/palette_picker/index.ts similarity index 83% rename from x-pack/plugins/reporting/public/constants.ts rename to x-pack/plugins/canvas/public/components/palette_picker/palette_picker/index.ts index c7e77fd44a78..ac9085abf0a5 100644 --- a/x-pack/plugins/reporting/public/constants.ts +++ b/x-pack/plugins/canvas/public/components/palette_picker/palette_picker/index.ts @@ -5,4 +5,4 @@ * 2.0. */ -export const REACT_ROUTER_REDIRECT_APP_PATH = '/r'; +export { PalettePicker } from './palette_picker'; diff --git a/x-pack/plugins/canvas/public/components/palette_picker/palette_picker/palette_picker.tsx b/x-pack/plugins/canvas/public/components/palette_picker/palette_picker/palette_picker.tsx new file mode 100644 index 000000000000..064a9bd217ab --- /dev/null +++ b/x-pack/plugins/canvas/public/components/palette_picker/palette_picker/palette_picker.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC } from 'react'; +import PropTypes from 'prop-types'; +import { ClearablePalettePicker } from './clearable_palette_picker'; +import { palettes as defaultPalettes } from '../../../../common/lib/palettes'; +import { PalettePickerProps } from '../types'; +import { DefaultPalettePicker } from './default_palette_picker'; + +export const PalettePicker: FC = (props) => { + const { additionalPalettes = [] } = props; + const palettes = [...defaultPalettes, ...additionalPalettes]; + + if (props.clearable) { + return ( + + ); + } + + return ( + + ); +}; + +PalettePicker.propTypes = { + id: PropTypes.string, + palette: PropTypes.object, + onChange: PropTypes.func, + clearable: PropTypes.bool, +}; diff --git a/x-pack/plugins/canvas/public/components/palette_picker/stops_palette_picker/index.ts b/x-pack/plugins/canvas/public/components/palette_picker/stops_palette_picker/index.ts new file mode 100644 index 000000000000..8782055147c4 --- /dev/null +++ b/x-pack/plugins/canvas/public/components/palette_picker/stops_palette_picker/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { StopsPalettePicker } from './stops_palette_picker'; diff --git a/x-pack/plugins/canvas/public/components/palette_picker/stops_palette_picker/stop_color_picker.tsx b/x-pack/plugins/canvas/public/components/palette_picker/stops_palette_picker/stop_color_picker.tsx new file mode 100644 index 000000000000..6c5ff2923c8d --- /dev/null +++ b/x-pack/plugins/canvas/public/components/palette_picker/stops_palette_picker/stop_color_picker.tsx @@ -0,0 +1,133 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { + EuiButtonIcon, + EuiColorPicker, + EuiFieldNumber, + EuiFlexGroup, + EuiFlexItem, +} from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import React, { FC, useEffect, useState } from 'react'; +import useDebounce from 'react-use/lib/useDebounce'; +import { ColorStop } from '../types'; + +interface Props { + removable?: boolean; + stop?: number; + color?: string; + onDelete: () => void; + onChange: (colorStop: ColorStop) => void; +} + +interface ValidationResult { + color: boolean; + stop: boolean; +} + +const strings = { + getDeleteStopColorLabel: () => + i18n.translate('xpack.canvas.stopsColorPicker.deleteColorStopLabel', { + defaultMessage: 'Delete', + }), +}; + +const isValidColorStop = (colorStop: ColorStop): ValidationResult & { valid: boolean } => { + const valid = !isNaN(colorStop.stop); + return { + valid, + stop: valid, + color: true, + }; +}; + +export const StopColorPicker: FC = (props) => { + const { stop, color, onDelete, onChange, removable = true } = props; + + const [colorStop, setColorStop] = useState({ stop: stop ?? 0, color: color ?? '' }); + const [areValidFields, setAreValidFields] = useState({ + stop: true, + color: true, + }); + + const onChangeInput = (updatedColorStop: ColorStop) => { + setColorStop(updatedColorStop); + }; + + const [, cancel] = useDebounce( + () => { + if (color === colorStop.color && stop === colorStop.stop) { + return; + } + + const { valid, ...validationResult } = isValidColorStop(colorStop); + if (!valid) { + setAreValidFields(validationResult); + return; + } + + onChange(colorStop); + }, + 150, + [colorStop] + ); + + useEffect(() => { + const newColorStop = { stop: stop ?? 0, color: color ?? '' }; + setColorStop(newColorStop); + + const { valid, ...validationResult } = isValidColorStop(newColorStop); + setAreValidFields(validationResult); + }, [color, stop]); + + useEffect(() => { + return () => { + cancel(); + }; + }, [cancel]); + + return ( + + + + onChangeInput({ ...colorStop, stop: valueAsNumber }) + } + isInvalid={!areValidFields.stop} + /> + + + + { + onChangeInput({ ...colorStop, color: newColor }); + }} + isInvalid={!areValidFields.color} + /> + + + + + + + ); +}; diff --git a/x-pack/plugins/canvas/public/components/palette_picker/stops_palette_picker/stops_palette_picker.tsx b/x-pack/plugins/canvas/public/components/palette_picker/stops_palette_picker/stops_palette_picker.tsx new file mode 100644 index 000000000000..aab48528770c --- /dev/null +++ b/x-pack/plugins/canvas/public/components/palette_picker/stops_palette_picker/stops_palette_picker.tsx @@ -0,0 +1,147 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC, useCallback, useMemo } from 'react'; +import { flowRight, identity } from 'lodash'; +import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem, EuiFormRow, EuiSpacer } from '@elastic/eui'; +import useEffectOnce from 'react-use/lib/useEffectOnce'; +import { i18n } from '@kbn/i18n'; +import { ColorStop, CustomColorPalette, StopsPalettePickerProps } from '../types'; +import { PalettePicker } from '../palette_picker'; +import { StopColorPicker } from './stop_color_picker'; +import { Palette } from './types'; +import { + reduceColorsByStopsSize, + transformPaletteToColorStops, + mergeColorStopsWithPalette, + deleteColorStop, + updateColorStop, + addNewColorStop, + getOverridenPaletteOptions, +} from './utils'; +import { ColorPalette } from '../../../../common/lib/palettes'; + +const strings = { + getAddColorStopLabel: () => + i18n.translate('xpack.canvas.stopsPalettePicker.addColorStopLabel', { + defaultMessage: 'Add color stop', + }), + getColorStopsLabel: () => + i18n.translate('xpack.canvas.stopsPalettePicker.colorStopsLabel', { + defaultMessage: 'Color stops', + }), +}; + +const defaultStops = [0, 1]; +const MIN_STOPS = 2; + +export const StopsPalettePicker: FC = (props) => { + const { palette, onChange } = props; + const stops = useMemo( + () => (!palette?.stops || !palette.stops.length ? defaultStops : palette.stops), + [palette?.stops] + ); + + const colors = useMemo( + () => reduceColorsByStopsSize(palette?.colors, stops.length), + [palette?.colors, stops.length] + ); + + const onChangePalette = useCallback( + (newPalette: ColorPalette | CustomColorPalette | null) => { + if (newPalette) { + const newColors = reduceColorsByStopsSize(newPalette?.colors, stops.length); + props.onChange?.({ + ...palette, + ...newPalette, + colors: newColors, + stops, + }); + } + }, + [palette, props, stops] + ); + + useEffectOnce(() => { + onChangePalette({ ...getOverridenPaletteOptions(), ...palette }); + }); + + const paletteColorStops = useMemo( + () => transformPaletteToColorStops({ stops, colors }), + [colors, stops] + ); + + const updatePalette = useCallback( + (fn: (colorStops: ColorStop[]) => ColorStop[]) => + flowRight( + onChange ?? identity, + mergeColorStopsWithPalette(palette), + fn + ), + [onChange, palette] + ); + + const deleteColorStopAndApply = useCallback( + (index: number) => updatePalette(deleteColorStop(index))(paletteColorStops), + [paletteColorStops, updatePalette] + ); + + const updateColorStopAndApply = useCallback( + (index: number, colorStop: ColorStop) => + updatePalette(updateColorStop(index, colorStop))(paletteColorStops), + [paletteColorStops, updatePalette] + ); + + const addColorStopAndApply = useCallback( + () => updatePalette(addNewColorStop(palette))(paletteColorStops), + [palette, paletteColorStops, updatePalette] + ); + + const stopColorPickers = paletteColorStops.map(({ id, ...rest }, index) => ( + + = MIN_STOPS} + onDelete={() => deleteColorStopAndApply(index)} + onChange={(cp: ColorStop) => updateColorStopAndApply(index, cp)} + /> + + )); + + return ( + <> + + + + + + + {stopColorPickers} + + + + + + + {strings.getAddColorStopLabel()} + + + ); +}; diff --git a/x-pack/plugins/canvas/public/components/palette_picker/stops_palette_picker/types.ts b/x-pack/plugins/canvas/public/components/palette_picker/stops_palette_picker/types.ts new file mode 100644 index 000000000000..fab6fd218608 --- /dev/null +++ b/x-pack/plugins/canvas/public/components/palette_picker/stops_palette_picker/types.ts @@ -0,0 +1,11 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { CustomColorPalette } from '../types'; +import { ColorPalette } from '../../../../common/lib/palettes'; + +export type Palette = ColorPalette | CustomColorPalette; +export type PaletteColorStops = Pick; diff --git a/x-pack/plugins/canvas/public/components/palette_picker/stops_palette_picker/utils.ts b/x-pack/plugins/canvas/public/components/palette_picker/stops_palette_picker/utils.ts new file mode 100644 index 000000000000..0dad7f7c3abe --- /dev/null +++ b/x-pack/plugins/canvas/public/components/palette_picker/stops_palette_picker/utils.ts @@ -0,0 +1,82 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { zip, take } from 'lodash'; +import { htmlIdGenerator } from '@elastic/eui'; +import { ColorPalette } from '../../../../common/lib'; +import { ColorStop } from '../types'; +import { Palette, PaletteColorStops } from './types'; + +const id = htmlIdGenerator(); + +export const getOverridenPaletteOptions = (): Pick => ({ + range: 'number', + continuity: 'below', +}); + +export const createColorStop = (stop: number = 0, color: string = '') => ({ + stop, + color, + id: id(), +}); + +export const transformPaletteToColorStops = ({ stops = [], colors }: PaletteColorStops) => + zip(stops, colors).map(([stop, color]) => createColorStop(stop, color)); + +export const mergeColorStopsWithPalette = + (palette: Palette) => + (colorStops: ColorStop[]): Palette => { + const stopsWithColors = colorStops.reduce<{ colors: string[]; stops: number[] }>( + (acc, { color, stop }) => { + acc.colors.push(color ?? ''); + acc.stops.push(stop); + return acc; + }, + { colors: [], stops: [] } + ); + return { ...palette, ...stopsWithColors }; + }; + +export const updateColorStop = + (index: number, colorStop: ColorStop) => (colorStops: ColorStop[]) => { + colorStops.splice(index, 1, colorStop); + return colorStops; + }; + +export const deleteColorStop = (index: number) => (colorStops: ColorStop[]) => { + colorStops.splice(index, 1); + return colorStops; +}; + +export const addNewColorStop = (palette: Palette) => (colorStops: ColorStop[]) => { + const lastColorStopIndex = colorStops.length - 1; + const lastStop = lastColorStopIndex >= 0 ? colorStops[lastColorStopIndex].stop + 1 : 0; + const newIndex = lastColorStopIndex + 1; + return [ + ...colorStops, + { + stop: lastStop, + color: + palette.colors.length > newIndex + 1 + ? palette.colors[newIndex] + : palette.colors[palette.colors.length - 1], + }, + ]; +}; + +export const reduceColorsByStopsSize = (colors: string[] = [], stopsSize: number) => { + const reducedColors = take(colors, stopsSize); + const colorsLength = reducedColors.length; + if (colorsLength === stopsSize) { + return reducedColors; + } + + return [ + ...reducedColors, + ...Array(stopsSize - colorsLength).fill(reducedColors[colorsLength - 1] ?? ''), + ]; +}; diff --git a/x-pack/plugins/canvas/public/components/palette_picker/types.ts b/x-pack/plugins/canvas/public/components/palette_picker/types.ts new file mode 100644 index 000000000000..f297c0064a26 --- /dev/null +++ b/x-pack/plugins/canvas/public/components/palette_picker/types.ts @@ -0,0 +1,43 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { ColorPalette } from '../../../common/lib/palettes'; + +export type CustomColorPalette = ColorPalette<'custom'>; + +export interface RequiredProps { + id?: string; + onChange?: (palette: ColorPalette | CustomColorPalette) => void; + palette: ColorPalette | CustomColorPalette; + clearable?: false; + additionalPalettes?: Array; +} + +export interface ClearableProps { + id?: string; + onChange?: (palette: ColorPalette | CustomColorPalette | null) => void; + palette: ColorPalette | CustomColorPalette | null; + clearable: true; + additionalPalettes?: Array; +} + +export type PalettePickerProps = RequiredProps | ClearableProps; +export type StopsPalettePickerProps = RequiredProps; + +export type ClearableComponentProps = { + palettes: Array; +} & Partial> & + Pick; + +export type RequiredComponentProps = { + palettes: Array; +} & Partial>; + +export interface ColorStop { + color: string; + stop: number; +} diff --git a/x-pack/plugins/canvas/public/components/palette_picker/utils.ts b/x-pack/plugins/canvas/public/components/palette_picker/utils.ts new file mode 100644 index 000000000000..57d9220069ff --- /dev/null +++ b/x-pack/plugins/canvas/public/components/palette_picker/utils.ts @@ -0,0 +1,34 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { EuiColorPalettePickerPaletteProps } from '@elastic/eui'; +import { isEqual } from 'lodash'; +import { ColorPalette } from '../../../common/lib/palettes'; +import { CustomColorPalette } from './types'; + +export const findPalette = ( + colorPalette: ColorPalette | CustomColorPalette | null, + colorPalettes: Array = [] +) => { + const palette = colorPalettes.filter((cp) => cp.id === colorPalette?.id)[0] ?? null; + if (palette === null) { + return colorPalettes.filter((cp) => isEqual(cp.colors, colorPalette?.colors))[0] ?? null; + } + + return palette; +}; + +export const prepareColorPalette = ({ + id, + label, + gradient, + colors, +}: ColorPalette | CustomColorPalette): EuiColorPalettePickerPaletteProps => ({ + value: id, + title: label, + type: gradient ? 'gradient' : 'fixed', + palette: colors, +}); diff --git a/x-pack/plugins/canvas/public/components/sidebar/element_settings/element_settings.component.tsx b/x-pack/plugins/canvas/public/components/sidebar/element_settings/element_settings.component.tsx index e8f2c7a559f5..a912668d9143 100644 --- a/x-pack/plugins/canvas/public/components/sidebar/element_settings/element_settings.component.tsx +++ b/x-pack/plugins/canvas/public/components/sidebar/element_settings/element_settings.component.tsx @@ -61,7 +61,6 @@ export const ElementSettings: FunctionComponent = ({ element }) => { ), }, ]; - return ; }; diff --git a/x-pack/plugins/canvas/public/components/sidebar/element_settings/element_settings.tsx b/x-pack/plugins/canvas/public/components/sidebar/element_settings/element_settings.tsx index 4935647ca681..2de52c996e7d 100644 --- a/x-pack/plugins/canvas/public/components/sidebar/element_settings/element_settings.tsx +++ b/x-pack/plugins/canvas/public/components/sidebar/element_settings/element_settings.tsx @@ -6,31 +6,24 @@ */ import React from 'react'; -import { connect } from 'react-redux'; +import deepEqual from 'react-fast-compare'; +import { useSelector } from 'react-redux'; import { getElementById, getSelectedPage } from '../../../state/selectors/workpad'; import { ElementSettings as Component } from './element_settings.component'; -import { State, PositionedElement } from '../../../../types'; +import { State } from '../../../../types'; interface Props { selectedElementId: string | null; } -const mapStateToProps = (state: State, { selectedElementId }: Props): StateProps => ({ - element: getElementById(state, selectedElementId, getSelectedPage(state)), -}); +export const ElementSettings: React.FC = ({ selectedElementId }) => { + const element = useSelector((state: State) => { + return getElementById(state, selectedElementId, getSelectedPage(state)); + }, deepEqual); -interface StateProps { - element: PositionedElement | undefined; -} - -const renderIfElement: React.FunctionComponent = (props) => { - if (props.element) { - return ; + if (element) { + return ; } return null; }; - -export const ElementSettings = connect(mapStateToProps)( - renderIfElement -); diff --git a/x-pack/plugins/canvas/public/components/sidebar/sidebar_content/sidebar_content.tsx b/x-pack/plugins/canvas/public/components/sidebar/sidebar_content/sidebar_content.tsx index e53f5d6d515d..cc7bfa7d1119 100644 --- a/x-pack/plugins/canvas/public/components/sidebar/sidebar_content/sidebar_content.tsx +++ b/x-pack/plugins/canvas/public/components/sidebar/sidebar_content/sidebar_content.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { useSelector } from 'react-redux'; +import { shallowEqual, useSelector } from 'react-redux'; import { getSelectedToplevelNodes, getSelectedElementId } from '../../../state/selectors/workpad'; import { State } from '../../../../types'; import { SidebarContent as Component } from './sidebar_content.component'; @@ -16,12 +16,14 @@ interface SidebarContentProps { } export const SidebarContent: React.FC = ({ commit }) => { - const selectedToplevelNodes = useSelector((state) => - getSelectedToplevelNodes(state) + const selectedToplevelNodes = useSelector( + (state) => getSelectedToplevelNodes(state), + shallowEqual ); - const selectedElementId = useSelector((state) => - getSelectedElementId(state) + const selectedElementId = useSelector( + (state) => getSelectedElementId(state), + shallowEqual ); return ( diff --git a/x-pack/plugins/canvas/public/components/workpad_app/workpad_app.component.tsx b/x-pack/plugins/canvas/public/components/workpad_app/workpad_app.component.tsx index 6e380088bd84..0d9ff68c9f46 100644 --- a/x-pack/plugins/canvas/public/components/workpad_app/workpad_app.component.tsx +++ b/x-pack/plugins/canvas/public/components/workpad_app/workpad_app.component.tsx @@ -16,7 +16,7 @@ import { CommitFn } from '../../../types'; export const WORKPAD_CONTAINER_ID = 'canvasWorkpadContainer'; -interface Props { +export interface Props { deselectElement?: MouseEventHandler; isWriteable: boolean; } diff --git a/x-pack/plugins/canvas/public/components/workpad_app/workpad_app.ts b/x-pack/plugins/canvas/public/components/workpad_app/workpad_app.ts index fe98e0f4b1bf..bf859ceb4316 100644 --- a/x-pack/plugins/canvas/public/components/workpad_app/workpad_app.ts +++ b/x-pack/plugins/canvas/public/components/workpad_app/workpad_app.ts @@ -6,8 +6,8 @@ */ import { MouseEventHandler } from 'react'; -import { Dispatch } from 'redux'; import { connect } from 'react-redux'; +import { Dispatch } from 'redux'; // @ts-expect-error untyped local import { selectToplevelNodes } from '../../state/actions/transient'; import { canUserWrite } from '../../state/selectors/app'; @@ -18,6 +18,8 @@ import { State } from '../../../types'; export { WORKPAD_CONTAINER_ID } from './workpad_app.component'; +const WorkpadAppComponent = withElementsLoadedTelemetry(Component); + const mapDispatchToProps = (dispatch: Dispatch): { deselectElement: MouseEventHandler } => ({ deselectElement: (ev) => { ev.stopPropagation(); @@ -31,4 +33,4 @@ export const WorkpadApp = connect( workpad: getWorkpad(state), }), mapDispatchToProps -)(withElementsLoadedTelemetry(Component)); +)(WorkpadAppComponent); diff --git a/x-pack/plugins/canvas/public/components/workpad_app/workpad_telemetry.test.tsx b/x-pack/plugins/canvas/public/components/workpad_app/workpad_telemetry.test.tsx index 54fd871203f1..3c2ab0bf8175 100644 --- a/x-pack/plugins/canvas/public/components/workpad_app/workpad_telemetry.test.tsx +++ b/x-pack/plugins/canvas/public/components/workpad_app/workpad_telemetry.test.tsx @@ -6,6 +6,7 @@ */ import React from 'react'; +import { useSelector } from 'react-redux'; import { render } from '@testing-library/react'; import { withUnconnectedElementsLoadedTelemetry, @@ -13,148 +14,137 @@ import { WorkpadLoadedWithErrorsMetric, } from './workpad_telemetry'; import { METRIC_TYPE } from '../../lib/ui_metric'; -import { ResolvedArgType } from '../../../types'; +import { ExpressionContext, ResolvedArgType } from '../../../types'; + +jest.mock('react-redux', () => { + const originalModule = jest.requireActual('react-redux'); + + return { + ...originalModule, + useSelector: jest.fn(), + }; +}); const trackMetric = jest.fn(); +const useSelectorMock = useSelector as jest.Mock; + const Component = withUnconnectedElementsLoadedTelemetry(() =>
, trackMetric); const mockWorkpad = { id: 'workpadid', pages: [ { - elements: [{ id: '1' }, { id: '2' }, { id: '3' }, { id: '4' }], + elements: [{ id: '0' }, { id: '1' }, { id: '2' }, { id: '3' }], }, { - elements: [{ id: '5' }], + elements: [{ id: '4' }], }, ], }; -const resolvedArgsMatchWorkpad = { - '1': {} as ResolvedArgType, - '2': {} as ResolvedArgType, - '3': {} as ResolvedArgType, - '4': {} as ResolvedArgType, - '5': {} as ResolvedArgType, -}; +const getMockState = (resolvedArgs: Record) => ({ + transient: { resolvedArgs }, +}); -const resolvedArgsNotMatchWorkpad = { - 'non-matching-id': {} as ResolvedArgType, -}; +const getResolveArgWithState = (state: 'pending' | 'ready' | 'error') => + ({ + expressionRenderable: { value: { as: state, type: 'render' }, state, error: null }, + expressionContext: {} as ExpressionContext, + } as ResolvedArgType); -const pendingCounts = { - pending: 5, - error: 0, - ready: 0, -}; +const arrayToObject = (array: ResolvedArgType[]) => + array.reduce>((acc, el, index) => { + acc[index] = el; + return acc; + }, {}); -const readyCounts = { - pending: 0, - error: 0, - ready: 5, -}; +const pendingMockState = getMockState( + arrayToObject(Array(5).fill(getResolveArgWithState('pending'))) +); -const errorCounts = { - pending: 0, - error: 1, - ready: 4, -}; +const readyMockState = getMockState(arrayToObject(Array(5).fill(getResolveArgWithState('ready')))); + +const errorMockState = getMockState( + arrayToObject([ + ...Array(4).fill(getResolveArgWithState('ready')), + ...Array(1).fill(getResolveArgWithState('error')), + ]) +); + +const emptyElementsMockState = getMockState({}); + +const notMatchedMockState = getMockState({ + 'non-matching-id': getResolveArgWithState('ready'), +}); describe('Elements Loaded Telemetry', () => { beforeEach(() => { trackMetric.mockReset(); }); + afterEach(() => { + useSelectorMock.mockClear(); + }); + it('tracks when all resolvedArgs are completed', () => { - const { rerender } = render( - - ); + useSelectorMock.mockImplementation((callback) => { + return callback(pendingMockState); + }); + const { rerender } = render(); expect(trackMetric).not.toBeCalled(); - rerender( - - ); + useSelectorMock.mockClear(); + useSelectorMock.mockImplementation((callback) => { + return callback(readyMockState); + }); + rerender(); expect(trackMetric).toBeCalledWith(METRIC_TYPE.LOADED, WorkpadLoadedMetric); }); it('only tracks loaded once', () => { - const { rerender } = render( - - ); + useSelectorMock.mockImplementation((callback) => { + return callback(pendingMockState); + }); + const { rerender } = render(); expect(trackMetric).not.toBeCalled(); - rerender( - - ); - rerender( - - ); + useSelectorMock.mockClear(); + useSelectorMock.mockImplementation((callback) => { + return callback(readyMockState); + }); + rerender(); + rerender(); expect(trackMetric).toBeCalledTimes(1); }); it('does not track if resolvedArgs are never pending', () => { - const { rerender } = render( - - ); - - rerender( - - ); + useSelectorMock.mockImplementation((callback) => { + return callback(readyMockState); + }); + const { rerender } = render(); + rerender(); expect(trackMetric).not.toBeCalled(); }); it('tracks if elements are in error state after load', () => { - const { rerender } = render( - - ); + useSelectorMock.mockImplementation((callback) => { + return callback(pendingMockState); + }); + const { rerender } = render(); expect(trackMetric).not.toBeCalled(); - rerender( - - ); + useSelectorMock.mockClear(); + useSelectorMock.mockImplementation((callback) => { + return callback(errorMockState); + }); + rerender(); expect(trackMetric).toBeCalledWith(METRIC_TYPE.LOADED, [ WorkpadLoadedMetric, WorkpadLoadedWithErrorsMetric, @@ -166,42 +156,30 @@ describe('Elements Loaded Telemetry', () => { id: 'otherworkpad', pages: [ { - elements: [{ id: '1' }, { id: '2' }, { id: '3' }, { id: '4' }], + elements: [{ id: '0' }, { id: '1' }, { id: '2' }, { id: '3' }], }, { - elements: [{ id: '5' }], + elements: [{ id: '4' }], }, ], }; - const { rerender } = render( - - ); + useSelectorMock.mockImplementation((callback) => { + return callback(notMatchedMockState); + }); + const { rerender } = render(); expect(trackMetric).not.toBeCalled(); - rerender( - - ); - + rerender(); expect(trackMetric).not.toBeCalled(); - rerender( - - ); + useSelectorMock.mockClear(); + useSelectorMock.mockImplementation((callback) => { + return callback(readyMockState); + }); + rerender(); expect(trackMetric).toBeCalledWith(METRIC_TYPE.LOADED, WorkpadLoadedMetric); }); @@ -211,24 +189,12 @@ describe('Elements Loaded Telemetry', () => { pages: [], }; - const resolvedArgs = {}; - - const { rerender } = render( - - ); - - rerender( - - ); + useSelectorMock.mockImplementation((callback) => { + return callback(emptyElementsMockState); + }); + const { rerender } = render(); + rerender(); expect(trackMetric).not.toBeCalled(); }); }); diff --git a/x-pack/plugins/canvas/public/components/workpad_app/workpad_telemetry.tsx b/x-pack/plugins/canvas/public/components/workpad_app/workpad_telemetry.tsx index 0915c757ff89..d74f8693bc9b 100644 --- a/x-pack/plugins/canvas/public/components/workpad_app/workpad_telemetry.tsx +++ b/x-pack/plugins/canvas/public/components/workpad_app/workpad_telemetry.tsx @@ -6,21 +6,18 @@ */ import React, { useState, useEffect } from 'react'; -import { connect, ConnectedProps } from 'react-redux'; +import { shallowEqual, useSelector } from 'react-redux'; +import deepEqual from 'react-fast-compare'; import { trackCanvasUiMetric, METRIC_TYPE } from '../../lib/ui_metric'; import { getElementCounts } from '../../state/selectors/workpad'; import { getArgs } from '../../state/selectors/resolved_args'; +import { State } from '../../../types'; const WorkpadLoadedMetric = 'workpad-loaded'; const WorkpadLoadedWithErrorsMetric = 'workpad-loaded-with-errors'; export { WorkpadLoadedMetric, WorkpadLoadedWithErrorsMetric }; -const mapStateToProps = (state: any) => ({ - telemetryElementCounts: getElementCounts(state), - telemetryResolvedArgs: getArgs(state), -}); - // TODO: Build out full workpad types /** Individual Page of a Workpad @@ -47,7 +44,7 @@ interface ResolvedArgs { [keys: string]: any; } -export interface ElementsLoadedTelemetryProps extends PropsFromRedux { +export interface ElementsLoadedTelemetryProps { workpad: Workpad; } @@ -65,33 +62,32 @@ export const withUnconnectedElementsLoadedTelemetry =

( Component: React.ComponentType

, trackMetric = trackCanvasUiMetric ) => - function ElementsLoadedTelemetry(props: ElementsLoadedTelemetryProps) { - const { telemetryElementCounts, workpad, telemetryResolvedArgs, ...other } = props; - const { error, pending } = telemetryElementCounts; + function ElementsLoadedTelemetry(props: P & ElementsLoadedTelemetryProps) { + const { workpad } = props; const [currentWorkpadId, setWorkpadId] = useState(undefined); const [hasReported, setHasReported] = useState(false); + const telemetryElementCounts = useSelector( + (state: State) => getElementCounts(state), + shallowEqual + ); - useEffect(() => { - const resolvedArgsAreForWorkpad = areAllElementsInResolvedArgs( - workpad, - telemetryResolvedArgs - ); + const telemetryResolvedArgs = useSelector((state: State) => getArgs(state), deepEqual); - if (workpad.id !== currentWorkpadId) { - setWorkpadId(workpad.id); + const resolvedArgsAreForWorkpad = areAllElementsInResolvedArgs(workpad, telemetryResolvedArgs); + const { error, pending } = telemetryElementCounts; + const resolved = resolvedArgsAreForWorkpad && pending === 0; + useEffect(() => { + if (workpad.id !== currentWorkpadId) { const workpadElementCount = workpad.pages.reduce( (reduction, page) => reduction + page.elements.length, 0 ); - if (workpadElementCount === 0 || (resolvedArgsAreForWorkpad && pending === 0)) { - setHasReported(true); - } else { - setHasReported(false); - } - } else if (!hasReported && pending === 0 && resolvedArgsAreForWorkpad) { + setWorkpadId(workpad.id); + setHasReported(workpadElementCount === 0 || resolved); + } else if (!hasReported && resolved) { if (error > 0) { trackMetric(METRIC_TYPE.LOADED, [WorkpadLoadedMetric, WorkpadLoadedWithErrorsMetric]); } else { @@ -99,16 +95,9 @@ export const withUnconnectedElementsLoadedTelemetry =

( } setHasReported(true); } - }, [currentWorkpadId, hasReported, error, pending, telemetryResolvedArgs, workpad]); - - return ; + }, [currentWorkpadId, hasReported, error, workpad.id, resolved, workpad.pages]); + return ; }; -const connector = connect(mapStateToProps, {}); - -type PropsFromRedux = ConnectedProps; - -export const withElementsLoadedTelemetry =

(Component: React.ComponentType

) => { - const telemetry = withUnconnectedElementsLoadedTelemetry(Component); - return connector(telemetry); -}; +export const withElementsLoadedTelemetry =

(Component: React.ComponentType

) => + withUnconnectedElementsLoadedTelemetry(Component); diff --git a/x-pack/plugins/canvas/public/expression_types/datasource.tsx b/x-pack/plugins/canvas/public/expression_types/datasource.tsx index 7566c473a720..8ecfedbf948d 100644 --- a/x-pack/plugins/canvas/public/expression_types/datasource.tsx +++ b/x-pack/plugins/canvas/public/expression_types/datasource.tsx @@ -12,6 +12,7 @@ import { RenderToDom } from '../components/render_to_dom'; import { BaseForm, BaseFormProps } from './base_form'; import { ExpressionFormHandlers } from '../../common/lib'; import { ExpressionFunction } from '../../types'; +import { UpdatePropsRef } from '../../types/arguments'; const defaultTemplate = () => (

@@ -22,7 +23,8 @@ const defaultTemplate = () => ( type TemplateFn = ( domNode: HTMLElement, config: DatasourceRenderProps, - handlers: ExpressionFormHandlers + handlers: ExpressionFormHandlers, + onMount?: (ref: UpdatePropsRef | null) => void ) => void; export type DatasourceProps = { @@ -49,6 +51,8 @@ interface DatasourceWrapperProps { const DatasourceWrapper: React.FunctionComponent = (props) => { const domNodeRef = useRef(); + const datasourceRef = useRef>(); + const { spec, datasourceProps, handlers } = props; const callRenderFn = useCallback(() => { @@ -58,14 +62,23 @@ const DatasourceWrapper: React.FunctionComponent = (prop return; } - template(domNodeRef.current, datasourceProps, handlers); + template(domNodeRef.current, datasourceProps, handlers, (ref) => { + datasourceRef.current = ref ?? undefined; + }); }, [datasourceProps, handlers, spec]); useEffect(() => { callRenderFn(); - }, [callRenderFn, props]); + }, [callRenderFn]); + + useEffect(() => { + if (datasourceRef.current) { + datasourceRef.current.updateProps(datasourceProps); + } + }, [datasourceProps]); useEffectOnce(() => () => { + datasourceRef.current = undefined; handlers.destroy(); }); diff --git a/x-pack/plugins/canvas/public/expression_types/function_form.tsx b/x-pack/plugins/canvas/public/expression_types/function_form.tsx index 70279453ac65..9028a0999149 100644 --- a/x-pack/plugins/canvas/public/expression_types/function_form.tsx +++ b/x-pack/plugins/canvas/public/expression_types/function_form.tsx @@ -140,7 +140,6 @@ export class FunctionForm extends BaseForm { // Don't instaniate these until render time, to give the registries a chance to populate. const argInstances = this.args.map((argSpec) => new Arg(argSpec)); - if (args === null || !isPlainObject(args)) { throw new Error(`Form "${this.name}" expects "args" object`); } @@ -153,7 +152,6 @@ export class FunctionForm extends BaseForm { // otherwise, leave the value alone (including if the arg is not defined) const isMulti = arg && arg.multi; const argValues = args[argName] && !isMulti ? [last(args[argName]) ?? null] : args[argName]; - return { arg, argValues }; }); diff --git a/x-pack/plugins/canvas/public/lib/template_from_react_component.tsx b/x-pack/plugins/canvas/public/lib/template_from_react_component.tsx index b2dfd67a2d34..a783d6de2916 100644 --- a/x-pack/plugins/canvas/public/lib/template_from_react_component.tsx +++ b/x-pack/plugins/canvas/public/lib/template_from_react_component.tsx @@ -5,42 +5,72 @@ * 2.0. */ -import React, { ComponentType, FC } from 'react'; +import React, { + ComponentType, + forwardRef, + ForwardRefRenderFunction, + useImperativeHandle, + useState, +} from 'react'; import { unmountComponentAtNode, render } from 'react-dom'; import PropTypes from 'prop-types'; import { I18nProvider } from '@kbn/i18n/react'; import { ErrorBoundary } from '../components/enhance/error_boundary'; -import { ArgumentHandlers } from '../../types/arguments'; +import { ArgumentHandlers, UpdatePropsRef } from '../../types/arguments'; export interface Props { renderError: Function; } export const templateFromReactComponent = (Component: ComponentType) => { - const WrappedComponent: FC = (props) => ( - - {({ error }) => { - if (error) { - props.renderError(); - return null; - } - - return ( - - - - ); - }} - - ); - - WrappedComponent.propTypes = { + const WrappedComponent: ForwardRefRenderFunction, Props> = (props, ref) => { + const [updatedProps, setUpdatedProps] = useState(props); + + useImperativeHandle(ref, () => ({ + updateProps: (newProps: Props) => { + setUpdatedProps(newProps); + }, + })); + + return ( + + {({ error }) => { + if (error) { + props.renderError(); + return null; + } + + return ( + + + + ); + }} + + ); + }; + + const ForwardRefWrappedComponent = forwardRef(WrappedComponent); + + ForwardRefWrappedComponent.propTypes = { renderError: PropTypes.func, }; - return (domNode: HTMLElement, config: Props, handlers: ArgumentHandlers) => { + return ( + domNode: HTMLElement, + config: Props, + handlers: ArgumentHandlers, + onMount?: (ref: UpdatePropsRef | null) => void + ) => { try { - const el = React.createElement(WrappedComponent, config); + const el = ( + { + onMount?.(ref); + }} + /> + ); render(el, domNode, () => { handlers.done(); }); diff --git a/x-pack/plugins/canvas/types/arguments.ts b/x-pack/plugins/canvas/types/arguments.ts index 5dfaa3f8e675..0ecc69616591 100644 --- a/x-pack/plugins/canvas/types/arguments.ts +++ b/x-pack/plugins/canvas/types/arguments.ts @@ -19,6 +19,10 @@ export interface ArgumentHandlers { onDestroy: GenericCallback; } +export interface UpdatePropsRef { + updateProps: (newProps: Props) => void; +} + export interface ArgumentSpec { /** The argument type */ name: string; @@ -33,13 +37,19 @@ export interface ArgumentSpec { simpleTemplate?: ( domNode: HTMLElement, config: ArgumentConfig, - handlers: ArgumentHandlers + handlers: ArgumentHandlers, + onMount: (ref: UpdatePropsRef | null) => void ) => void; /** * A function that renders a complex/large argument * This is nested in an accordian so it can be expanded/collapsed */ - template?: (domNode: HTMLElement, config: ArgumentConfig, handlers: ArgumentHandlers) => void; + template?: ( + domNode: HTMLElement, + config: ArgumentConfig, + handlers: ArgumentHandlers, + onMount: (ref: UpdatePropsRef | null) => void + ) => void; } export type ArgumentFactory = () => ArgumentSpec; diff --git a/x-pack/plugins/cases/public/components/all_cases/all_cases_generic.tsx b/x-pack/plugins/cases/public/components/all_cases/all_cases_generic.tsx index 4a4e31230030..54867c333c2e 100644 --- a/x-pack/plugins/cases/public/components/all_cases/all_cases_generic.tsx +++ b/x-pack/plugins/cases/public/components/all_cases/all_cases_generic.tsx @@ -7,7 +7,7 @@ import React, { useCallback, useMemo, useRef, useState } from 'react'; import { EuiProgress, EuiBasicTable, EuiTableSelectionType } from '@elastic/eui'; -import { difference, head, isEmpty, memoize } from 'lodash/fp'; +import { difference, head, isEmpty } from 'lodash/fp'; import styled, { css } from 'styled-components'; import classnames from 'classnames'; @@ -17,7 +17,6 @@ import { CaseType, CommentRequestAlertType, CaseStatusWithAllStatus, - CommentType, FilterOptions, SortFieldCase, SubCase, @@ -207,6 +206,10 @@ export const AllCasesGeneric = React.memo( isSelectorView: !!isSelectorView, userCanCrud, connectors, + onRowClick, + alertData, + postComment, + updateCase, }); const itemIdToExpandedRowMap = useMemo( @@ -241,32 +244,11 @@ export const AllCasesGeneric = React.memo( const isDataEmpty = useMemo(() => data.total === 0, [data]); const tableRowProps = useCallback( - (theCase: Case) => { - const onTableRowClick = memoize(async () => { - if (alertData != null) { - await postComment({ - caseId: theCase.id, - data: { - type: CommentType.alert, - ...alertData, - }, - updateCase, - }); - } - if (onRowClick) { - onRowClick(theCase); - } - }); - - return { - 'data-test-subj': `cases-table-row-${theCase.id}`, - className: classnames({ isDisabled: theCase.type === CaseType.collection }), - ...(isSelectorView && theCase.type !== CaseType.collection - ? { onClick: onTableRowClick } - : {}), - }; - }, - [isSelectorView, alertData, onRowClick, postComment, updateCase] + (theCase: Case) => ({ + 'data-test-subj': `cases-table-row-${theCase.id}`, + className: classnames({ isDisabled: theCase.type === CaseType.collection }), + }), + [] ); return ( diff --git a/x-pack/plugins/cases/public/components/all_cases/columns.tsx b/x-pack/plugins/cases/public/components/all_cases/columns.tsx index c0bd6536f1b7..6a23a293bfb8 100644 --- a/x-pack/plugins/cases/public/components/all_cases/columns.tsx +++ b/x-pack/plugins/cases/public/components/all_cases/columns.tsx @@ -10,6 +10,7 @@ import { EuiAvatar, EuiBadgeGroup, EuiBadge, + EuiButton, EuiLink, EuiTableActionsColumnType, EuiTableComputedColumnType, @@ -24,6 +25,8 @@ import styled from 'styled-components'; import { CaseStatuses, CaseType, + CommentType, + CommentRequestAlertType, DeleteCase, Case, SubCase, @@ -43,6 +46,7 @@ import { useKibana } from '../../common/lib/kibana'; import { StatusContextMenu } from '../case_action_bar/status_context_menu'; import { TruncatedText } from '../truncated_text'; import { getConnectorIcon } from '../utils'; +import { PostComment } from '../../containers/use_post_comment'; export type CasesColumns = | EuiTableActionsColumnType @@ -75,6 +79,10 @@ export interface GetCasesColumn { isSelectorView: boolean; userCanCrud: boolean; connectors?: ActionConnector[]; + onRowClick?: (theCase: Case) => void; + alertData?: Omit; + postComment?: (args: PostComment) => Promise; + updateCase?: (newCase: Case) => void; } export const useCasesColumns = ({ caseDetailsNavigation, @@ -87,6 +95,10 @@ export const useCasesColumns = ({ isSelectorView, userCanCrud, connectors = [], + onRowClick, + alertData, + postComment, + updateCase, }: GetCasesColumn): CasesColumns[] => { // Delete case const { @@ -132,6 +144,25 @@ export const useCasesColumns = ({ [toggleDeleteModal] ); + const assignCaseAction = useCallback( + async (theCase: Case) => { + if (alertData != null) { + await postComment?.({ + caseId: theCase.id, + data: { + type: CommentType.alert, + ...alertData, + }, + updateCase, + }); + } + if (onRowClick) { + onRowClick(theCase); + } + }, + [alertData, onRowClick, postComment, updateCase] + ); + useEffect(() => { handleIsLoading(isDeleting || isLoadingCases.indexOf('caseUpdate') > -1); }, [handleIsLoading, isDeleting, isLoadingCases]); @@ -281,6 +312,30 @@ export const useCasesColumns = ({ return getEmptyTagValue(); }, }, + ...(isSelectorView + ? [ + { + align: RIGHT_ALIGNMENT, + render: (theCase: Case) => { + if (theCase.id != null) { + return ( + { + assignCaseAction(theCase); + }} + size="s" + fill={true} + > + {i18n.SELECT} + + ); + } + return getEmptyTagValue(); + }, + }, + ] + : []), ...(!isSelectorView ? [ { diff --git a/x-pack/plugins/cases/public/components/all_cases/index.test.tsx b/x-pack/plugins/cases/public/components/all_cases/index.test.tsx index f55c871f4922..7e3ca8729ef6 100644 --- a/x-pack/plugins/cases/public/components/all_cases/index.test.tsx +++ b/x-pack/plugins/cases/public/components/all_cases/index.test.tsx @@ -749,7 +749,7 @@ describe('AllCasesGeneric', () => { /> ); - wrapper.find('[data-test-subj="cases-table-row-1"]').first().simulate('click'); + wrapper.find('[data-test-subj="cases-table-row-select-1"]').first().simulate('click'); await waitFor(() => { expect(onRowClick).toHaveBeenCalledWith({ closedAt: null, diff --git a/x-pack/plugins/cases/public/components/all_cases/selector_modal/index.tsx b/x-pack/plugins/cases/public/components/all_cases/selector_modal/index.tsx index cbfb24f18c97..735676480255 100644 --- a/x-pack/plugins/cases/public/components/all_cases/selector_modal/index.tsx +++ b/x-pack/plugins/cases/public/components/all_cases/selector_modal/index.tsx @@ -6,7 +6,14 @@ */ import React, { useState, useCallback } from 'react'; -import { EuiModal, EuiModalBody, EuiModalHeader, EuiModalHeaderTitle } from '@elastic/eui'; +import { + EuiButton, + EuiModal, + EuiModalBody, + EuiModalFooter, + EuiModalHeader, + EuiModalHeaderTitle, +} from '@elastic/eui'; import styled from 'styled-components'; import { Case, @@ -76,6 +83,11 @@ const AllCasesSelectorModalComponent: React.FC = ({ updateCase={updateCase} /> + + + {i18n.CANCEL} + + ) : null; }; diff --git a/x-pack/plugins/cases/public/components/all_cases/translations.ts b/x-pack/plugins/cases/public/components/all_cases/translations.ts index be1aa256db65..5f5cb274ebf7 100644 --- a/x-pack/plugins/cases/public/components/all_cases/translations.ts +++ b/x-pack/plugins/cases/public/components/all_cases/translations.ts @@ -75,6 +75,10 @@ export const DELETE = i18n.translate('xpack.cases.caseTable.delete', { defaultMessage: 'Delete', }); +export const SELECT = i18n.translate('xpack.cases.caseTable.select', { + defaultMessage: 'Select', +}); + export const REQUIRES_UPDATE = i18n.translate('xpack.cases.caseTable.requiresUpdate', { defaultMessage: ' requires update', }); diff --git a/x-pack/plugins/cases/public/components/case_action_bar/index.tsx b/x-pack/plugins/cases/public/components/case_action_bar/index.tsx index af17ea0dca89..8149fd659164 100644 --- a/x-pack/plugins/cases/public/components/case_action_bar/index.tsx +++ b/x-pack/plugins/cases/public/components/case_action_bar/index.tsx @@ -86,7 +86,7 @@ const CaseActionBarComponent: React.FC = ({ {caseData.type !== CaseType.collection && ( - + {i18n.STATUS} = ({ )} - + {title} ( return ( <> - - - } - title={caseData.title} - > - - - + } + title={caseData.title} + > + + + diff --git a/x-pack/plugins/cases/public/components/truncated_text/index.tsx b/x-pack/plugins/cases/public/components/truncated_text/index.tsx index 8a480ed9dbdd..3cf7f8322d79 100644 --- a/x-pack/plugins/cases/public/components/truncated_text/index.tsx +++ b/x-pack/plugins/cases/public/components/truncated_text/index.tsx @@ -16,6 +16,7 @@ const Text = styled.span` -webkit-line-clamp: ${LINE_CLAMP}; -webkit-box-orient: vertical; overflow: hidden; + word-break: normal; `; interface Props { diff --git a/x-pack/plugins/cases/public/components/wrappers/index.tsx b/x-pack/plugins/cases/public/components/wrappers/index.tsx index 4c8a3a681f02..7a3d611413be 100644 --- a/x-pack/plugins/cases/public/components/wrappers/index.tsx +++ b/x-pack/plugins/cases/public/components/wrappers/index.tsx @@ -20,24 +20,10 @@ export const SectionWrapper = styled.div` width: 100%; `; -export const HeaderWrapper = styled.div` - ${({ theme }) => - ` - padding: ${theme.eui.paddingSizes.l} ${theme.eui.paddingSizes.l} 0 ${theme.eui.paddingSizes.l}; - @media only screen and (max-width: ${theme.eui.euiBreakpoints.s}) { - padding: ${theme.eui.paddingSizes.s} ${theme.eui.paddingSizes.s} 0 - ${theme.eui.paddingSizes.s}; - } - `}; -`; const gutterTimeline = '70px'; // seems to be a timeline reference from the original file export const ContentWrapper = styled.div` ${({ theme }) => ` - padding: ${theme.eui.paddingSizes.l} ${theme.eui.paddingSizes.l} ${gutterTimeline} ${theme.eui.paddingSizes.l}; - @media only screen and (max-width: ${theme.eui.euiBreakpoints.s}) { - padding: ${theme.eui.paddingSizes.s} ${theme.eui.paddingSizes.s} ${gutterTimeline} - ${theme.eui.paddingSizes.s}; - } + padding: ${theme.eui.paddingSizes.l} 0 ${gutterTimeline} 0; `}; `; diff --git a/x-pack/plugins/cases/public/containers/use_post_comment.tsx b/x-pack/plugins/cases/public/containers/use_post_comment.tsx index 8677787fd9af..2d4437826092 100644 --- a/x-pack/plugins/cases/public/containers/use_post_comment.tsx +++ b/x-pack/plugins/cases/public/containers/use_post_comment.tsx @@ -41,7 +41,7 @@ const dataFetchReducer = (state: NewCommentState, action: Action): NewCommentSta } }; -interface PostComment { +export interface PostComment { caseId: string; data: CommentRequest; updateCase?: (newCase: Case) => void; diff --git a/x-pack/plugins/cases/server/index.ts b/x-pack/plugins/cases/server/index.ts index 57db6e5565ff..765d21af8538 100644 --- a/x-pack/plugins/cases/server/index.ts +++ b/x-pack/plugins/cases/server/index.ts @@ -16,7 +16,7 @@ export const config: PluginConfigDescriptor = { markdownPlugins: true, }, deprecations: ({ renameFromRoot }) => [ - renameFromRoot('xpack.case.enabled', 'xpack.cases.enabled'), + renameFromRoot('xpack.case.enabled', 'xpack.cases.enabled', { level: 'critical' }), ], }; export const plugin = (initializerContext: PluginInitializerContext) => diff --git a/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/flash_messages_logic.mock.ts b/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/flash_messages_logic.mock.ts index 36a10fd234bf..d55c69d478b1 100644 --- a/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/flash_messages_logic.mock.ts +++ b/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/flash_messages_logic.mock.ts @@ -27,6 +27,7 @@ export const mockFlashMessageHelpers = { clearFlashMessages: jest.fn(), flashSuccessToast: jest.fn(), flashErrorToast: jest.fn(), + toastAPIErrors: jest.fn(), }; jest.mock('../../shared/flash_messages', () => ({ diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/handle_api_errors.test.ts b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/handle_api_errors.test.ts index 47cbef0bfd95..1e3705a3800e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/handle_api_errors.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/handle_api_errors.test.ts @@ -5,11 +5,14 @@ * 2.0. */ +jest.mock('./set_message_helpers', () => ({ + flashErrorToast: jest.fn(), +})); import '../../__mocks__/kea_logic/kibana_logic.mock'; import { FlashMessagesLogic } from './flash_messages_logic'; - -import { flashAPIErrors, getErrorsFromHttpResponse } from './handle_api_errors'; +import { flashAPIErrors, getErrorsFromHttpResponse, toastAPIErrors } from './handle_api_errors'; +import { flashErrorToast } from './set_message_helpers'; describe('flashAPIErrors', () => { const mockHttpError = { @@ -75,6 +78,56 @@ describe('flashAPIErrors', () => { }); }); +describe('toastAPIErrors', () => { + const mockHttpError = { + body: { + statusCode: 404, + error: 'Not Found', + message: 'Could not find X,Could not find Y,Something else bad happened', + attributes: { + errors: ['Could not find X', 'Could not find Y', 'Something else bad happened'], + }, + }, + } as any; + + beforeEach(() => { + jest.clearAllMocks(); + FlashMessagesLogic.mount(); + jest.spyOn(FlashMessagesLogic.actions, 'setFlashMessages'); + jest.spyOn(FlashMessagesLogic.actions, 'setQueuedMessages'); + }); + + it('converts API errors into flash messages', () => { + toastAPIErrors(mockHttpError); + + expect(flashErrorToast).toHaveBeenNthCalledWith(1, 'Could not find X'); + expect(flashErrorToast).toHaveBeenNthCalledWith(2, 'Could not find Y'); + expect(flashErrorToast).toHaveBeenNthCalledWith(3, 'Something else bad happened'); + }); + + it('falls back to the basic message for http responses without an errors array', () => { + toastAPIErrors({ + body: { + statusCode: 404, + error: 'Not Found', + message: 'Not Found', + }, + } as any); + + expect(flashErrorToast).toHaveBeenCalledWith('Not Found'); + }); + + it('displays a generic error message and re-throws non-API errors', () => { + const error = Error('whatever'); + + expect(() => { + toastAPIErrors(error as any); + }).toThrowError(error); + + expect(flashErrorToast).toHaveBeenCalledWith(expect.any(String)); + }); +}); + describe('getErrorsFromHttpResponse', () => { it('should return errors from the response if present', () => { expect( diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/handle_api_errors.ts b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/handle_api_errors.ts index abaa67e06f60..40863087004d 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/handle_api_errors.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/handle_api_errors.ts @@ -10,6 +10,7 @@ import { i18n } from '@kbn/i18n'; import { HttpResponse } from 'src/core/public'; import { FlashMessagesLogic } from './flash_messages_logic'; +import { flashErrorToast } from './set_message_helpers'; import { IFlashMessage } from './types'; /** @@ -69,3 +70,16 @@ export const flashAPIErrors = ( throw response; } }; + +export const toastAPIErrors = (response: HttpResponse) => { + const messages = getErrorsFromHttpResponse(response); + + for (const message of messages) { + flashErrorToast(message); + } + // If this was a programming error or a failed request (such as a CORS) error, + // we rethrow the error so it shows up in the developer console + if (!response?.body?.message) { + throw response; + } +}; diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/index.ts b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/index.ts index 097d38e0691c..3d3775aee960 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/index.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/index.ts @@ -8,7 +8,7 @@ export { FlashMessages, Toasts } from './flash_messages'; export { FlashMessagesLogic, mountFlashMessagesLogic } from './flash_messages_logic'; export type { IFlashMessage } from './types'; -export { flashAPIErrors } from './handle_api_errors'; +export { flashAPIErrors, toastAPIErrors } from './handle_api_errors'; export { setSuccessMessage, setErrorMessage, diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/tables/generic_endpoint_inline_editable_table/generic_endpoint_inline_editable_table_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/shared/tables/generic_endpoint_inline_editable_table/generic_endpoint_inline_editable_table_logic.test.ts index a77892a70d52..481013d91bf6 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/tables/generic_endpoint_inline_editable_table/generic_endpoint_inline_editable_table_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/tables/generic_endpoint_inline_editable_table/generic_endpoint_inline_editable_table_logic.test.ts @@ -5,6 +5,16 @@ * 2.0. */ +const MOCK_SET_ROW_ERRORS = jest.fn(); + +jest.mock('../inline_editable_table/inline_editable_table_logic', () => ({ + InlineEditableTableLogic: () => ({ + actions: { + setRowErrors: MOCK_SET_ROW_ERRORS, + }, + }), +})); + import { LogicMounter, mockFlashMessageHelpers, @@ -13,14 +23,12 @@ import { import { nextTick } from '@kbn/test/jest'; -import { itShowsServerErrorAsFlashMessage } from '../../../test_helpers'; - import { GenericEndpointInlineEditableTableLogic } from './generic_endpoint_inline_editable_table_logic'; describe('GenericEndpointInlineEditableTableLogic', () => { const { mount } = new LogicMounter(GenericEndpointInlineEditableTableLogic); const { http } = mockHttpValues; - const { flashAPIErrors } = mockFlashMessageHelpers; + const { toastAPIErrors } = mockFlashMessageHelpers; const DEFAULT_VALUES = { isLoading: false, @@ -121,9 +129,13 @@ describe('GenericEndpointInlineEditableTableLogic', () => { expect(logic.actions.clearLoading).toHaveBeenCalled(); }); - itShowsServerErrorAsFlashMessage(http.post, () => { + it('passes API errors to the nested inline editable table', async () => { + http.post.mockReturnValueOnce(Promise.reject('error')); const logic = mountLogic(); logic.actions.addItem(item, onSuccess); + await nextTick(); + + expect(MOCK_SET_ROW_ERRORS).toHaveBeenCalledWith(['An unexpected error occurred']); }); }); @@ -164,9 +176,13 @@ describe('GenericEndpointInlineEditableTableLogic', () => { expect(logic.actions.clearLoading).toHaveBeenCalled(); }); - itShowsServerErrorAsFlashMessage(http.delete, () => { + it('passes errors to the nested inline editable table', async () => { + http.delete.mockReturnValueOnce(Promise.reject('error')); const logic = mountLogic(); logic.actions.deleteItem(item, onSuccess); + await nextTick(); + + expect(MOCK_SET_ROW_ERRORS).toHaveBeenCalledWith(['An unexpected error occurred']); }); }); @@ -213,9 +229,13 @@ describe('GenericEndpointInlineEditableTableLogic', () => { expect(logic.actions.clearLoading).toHaveBeenCalled(); }); - itShowsServerErrorAsFlashMessage(http.put, () => { + it('passes errors to the nested inline editable table', async () => { + http.put.mockReturnValueOnce(Promise.reject('error')); const logic = mountLogic(); logic.actions.updateItem(item, onSuccess); + await nextTick(); + + expect(MOCK_SET_ROW_ERRORS).toHaveBeenCalledWith(['An unexpected error occurred']); }); }); @@ -281,7 +301,7 @@ describe('GenericEndpointInlineEditableTableLogic', () => { // It again calls back to the configured 'onReorder' to reset the order expect(DEFAULT_LOGIC_PARAMS.onReorder).toHaveBeenCalledWith(oldItems); - expect(flashAPIErrors).toHaveBeenCalledWith('error'); + expect(toastAPIErrors).toHaveBeenCalledWith('error'); }); it('does nothing if there are no reorder props', async () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/tables/generic_endpoint_inline_editable_table/generic_endpoint_inline_editable_table_logic.ts b/x-pack/plugins/enterprise_search/public/applications/shared/tables/generic_endpoint_inline_editable_table/generic_endpoint_inline_editable_table_logic.ts index 71c993dca9cb..b5beb2a74757 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/tables/generic_endpoint_inline_editable_table/generic_endpoint_inline_editable_table_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/tables/generic_endpoint_inline_editable_table/generic_endpoint_inline_editable_table_logic.ts @@ -7,9 +7,14 @@ import { kea, MakeLogicType } from 'kea'; -import { flashAPIErrors } from '../../flash_messages'; +import { toastAPIErrors } from '../../flash_messages'; +import { getErrorsFromHttpResponse } from '../../flash_messages/handle_api_errors'; import { HttpLogic } from '../../http'; +import { + InlineEditableTableLogic, + InlineEditableTableProps as InlineEditableTableLogicProps, +} from '../inline_editable_table/inline_editable_table_logic'; import { ItemWithAnID } from '../types'; @@ -91,7 +96,10 @@ export const GenericEndpointInlineEditableTableLogic = kea< onAdd(item, itemsFromResponse); onSuccess(); } catch (e) { - flashAPIErrors(e); + const errors = getErrorsFromHttpResponse(e); + InlineEditableTableLogic({ + instanceId: props.instanceId, + } as InlineEditableTableLogicProps).actions.setRowErrors(errors); } finally { actions.clearLoading(); } @@ -107,7 +115,10 @@ export const GenericEndpointInlineEditableTableLogic = kea< onDelete(item, itemsFromResponse); onSuccess(); } catch (e) { - flashAPIErrors(e); + const errors = getErrorsFromHttpResponse(e); + InlineEditableTableLogic({ + instanceId: props.instanceId, + } as InlineEditableTableLogicProps).actions.setRowErrors(errors); } finally { actions.clearLoading(); } @@ -126,7 +137,10 @@ export const GenericEndpointInlineEditableTableLogic = kea< onUpdate(item, itemsFromResponse); onSuccess(); } catch (e) { - flashAPIErrors(e); + const errors = getErrorsFromHttpResponse(e); + InlineEditableTableLogic({ + instanceId: props.instanceId, + } as InlineEditableTableLogicProps).actions.setRowErrors(errors); } finally { actions.clearLoading(); } @@ -152,7 +166,7 @@ export const GenericEndpointInlineEditableTableLogic = kea< onSuccess(); } catch (e) { onReorder(oldItems); - flashAPIErrors(e); + toastAPIErrors(e); } actions.clearLoading(); diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/action_column.test.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/action_column.test.tsx index 6328b01cd2be..4c9532b038a8 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/action_column.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/action_column.test.tsx @@ -23,9 +23,10 @@ describe('ActionColumn', () => { const mockValues = { doesEditingItemValueContainEmptyProperty: false, editingItemId: 1, - formErrors: [], + fieldErrors: {}, isEditing: false, isEditingUnsavedItem: false, + rowErrors: [], }; const mockActions = { editExistingItem: jest.fn(), @@ -87,10 +88,20 @@ describe('ActionColumn', () => { expect(subject(wrapper).prop('disabled')).toBe(true); }); - it('which is disabled if there are form errors', () => { + it('which is disabled if there are field errors', () => { setMockValues({ ...mockValues, - formErrors: ['I am an error'], + fieldErrors: { foo: ['I am an error for foo'] }, + }); + + const wrapper = shallow(); + expect(subject(wrapper).prop('disabled')).toBe(true); + }); + + it('which is disabled if there are row errors', () => { + setMockValues({ + ...mockValues, + rowErrors: ['I am a row error'], }); const wrapper = shallow(); diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/action_column.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/action_column.tsx index ec52b18adf64..3293e8c5021d 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/action_column.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/action_column.tsx @@ -41,7 +41,7 @@ export const ActionColumn = ({ lastItemWarning, uneditableItems, }: ActionColumnProps) => { - const { doesEditingItemValueContainEmptyProperty, formErrors, isEditingUnsavedItem } = + const { doesEditingItemValueContainEmptyProperty, fieldErrors, rowErrors, isEditingUnsavedItem } = useValues(InlineEditableTableLogic); const { editExistingItem, deleteItem, doneEditing, saveExistingItem, saveNewItem } = useActions(InlineEditableTableLogic); @@ -50,6 +50,8 @@ export const ActionColumn = ({ return null; } + const isInvalid = Object.keys(fieldErrors).length > 0 || rowErrors.length > 0; + if (isActivelyEditing(item)) { return ( @@ -59,11 +61,7 @@ export const ActionColumn = ({ color="primary" iconType="checkInCircleFilled" onClick={isEditingUnsavedItem ? saveNewItem : saveExistingItem} - disabled={ - isLoading || - Object.keys(formErrors).length > 0 || - doesEditingItemValueContainEmptyProperty - } + disabled={isLoading || isInvalid || doesEditingItemValueContainEmptyProperty} > {SAVE_BUTTON_LABEL} diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/editing_column.test.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/editing_column.test.tsx index 43ced1bd8749..3dcdc8a84ce3 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/editing_column.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/editing_column.test.tsx @@ -28,8 +28,9 @@ describe('EditingColumn', () => { }; const mockValues = { - formErrors: [], editingItemValue: { id: 1 }, + fieldErrors: {}, + rowErrors: [], }; const mockActions = { @@ -52,7 +53,7 @@ describe('EditingColumn', () => { beforeEach(() => { setMockValues({ ...mockValues, - formErrors: { + fieldErrors: { foo: 'I am an error for foo and should be displayed', }, }); @@ -70,7 +71,7 @@ describe('EditingColumn', () => { ); }); - it('renders form errors for this field if any are present', () => { + it('renders field errors for this field if any are present', () => { expect(shallow(wrapper.find(EuiFormRow).prop('helpText') as any).html()).toContain( 'I am an error for foo and should be displayed' ); @@ -81,6 +82,22 @@ describe('EditingColumn', () => { }); }); + describe('when there is a form error for this row', () => { + let wrapper: ShallowWrapper; + beforeEach(() => { + setMockValues({ + ...mockValues, + rowErrors: ['I am an error for this row'], + }); + + wrapper = shallow(); + }); + + it('renders as invalid', () => { + expect(wrapper.find(EuiFormRow).prop('isInvalid')).toBe(true); + }); + }); + it('renders nothing if there is no editingItemValue in state', () => { setMockValues({ ...mockValues, @@ -95,7 +112,7 @@ describe('EditingColumn', () => { setMockValues({ ...mockValues, editingItemValue: { id: 1, foo: 'foo', bar: 'bar' }, - formErrors: { foo: ['I am an error for foo'] }, + fieldErrors: { foo: ['I am an error for foo'] }, }); const wrapper = shallow( diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/editing_column.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/editing_column.tsx index d3d36046dc0a..99b06ef827de 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/editing_column.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/editing_column.tsx @@ -25,20 +25,25 @@ export const EditingColumn = ({ column, isLoading = false, }: EditingColumnProps) => { - const { formErrors, editingItemValue } = useValues(InlineEditableTableLogic); + const { fieldErrors, rowErrors, editingItemValue } = useValues(InlineEditableTableLogic); const { setEditingItemValue } = useActions(InlineEditableTableLogic); if (!editingItemValue) return null; + const fieldError = fieldErrors[column.field]; + const isInvalid = !!fieldError || rowErrors.length > 0; + return ( - {formErrors[column.field]} - + fieldError && ( + + {fieldError} + + ) } - isInvalid={!!formErrors[column.field]} + isInvalid={isInvalid} > <> {column.editingRender( @@ -50,7 +55,7 @@ export const EditingColumn = ({ }); }, { - isInvalid: !!formErrors[column.field], + isInvalid, isLoading, } )} diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/inline_editable_table.test.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/inline_editable_table.test.tsx index ab59616e9ce7..c8d3079b033c 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/inline_editable_table.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/inline_editable_table.test.tsx @@ -153,6 +153,21 @@ describe('InlineEditableTable', () => { expect(rowProps(items[1])).toEqual({ className: 'is-being-edited' }); }); + it('will pass errors for row that is currently being edited', () => { + setMockValues({ + ...mockValues, + isEditing: true, + editingItemId: 2, + rowErrors: ['first error', 'second error'], + }); + const itemList = [{ id: 1 }, { id: 2 }]; + const wrapper = shallow(); + const rowErrors = wrapper.find(ReorderableTable).prop('rowErrors') as (item: any) => object; + expect(rowErrors(items[0])).toEqual(undefined); + // Since editingItemId is 2 and the second item (position 1) in item list has an id of 2, it gets the errors + expect(rowErrors(items[1])).toEqual(['first error', 'second error']); + }); + it('will update the passed columns and pass them through to the underlying table', () => { const updatedColumns = {}; const canRemoveLastItem = true; diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/inline_editable_table.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/inline_editable_table.tsx index 093692dfde33..3c670264dff2 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/inline_editable_table.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/inline_editable_table.tsx @@ -95,7 +95,8 @@ export const InlineEditableTableContents = ({ uneditableItems, ...rest }: InlineEditableTableProps) => { - const { editingItemId, isEditing, isEditingUnsavedItem } = useValues(InlineEditableTableLogic); + const { editingItemId, isEditing, isEditingUnsavedItem, rowErrors } = + useValues(InlineEditableTableLogic); const { editNewItem, reorderItems } = useActions(InlineEditableTableLogic); // TODO These two things shoud just be selectors @@ -168,6 +169,7 @@ export const InlineEditableTableContents = ({ 'is-being-edited': isActivelyEditing(item), }), })} + rowErrors={(item) => (isActivelyEditing(item) ? rowErrors : undefined)} noItemsMessage={noItemsMessage(editNewItem)} onReorder={reorderItems} disableDragging={isEditing} diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/inline_editable_table_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/inline_editable_table_logic.test.ts index f690a38620ec..5a8a72407622 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/inline_editable_table_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/inline_editable_table_logic.test.ts @@ -29,8 +29,9 @@ describe('InlineEditableTableLogic', () => { const DEFAULT_VALUES = { editingItemId: null, editingItemValue: null, - formErrors: {}, + fieldErrors: {}, isEditing: false, + rowErrors: [], }; const SELECTORS = { @@ -91,7 +92,7 @@ describe('InlineEditableTableLogic', () => { isEditing: true, editingItemId: 1, editingItemValue: {}, - formErrors: { foo: 'I am error' }, + fieldErrors: { foo: 'I am error for foo' }, }); logic.actions.doneEditing(); expect(logicValuesWithoutSelectors(logic)).toEqual(DEFAULT_VALUES); @@ -152,29 +153,41 @@ describe('InlineEditableTableLogic', () => { }); }); - describe('setFormErrors', () => { - it('sets formErrors', () => { - const formErrors = { - bar: 'I am an error', + describe('setFieldErrors', () => { + it('sets fieldErrors', () => { + const fieldErrors = { + foo: 'I am an error for foo', }; const logic = mountLogic(); - logic.actions.setFormErrors(formErrors); + logic.actions.setFieldErrors(fieldErrors); expect(logicValuesWithoutSelectors(logic)).toEqual({ ...DEFAULT_VALUES, - formErrors, + fieldErrors, + }); + }); + }); + + describe('setRowErrors', () => { + it('sets rowErrors', () => { + const rowErrors = ['I am a row error']; + const logic = mountLogic(); + logic.actions.setRowErrors(rowErrors); + expect(logicValuesWithoutSelectors(logic)).toEqual({ + ...DEFAULT_VALUES, + rowErrors, }); }); }); describe('setEditingItemValue', () => { - it('updates the state of the item currently being edited and resets form errors', () => { + it('updates the state of the item currently being edited and resets field errors', () => { const logic = mountLogic({ editingItemValue: { id: 1, foo: '', bar: '', }, - formErrors: { foo: 'I am error' }, + fieldErrors: { foo: 'I am error for foo' }, }); logic.actions.setEditingItemValue({ id: 1, @@ -188,7 +201,7 @@ describe('InlineEditableTableLogic', () => { foo: 'blah blah', bar: '', }, - formErrors: {}, + fieldErrors: {}, }); }); }); @@ -297,20 +310,20 @@ describe('InlineEditableTableLogic', () => { ); }); - it('will set form errors and not call the provided onUpdate callback if the item being edited does not validate', () => { + it('will set field errors and not call the provided onUpdate callback if the item being edited does not validate', () => { const editingItemValue = {}; - const formErrors = { + const fieldErrors = { foo: 'some error', }; - DEFAULT_LOGIC_PARAMS.validateItem.mockReturnValue(formErrors); + DEFAULT_LOGIC_PARAMS.validateItem.mockReturnValue(fieldErrors); const logic = mountLogic({ ...DEFAULT_VALUES, editingItemValue, }); - jest.spyOn(logic.actions, 'setFormErrors'); + jest.spyOn(logic.actions, 'setFieldErrors'); logic.actions.saveExistingItem(); expect(DEFAULT_LOGIC_PARAMS.onUpdate).not.toHaveBeenCalled(); - expect(logic.actions.setFormErrors).toHaveBeenCalledWith(formErrors); + expect(logic.actions.setFieldErrors).toHaveBeenCalledWith(fieldErrors); }); it('will do neither if no value is currently being edited', () => { @@ -319,10 +332,10 @@ describe('InlineEditableTableLogic', () => { ...DEFAULT_VALUES, editingItemValue, }); - jest.spyOn(logic.actions, 'setFormErrors'); + jest.spyOn(logic.actions, 'setFieldErrors'); logic.actions.saveExistingItem(); expect(DEFAULT_LOGIC_PARAMS.onUpdate).not.toHaveBeenCalled(); - expect(logic.actions.setFormErrors).not.toHaveBeenCalled(); + expect(logic.actions.setFieldErrors).not.toHaveBeenCalled(); }); it('will always call the provided onUpdate callback if no validateItem param was provided', () => { @@ -382,20 +395,20 @@ describe('InlineEditableTableLogic', () => { ); }); - it('will set form errors and not call the provided onAdd callback if the item being edited does not validate', () => { + it('will set field errors and not call the provided onAdd callback if the item being edited does not validate', () => { const editingItemValue = {}; - const formErrors = { + const fieldErrors = { foo: 'some error', }; - DEFAULT_LOGIC_PARAMS.validateItem.mockReturnValue(formErrors); + DEFAULT_LOGIC_PARAMS.validateItem.mockReturnValue(fieldErrors); const logic = mountLogic({ ...DEFAULT_VALUES, editingItemValue, }); - jest.spyOn(logic.actions, 'setFormErrors'); + jest.spyOn(logic.actions, 'setFieldErrors'); logic.actions.saveNewItem(); expect(DEFAULT_LOGIC_PARAMS.onAdd).not.toHaveBeenCalled(); - expect(logic.actions.setFormErrors).toHaveBeenCalledWith(formErrors); + expect(logic.actions.setFieldErrors).toHaveBeenCalledWith(fieldErrors); }); it('will do nothing if no value is currently being edited', () => { @@ -404,10 +417,10 @@ describe('InlineEditableTableLogic', () => { ...DEFAULT_VALUES, editingItemValue, }); - jest.spyOn(logic.actions, 'setFormErrors'); + jest.spyOn(logic.actions, 'setFieldErrors'); logic.actions.saveNewItem(); expect(DEFAULT_LOGIC_PARAMS.onAdd).not.toHaveBeenCalled(); - expect(logic.actions.setFormErrors).not.toHaveBeenCalled(); + expect(logic.actions.setFieldErrors).not.toHaveBeenCalled(); }); it('will always call the provided onAdd callback if no validateItem param was provided', () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/inline_editable_table_logic.ts b/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/inline_editable_table_logic.ts index 0230fc075412..04b5ceb99885 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/inline_editable_table_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/inline_editable_table_logic.ts @@ -20,7 +20,8 @@ interface InlineEditableTableActions { saveExistingItem(): void; saveNewItem(): void; setEditingItemValue(newValue: Item): { item: Item }; - setFormErrors(formErrors: FormErrors): { formErrors: FormErrors }; + setFieldErrors(fieldErrors: FormErrors): { fieldErrors: FormErrors }; + setRowErrors(rowErrors: string[]): { rowErrors: string[] }; } const generateEmptyItem = ( @@ -39,12 +40,13 @@ interface InlineEditableTableValues { // TODO we should editingItemValue have editingItemValue and editingItemId should be a selector editingItemId: Item['id'] | null; // editingItem is null when the user is editing a new but not saved item editingItemValue: Item | null; - formErrors: FormErrors; + fieldErrors: FormErrors; + rowErrors: string[]; isEditingUnsavedItem: boolean; doesEditingItemValueContainEmptyProperty: boolean; } -interface InlineEditableTableProps { +export interface InlineEditableTableProps { columns: Array>; instanceId: string; // TODO Because these callbacks are params, they are only set on the logic once (i.e., they are cached) @@ -75,7 +77,8 @@ export const InlineEditableTableLogic = kea ({ item: newValue }), - setFormErrors: (formErrors) => ({ formErrors }), + setFieldErrors: (fieldErrors) => ({ fieldErrors }), + setRowErrors: (rowErrors) => ({ rowErrors }), }), reducers: ({ props: { columns } }) => ({ isEditing: [ @@ -103,12 +106,20 @@ export const InlineEditableTableLogic = kea item, }, ], - formErrors: [ + fieldErrors: [ {}, { doneEditing: () => ({}), setEditingItemValue: () => ({}), - setFormErrors: (_, { formErrors }) => formErrors, + setFieldErrors: (_, { fieldErrors }) => fieldErrors, + }, + ], + rowErrors: [ + [], + { + doneEditing: () => [], + setEditingItemValue: () => [], + setRowErrors: (_, { rowErrors }) => rowErrors, }, ], }), @@ -144,7 +155,7 @@ export const InlineEditableTableLogic = kea { const cells = wrapper.find(Cell); expect(cells.length).toBe(3); }); + + it('will render row errors', () => { + const wrapper = shallow( + + ); + const callouts = wrapper.find(EuiCallOut); + expect(callouts.length).toBe(2); + expect(callouts.at(0).prop('title')).toEqual('first error'); + expect(callouts.at(1).prop('title')).toEqual('second error'); + }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/tables/reorderable_table/body_row.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/tables/reorderable_table/body_row.tsx index 474d49f5eef0..588f14190d27 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/tables/reorderable_table/body_row.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/tables/reorderable_table/body_row.tsx @@ -7,7 +7,7 @@ import React from 'react'; -import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; +import { EuiCallOut, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { Cell } from './cell'; import { DRAGGABLE_UX_STYLE } from './constants'; @@ -19,6 +19,7 @@ export interface BodyRowProps { additionalProps?: object; // Cell to put in first column before other columns leftAction?: React.ReactNode; + errors?: string[]; } export const BodyRow = ({ @@ -26,6 +27,7 @@ export const BodyRow = ({ item, additionalProps, leftAction, + errors = [], }: BodyRowProps) => { return (
@@ -46,6 +48,15 @@ export const BodyRow = ({ + {errors.length > 0 && ( + + {errors.map((errorMessage, errorMessageIndex) => ( + + + + ))} + + )}
); }; diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/tables/reorderable_table/draggable_body_row.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/tables/reorderable_table/draggable_body_row.tsx index 191843a2e6e7..9a21d5a9c8c2 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/tables/reorderable_table/draggable_body_row.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/tables/reorderable_table/draggable_body_row.tsx @@ -18,6 +18,7 @@ export interface DraggableBodyRowProps { rowIndex: number; additionalProps?: object; disableDragging?: boolean; + errors?: string[]; } export const DraggableBodyRow = ({ @@ -26,6 +27,7 @@ export const DraggableBodyRow = ({ rowIndex, additionalProps, disableDragging = false, + errors, }: DraggableBodyRowProps) => { const draggableId = `draggable_row_${rowIndex}`; @@ -42,6 +44,7 @@ export const DraggableBodyRow = ({ item={item} additionalProps={additionalProps} leftAction={!disableDragging ? : <>} + errors={errors} /> ); diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/tables/reorderable_table/reorderable_table.scss b/x-pack/plugins/enterprise_search/public/applications/shared/tables/reorderable_table/reorderable_table.scss index d2ea90bbbfec..81ae229dcdd4 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/tables/reorderable_table/reorderable_table.scss +++ b/x-pack/plugins/enterprise_search/public/applications/shared/tables/reorderable_table/reorderable_table.scss @@ -9,14 +9,18 @@ border-top: $euiBorderThin; background-color: $euiColorEmptyShade; - > .euiFlexGroup--directionRow.euiFlexGroup--gutterLarge { + > .euiFlexGroup { margin: 0; } + + > .euiFlexGroup:nth-child(2) > .euiFlexItem { + margin-top: 0; + } } &Header { - > .euiFlexGroup--directionRow.euiFlexGroup--gutterLarge { - margin: -12px 0; + > .euiFlexGroup { + margin: ($euiSizeM * -1) 0; } } diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/tables/reorderable_table/reorderable_table.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/tables/reorderable_table/reorderable_table.tsx index 4cb12321bdfc..88e80f1d5401 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/tables/reorderable_table/reorderable_table.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/tables/reorderable_table/reorderable_table.tsx @@ -30,6 +30,7 @@ interface ReorderableTableProps { disableReordering?: boolean; onReorder?: (items: Item[], oldItems: Item[]) => void; rowProps?: (item: Item) => object; + rowErrors?: (item: Item) => string[] | undefined; } export const ReorderableTable = ({ @@ -42,6 +43,7 @@ export const ReorderableTable = ({ disableReordering = false, onReorder = () => undefined, rowProps = () => ({}), + rowErrors = () => undefined, }: ReorderableTableProps) => { return (
@@ -67,6 +69,7 @@ export const ReorderableTable = ({ additionalProps={rowProps(item)} disableDragging={disableDragging} rowIndex={itemIndex} + errors={rowErrors(item)} /> )} onReorder={onReorder} @@ -83,6 +86,7 @@ export const ReorderableTable = ({ columns={columns} item={item} additionalProps={rowProps(item)} + errors={rowErrors(item)} /> )} /> @@ -97,6 +101,7 @@ export const ReorderableTable = ({ columns={columns} item={item} additionalProps={rowProps(item)} + errors={rowErrors(item)} leftAction={<>} /> )} diff --git a/x-pack/plugins/fleet/common/constants/agent.ts b/x-pack/plugins/fleet/common/constants/agent.ts index e38b7a6b5832..832a9027c651 100644 --- a/x-pack/plugins/fleet/common/constants/agent.ts +++ b/x-pack/plugins/fleet/common/constants/agent.ts @@ -5,8 +5,7 @@ * 2.0. */ -export const AGENT_SAVED_OBJECT_TYPE = 'fleet-agents'; -export const AGENT_ACTION_SAVED_OBJECT_TYPE = 'fleet-agent-actions'; +export const AGENTS_PREFIX = 'fleet-agents'; export const AGENT_TYPE_PERMANENT = 'PERMANENT'; export const AGENT_TYPE_EPHEMERAL = 'EPHEMERAL'; diff --git a/x-pack/plugins/fleet/common/constants/enrollment_api_key.ts b/x-pack/plugins/fleet/common/constants/enrollment_api_key.ts index 25d395893aae..c9a449939ef3 100644 --- a/x-pack/plugins/fleet/common/constants/enrollment_api_key.ts +++ b/x-pack/plugins/fleet/common/constants/enrollment_api_key.ts @@ -5,6 +5,4 @@ * 2.0. */ -export const ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE = 'fleet-enrollment-api-keys'; - export const ENROLLMENT_API_KEYS_INDEX = '.fleet-enrollment-api-keys'; diff --git a/x-pack/plugins/fleet/common/constants/routes.ts b/x-pack/plugins/fleet/common/constants/routes.ts index aa5e0dbcd5ed..be4103c549f1 100644 --- a/x-pack/plugins/fleet/common/constants/routes.ts +++ b/x-pack/plugins/fleet/common/constants/routes.ts @@ -12,7 +12,6 @@ export const EPM_API_ROOT = `${API_ROOT}/epm`; export const DATA_STREAM_API_ROOT = `${API_ROOT}/data_streams`; export const PACKAGE_POLICY_API_ROOT = `${API_ROOT}/package_policies`; export const AGENT_POLICY_API_ROOT = `${API_ROOT}/agent_policies`; -export const FLEET_API_ROOT_7_9 = `/api/ingest_manager/fleet`; export const LIMITED_CONCURRENCY_ROUTE_TAG = 'ingest:limited-concurrency'; diff --git a/x-pack/plugins/fleet/common/types/models/agent.ts b/x-pack/plugins/fleet/common/types/models/agent.ts index 6913fc52d8c6..018f591fef79 100644 --- a/x-pack/plugins/fleet/common/types/models/agent.ts +++ b/x-pack/plugins/fleet/common/types/models/agent.ts @@ -66,15 +66,6 @@ export interface AgentPolicyAction extends NewAgentAction { ack_data?: any; } -// Make policy change action renaming BWC with agent version <= 7.9 -// eslint-disable-next-line @typescript-eslint/naming-convention -export type AgentPolicyActionV7_9 = Omit & { - type: 'CONFIG_CHANGE'; - data: { - config: FullAgentPolicy; - }; -}; - interface CommonAgentActionSOAttributes { type: AgentActionType; sent_at?: string; diff --git a/x-pack/plugins/fleet/dev_docs/data_model.md b/x-pack/plugins/fleet/dev_docs/data_model.md index ec9fa031d09d..be0e06e5439d 100644 --- a/x-pack/plugins/fleet/dev_docs/data_model.md +++ b/x-pack/plugins/fleet/dev_docs/data_model.md @@ -37,8 +37,6 @@ All of the code that interacts with this index is currently located in [`x-pack/plugins/fleet/server/services/agents/crud.ts`](../server/services/agents/crud.ts) and the schema of these documents is maintained by the `FleetServerAgent` TypeScript interface. -Prior to Fleet Server, this data was stored in the `fleet-agents` Saved Object type which is now obsolete. - ### `.fleet-actions` index Each document in this index represents an action that was initiated by a user and needs to be processed by Fleet Server @@ -167,46 +165,3 @@ represents the relative file path of the file from the package contents Used as "tombstone record" to indicate that a package that was installed by default through preconfiguration was explicitly deleted by user. Used to avoid recreating a preconfiguration policy that a user explicitly does not want. - -### `fleet-agents` - -**DEPRECATED in favor of `.fleet-agents` index.** - -- Constant in code: `AGENT_SAVED_OBJECT_TYPE` -- Introduced in ? -- [Code Link](../server/saved_objects/index.ts#76) -- Migrations: 7.10.0, 7.12.0 -- References to other objects: - - `policy_id` - ID that points to the policy (`ingest-agent-policies`) this agent is assigned to. - - `access_api_key_id` - - `default_api_key_id` - -Tracks an individual Elastic Agent's enrollment in the Fleet, which policy it is current assigned to, its check in -status, which packages are currently installed, and other metadata about the Agent. - -### `fleet-agent-actions` - -**DEPRECATED in favor of `.fleet-agent-actions` index.** - -- Constant in code: `AGENT_ACTION_SAVED_OBJECT_TYPE` -- Introduced in ? -- [Code Link](../server/saved_objects/index.ts#113) -- Migrations: 7.10.0 -- References to other objects: - - `agent_id` - ID that points to the agent for this action (`fleet-agents`) - - `policy_id`- ID that points to the policy for this action (`ingest-agent-policies`) - - -### `fleet-enrollment-api-keys` - -**DEPRECATED in favor of `.fleet-enrollment-api-keys` index.** - -- Constant in code: `ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE` -- Introduced in ? -- [Code Link](../server/saved_objects/index.ts#166) -- Migrations: 7.10.0 -- References to other objects: - - `api_key_id` - - `policy_id` - ID that points to an agent policy (`ingest-agent-policies`) - -Contains an enrollment key that can be used to enroll a new agent in a specific agent policy. \ No newline at end of file diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/search_bar.tsx b/x-pack/plugins/fleet/public/applications/fleet/components/search_bar.tsx index 70becfe40d8e..f1a23ea759de 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/components/search_bar.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/components/search_bar.tsx @@ -12,9 +12,9 @@ import { fromKueryExpression } from '@kbn/es-query'; import type { IFieldType } from '../../../../../../../src/plugins/data/public'; import { QueryStringInput } from '../../../../../../../src/plugins/data/public'; import { useStartServices } from '../hooks'; -import { INDEX_NAME, AGENT_SAVED_OBJECT_TYPE } from '../constants'; +import { INDEX_NAME, AGENTS_PREFIX } from '../constants'; -const HIDDEN_FIELDS = [`${AGENT_SAVED_OBJECT_TYPE}.actions`, '_id', '_index']; +const HIDDEN_FIELDS = [`${AGENTS_PREFIX}.actions`, '_id', '_index']; interface Props { value: string; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_delete_provider.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_delete_provider.tsx index c5d0e5279220..b8d8f212a545 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_delete_provider.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_delete_provider.tsx @@ -10,7 +10,7 @@ import { EuiConfirmModal, EuiCallOut } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { AGENT_SAVED_OBJECT_TYPE } from '../../../constants'; +import { AGENTS_PREFIX } from '../../../constants'; import { sendDeleteAgentPolicy, useStartServices, useConfig, sendRequest } from '../../../hooks'; interface Props { @@ -98,7 +98,7 @@ export const AgentPolicyDeleteProvider: React.FunctionComponent = ({ chil path: `/api/fleet/agents`, method: 'get', query: { - kuery: `${AGENT_SAVED_OBJECT_TYPE}.policy_id : ${agentPolicyToCheck}`, + kuery: `${AGENTS_PREFIX}.policy_id : ${agentPolicyToCheck}`, }, }); setAgentsCount(data?.total || 0); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.tsx index c6e92cbce8d1..9ba63475aaaa 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.tsx @@ -42,7 +42,7 @@ import { ContextMenuActions, } from '../../../components'; import { AgentStatusKueryHelper, isAgentUpgradeable } from '../../../services'; -import { AGENT_SAVED_OBJECT_TYPE, FLEET_SERVER_PACKAGE } from '../../../constants'; +import { AGENTS_PREFIX, FLEET_SERVER_PACKAGE } from '../../../constants'; import { AgentReassignAgentPolicyModal, AgentHealth, @@ -207,7 +207,7 @@ export const AgentListPage: React.FunctionComponent<{}> = () => { if (kueryBuilder) { kueryBuilder = `(${kueryBuilder}) and`; } - kueryBuilder = `${kueryBuilder} ${AGENT_SAVED_OBJECT_TYPE}.policy_id : (${selectedAgentPolicies + kueryBuilder = `${kueryBuilder} ${AGENTS_PREFIX}.policy_id : (${selectedAgentPolicies .map((agentPolicy) => `"${agentPolicy}"`) .join(' or ')})`; } diff --git a/x-pack/plugins/fleet/public/components/linked_agent_count.tsx b/x-pack/plugins/fleet/public/components/linked_agent_count.tsx index f9b2727f4893..dcbda2e1445c 100644 --- a/x-pack/plugins/fleet/public/components/linked_agent_count.tsx +++ b/x-pack/plugins/fleet/public/components/linked_agent_count.tsx @@ -11,7 +11,7 @@ import type { EuiLinkAnchorProps } from '@elastic/eui'; import { EuiLink } from '@elastic/eui'; import { useLink } from '../hooks'; -import { AGENT_SAVED_OBJECT_TYPE } from '../constants'; +import { AGENTS_PREFIX } from '../constants'; /** * Displays the provided `count` number as a link to the Agents list if it is greater than zero @@ -37,7 +37,7 @@ export const LinkedAgentCount = memo< {displayValue} diff --git a/x-pack/plugins/fleet/public/components/package_policy_delete_provider.tsx b/x-pack/plugins/fleet/public/components/package_policy_delete_provider.tsx index e2522f40ef96..7c2703ec8437 100644 --- a/x-pack/plugins/fleet/public/components/package_policy_delete_provider.tsx +++ b/x-pack/plugins/fleet/public/components/package_policy_delete_provider.tsx @@ -11,7 +11,7 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import { useStartServices, sendRequest, sendDeletePackagePolicy, useConfig } from '../hooks'; -import { AGENT_API_ROUTES, AGENT_SAVED_OBJECT_TYPE } from '../../common/constants'; +import { AGENT_API_ROUTES, AGENTS_PREFIX } from '../../common/constants'; import type { AgentPolicy } from '../types'; interface Props { @@ -53,7 +53,7 @@ export const PackagePolicyDeleteProvider: React.FunctionComponent = ({ query: { page: 1, perPage: 1, - kuery: `${AGENT_SAVED_OBJECT_TYPE}.policy_id : ${agentPolicy.id}`, + kuery: `${AGENTS_PREFIX}.policy_id : ${agentPolicy.id}`, }, }); setAgentsCount(data?.total || 0); diff --git a/x-pack/plugins/fleet/public/constants/index.ts b/x-pack/plugins/fleet/public/constants/index.ts index 32dd732c53de..38b7875c93b3 100644 --- a/x-pack/plugins/fleet/public/constants/index.ts +++ b/x-pack/plugins/fleet/public/constants/index.ts @@ -12,8 +12,7 @@ export { AGENT_API_ROUTES, SO_SEARCH_LIMIT, AGENT_POLICY_SAVED_OBJECT_TYPE, - AGENT_SAVED_OBJECT_TYPE, - ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE, + AGENTS_PREFIX, PACKAGE_POLICY_SAVED_OBJECT_TYPE, FLEET_SERVER_PACKAGE, // Fleet Server index diff --git a/x-pack/plugins/fleet/server/collectors/agent_collectors.ts b/x-pack/plugins/fleet/server/collectors/agent_collectors.ts index 43c15e603a87..9b7d48328467 100644 --- a/x-pack/plugins/fleet/server/collectors/agent_collectors.ts +++ b/x-pack/plugins/fleet/server/collectors/agent_collectors.ts @@ -9,7 +9,6 @@ import type { SavedObjectsClient, ElasticsearchClient } from 'kibana/server'; import type { FleetConfigType } from '../../common/types'; import * as AgentService from '../services/agents'; -import { isFleetServerSetup } from '../services/fleet_server'; export interface AgentUsage { total_enrolled: number; @@ -26,7 +25,7 @@ export const getAgentUsage = async ( esClient?: ElasticsearchClient ): Promise => { // TODO: unsure if this case is possible at all. - if (!soClient || !esClient || !(await isFleetServerSetup())) { + if (!soClient || !esClient) { return { total_enrolled: 0, healthy: 0, diff --git a/x-pack/plugins/fleet/server/collectors/fleet_server_collector.ts b/x-pack/plugins/fleet/server/collectors/fleet_server_collector.ts index 47440e791747..a08ed450b5b3 100644 --- a/x-pack/plugins/fleet/server/collectors/fleet_server_collector.ts +++ b/x-pack/plugins/fleet/server/collectors/fleet_server_collector.ts @@ -10,7 +10,6 @@ import type { SavedObjectsClient, ElasticsearchClient } from 'kibana/server'; import { packagePolicyService, settingsService } from '../services'; import { getAgentStatusForAgentPolicy } from '../services/agents'; -import { isFleetServerSetup } from '../services/fleet_server'; const DEFAULT_USAGE = { total_all_statuses: 0, @@ -36,7 +35,7 @@ export const getFleetServerUsage = async ( soClient?: SavedObjectsClient, esClient?: ElasticsearchClient ): Promise => { - if (!soClient || !esClient || !(await isFleetServerSetup())) { + if (!soClient || !esClient) { return DEFAULT_USAGE; } diff --git a/x-pack/plugins/fleet/server/constants/index.ts b/x-pack/plugins/fleet/server/constants/index.ts index bfb1f3ec433f..633390c36895 100644 --- a/x-pack/plugins/fleet/server/constants/index.ts +++ b/x-pack/plugins/fleet/server/constants/index.ts @@ -35,14 +35,12 @@ export { PRECONFIGURATION_API_ROUTES, // Saved object types SO_SEARCH_LIMIT, - AGENT_SAVED_OBJECT_TYPE, - AGENT_ACTION_SAVED_OBJECT_TYPE, + AGENTS_PREFIX, AGENT_POLICY_SAVED_OBJECT_TYPE, PACKAGE_POLICY_SAVED_OBJECT_TYPE, OUTPUT_SAVED_OBJECT_TYPE, PACKAGES_SAVED_OBJECT_TYPE, ASSETS_SAVED_OBJECT_TYPE, - ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE, GLOBAL_SETTINGS_SAVED_OBJECT_TYPE, // Defaults DEFAULT_AGENT_POLICY, diff --git a/x-pack/plugins/fleet/server/index.test.ts b/x-pack/plugins/fleet/server/index.test.ts deleted file mode 100644 index 724bb9ad91ab..000000000000 --- a/x-pack/plugins/fleet/server/index.test.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { applyDeprecations, configDeprecationFactory } from '@kbn/config'; - -import { configDeprecationsMock } from '../../../../src/core/server/mocks'; - -import { config } from '.'; - -const deprecationContext = configDeprecationsMock.createContext(); - -const applyConfigDeprecations = (settings: Record = {}) => { - if (!config.deprecations) { - throw new Error('Config is not valid no deprecations'); - } - const deprecations = config.deprecations(configDeprecationFactory); - const deprecationMessages: string[] = []; - const migrated = applyDeprecations( - settings, - deprecations.map((deprecation) => ({ - deprecation, - path: '', - context: deprecationContext, - })), - () => - ({ message }) => - deprecationMessages.push(message) - ); - return { - messages: deprecationMessages, - migrated: migrated.config, - }; -}; - -describe('Config depreciation test', () => { - it('should migrate old xpack.ingestManager.fleet settings to xpack.fleet.agents', () => { - const { migrated } = applyConfigDeprecations({ - xpack: { - ingestManager: { - fleet: { enabled: true, elasticsearch: { host: 'http://testes.fr:9200' } }, - }, - }, - }); - - expect(migrated).toMatchInlineSnapshot(` - Object { - "xpack": Object { - "fleet": Object { - "agents": Object { - "elasticsearch": Object { - "hosts": Array [ - "http://testes.fr:9200", - ], - }, - "enabled": true, - }, - }, - }, - } - `); - }); - - it('should support mixing xpack.ingestManager config and xpack.fleet config', () => { - const { migrated } = applyConfigDeprecations({ - xpack: { - ingestManager: { registryUrl: 'http://registrytest.fr' }, - fleet: { registryProxyUrl: 'http://registryProxy.fr' }, - }, - }); - - expect(migrated).toMatchInlineSnapshot(` - Object { - "xpack": Object { - "fleet": Object { - "registryProxyUrl": "http://registryProxy.fr", - "registryUrl": "http://registrytest.fr", - }, - }, - } - `); - }); -}); diff --git a/x-pack/plugins/fleet/server/index.ts b/x-pack/plugins/fleet/server/index.ts index e1ee2652594c..c3dd408925cf 100644 --- a/x-pack/plugins/fleet/server/index.ts +++ b/x-pack/plugins/fleet/server/index.ts @@ -44,52 +44,6 @@ export const config: PluginConfigDescriptor = { agents: true, }, deprecations: ({ renameFromRoot, unused, unusedFromRoot }) => [ - // Fleet plugin was named ingestManager before - renameFromRoot('xpack.ingestManager.enabled', 'xpack.fleet.enabled', { level: 'critical' }), - renameFromRoot('xpack.ingestManager.registryUrl', 'xpack.fleet.registryUrl', { - level: 'critical', - }), - renameFromRoot('xpack.ingestManager.registryProxyUrl', 'xpack.fleet.registryProxyUrl', { - level: 'critical', - }), - renameFromRoot('xpack.ingestManager.fleet', 'xpack.ingestManager.agents', { - level: 'critical', - }), - renameFromRoot('xpack.ingestManager.agents.enabled', 'xpack.fleet.agents.enabled', { - level: 'critical', - }), - renameFromRoot('xpack.ingestManager.agents.elasticsearch', 'xpack.fleet.agents.elasticsearch', { - level: 'critical', - }), - renameFromRoot( - 'xpack.ingestManager.agents.tlsCheckDisabled', - 'xpack.fleet.agents.tlsCheckDisabled', - { level: 'critical' } - ), - renameFromRoot( - 'xpack.ingestManager.agents.pollingRequestTimeout', - 'xpack.fleet.agents.pollingRequestTimeout', - { level: 'critical' } - ), - renameFromRoot( - 'xpack.ingestManager.agents.maxConcurrentConnections', - 'xpack.fleet.agents.maxConcurrentConnections', - { level: 'critical' } - ), - renameFromRoot('xpack.ingestManager.agents.kibana', 'xpack.fleet.agents.kibana', { - level: 'critical', - }), - renameFromRoot( - 'xpack.ingestManager.agents.agentPolicyRolloutRateLimitIntervalMs', - 'xpack.fleet.agents.agentPolicyRolloutRateLimitIntervalMs', - { level: 'critical' } - ), - renameFromRoot( - 'xpack.ingestManager.agents.agentPolicyRolloutRateLimitRequestPerInterval', - 'xpack.fleet.agents.agentPolicyRolloutRateLimitRequestPerInterval', - { level: 'critical' } - ), - unusedFromRoot('xpack.ingestManager', { level: 'critical' }), // Unused settings before Fleet server exists unused('agents.kibana', { level: 'critical' }), unused('agents.maxConcurrentConnections', { level: 'critical' }), diff --git a/x-pack/plugins/fleet/server/integration_tests/router.test.ts b/x-pack/plugins/fleet/server/integration_tests/router.test.ts index 55518923e65f..eb002f5d731d 100644 --- a/x-pack/plugins/fleet/server/integration_tests/router.test.ts +++ b/x-pack/plugins/fleet/server/integration_tests/router.test.ts @@ -30,7 +30,7 @@ function createXPackRoot(config: {} = {}) { }); } -describe('ingestManager', () => { +describe('fleet', () => { describe('default. manager, EPM, and Fleet all disabled', () => { let root: ReturnType; @@ -64,11 +64,11 @@ describe('ingestManager', () => { let root: ReturnType; beforeAll(async () => { - const ingestManagerConfig = { + const fleetConfig = { enabled: true, }; root = createXPackRoot({ - ingestManager: ingestManagerConfig, + fleet: fleetConfig, }); await root.preboot(); await root.setup(); @@ -103,12 +103,12 @@ describe('ingestManager', () => { let root: ReturnType; beforeAll(async () => { - const ingestManagerConfig = { + const fleetConfig = { enabled: true, epm: { enabled: true }, }; root = createXPackRoot({ - ingestManager: ingestManagerConfig, + fleet: fleetConfig, }); await root.preboot(); await root.setup(); @@ -138,12 +138,12 @@ describe('ingestManager', () => { let root: ReturnType; beforeAll(async () => { - const ingestManagerConfig = { + const fleetConfig = { enabled: true, fleet: { enabled: true }, }; root = createXPackRoot({ - ingestManager: ingestManagerConfig, + fleet: fleetConfig, }); await root.preboot(); await root.setup(); @@ -173,13 +173,13 @@ describe('ingestManager', () => { let root: ReturnType; beforeAll(async () => { - const ingestManagerConfig = { + const fleetConfig = { enabled: true, epm: { enabled: true }, fleet: { enabled: true }, }; root = createXPackRoot({ - ingestManager: ingestManagerConfig, + fleet: fleetConfig, }); await root.preboot(); await root.setup(); diff --git a/x-pack/plugins/fleet/server/plugin.ts b/x-pack/plugins/fleet/server/plugin.ts index 7cc1b8b1cfcc..f7593e32c25c 100644 --- a/x-pack/plugins/fleet/server/plugin.ts +++ b/x-pack/plugins/fleet/server/plugin.ts @@ -20,7 +20,7 @@ import type { UsageCollectionSetup } from 'src/plugins/usage_collection/server'; import type { TelemetryPluginSetup, TelemetryPluginStart } from 'src/plugins/telemetry/server'; -import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/server'; +import { DEFAULT_APP_CATEGORIES, SavedObjectsClient } from '../../../../src/core/server'; import type { PluginStart as DataPluginStart } from '../../../../src/plugins/data/server'; import type { LicensingPluginSetup, ILicense } from '../../licensing/server'; import type { @@ -40,8 +40,6 @@ import { PACKAGE_POLICY_SAVED_OBJECT_TYPE, PACKAGES_SAVED_OBJECT_TYPE, ASSETS_SAVED_OBJECT_TYPE, - AGENT_SAVED_OBJECT_TYPE, - ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE, PRECONFIGURATION_DELETION_RECORD_SAVED_OBJECT_TYPE, } from './constants'; import { registerSavedObjects, registerEncryptedSavedObjects } from './saved_objects'; @@ -82,10 +80,10 @@ import { import { registerFleetUsageCollector } from './collectors/register'; import { getInstallation, ensureInstalledPackage } from './services/epm/packages'; import { RouterWrappers } from './routes/security'; -import { startFleetServerSetup } from './services/fleet_server'; import { FleetArtifactsClient } from './services/artifacts'; import type { FleetRouter } from './types/request_context'; import { TelemetryEventsSender } from './telemetry/sender'; +import { setupFleet } from './services/setup'; export interface FleetSetupDeps { licensing: LicensingPluginSetup; @@ -131,8 +129,6 @@ const allSavedObjectTypes = [ PACKAGE_POLICY_SAVED_OBJECT_TYPE, PACKAGES_SAVED_OBJECT_TYPE, ASSETS_SAVED_OBJECT_TYPE, - AGENT_SAVED_OBJECT_TYPE, - ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE, PRECONFIGURATION_DELETION_RECORD_SAVED_OBJECT_TYPE, ]; @@ -335,15 +331,24 @@ export class FleetPlugin }); licenseService.start(this.licensing$); - const fleetServerSetup = startFleetServerSetup(); - this.telemetryEventsSender.start(plugins.telemetry, core); + const logger = appContextService.getLogger(); + + const fleetSetupPromise = (async () => { + try { + await setupFleet( + new SavedObjectsClient(core.savedObjects.createInternalRepository()), + core.elasticsearch.client.asInternalUser + ); + } catch (error) { + logger.warn('Fleet setup failed'); + logger.warn(error); + } + })(); + return { - fleetSetupCompleted: () => - new Promise((resolve) => { - Promise.all([fleetServerSetup]).finally(() => resolve()); - }), + fleetSetupCompleted: () => fleetSetupPromise, esIndexPatternService: new ESIndexPatternSavedObjectService(), packageService: { getInstallation, diff --git a/x-pack/plugins/fleet/server/routes/agent_policy/handlers.ts b/x-pack/plugins/fleet/server/routes/agent_policy/handlers.ts index c3da75183f58..250bfd13a84c 100644 --- a/x-pack/plugins/fleet/server/routes/agent_policy/handlers.ts +++ b/x-pack/plugins/fleet/server/routes/agent_policy/handlers.ts @@ -7,13 +7,13 @@ import type { TypeOf } from '@kbn/config-schema'; import type { RequestHandler, ResponseHeaders } from 'src/core/server'; -import bluebird from 'bluebird'; +import pMap from 'p-map'; import { safeDump } from 'js-yaml'; import { fullAgentPolicyToYaml } from '../../../common/services'; import { appContextService, agentPolicyService, packagePolicyService } from '../../services'; import { getAgentsByKuery } from '../../services/agents'; -import { AGENT_SAVED_OBJECT_TYPE } from '../../constants'; +import { AGENTS_PREFIX } from '../../constants'; import type { GetAgentPoliciesRequestSchema, GetOneAgentPolicyRequestSchema, @@ -37,6 +37,7 @@ import type { GetFullAgentConfigMapResponse, } from '../../../common'; import { defaultIngestErrorHandler } from '../../errors'; +import { incrementPackageName } from '../../services/package_policy'; export const getAgentPoliciesHandler: RequestHandler< undefined, @@ -57,14 +58,14 @@ export const getAgentPoliciesHandler: RequestHandler< perPage, }; - await bluebird.map( + await pMap( items, (agentPolicy: GetAgentPoliciesResponseItem) => getAgentsByKuery(esClient, { showInactive: false, perPage: 0, page: 1, - kuery: `${AGENT_SAVED_OBJECT_TYPE}.policy_id:${agentPolicy.id}`, + kuery: `${AGENTS_PREFIX}.policy_id:${agentPolicy.id}`, }).then(({ total: agentTotal }) => (agentPolicy.agents = agentTotal)), { concurrency: 10 } ); @@ -108,6 +109,7 @@ export const createAgentPolicyHandler: RequestHandler< const esClient = context.core.elasticsearch.client.asCurrentUser; const user = (await appContextService.getSecurity()?.authc.getCurrentUser(request)) || undefined; const withSysMonitoring = request.query.sys_monitoring ?? false; + try { // eslint-disable-next-line prefer-const let [agentPolicy, newSysPackagePolicy] = await Promise.all< @@ -131,6 +133,8 @@ export const createAgentPolicyHandler: RequestHandler< if (withSysMonitoring && newSysPackagePolicy !== undefined && agentPolicy !== undefined) { newSysPackagePolicy.policy_id = agentPolicy.id; newSysPackagePolicy.namespace = agentPolicy.namespace; + newSysPackagePolicy.name = await incrementPackageName(soClient, FLEET_SYSTEM_PACKAGE); + await packagePolicyService.create(soClient, esClient, newSysPackagePolicy, { user, bumpRevision: false, diff --git a/x-pack/plugins/fleet/server/routes/setup/handlers.test.ts b/x-pack/plugins/fleet/server/routes/setup/handlers.test.ts index b39c6e768611..ffdec9509b05 100644 --- a/x-pack/plugins/fleet/server/routes/setup/handlers.test.ts +++ b/x-pack/plugins/fleet/server/routes/setup/handlers.test.ts @@ -18,6 +18,7 @@ import { fleetSetupHandler } from './handlers'; jest.mock('../../services/setup', () => { return { + ...jest.requireActual('../../services/setup'), setupFleet: jest.fn(), }; }); diff --git a/x-pack/plugins/fleet/server/routes/setup/handlers.ts b/x-pack/plugins/fleet/server/routes/setup/handlers.ts index fad5d93c3f5d..60094c532b91 100644 --- a/x-pack/plugins/fleet/server/routes/setup/handlers.ts +++ b/x-pack/plugins/fleet/server/routes/setup/handlers.ts @@ -7,7 +7,7 @@ import { appContextService } from '../../services'; import type { GetFleetStatusResponse, PostFleetSetupResponse } from '../../../common'; -import { setupFleet } from '../../services/setup'; +import { formatNonFatalErrors, setupFleet } from '../../services/setup'; import { hasFleetServers } from '../../services/fleet_server'; import { defaultIngestErrorHandler } from '../../errors'; import type { FleetRequestHandler } from '../../types'; @@ -50,24 +50,8 @@ export const fleetSetupHandler: FleetRequestHandler = async (context, request, r const setupStatus = await setupFleet(soClient, esClient); const body: PostFleetSetupResponse = { ...setupStatus, - nonFatalErrors: setupStatus.nonFatalErrors.flatMap((e) => { - // JSONify the error object so it can be displayed properly in the UI - if ('error' in e) { - return { - name: e.error.name, - message: e.error.message, - }; - } else { - return e.errors.map((upgradePackagePolicyError: any) => { - return { - name: upgradePackagePolicyError.key, - message: upgradePackagePolicyError.message, - }; - }); - } - }), + nonFatalErrors: formatNonFatalErrors(setupStatus.nonFatalErrors), }; - return response.ok({ body }); } catch (error) { return defaultIngestErrorHandler({ error, response }); diff --git a/x-pack/plugins/fleet/server/saved_objects/index.ts b/x-pack/plugins/fleet/server/saved_objects/index.ts index 19998c8d8bdb..3b459c938b5f 100644 --- a/x-pack/plugins/fleet/server/saved_objects/index.ts +++ b/x-pack/plugins/fleet/server/saved_objects/index.ts @@ -14,29 +14,19 @@ import { PACKAGE_POLICY_SAVED_OBJECT_TYPE, PACKAGES_SAVED_OBJECT_TYPE, ASSETS_SAVED_OBJECT_TYPE, - AGENT_SAVED_OBJECT_TYPE, - AGENT_ACTION_SAVED_OBJECT_TYPE, - ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE, GLOBAL_SETTINGS_SAVED_OBJECT_TYPE, PRECONFIGURATION_DELETION_RECORD_SAVED_OBJECT_TYPE, } from '../constants'; import { - migrateAgentActionToV7100, migrateAgentPolicyToV7100, - migrateAgentToV7100, - migrateEnrollmentApiKeysToV7100, migratePackagePolicyToV7100, migrateSettingsToV7100, } from './migrations/to_v7_10_0'; import { migratePackagePolicyToV7110 } from './migrations/to_v7_11_0'; -import { - migrateAgentPolicyToV7120, - migrateAgentToV7120, - migratePackagePolicyToV7120, -} from './migrations/to_v7_12_0'; +import { migrateAgentPolicyToV7120, migratePackagePolicyToV7120 } from './migrations/to_v7_12_0'; import { migratePackagePolicyToV7130, migrateSettingsToV7130, @@ -75,66 +65,6 @@ const getSavedObjectTypes = ( '7.13.0': migrateSettingsToV7130, }, }, - [AGENT_SAVED_OBJECT_TYPE]: { - name: AGENT_SAVED_OBJECT_TYPE, - hidden: false, - namespaceType: 'agnostic', - management: { - importableAndExportable: false, - }, - mappings: { - properties: { - type: { type: 'keyword' }, - active: { type: 'boolean' }, - enrolled_at: { type: 'date' }, - unenrolled_at: { type: 'date' }, - unenrollment_started_at: { type: 'date' }, - upgraded_at: { type: 'date' }, - upgrade_started_at: { type: 'date' }, - access_api_key_id: { type: 'keyword' }, - version: { type: 'keyword' }, - user_provided_metadata: { type: 'flattened' }, - local_metadata: { type: 'flattened' }, - policy_id: { type: 'keyword' }, - policy_revision: { type: 'integer' }, - last_updated: { type: 'date' }, - last_checkin: { type: 'date' }, - last_checkin_status: { type: 'keyword' }, - default_api_key_id: { type: 'keyword' }, - default_api_key: { type: 'binary' }, - updated_at: { type: 'date' }, - current_error_events: { type: 'text', index: false }, - packages: { type: 'keyword' }, - }, - }, - migrations: { - '7.10.0': migrateAgentToV7100, - '7.12.0': migrateAgentToV7120, - }, - }, - [AGENT_ACTION_SAVED_OBJECT_TYPE]: { - name: AGENT_ACTION_SAVED_OBJECT_TYPE, - hidden: false, - namespaceType: 'agnostic', - management: { - importableAndExportable: false, - }, - mappings: { - properties: { - agent_id: { type: 'keyword' }, - policy_id: { type: 'keyword' }, - policy_revision: { type: 'integer' }, - type: { type: 'keyword' }, - data: { type: 'binary' }, - ack_data: { type: 'text' }, - sent_at: { type: 'date' }, - created_at: { type: 'date' }, - }, - }, - migrations: { - '7.10.0': migrateAgentActionToV7100(encryptedSavedObjects), - }, - }, [AGENT_POLICY_SAVED_OBJECT_TYPE]: { name: AGENT_POLICY_SAVED_OBJECT_TYPE, hidden: false, @@ -167,30 +97,6 @@ const getSavedObjectTypes = ( '7.12.0': migrateAgentPolicyToV7120, }, }, - [ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE]: { - name: ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE, - hidden: false, - namespaceType: 'agnostic', - management: { - importableAndExportable: false, - }, - mappings: { - properties: { - name: { type: 'keyword' }, - type: { type: 'keyword' }, - api_key: { type: 'binary' }, - api_key_id: { type: 'keyword' }, - policy_id: { type: 'keyword' }, - created_at: { type: 'date' }, - updated_at: { type: 'date' }, - expire_at: { type: 'date' }, - active: { type: 'boolean' }, - }, - }, - migrations: { - '7.10.0': migrateEnrollmentApiKeysToV7100, - }, - }, [OUTPUT_SAVED_OBJECT_TYPE]: { name: OUTPUT_SAVED_OBJECT_TYPE, hidden: false, @@ -399,48 +305,4 @@ export function registerEncryptedSavedObjects( encryptedSavedObjects: EncryptedSavedObjectsPluginSetup ) { // Encrypted saved objects - encryptedSavedObjects.registerType({ - type: ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE, - attributesToEncrypt: new Set(['api_key']), - attributesToExcludeFromAAD: new Set([ - 'name', - 'type', - 'api_key_id', - 'policy_id', - 'created_at', - 'updated_at', - 'expire_at', - 'active', - ]), - }); - encryptedSavedObjects.registerType({ - type: AGENT_SAVED_OBJECT_TYPE, - attributesToEncrypt: new Set(['default_api_key']), - attributesToExcludeFromAAD: new Set([ - 'type', - 'active', - 'enrolled_at', - 'access_api_key_id', - 'version', - 'user_provided_metadata', - 'local_metadata', - 'policy_id', - 'policy_revision', - 'last_updated', - 'last_checkin', - 'last_checkin_status', - 'updated_at', - 'current_error_events', - 'unenrolled_at', - 'unenrollment_started_at', - 'packages', - 'upgraded_at', - 'upgrade_started_at', - ]), - }); - encryptedSavedObjects.registerType({ - type: AGENT_ACTION_SAVED_OBJECT_TYPE, - attributesToEncrypt: new Set(['data']), - attributesToExcludeFromAAD: new Set(['agent_id', 'type', 'sent_at', 'created_at']), - }); } diff --git a/x-pack/plugins/fleet/server/saved_objects/migrations/to_v7_10_0.ts b/x-pack/plugins/fleet/server/saved_objects/migrations/to_v7_10_0.ts index 64338690977c..bb54c55ac75a 100644 --- a/x-pack/plugins/fleet/server/saved_objects/migrations/to_v7_10_0.ts +++ b/x-pack/plugins/fleet/server/saved_objects/migrations/to_v7_10_0.ts @@ -5,33 +5,9 @@ * 2.0. */ -import type { SavedObjectMigrationFn, SavedObjectUnsanitizedDoc } from 'kibana/server'; +import type { SavedObjectMigrationFn } from 'kibana/server'; -import type { EncryptedSavedObjectsPluginSetup } from '../../../../encrypted_saved_objects/server'; -import type { - Agent, - AgentPolicy, - PackagePolicy, - EnrollmentAPIKey, - Settings, - AgentAction, -} from '../../types'; - -export const migrateAgentToV7100: SavedObjectMigrationFn< - Exclude & { - config_id?: string; - config_revision?: number | null; - }, - Agent -> = (agentDoc) => { - agentDoc.attributes.policy_id = agentDoc.attributes.config_id; - delete agentDoc.attributes.config_id; - - agentDoc.attributes.policy_revision = agentDoc.attributes.config_revision; - delete agentDoc.attributes.config_revision; - - return agentDoc; -}; +import type { AgentPolicy, PackagePolicy, Settings } from '../../types'; export const migrateAgentPolicyToV7100: SavedObjectMigrationFn< Exclude & { @@ -46,18 +22,6 @@ export const migrateAgentPolicyToV7100: SavedObjectMigrationFn< return agentPolicyDoc; }; -export const migrateEnrollmentApiKeysToV7100: SavedObjectMigrationFn< - Exclude & { - config_id?: string; - }, - EnrollmentAPIKey -> = (enrollmentApiKeyDoc) => { - enrollmentApiKeyDoc.attributes.policy_id = enrollmentApiKeyDoc.attributes.config_id; - delete enrollmentApiKeyDoc.attributes.config_id; - - return enrollmentApiKeyDoc; -}; - export const migratePackagePolicyToV7100: SavedObjectMigrationFn< Exclude & { config_id: string; @@ -84,45 +48,3 @@ export const migrateSettingsToV7100: SavedObjectMigrationFn< return settingsDoc; }; - -export const migrateAgentActionToV7100 = ( - encryptedSavedObjects: EncryptedSavedObjectsPluginSetup -): SavedObjectMigrationFn => { - return encryptedSavedObjects.createMigration({ - isMigrationNeededPredicate: ( - agentActionDoc - ): agentActionDoc is SavedObjectUnsanitizedDoc => { - // @ts-expect-error - return agentActionDoc.attributes.type === 'CONFIG_CHANGE'; - }, - migration: (agentActionDoc) => { - let agentActionData; - try { - agentActionData = agentActionDoc.attributes.data - ? JSON.parse(agentActionDoc.attributes.data) - : undefined; - } catch (e) { - // Silently swallow JSON parsing error - } - if (agentActionData && agentActionData.config) { - const { - attributes: { data, ...restOfAttributes }, - } = agentActionDoc; - const { config, ...restOfData } = agentActionData; - return { - ...agentActionDoc, - attributes: { - ...restOfAttributes, - type: 'POLICY_CHANGE', - data: JSON.stringify({ - ...restOfData, - policy: config, - }), - }, - }; - } else { - return agentActionDoc; - } - }, - }); -}; diff --git a/x-pack/plugins/fleet/server/saved_objects/migrations/to_v7_12_0.ts b/x-pack/plugins/fleet/server/saved_objects/migrations/to_v7_12_0.ts index ad7a179f5076..fde71388cbbd 100644 --- a/x-pack/plugins/fleet/server/saved_objects/migrations/to_v7_12_0.ts +++ b/x-pack/plugins/fleet/server/saved_objects/migrations/to_v7_12_0.ts @@ -7,18 +7,10 @@ import type { SavedObjectMigrationFn } from 'kibana/server'; -import type { Agent, AgentPolicy } from '../../types'; +import type { AgentPolicy } from '../../types'; export { migratePackagePolicyToV7120 } from './security_solution/to_v7_12_0'; -export const migrateAgentToV7120: SavedObjectMigrationFn = ( - agentDoc -) => { - delete agentDoc.attributes.shared_id; - - return agentDoc; -}; - export const migrateAgentPolicyToV7120: SavedObjectMigrationFn< Exclude, AgentPolicy diff --git a/x-pack/plugins/fleet/server/services/agent_policy.ts b/x-pack/plugins/fleet/server/services/agent_policy.ts index b1a45b5a9242..bb9360b834b3 100644 --- a/x-pack/plugins/fleet/server/services/agent_policy.ts +++ b/x-pack/plugins/fleet/server/services/agent_policy.ts @@ -20,7 +20,7 @@ import { SavedObjectsErrorHelpers } from '../../../../../src/core/server'; import type { AuthenticatedUser } from '../../../security/server'; import { AGENT_POLICY_SAVED_OBJECT_TYPE, - AGENT_SAVED_OBJECT_TYPE, + AGENTS_PREFIX, PRECONFIGURATION_DELETION_RECORD_SAVED_OBJECT_TYPE, } from '../constants'; import type { @@ -626,7 +626,7 @@ class AgentPolicyService { showInactive: false, perPage: 0, page: 1, - kuery: `${AGENT_SAVED_OBJECT_TYPE}.policy_id:${id}`, + kuery: `${AGENTS_PREFIX}.policy_id:${id}`, }); if (total > 0) { diff --git a/x-pack/plugins/fleet/server/services/agents/crud.ts b/x-pack/plugins/fleet/server/services/agents/crud.ts index b8d7c284309d..516acf5a120d 100644 --- a/x-pack/plugins/fleet/server/services/agents/crud.ts +++ b/x-pack/plugins/fleet/server/services/agents/crud.ts @@ -16,7 +16,7 @@ import type { AgentSOAttributes, Agent, BulkActionResult, ListWithKuery } from ' import { appContextService, agentPolicyService } from '../../services'; import type { FleetServerAgent } from '../../../common'; import { isAgentUpgradeable, SO_SEARCH_LIMIT } from '../../../common'; -import { AGENT_SAVED_OBJECT_TYPE, AGENTS_INDEX } from '../../constants'; +import { AGENTS_PREFIX, AGENTS_INDEX } from '../../constants'; import { escapeSearchQueryPhrase, normalizeKuery } from '../saved_object'; import { IngestManagerError, isESClientError, AgentNotFoundError } from '../../errors'; @@ -176,7 +176,7 @@ export async function countInactiveAgents( const filters = [INACTIVE_AGENT_CONDITION]; if (kuery && kuery !== '') { - filters.push(normalizeKuery(AGENT_SAVED_OBJECT_TYPE, kuery)); + filters.push(normalizeKuery(AGENTS_PREFIX, kuery)); } const kueryNode = _joinFilters(filters); diff --git a/x-pack/plugins/fleet/server/services/agents/crud_so.ts b/x-pack/plugins/fleet/server/services/agents/crud_so.ts deleted file mode 100644 index aa3cb4e4ec1a..000000000000 --- a/x-pack/plugins/fleet/server/services/agents/crud_so.ts +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import Boom from '@hapi/boom'; -import type { SavedObjectsBulkUpdateObject, SavedObjectsClientContract } from 'src/core/server'; - -import type { KueryNode } from '@kbn/es-query'; -import { fromKueryExpression } from '@kbn/es-query'; - -import { isAgentUpgradeable } from '../../../common'; -import { AGENT_SAVED_OBJECT_TYPE } from '../../constants'; -import type { AgentSOAttributes, Agent, ListWithKuery } from '../../types'; -import { escapeSearchQueryPhrase, normalizeKuery, findAllSOs } from '../saved_object'; -import { appContextService } from '../../services'; - -import { savedObjectToAgent } from './saved_objects'; - -const ACTIVE_AGENT_CONDITION = `${AGENT_SAVED_OBJECT_TYPE}.attributes.active:true`; -const INACTIVE_AGENT_CONDITION = `NOT (${ACTIVE_AGENT_CONDITION})`; - -function _joinFilters(filters: Array) { - return filters - .filter((filter) => filter !== undefined) - .reduce( - ( - acc: KueryNode | undefined, - kuery: string | KueryNode | undefined - ): KueryNode | undefined => { - if (kuery === undefined) { - return acc; - } - const kueryNode: KueryNode = - typeof kuery === 'string' - ? fromKueryExpression(normalizeKuery(AGENT_SAVED_OBJECT_TYPE, kuery)) - : kuery; - - if (!acc) { - return kueryNode; - } - - return { - type: 'function', - function: 'and', - arguments: [acc, kueryNode], - }; - }, - undefined as KueryNode | undefined - ); -} - -export async function listAgents( - soClient: SavedObjectsClientContract, - options: ListWithKuery & { - showInactive: boolean; - } -): Promise<{ - agents: Agent[]; - total: number; - page: number; - perPage: number; -}> { - const { - page = 1, - perPage = 20, - sortField = 'enrolled_at', - sortOrder = 'desc', - kuery, - showInactive = false, - showUpgradeable, - } = options; - const filters: Array = []; - - if (kuery && kuery !== '') { - filters.push(kuery); - } - - if (showInactive === false) { - filters.push(ACTIVE_AGENT_CONDITION); - } - try { - let { saved_objects: agentSOs, total } = await soClient.find({ - type: AGENT_SAVED_OBJECT_TYPE, - filter: _joinFilters(filters) || '', - sortField, - sortOrder, - page, - perPage, - }); - // filtering for a range on the version string will not work, - // nor does filtering on a flattened field (local_metadata), so filter here - if (showUpgradeable) { - agentSOs = agentSOs.filter((agent) => - isAgentUpgradeable(savedObjectToAgent(agent), appContextService.getKibanaVersion()) - ); - total = agentSOs.length; - } - - return { - agents: agentSOs.map(savedObjectToAgent), - total, - page, - perPage, - }; - } catch (e) { - if (e.output?.payload?.message?.startsWith('The key is empty')) { - return { - agents: [], - total: 0, - page: 0, - perPage: 0, - }; - } else { - throw e; - } - } -} - -export async function listAllAgents( - soClient: SavedObjectsClientContract, - options: Omit & { - showInactive: boolean; - } -): Promise<{ - agents: Agent[]; - total: number; -}> { - const { sortField = 'enrolled_at', sortOrder = 'desc', kuery, showInactive = false } = options; - const filters = []; - - if (kuery && kuery !== '') { - filters.push(kuery); - } - - if (showInactive === false) { - filters.push(ACTIVE_AGENT_CONDITION); - } - - const { saved_objects: agentSOs, total } = await findAllSOs(soClient, { - type: AGENT_SAVED_OBJECT_TYPE, - kuery: _joinFilters(filters), - sortField, - sortOrder, - }); - - return { - agents: agentSOs.map(savedObjectToAgent), - total, - }; -} - -export async function countInactiveAgents( - soClient: SavedObjectsClientContract, - options: Pick -): Promise { - const { kuery } = options; - const filters = [INACTIVE_AGENT_CONDITION]; - - if (kuery && kuery !== '') { - filters.push(normalizeKuery(AGENT_SAVED_OBJECT_TYPE, kuery)); - } - - const { total } = await soClient.find({ - type: AGENT_SAVED_OBJECT_TYPE, - filter: _joinFilters(filters), - perPage: 0, - }); - - return total; -} - -export async function getAgent(soClient: SavedObjectsClientContract, agentId: string) { - const agent = savedObjectToAgent( - await soClient.get(AGENT_SAVED_OBJECT_TYPE, agentId) - ); - return agent; -} - -export async function getAgents(soClient: SavedObjectsClientContract, agentIds: string[]) { - const agentSOs = await soClient.bulkGet( - agentIds.map((agentId) => ({ - id: agentId, - type: AGENT_SAVED_OBJECT_TYPE, - })) - ); - const agents = agentSOs.saved_objects.map(savedObjectToAgent); - return agents; -} - -export async function getAgentByAccessAPIKeyId( - soClient: SavedObjectsClientContract, - accessAPIKeyId: string -): Promise { - const response = await soClient.find({ - type: AGENT_SAVED_OBJECT_TYPE, - searchFields: ['access_api_key_id'], - search: escapeSearchQueryPhrase(accessAPIKeyId), - }); - const [agent] = response.saved_objects.map(savedObjectToAgent); - - if (!agent) { - throw Boom.notFound('Agent not found'); - } - if (agent.access_api_key_id !== accessAPIKeyId) { - throw new Error('Agent api key id is not matching'); - } - if (!agent.active) { - throw Boom.forbidden('Agent inactive'); - } - - return agent; -} - -export async function updateAgent( - soClient: SavedObjectsClientContract, - agentId: string, - data: Partial -) { - await soClient.update(AGENT_SAVED_OBJECT_TYPE, agentId, data); -} - -export async function bulkUpdateAgents( - soClient: SavedObjectsClientContract, - updateData: Array<{ - agentId: string; - data: Partial; - }> -) { - const updates: Array> = updateData.map( - ({ agentId, data }) => ({ - type: AGENT_SAVED_OBJECT_TYPE, - id: agentId, - attributes: data, - }) - ); - - const res = await soClient.bulkUpdate(updates); - - return { - items: res.saved_objects.map((so) => ({ - id: so.id, - success: !so.error, - error: so.error, - })), - }; -} - -export async function deleteAgent(soClient: SavedObjectsClientContract, agentId: string) { - await soClient.update(AGENT_SAVED_OBJECT_TYPE, agentId, { - active: false, - }); -} diff --git a/x-pack/plugins/fleet/server/services/agents/status.ts b/x-pack/plugins/fleet/server/services/agents/status.ts index ee30843e74e1..5c5176ec4135 100644 --- a/x-pack/plugins/fleet/server/services/agents/status.ts +++ b/x-pack/plugins/fleet/server/services/agents/status.ts @@ -11,7 +11,7 @@ import pMap from 'p-map'; import type { KueryNode } from '@kbn/es-query'; import { fromKueryExpression } from '@kbn/es-query'; -import { AGENT_SAVED_OBJECT_TYPE } from '../../constants'; +import { AGENTS_PREFIX } from '../../constants'; import type { AgentStatus } from '../../types'; import { AgentStatusKueryHelper } from '../../../common/services'; @@ -70,8 +70,8 @@ export async function getAgentStatusForAgentPolicy( ...[ kuery, filterKuery, - `${AGENT_SAVED_OBJECT_TYPE}.attributes.active:true`, - agentPolicyId ? `${AGENT_SAVED_OBJECT_TYPE}.policy_id:"${agentPolicyId}"` : undefined, + `${AGENTS_PREFIX}.attributes.active:true`, + agentPolicyId ? `${AGENTS_PREFIX}.policy_id:"${agentPolicyId}"` : undefined, ] ), }), diff --git a/x-pack/plugins/fleet/server/services/agents/update.ts b/x-pack/plugins/fleet/server/services/agents/update.ts index 74386efe6561..cbe7853425fa 100644 --- a/x-pack/plugins/fleet/server/services/agents/update.ts +++ b/x-pack/plugins/fleet/server/services/agents/update.ts @@ -7,7 +7,7 @@ import type { ElasticsearchClient, SavedObjectsClientContract } from 'src/core/server'; -import { AGENT_SAVED_OBJECT_TYPE } from '../../constants'; +import { AGENTS_PREFIX } from '../../constants'; import { getAgentsByKuery } from './crud'; import { unenrollAgent } from './unenroll'; @@ -21,7 +21,7 @@ export async function unenrollForAgentPolicyId( let page = 1; while (hasMore) { const { agents } = await getAgentsByKuery(esClient, { - kuery: `${AGENT_SAVED_OBJECT_TYPE}.policy_id:"${policyId}"`, + kuery: `${AGENTS_PREFIX}.policy_id:"${policyId}"`, page: page++, perPage: 1000, showInactive: false, diff --git a/x-pack/plugins/fleet/server/services/agents/upgrade.ts b/x-pack/plugins/fleet/server/services/agents/upgrade.ts index 988d3c63223f..ce5536df359b 100644 --- a/x-pack/plugins/fleet/server/services/agents/upgrade.ts +++ b/x-pack/plugins/fleet/server/services/agents/upgrade.ts @@ -7,8 +7,7 @@ import type { ElasticsearchClient, SavedObjectsClientContract } from 'src/core/server'; -import type { Agent, AgentAction, AgentActionSOAttributes, BulkActionResult } from '../../types'; -import { AGENT_ACTION_SAVED_OBJECT_TYPE } from '../../constants'; +import type { Agent, BulkActionResult } from '../../types'; import { agentPolicyService } from '../../services'; import { AgentReassignmentError, @@ -68,23 +67,6 @@ export async function sendUpgradeAgentAction({ }); } -export async function ackAgentUpgraded( - soClient: SavedObjectsClientContract, - esClient: ElasticsearchClient, - agentAction: AgentAction -) { - const { - attributes: { ack_data: ackData }, - } = await soClient.get(AGENT_ACTION_SAVED_OBJECT_TYPE, agentAction.id); - if (!ackData) throw new Error('data missing from UPGRADE action'); - const { version } = JSON.parse(ackData); - if (!version) throw new Error('version missing from UPGRADE action'); - await updateAgent(esClient, agentAction.agent_id, { - upgraded_at: new Date().toISOString(), - upgrade_started_at: null, - }); -} - export async function sendUpgradeAgentsActions( soClient: SavedObjectsClientContract, esClient: ElasticsearchClient, diff --git a/x-pack/plugins/fleet/server/services/api_keys/enrollment_api_key_so.ts b/x-pack/plugins/fleet/server/services/api_keys/enrollment_api_key_so.ts deleted file mode 100644 index a2b40200fe13..000000000000 --- a/x-pack/plugins/fleet/server/services/api_keys/enrollment_api_key_so.ts +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import type { SavedObjectsClientContract, SavedObject } from 'src/core/server'; - -import type { EnrollmentAPIKey, EnrollmentAPIKeySOAttributes } from '../../types'; -import { ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE } from '../../constants'; -import { appContextService } from '../app_context'; -import { normalizeKuery } from '../saved_object'; - -export async function listEnrollmentApiKeys( - soClient: SavedObjectsClientContract, - options: { - page?: number; - perPage?: number; - kuery?: string; - showInactive?: boolean; - } -): Promise<{ items: EnrollmentAPIKey[]; total: any; page: any; perPage: any }> { - const { page = 1, perPage = 20, kuery } = options; - - // eslint-disable-next-line @typescript-eslint/naming-convention - const { saved_objects, total } = await soClient.find({ - type: ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE, - page, - perPage, - sortField: 'created_at', - sortOrder: 'desc', - filter: - kuery && kuery !== '' - ? normalizeKuery(ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE, kuery) - : undefined, - }); - - const items = saved_objects.map(savedObjectToEnrollmentApiKey); - - return { - items, - total, - page, - perPage, - }; -} - -export async function getEnrollmentAPIKey(soClient: SavedObjectsClientContract, id: string) { - const so = await appContextService - .getEncryptedSavedObjects() - .getDecryptedAsInternalUser( - ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE, - id - ); - return savedObjectToEnrollmentApiKey(so); -} - -function savedObjectToEnrollmentApiKey({ - error, - attributes, - id, -}: SavedObject): EnrollmentAPIKey { - if (error) { - throw new Error(error.message); - } - - return { - id, - ...attributes, - }; -} diff --git a/x-pack/plugins/fleet/server/services/fleet_server/index.ts b/x-pack/plugins/fleet/server/services/fleet_server/index.ts index 0d386b9ba499..55b0fb0dff22 100644 --- a/x-pack/plugins/fleet/server/services/fleet_server/index.ts +++ b/x-pack/plugins/fleet/server/services/fleet_server/index.ts @@ -6,23 +6,9 @@ */ import type { ElasticsearchClient } from 'kibana/server'; -import { first } from 'rxjs/operators'; -import { appContextService } from '../app_context'; -import { licenseService } from '../license'; import { FLEET_SERVER_SERVERS_INDEX } from '../../constants'; -import { runFleetServerMigration } from './saved_object_migrations'; - -let _isFleetServerSetup = false; -let _isPending = false; -let _status: Promise | undefined; -let _onResolve: (arg?: any) => void; - -export function isFleetServerSetup() { - return _isFleetServerSetup; -} - /** * Check if at least one fleet server is connected */ @@ -35,48 +21,3 @@ export async function hasFleetServers(esClient: ElasticsearchClient) { // @ts-expect-error value is number | TotalHits return res.body.hits.total.value > 0; } - -export async function awaitIfFleetServerSetupPending() { - if (!_isPending) { - return; - } - - return _status; -} - -export async function startFleetServerSetup() { - _isPending = true; - _status = new Promise((resolve) => { - _onResolve = resolve; - }); - const logger = appContextService.getLogger(); - - // Check for security - if (!appContextService.hasSecurity()) { - // Fleet will not work if security is not enabled - logger?.warn('Fleet requires the security plugin to be enabled.'); - return; - } - - // Log information about custom registry URL - const customUrl = appContextService.getConfig()?.registryUrl; - if (customUrl) { - logger.info( - `Custom registry url is an experimental feature and is unsupported. Using custom registry at ${customUrl}` - ); - } - - try { - // We need licence to be initialized before using the SO service. - await licenseService.getLicenseInformation$()?.pipe(first())?.toPromise(); - await runFleetServerMigration(); - _isFleetServerSetup = true; - } catch (err) { - logger?.error('Setup for central management of agents failed.'); - logger?.error(err); - } - _isPending = false; - if (_onResolve) { - _onResolve(); - } -} diff --git a/x-pack/plugins/fleet/server/services/fleet_server/saved_object_migrations.ts b/x-pack/plugins/fleet/server/services/fleet_server/saved_object_migrations.ts deleted file mode 100644 index bbaf9c9479eb..000000000000 --- a/x-pack/plugins/fleet/server/services/fleet_server/saved_object_migrations.ts +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { isBoom } from '@hapi/boom'; -import type { KibanaRequest } from 'src/core/server'; - -import { - ENROLLMENT_API_KEYS_INDEX, - ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE, - AGENT_POLICY_INDEX, - AGENTS_INDEX, - AGENT_SAVED_OBJECT_TYPE, - SO_SEARCH_LIMIT, -} from '../../../common'; -import type { - FleetServerEnrollmentAPIKey, - AgentSOAttributes, - FleetServerAgent, -} from '../../../common'; -import { listEnrollmentApiKeys, getEnrollmentAPIKey } from '../api_keys/enrollment_api_key_so'; -import { appContextService } from '../app_context'; -import { agentPolicyService } from '../agent_policy'; -import { invalidateAPIKeys } from '../api_keys'; -import { settingsService } from '..'; - -export async function runFleetServerMigration() { - await settingsService.settingsSetup(getInternalUserSOClient()); - await Promise.all([migrateEnrollmentApiKeys(), migrateAgentPolicies(), migrateAgents()]); -} - -function getInternalUserSOClient() { - const fakeRequest = { - headers: {}, - getBasePath: () => '', - path: '/', - route: { settings: {} }, - url: { - href: '/', - }, - raw: { - req: { - url: '/', - }, - }, - } as unknown as KibanaRequest; - - return appContextService.getInternalUserSOClient(fakeRequest); -} - -async function migrateAgents() { - const esClient = appContextService.getInternalUserESClient(); - const soClient = getInternalUserSOClient(); - const logger = appContextService.getLogger(); - let hasMore = true; - - let hasAgents = false; - - while (hasMore) { - const res = await soClient.find({ - type: AGENT_SAVED_OBJECT_TYPE, - page: 1, - perPage: 100, - }); - - if (res.total === 0) { - hasMore = false; - } else { - hasAgents = true; - } - - for (const so of res.saved_objects) { - try { - const { attributes } = await appContextService - .getEncryptedSavedObjects() - .getDecryptedAsInternalUser(AGENT_SAVED_OBJECT_TYPE, so.id); - - await invalidateAPIKeys( - [attributes.access_api_key_id, attributes.default_api_key_id].filter( - (keyId): keyId is string => keyId !== undefined - ) - ).catch((error) => { - logger.error(`Invalidating API keys for agent ${so.id} failed: ${error.message}`); - }); - - const body: FleetServerAgent = { - type: attributes.type, - active: false, - enrolled_at: attributes.enrolled_at, - unenrolled_at: new Date().toISOString(), - unenrollment_started_at: attributes.unenrollment_started_at, - upgraded_at: attributes.upgraded_at, - upgrade_started_at: attributes.upgrade_started_at, - access_api_key_id: attributes.access_api_key_id, - user_provided_metadata: attributes.user_provided_metadata, - local_metadata: attributes.local_metadata, - policy_id: attributes.policy_id, - policy_revision_idx: attributes.policy_revision || undefined, - last_checkin: attributes.last_checkin, - last_checkin_status: attributes.last_checkin_status, - default_api_key_id: attributes.default_api_key_id, - default_api_key: attributes.default_api_key, - packages: attributes.packages, - }; - await esClient.create({ - index: AGENTS_INDEX, - body, - id: so.id, - refresh: 'wait_for', - }); - - await soClient.delete(AGENT_SAVED_OBJECT_TYPE, so.id); - } catch (error) { - // swallow 404 error has multiple Kibana can run the migration at the same time - if (!is404Error(error)) { - throw error; - } - } - } - } - - // Update settings to show migration modal - if (hasAgents) { - await settingsService.saveSettings(soClient, { - has_seen_fleet_migration_notice: false, - }); - } -} - -async function migrateEnrollmentApiKeys() { - const esClient = appContextService.getInternalUserESClient(); - const soClient = getInternalUserSOClient(); - let hasMore = true; - while (hasMore) { - const res = await listEnrollmentApiKeys(soClient, { - page: 1, - perPage: 100, - }); - if (res.total === 0) { - hasMore = false; - } - for (const item of res.items) { - try { - const key = await getEnrollmentAPIKey(soClient, item.id); - - const body: FleetServerEnrollmentAPIKey = { - api_key: key.api_key, - api_key_id: key.api_key_id, - active: key.active, - created_at: key.created_at, - name: key.name, - policy_id: key.policy_id, - }; - await esClient.create({ - index: ENROLLMENT_API_KEYS_INDEX, - body, - id: key.id, - refresh: 'wait_for', - }); - - await soClient.delete(ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE, key.id); - } catch (error) { - // swallow 404 error has multiple Kibana can run the migration at the same time - if (!is404Error(error)) { - throw error; - } - } - } - } -} - -async function migrateAgentPolicies() { - const esClient = appContextService.getInternalUserESClient(); - const soClient = getInternalUserSOClient(); - const { items: agentPolicies } = await agentPolicyService.list(soClient, { - perPage: SO_SEARCH_LIMIT, - }); - - await Promise.all( - agentPolicies.map(async (agentPolicy) => { - const res = await esClient.search({ - index: AGENT_POLICY_INDEX, - q: `policy_id:${agentPolicy.id}`, - track_total_hits: true, - ignore_unavailable: true, - }); - - // @ts-expect-error value is number | TotalHits - if (res.body.hits.total.value === 0) { - return agentPolicyService.createFleetServerPolicy(soClient, agentPolicy.id); - } - }) - ); -} - -function is404Error(error: any) { - return isBoom(error) && error.output.statusCode === 404; -} diff --git a/x-pack/plugins/fleet/server/services/package_policy.ts b/x-pack/plugins/fleet/server/services/package_policy.ts index 20434e829045..856bf077b33d 100644 --- a/x-pack/plugins/fleet/server/services/package_policy.ts +++ b/x-pack/plugins/fleet/server/services/package_policy.ts @@ -1195,3 +1195,30 @@ function deepMergeVars(original: any, override: any): any { return result; } + +export async function incrementPackageName( + soClient: SavedObjectsClientContract, + packageName: string +) { + // Fetch all packagePolicies having the package name + const packagePolicyData = await packagePolicyService.list(soClient, { + perPage: 1, + kuery: `${PACKAGE_POLICY_SAVED_OBJECT_TYPE}.package.name: "${packageName}"`, + }); + + // Retrieve highest number appended to package policy name and increment it by one + const pkgPoliciesNamePattern = new RegExp(`${packageName}-(\\d+)`); + + const pkgPoliciesWithMatchingNames = packagePolicyData?.items + ? packagePolicyData.items + .filter((ds) => Boolean(ds.name.match(pkgPoliciesNamePattern))) + .map((ds) => parseInt(ds.name.match(pkgPoliciesNamePattern)![1], 10)) + .sort() + : []; + + return `${packageName}-${ + pkgPoliciesWithMatchingNames.length + ? pkgPoliciesWithMatchingNames[pkgPoliciesWithMatchingNames.length - 1] + 1 + : 1 + }`; +} diff --git a/x-pack/plugins/fleet/server/services/preconfiguration.ts b/x-pack/plugins/fleet/server/services/preconfiguration.ts index 6cdb3abf2490..b16eae266d28 100644 --- a/x-pack/plugins/fleet/server/services/preconfiguration.ts +++ b/x-pack/plugins/fleet/server/services/preconfiguration.ts @@ -73,6 +73,8 @@ export async function ensurePreconfiguredOutputs( esClient: ElasticsearchClient, outputs: PreconfiguredOutput[] ) { + const logger = appContextService.getLogger(); + if (outputs.length === 0) { return; } @@ -106,8 +108,10 @@ export async function ensurePreconfiguredOutputs( existingOutput && isPreconfiguredOutputDifferentFromCurrent(existingOutput, data); if (isCreate) { + logger.debug(`Creating output ${output.id}`); await outputService.create(soClient, data, { id, fromPreconfiguration: true }); } else if (isUpdateWithNewData) { + logger.debug(`Updating output ${output.id}`); await outputService.update(soClient, id, data, { fromPreconfiguration: true }); // Bump revision of all policies using that output if (outputData.is_default || outputData.is_default_monitoring) { @@ -335,7 +339,7 @@ export async function ensurePreconfiguredPackagesAndPolicies( await soClient .delete(AGENT_POLICY_SAVED_OBJECT_TYPE, policy!.id) // swallow error - .catch((deleteErr) => appContextService.getLogger().error(deleteErr)); + .catch((deleteErr) => logger.error(deleteErr)); throw err; } diff --git a/x-pack/plugins/fleet/server/services/setup.ts b/x-pack/plugins/fleet/server/services/setup.ts index 37d79c1bb691..1c84073552e5 100644 --- a/x-pack/plugins/fleet/server/services/setup.ts +++ b/x-pack/plugins/fleet/server/services/setup.ts @@ -26,7 +26,6 @@ import { generateEnrollmentAPIKey, hasEnrollementAPIKeysForPolicy } from './api_ import { settingsService } from '.'; import { awaitIfPending } from './setup_utils'; import { ensureFleetServerAgentPoliciesExists } from './agents'; -import { awaitIfFleetServerSetupPending } from './fleet_server'; import { ensureFleetFinalPipelineIsInstalled } from './epm/elasticsearch/ingest_pipeline/install'; import { ensureDefaultComponentTemplate } from './epm/elasticsearch/template/install'; import { getInstallations, installPackage } from './epm/packages'; @@ -52,6 +51,9 @@ async function createSetupSideEffects( soClient: SavedObjectsClientContract, esClient: ElasticsearchClient ): Promise { + const logger = appContextService.getLogger(); + logger.info('Beginning fleet setup'); + const { agentPolicies: policiesOrUndefined, packages: packagesOrUndefined, @@ -61,6 +63,7 @@ async function createSetupSideEffects( const policies = policiesOrUndefined ?? []; let packages = packagesOrUndefined ?? []; + logger.debug('Setting up Fleet outputs'); await Promise.all([ ensurePreconfiguredOutputs(soClient, esClient, outputsOrUndefined ?? []), settingsService.settingsSetup(soClient), @@ -68,8 +71,8 @@ async function createSetupSideEffects( const defaultOutput = await outputService.ensureDefaultOutput(soClient); - await awaitIfFleetServerSetupPending(); if (appContextService.getConfig()?.agentIdVerificationEnabled) { + logger.debug('Setting up Fleet Elasticsearch assets'); await ensureFleetGlobalEsAssets(soClient, esClient); } @@ -93,6 +96,8 @@ async function createSetupSideEffects( ...autoUpdateablePackages.filter((pkg) => !preconfiguredPackageNames.has(pkg.name)), ]; + logger.debug('Setting up initial Fleet packages'); + const { nonFatalErrors } = await ensurePreconfiguredPackagesAndPolicies( soClient, esClient, @@ -101,11 +106,22 @@ async function createSetupSideEffects( defaultOutput ); + logger.debug('Cleaning up Fleet outputs'); await cleanPreconfiguredOutputs(soClient, outputsOrUndefined ?? []); + logger.debug('Setting up Fleet enrollment keys'); await ensureDefaultEnrollmentAPIKeysExists(soClient, esClient); + + logger.debug('Setting up Fleet Server agent policies'); await ensureFleetServerAgentPoliciesExists(soClient, esClient); + if (nonFatalErrors.length > 0) { + logger.info('Encountered non fatal errors during Fleet setup'); + formatNonFatalErrors(nonFatalErrors).forEach((error) => logger.info(JSON.stringify(error))); + } + + logger.info('Fleet setup completed'); + return { isInitialized: true, nonFatalErrors, @@ -121,6 +137,7 @@ export async function ensureFleetGlobalEsAssets( ) { const logger = appContextService.getLogger(); // Ensure Global Fleet ES assets are installed + logger.debug('Creating Fleet component template and ingest pipeline'); const globalAssetsRes = await Promise.all([ ensureDefaultComponentTemplate(esClient), ensureFleetFinalPipelineIsInstalled(esClient), @@ -143,7 +160,7 @@ export async function ensureFleetGlobalEsAssets( savedObjectsClient: soClient, pkgkey: pkgToPkgKey({ name: installation.name, version: installation.version }), esClient, - // Force install the pacakge will update the index template and the datastream write indices + // Force install the package will update the index template and the datastream write indices force: true, }).catch((err) => { logger.error( @@ -189,3 +206,27 @@ export async function ensureDefaultEnrollmentAPIKeysExists( }) ); } + +/** + * Maps the `nonFatalErrors` object returned by the setup process to a more readable + * and predictable format suitable for logging output or UI presentation. + */ +export function formatNonFatalErrors( + nonFatalErrors: SetupStatus['nonFatalErrors'] +): Array<{ name: string; message: string }> { + return nonFatalErrors.flatMap((e) => { + if ('error' in e) { + return { + name: e.error.name, + message: e.error.message, + }; + } else { + return e.errors.map((upgradePackagePolicyError: any) => { + return { + name: upgradePackagePolicyError.key, + message: upgradePackagePolicyError.message, + }; + }); + } + }); +} diff --git a/x-pack/plugins/fleet/server/types/index.tsx b/x-pack/plugins/fleet/server/types/index.tsx index 174aac03d6a3..9d3e91286478 100644 --- a/x-pack/plugins/fleet/server/types/index.tsx +++ b/x-pack/plugins/fleet/server/types/index.tsx @@ -13,7 +13,6 @@ export type { AgentType, AgentAction, AgentPolicyAction, - AgentPolicyActionV7_9, BaseAgentActionSOAttributes, AgentActionSOAttributes, AgentPolicyActionSOAttributes, diff --git a/x-pack/plugins/index_management/__jest__/client_integration/home/data_streams_tab.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/home/data_streams_tab.helpers.ts index 311acb13d3f0..e3184cadbdc4 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/home/data_streams_tab.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/home/data_streams_tab.helpers.ts @@ -9,7 +9,7 @@ import { act } from 'react-dom/test-utils'; import { ReactWrapper } from 'enzyme'; import { EuiDescriptionListDescription } from '@elastic/eui'; -import { registerTestBed, TestBed, TestBedConfig, findTestSubject } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig, findTestSubject } from '@kbn/test/jest'; import { DataStream } from '../../../common'; import { IndexManagementHome } from '../../../public/application/sections/home'; import { indexManagementStore } from '../../../public/application/store'; @@ -42,7 +42,7 @@ export interface DataStreamsTabTestBed extends TestBed { } export const setup = async (overridingDependencies: any = {}): Promise => { - const testBedConfig: TestBedConfig = { + const testBedConfig: AsyncTestBedConfig = { store: () => indexManagementStore(services as any), memoryRouter: { initialEntries: [`/indices`], diff --git a/x-pack/plugins/index_management/__jest__/client_integration/home/home.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/home/home.helpers.ts index a15e4f2a613d..ad8aceb7d56b 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/home/home.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/home/home.helpers.ts @@ -5,12 +5,12 @@ * 2.0. */ -import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { IndexManagementHome } from '../../../public/application/sections/home'; import { indexManagementStore } from '../../../public/application/store'; import { WithAppDependencies, services, TestSubjects } from '../helpers'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { store: () => indexManagementStore(services as any), memoryRouter: { initialEntries: [`/indices?includeHidden=true`], diff --git a/x-pack/plugins/index_management/__jest__/client_integration/home/index_templates_tab.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/home/index_templates_tab.helpers.ts index 7431686c02bb..4ddd14562577 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/home/index_templates_tab.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/home/index_templates_tab.helpers.ts @@ -7,12 +7,12 @@ import { act } from 'react-dom/test-utils'; -import { registerTestBed, TestBed, TestBedConfig, findTestSubject } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig, findTestSubject } from '@kbn/test/jest'; import { TemplateList } from '../../../public/application/sections/home/template_list'; import { TemplateDeserialized } from '../../../common'; import { WithAppDependencies, TestSubjects } from '../helpers'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [`/templates`], componentRoutePath: `/templates/:templateName?`, diff --git a/x-pack/plugins/index_management/__jest__/client_integration/home/indices_tab.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/home/indices_tab.helpers.ts index 2576b5f92b7b..0e4564163c55 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/home/indices_tab.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/home/indices_tab.helpers.ts @@ -8,12 +8,12 @@ import { act } from 'react-dom/test-utils'; import { ReactWrapper } from 'enzyme'; -import { registerTestBed, TestBed, TestBedConfig, findTestSubject } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig, findTestSubject } from '@kbn/test/jest'; import { IndexManagementHome } from '../../../public/application/sections/home'; import { indexManagementStore } from '../../../public/application/store'; import { WithAppDependencies, services, TestSubjects } from '../helpers'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { store: () => indexManagementStore(services as any), memoryRouter: { initialEntries: [`/indices?includeHiddenIndices=true`], diff --git a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_clone.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_clone.helpers.ts index 222bee28aef4..dffa6fee19d0 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_clone.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_clone.helpers.ts @@ -5,14 +5,14 @@ * 2.0. */ -import { registerTestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { TemplateClone } from '../../../public/application/sections/template_clone'; import { WithAppDependencies } from '../helpers'; import { formSetup } from './template_form.helpers'; import { TEMPLATE_NAME } from './constants'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [`/clone_template/${TEMPLATE_NAME}`], componentRoutePath: `/clone_template/:name`, diff --git a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_create.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_create.helpers.ts index 7d3b34a6b823..450d2c524b44 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_create.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_create.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { TemplateCreate } from '../../../public/application/sections/template_create'; import { WithAppDependencies } from '../helpers'; @@ -16,7 +16,7 @@ export const setup: any = (isLegacy: boolean = false) => { ? { pathname: '/create_template', search: '?legacy=true' } : { pathname: '/create_template' }; - const testBedConfig: TestBedConfig = { + const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [route], componentRoutePath: route, diff --git a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_edit.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_edit.helpers.ts index e087c9432c4c..6c73da3b3379 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_edit.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_edit.helpers.ts @@ -5,14 +5,14 @@ * 2.0. */ -import { registerTestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { TemplateEdit } from '../../../public/application/sections/template_edit'; import { WithAppDependencies } from '../helpers'; import { formSetup, TestSubjects } from './template_form.helpers'; import { TEMPLATE_NAME } from './constants'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [`/edit_template/${TEMPLATE_NAME}`], componentRoutePath: `/edit_template/:name`, diff --git a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_create.helpers.ts b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_create.helpers.ts index 9d28d57e531c..06f0036cc5c7 100644 --- a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_create.helpers.ts +++ b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_create.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { BASE_PATH } from '../../../../../../../common'; import { ComponentTemplateCreate } from '../../../component_template_wizard'; @@ -19,7 +19,7 @@ export type ComponentTemplateCreateTestBed = TestBed; }; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [`${BASE_PATH}/create_component_template`], componentRoutePath: `${BASE_PATH}/create_component_template`, diff --git a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_edit.helpers.ts b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_edit.helpers.ts index 093a01d8db41..e7b8df245aaa 100644 --- a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_edit.helpers.ts +++ b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_edit.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { BASE_PATH } from '../../../../../../../common'; import { ComponentTemplateEdit } from '../../../component_template_wizard'; @@ -19,7 +19,7 @@ export type ComponentTemplateEditTestBed = TestBed; }; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [`${BASE_PATH}/edit_component_template/comp-1`], componentRoutePath: `${BASE_PATH}/edit_component_template/:name`, diff --git a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_list.helpers.ts b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_list.helpers.ts index a8d548a9bf2b..680550d16096 100644 --- a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_list.helpers.ts +++ b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_list.helpers.ts @@ -7,12 +7,18 @@ import { act } from 'react-dom/test-utils'; -import { registerTestBed, TestBed, TestBedConfig, findTestSubject, nextTick } from '@kbn/test/jest'; +import { + registerTestBed, + TestBed, + AsyncTestBedConfig, + findTestSubject, + nextTick, +} from '@kbn/test/jest'; import { BASE_PATH } from '../../../../../../../common'; import { WithAppDependencies } from './setup_environment'; import { ComponentTemplateList } from '../../../component_template_list/component_template_list'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [`${BASE_PATH}component_templates`], componentRoutePath: `${BASE_PATH}component_templates`, diff --git a/x-pack/plugins/infra/public/components/autocomplete_field/autocomplete_field.tsx b/x-pack/plugins/infra/public/components/autocomplete_field/autocomplete_field.tsx index 0e3e2018c963..4aa0edb40685 100644 --- a/x-pack/plugins/infra/public/components/autocomplete_field/autocomplete_field.tsx +++ b/x-pack/plugins/infra/public/components/autocomplete_field/autocomplete_field.tsx @@ -73,6 +73,7 @@ export class AutocompleteField extends React.Component< placeholder={placeholder} value={value} aria-label={ariaLabel} + data-test-subj="infraSearchField" /> {areSuggestionsVisible && !isLoadingSuggestions && suggestions.length > 0 ? ( diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/bottom_drawer.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/bottom_drawer.tsx index 31bc09f9d4dd..3681d740d93d 100644 --- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/bottom_drawer.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/bottom_drawer.tsx @@ -52,6 +52,7 @@ export const BottomDrawer: React.FC<{ aria-expanded={isOpen} iconType={isOpen ? 'arrowDown' : 'arrowRight'} onClick={onClick} + data-test-subj="toggleTimelineButton" > {isOpen ? hideHistory : showHistory} diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/timeline/timeline.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/timeline/timeline.tsx index 65c3136cb48a..0a511589298d 100644 --- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/timeline/timeline.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/timeline/timeline.tsx @@ -210,7 +210,9 @@ export const Timeline: React.FC = ({ interval, yAxisFormatter, isVisible } return ( - + diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/custom_field_panel.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/custom_field_panel.tsx index acc6ae7af272..7d2a327a5082 100644 --- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/custom_field_panel.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/custom_field_panel.tsx @@ -55,6 +55,7 @@ export class CustomFieldPanel extends React.PureComponent { fullWidth > { /> { - + {group.name} diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/legend_controls.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/legend_controls.tsx index 06b7739e03c5..bd7d0ad2f2a4 100644 --- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/legend_controls.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/legend_controls.tsx @@ -84,6 +84,7 @@ export const LegendControls = ({ defaultMessage: 'configure legend', })} onClick={() => setPopoverState(true)} + data-test-subj="openLegendControlsButton" /> ); @@ -131,6 +132,7 @@ export const LegendControls = ({ bounds: { min: draftBounds.min / 100, max: draftBounds.max / 100 }, legend: draftLegend, }); + setPopoverState(false); }, [onChange, draftAuto, draftBounds, draftLegend]); const handleCancelClick = useCallback(() => { @@ -179,7 +181,7 @@ export const LegendControls = ({ : []; return ( - + { {valueMode ? ( - - {value} + + + {value} + ) : ( ellipsisMode && ( diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/waffle_group_by_controls.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/waffle_group_by_controls.tsx index 9f350610b136..ff40a269aed4 100644 --- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/waffle_group_by_controls.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/waffle_group_by_controls.tsx @@ -134,6 +134,7 @@ export class WaffleGroupByControls extends React.PureComponent { {buttonBody} @@ -147,7 +148,11 @@ export class WaffleGroupByControls extends React.PureComponent { panelPaddingSize="none" closePopover={this.handleClose} > - + ); } diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/waffle_sort_controls.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/waffle_sort_controls.tsx index dfa293041d64..dd5b1857e1e6 100644 --- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/waffle_sort_controls.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/waffle_sort_controls.tsx @@ -39,6 +39,7 @@ export const WaffleSortControls = ({ sort, onChange }: Props) => { {label} @@ -59,7 +60,8 @@ export const WaffleSortControls = ({ sort, onChange }: Props) => { ...sort, direction: sort.direction === 'asc' ? 'desc' : 'asc', }); - }, [sort, onChange]); + closePopover(); + }, [closePopover, sort, onChange]); const panels = useMemo( () => [ @@ -71,11 +73,13 @@ export const WaffleSortControls = ({ sort, onChange }: Props) => { name: LABELS.name, icon: sort.by === 'name' ? 'check' : 'empty', onClick: selectName, + 'data-test-subj': 'waffleSortByName', }, { name: LABELS.value, icon: sort.by === 'value' ? 'check' : 'empty', onClick: selectValue, + 'data-test-subj': 'waffleSortByValue', }, ], }, @@ -101,6 +105,7 @@ export const WaffleSortControls = ({ sort, onChange }: Props) => { })} checked={sort.direction === 'desc'} onChange={toggleSort} + data-test-subj={'waffleSortByDirection'} /> diff --git a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_clone.helpers.ts b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_clone.helpers.ts index cf30870cefbb..51f6d9bd96bd 100644 --- a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_clone.helpers.ts +++ b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_clone.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, TestBedConfig, TestBed } from '@kbn/test/jest'; +import { registerTestBed, AsyncTestBedConfig, TestBed } from '@kbn/test/jest'; import { PipelinesClone } from '../../../public/application/sections/pipelines_clone'; import { getFormActions, PipelineFormTestSubjects } from './pipeline_form.helpers'; import { WithAppDependencies } from './setup_environment'; @@ -28,7 +28,7 @@ export const PIPELINE_TO_CLONE = { ], }; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [getClonePath({ clonedPipelineName: PIPELINE_TO_CLONE.name })], componentRoutePath: ROUTES.clone, diff --git a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_create.helpers.ts b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_create.helpers.ts index 06c880bbceda..faf1b42042ec 100644 --- a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_create.helpers.ts +++ b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_create.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, TestBedConfig, TestBed } from '@kbn/test/jest'; +import { registerTestBed, AsyncTestBedConfig, TestBed } from '@kbn/test/jest'; import { PipelinesCreate } from '../../../public/application/sections/pipelines_create'; import { getFormActions, PipelineFormTestSubjects } from './pipeline_form.helpers'; import { WithAppDependencies } from './setup_environment'; @@ -15,7 +15,7 @@ export type PipelinesCreateTestBed = TestBed & { actions: ReturnType; }; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [getCreatePath()], componentRoutePath: ROUTES.create, diff --git a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_edit.helpers.ts b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_edit.helpers.ts index 913eb1355a6d..9a3c41196653 100644 --- a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_edit.helpers.ts +++ b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_edit.helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { registerTestBed, TestBedConfig, TestBed } from '@kbn/test/jest'; +import { registerTestBed, AsyncTestBedConfig, TestBed } from '@kbn/test/jest'; import { PipelinesEdit } from '../../../public/application/sections/pipelines_edit'; import { getFormActions, PipelineFormTestSubjects } from './pipeline_form.helpers'; import { WithAppDependencies } from './setup_environment'; @@ -28,7 +28,7 @@ export const PIPELINE_TO_EDIT = { ], }; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [getEditPath({ pipelineName: PIPELINE_TO_EDIT.name })], componentRoutePath: ROUTES.edit, diff --git a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_list.helpers.ts b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_list.helpers.ts index 5f340b645f95..3cd768104203 100644 --- a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_list.helpers.ts +++ b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_list.helpers.ts @@ -7,12 +7,12 @@ import { act } from 'react-dom/test-utils'; -import { registerTestBed, TestBed, TestBedConfig, findTestSubject } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig, findTestSubject } from '@kbn/test/jest'; import { PipelinesList } from '../../../public/application/sections/pipelines_list'; import { WithAppDependencies } from './setup_environment'; import { getListPath, ROUTES } from '../../../public/application/services/navigation'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [getListPath()], componentRoutePath: ROUTES.list, diff --git a/x-pack/plugins/lens/common/expressions/datatable/datatable.ts b/x-pack/plugins/lens/common/expressions/datatable/datatable.ts index d9f1f9c1196f..7a6d68eaa656 100644 --- a/x-pack/plugins/lens/common/expressions/datatable/datatable.ts +++ b/x-pack/plugins/lens/common/expressions/datatable/datatable.ts @@ -22,6 +22,7 @@ export interface DatatableArgs { columns: ColumnConfigArg[]; sortingColumnId: SortingState['columnId']; sortingDirection: SortingState['direction']; + fitRowToContent?: boolean; } export const getDatatable = ( @@ -57,6 +58,10 @@ export const getDatatable = ( types: ['string'], help: '', }, + fitRowToContent: { + types: ['boolean'], + help: '', + }, }, async fn(...args) { /** Build optimization: prevent adding extra code into initial bundle **/ diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/__snapshots__/table_basic.test.tsx.snap b/x-pack/plugins/lens/public/datatable_visualization/components/__snapshots__/table_basic.test.tsx.snap index 7e3c8c3342e4..bf8497e686e9 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/components/__snapshots__/table_basic.test.tsx.snap +++ b/x-pack/plugins/lens/public/datatable_visualization/components/__snapshots__/table_basic.test.tsx.snap @@ -487,7 +487,7 @@ exports[`DatatableComponent it renders the title and value 1`] = ` `; -exports[`DatatableComponent it should render hide and reset actions on header even when it is in read only mode 1`] = ` +exports[`DatatableComponent it should render hide, reset, and sort actions on header even when it is in read only mode 1`] = ` >, columnConfig: ColumnConfig, DataContext: React.Context, - uiSettings: IUiSettingsClient + uiSettings: IUiSettingsClient, + fitRowToContent?: boolean ) => { // Changing theme requires a full reload of the page, so we can cache here const IS_DARK_THEME = uiSettings.get('theme:darkMode'); @@ -28,6 +30,9 @@ export const createGridCell = ( const content = formatters[columnId]?.convert(rowValue, 'html'); const currentAlignment = alignments && alignments[columnId]; const alignmentClassName = `lnsTableCell--${currentAlignment}`; + const className = classNames(alignmentClassName, { + lnsTableCell: !fitRowToContent, + }); const { colorMode, palette } = columnConfig.columns.find(({ columnId: id }) => id === columnId) || {}; @@ -75,7 +80,7 @@ export const createGridCell = ( */ dangerouslySetInnerHTML={{ __html: content }} // eslint-disable-line react/no-danger data-test-subj="lnsTableCellContent" - className={`lnsTableCell ${alignmentClassName}`} + className={className} /> ); }; diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/columns.tsx b/x-pack/plugins/lens/public/datatable_visualization/components/columns.tsx index 0bc249c78323..a8ba6d553b73 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/components/columns.tsx +++ b/x-pack/plugins/lens/public/datatable_visualization/components/columns.tsx @@ -215,20 +215,16 @@ export const createGridColumns = ( showHide: false, showMoveLeft: false, showMoveRight: false, - showSortAsc: isReadOnly - ? false - : { - label: i18n.translate('xpack.lens.table.sort.ascLabel', { - defaultMessage: 'Sort ascending', - }), - }, - showSortDesc: isReadOnly - ? false - : { - label: i18n.translate('xpack.lens.table.sort.descLabel', { - defaultMessage: 'Sort descending', - }), - }, + showSortAsc: { + label: i18n.translate('xpack.lens.table.sort.ascLabel', { + defaultMessage: 'Sort ascending', + }), + }, + showSortDesc: { + label: i18n.translate('xpack.lens.table.sort.descLabel', { + defaultMessage: 'Sort descending', + }), + }, additional: additionalActions, }, }; diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/table_basic.test.tsx b/x-pack/plugins/lens/public/datatable_visualization/components/table_basic.test.tsx index 312d81e377f3..22407f2b3977 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/components/table_basic.test.tsx +++ b/x-pack/plugins/lens/public/datatable_visualization/components/table_basic.test.tsx @@ -139,7 +139,7 @@ describe('DatatableComponent', () => { ).toMatchSnapshot(); }); - test('it should render hide and reset actions on header even when it is in read only mode', () => { + test('it should render hide, reset, and sort actions on header even when it is in read only mode', () => { const { data, args } = sampleArgs(); expect( diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/table_basic.tsx b/x-pack/plugins/lens/public/datatable_visualization/components/table_basic.tsx index 6be69e5d4d23..ec7a00442f95 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/components/table_basic.tsx +++ b/x-pack/plugins/lens/public/datatable_visualization/components/table_basic.tsx @@ -103,11 +103,9 @@ export const DatatableComponent = (props: DatatableRenderProps) => { const onEditAction = useCallback( (data: LensSortAction['data'] | LensResizeAction['data'] | LensToggleAction['data']) => { - if (renderMode === 'edit') { - dispatchEvent({ name: 'edit', data }); - } + dispatchEvent({ name: 'edit', data }); }, - [dispatchEvent, renderMode] + [dispatchEvent] ); const onRowContextMenuClick = useCallback( (data: LensTableRowContextMenuEvent['data']) => { @@ -264,8 +262,15 @@ export const DatatableComponent = (props: DatatableRenderProps) => { }, [firstTableRef, onRowContextMenuClick, columnConfig, hasAtLeastOneRowClickAction]); const renderCellValue = useMemo( - () => createGridCell(formatters, columnConfig, DataContext, props.uiSettings), - [formatters, columnConfig, props.uiSettings] + () => + createGridCell( + formatters, + columnConfig, + DataContext, + props.uiSettings, + props.args.fitRowToContent + ), + [formatters, columnConfig, props.uiSettings, props.args.fitRowToContent] ); const columnVisibility = useMemo( @@ -351,6 +356,13 @@ export const DatatableComponent = (props: DatatableRenderProps) => { ) { + const { state, setState } = props; + + const onChange = useCallback(() => { + const current = state.fitRowToContent ?? false; + setState({ + ...state, + fitRowToContent: !current, + }); + }, [setState, state]); + + return ( + + + + + + + + ); +} diff --git a/x-pack/plugins/lens/public/datatable_visualization/visualization.tsx b/x-pack/plugins/lens/public/datatable_visualization/visualization.tsx index b21b8b8e07b3..a953da4c380f 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/visualization.tsx +++ b/x-pack/plugins/lens/public/datatable_visualization/visualization.tsx @@ -24,12 +24,13 @@ import { getStopsForFixedMode } from '../shared_components'; import { LayerType, layerTypes } from '../../common'; import { getDefaultSummaryLabel } from '../../common/expressions'; import type { ColumnState, SortingState } from '../../common/expressions'; - +import { DataTableToolbar } from './components/toolbar'; export interface DatatableVisualizationState { columns: ColumnState[]; layerId: string; layerType: LayerType; sorting?: SortingState; + fitRowToContent?: boolean; } const visualizationLabel = i18n.translate('xpack.lens.datatable.label', { @@ -389,6 +390,7 @@ export const getDatatableVisualization = ({ }), sortingColumnId: [state.sorting?.columnId || ''], sortingDirection: [state.sorting?.direction || 'none'], + fitRowToContent: [state.fitRowToContent ?? false], }, }, ], @@ -399,6 +401,15 @@ export const getDatatableVisualization = ({ return undefined; }, + renderToolbar(domElement, props) { + render( + + + , + domElement + ); + }, + onEditAction(state, event) { switch (event.data.action) { case 'sort': diff --git a/x-pack/plugins/lens/public/editor_frame_service/service.tsx b/x-pack/plugins/lens/public/editor_frame_service/service.tsx index d97cfd3cbca2..b585d03e12f8 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/service.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/service.tsx @@ -61,16 +61,19 @@ export class EditorFrameService { private readonly datasources: Array Promise)> = []; private readonly visualizations: Array Promise)> = []; + private loadDatasources = () => collectAsyncDefinitions(this.datasources); + public loadVisualizations = () => collectAsyncDefinitions(this.visualizations); + /** * This method takes a Lens saved object as returned from the persistence helper, * initializes datsources and visualization and creates the current expression. - * This is an asynchronous process and should only be triggered once for a saved object. + * This is an asynchronous process. * @param doc parsed Lens saved object */ public documentToExpression = async (doc: Document) => { const [resolvedDatasources, resolvedVisualizations] = await Promise.all([ - collectAsyncDefinitions(this.datasources), - collectAsyncDefinitions(this.visualizations), + this.loadDatasources(), + this.loadVisualizations(), ]); const { persistedStateToExpression } = await import('../async_services'); @@ -92,8 +95,8 @@ export class EditorFrameService { public start(core: CoreStart, plugins: EditorFrameStartPlugins): EditorFrameStart { const createInstance = async (): Promise => { const [resolvedDatasources, resolvedVisualizations] = await Promise.all([ - collectAsyncDefinitions(this.datasources), - collectAsyncDefinitions(this.visualizations), + this.loadDatasources(), + this.loadVisualizations(), ]); const { EditorFrame } = await import('../async_services'); diff --git a/x-pack/plugins/lens/public/embeddable/embeddable.test.tsx b/x-pack/plugins/lens/public/embeddable/embeddable.test.tsx index 4c247c031eac..59d6325e1c0c 100644 --- a/x-pack/plugins/lens/public/embeddable/embeddable.test.tsx +++ b/x-pack/plugins/lens/public/embeddable/embeddable.test.tsx @@ -25,6 +25,7 @@ import { LensAttributeService } from '../lens_attribute_service'; import { OnSaveProps } from '../../../../../src/plugins/saved_objects/public/save_modal'; import { act } from 'react-dom/test-utils'; import { inspectorPluginMock } from '../../../../../src/plugins/inspector/public/mocks'; +import { Visualization } from '../types'; jest.mock('../../../../../src/plugins/inspector/public/', () => ({ isAvailable: false, @@ -125,6 +126,7 @@ describe('embeddable', () => { }, inspector: inspectorPluginMock.createStartContract(), getTrigger, + visualizationMap: {}, documentToExpression: () => Promise.resolve({ ast: { @@ -165,6 +167,7 @@ describe('embeddable', () => { inspector: inspectorPluginMock.createStartContract(), capabilities: { canSaveDashboards: true, canSaveVisualizations: true }, getTrigger, + visualizationMap: {}, documentToExpression: () => Promise.resolve({ ast: { @@ -209,6 +212,7 @@ describe('embeddable', () => { canSaveVisualizations: true, }, getTrigger, + visualizationMap: {}, documentToExpression: () => Promise.resolve({ ast: { @@ -255,6 +259,7 @@ describe('embeddable', () => { canSaveVisualizations: true, }, getTrigger, + visualizationMap: {}, documentToExpression: () => Promise.resolve({ ast: { @@ -297,6 +302,7 @@ describe('embeddable', () => { canSaveVisualizations: true, }, getTrigger, + visualizationMap: {}, documentToExpression: () => Promise.resolve({ ast: { @@ -336,6 +342,7 @@ describe('embeddable', () => { canSaveVisualizations: true, }, getTrigger, + visualizationMap: {}, documentToExpression: () => Promise.resolve({ ast: { @@ -378,6 +385,7 @@ describe('embeddable', () => { indexPatternService: {} as IndexPatternsContract, capabilities: { canSaveDashboards: true, canSaveVisualizations: true }, getTrigger, + visualizationMap: {}, documentToExpression: () => Promise.resolve({ ast: { @@ -427,6 +435,7 @@ describe('embeddable', () => { canSaveVisualizations: true, }, getTrigger, + visualizationMap: {}, documentToExpression: () => Promise.resolve({ ast: { @@ -474,6 +483,7 @@ describe('embeddable', () => { canSaveVisualizations: true, }, getTrigger, + visualizationMap: {}, documentToExpression: () => Promise.resolve({ ast: { @@ -528,6 +538,7 @@ describe('embeddable', () => { canSaveVisualizations: true, }, getTrigger, + visualizationMap: {}, documentToExpression: () => Promise.resolve({ ast: { @@ -583,6 +594,7 @@ describe('embeddable', () => { canSaveVisualizations: true, }, getTrigger, + visualizationMap: {}, documentToExpression: () => Promise.resolve({ ast: { @@ -641,6 +653,7 @@ describe('embeddable', () => { canSaveVisualizations: true, }, getTrigger, + visualizationMap: {}, documentToExpression: () => Promise.resolve({ ast: { @@ -683,6 +696,7 @@ describe('embeddable', () => { canSaveVisualizations: true, }, getTrigger, + visualizationMap: {}, documentToExpression: () => Promise.resolve({ ast: { @@ -725,6 +739,7 @@ describe('embeddable', () => { canSaveVisualizations: true, }, getTrigger, + visualizationMap: {}, documentToExpression: () => Promise.resolve({ ast: { @@ -767,6 +782,7 @@ describe('embeddable', () => { canSaveVisualizations: true, }, getTrigger, + visualizationMap: {}, documentToExpression: () => Promise.resolve({ ast: { @@ -824,6 +840,7 @@ describe('embeddable', () => { canSaveVisualizations: true, }, getTrigger, + visualizationMap: {}, documentToExpression: () => Promise.resolve({ ast: { @@ -897,6 +914,7 @@ describe('embeddable', () => { canSaveVisualizations: true, }, getTrigger, + visualizationMap: {}, documentToExpression: () => Promise.resolve({ ast: { @@ -945,6 +963,7 @@ describe('embeddable', () => { canSaveVisualizations: true, }, getTrigger, + visualizationMap: {}, documentToExpression: () => Promise.resolve({ ast: { @@ -993,6 +1012,7 @@ describe('embeddable', () => { canSaveVisualizations: true, }, getTrigger, + visualizationMap: {}, documentToExpression: () => Promise.resolve({ ast: { @@ -1016,4 +1036,82 @@ describe('embeddable', () => { expect(onTableRowClick).toHaveBeenCalledWith({ name: 'test' }); expect(onTableRowClick).toHaveBeenCalledTimes(1); }); + + it('handles edit actions ', async () => { + const editedVisualizationState = { value: 'edited' }; + const onEditActionMock = jest.fn().mockReturnValue(editedVisualizationState); + const documentToExpressionMock = jest.fn().mockImplementation(async (document) => { + const isStateEdited = document.state.visualization.value === 'edited'; + return { + ast: { + type: 'expression', + chain: [ + { + type: 'function', + function: isStateEdited ? 'edited' : 'not_edited', + arguments: {}, + }, + ], + }, + errors: undefined, + }; + }); + + const visDocument: Document = { + state: { + visualization: {}, + datasourceStates: {}, + query: { query: '', language: 'lucene' }, + filters: [], + }, + references: [], + title: 'My title', + visualizationType: 'lensDatatable', + }; + + const embeddable = new Embeddable( + { + timefilter: dataPluginMock.createSetupContract().query.timefilter.timefilter, + attributeService: attributeServiceMockFromSavedVis(visDocument), + expressionRenderer, + basePath, + inspector: inspectorPluginMock.createStartContract(), + indexPatternService: {} as IndexPatternsContract, + capabilities: { + canSaveDashboards: true, + canSaveVisualizations: true, + }, + getTrigger, + visualizationMap: { + [visDocument.visualizationType as string]: { + onEditAction: onEditActionMock, + } as unknown as Visualization, + }, + documentToExpression: documentToExpressionMock, + }, + { id: '123' } as unknown as LensEmbeddableInput + ); + + // SETUP FRESH STATE + await embeddable.initializeSavedVis({ id: '123' } as LensEmbeddableInput); + embeddable.render(mountpoint); + + await new Promise((resolve) => setTimeout(resolve, 0)); + + expect(expressionRenderer).toHaveBeenCalledTimes(1); + expect(expressionRenderer.mock.calls[0][0]!.expression).toBe(`not_edited`); + + // TEST EDIT EVENT + await embeddable.handleEvent({ name: 'edit' }); + + expect(onEditActionMock).toHaveBeenCalledTimes(1); + expect(documentToExpressionMock).toHaveBeenCalled(); + + const docToExpCalls = documentToExpressionMock.mock.calls; + const editedVisDocument = docToExpCalls[docToExpCalls.length - 1][0]; + expect(editedVisDocument.state.visualization).toEqual(editedVisualizationState); + + expect(expressionRenderer).toHaveBeenCalledTimes(2); + expect(expressionRenderer.mock.calls[1][0]!.expression).toBe(`edited`); + }); }); diff --git a/x-pack/plugins/lens/public/embeddable/embeddable.tsx b/x-pack/plugins/lens/public/embeddable/embeddable.tsx index 7faf873cf0b0..563e10bb03ab 100644 --- a/x-pack/plugins/lens/public/embeddable/embeddable.tsx +++ b/x-pack/plugins/lens/public/embeddable/embeddable.tsx @@ -47,10 +47,13 @@ import { UiActionsStart } from '../../../../../src/plugins/ui_actions/public'; import { isLensBrushEvent, isLensFilterEvent, + isLensEditEvent, isLensTableRowContextMenuClickEvent, LensBrushEvent, LensFilterEvent, LensTableRowContextMenuEvent, + VisualizationMap, + Visualization, } from '../types'; import { IndexPatternsContract } from '../../../../../src/plugins/data/public'; @@ -97,6 +100,7 @@ export interface LensEmbeddableDeps { documentToExpression: ( doc: Document ) => Promise<{ ast: Ast | null; errors: ErrorMessage[] | undefined }>; + visualizationMap: VisualizationMap; indexPatternService: IndexPatternsContract; expressionRenderer: ReactExpressionRendererType; timefilter: TimefilterContract; @@ -109,6 +113,17 @@ export interface LensEmbeddableDeps { spaces?: SpacesPluginStart; } +const getExpressionFromDocument = async ( + document: Document, + documentToExpression: LensEmbeddableDeps['documentToExpression'] +) => { + const { ast, errors } = await documentToExpression(document); + return { + expression: ast ? toExpression(ast) : null, + errors, + }; +}; + export class Embeddable extends AbstractEmbeddable implements ReferenceOrValueEmbeddable @@ -260,6 +275,29 @@ export class Embeddable return this.lensInspector.adapters; } + private maybeAddConflictError( + errors: ErrorMessage[], + sharingSavedObjectProps?: SharingSavedObjectProps + ) { + const ret = [...errors]; + + if (sharingSavedObjectProps?.outcome === 'conflict' && !!this.deps.spaces) { + ret.push({ + shortMessage: i18n.translate('xpack.lens.embeddable.legacyURLConflict.shortMessage', { + defaultMessage: `You've encountered a URL conflict`, + }), + longMessage: ( + + ), + }); + } + + return ret; + } + async initializeSavedVis(input: LensEmbeddableInput) { const attrs: ResolvedLensSavedObjectAttributes | false = await this.deps.attributeService .unwrapAttributes(input) @@ -278,23 +316,14 @@ export class Embeddable type: this.type, savedObjectId: (input as LensByReferenceInput)?.savedObjectId, }; - const { ast, errors } = await this.deps.documentToExpression(this.savedVis); - this.errors = errors; - if (sharingSavedObjectProps?.outcome === 'conflict' && this.deps.spaces) { - const conflictError = { - shortMessage: i18n.translate('xpack.lens.embeddable.legacyURLConflict.shortMessage', { - defaultMessage: `You've encountered a URL conflict`, - }), - longMessage: ( - - ), - }; - this.errors = this.errors ? [...this.errors, conflictError] : [conflictError]; - } - this.expression = ast ? toExpression(ast) : null; + + const { expression, errors } = await getExpressionFromDocument( + this.savedVis, + this.deps.documentToExpression + ); + this.expression = expression; + this.errors = errors && this.maybeAddConflictError(errors, sharingSavedObjectProps); + if (this.errors) { this.logError('validation'); } @@ -432,7 +461,17 @@ export class Embeddable return output; } - handleEvent = (event: ExpressionRendererEvent) => { + private get onEditAction(): Visualization['onEditAction'] { + const visType = this.savedVis?.visualizationType; + + if (!visType) { + return; + } + + return this.deps.visualizationMap[visType].onEditAction; + } + + handleEvent = async (event: ExpressionRendererEvent) => { if (!this.deps.getTrigger || this.input.disableTriggers) { return; } @@ -468,9 +507,29 @@ export class Embeddable this.input.onTableRowClick(event.data as unknown as LensTableRowContextMenuEvent['data']); } } + + // We allow for edit actions in the Embeddable for display purposes only (e.g. changing the datatable sort order). + // No state changes made here with an edit action are persisted. + if (isLensEditEvent(event) && this.onEditAction) { + if (!this.savedVis) return; + + // have to dance since this.savedVis.state is readonly + const newVis = JSON.parse(JSON.stringify(this.savedVis)) as Document; + newVis.state.visualization = this.onEditAction(newVis.state.visualization, event); + this.savedVis = newVis; + + const { expression, errors } = await getExpressionFromDocument( + this.savedVis, + this.deps.documentToExpression + ); + this.expression = expression; + this.errors = errors; + + this.reload(); + } }; - async reload() { + reload() { if (!this.savedVis || !this.isInitialized || this.isDestroyed) { return; } diff --git a/x-pack/plugins/lens/public/embeddable/embeddable_factory.ts b/x-pack/plugins/lens/public/embeddable/embeddable_factory.ts index e51ec4c3e558..811f391e32f9 100644 --- a/x-pack/plugins/lens/public/embeddable/embeddable_factory.ts +++ b/x-pack/plugins/lens/public/embeddable/embeddable_factory.ts @@ -25,6 +25,7 @@ import { DOC_TYPE } from '../../common/constants'; import { ErrorMessage } from '../editor_frame_service/types'; import { extract, inject } from '../../common/embeddable_factory'; import type { SpacesPluginStart } from '../../../spaces/public'; +import { VisualizationMap } from '../types'; export interface LensEmbeddableStartServices { timefilter: TimefilterContract; @@ -39,6 +40,7 @@ export interface LensEmbeddableStartServices { documentToExpression: ( doc: Document ) => Promise<{ ast: Ast | null; errors: ErrorMessage[] | undefined }>; + visualizationMap: VisualizationMap; spaces?: SpacesPluginStart; } @@ -85,6 +87,7 @@ export class EmbeddableFactory implements EmbeddableFactoryDefinition { timefilter, expressionRenderer, documentToExpression, + visualizationMap, uiActions, coreHttp, attributeService, @@ -108,6 +111,7 @@ export class EmbeddableFactory implements EmbeddableFactoryDefinition { getTrigger: uiActions?.getTrigger, getTriggerCompatibleActions: uiActions?.getTriggerCompatibleActions, documentToExpression, + visualizationMap, capabilities: { canSaveDashboards: Boolean(capabilities.dashboard?.showWriteControls), canSaveVisualizations: Boolean(capabilities.visualize.save), diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.test.ts b/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.test.ts index 5a405bb2328e..8f180d4a021e 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.test.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.test.ts @@ -1345,8 +1345,11 @@ describe('IndexPattern Data Source', () => { }); describe('#getWarningMessages', () => { - it('should return mismatched time shifts', () => { - const state: IndexPatternPrivateState = { + let state: IndexPatternPrivateState; + let framePublicAPI: FramePublicAPI; + + beforeEach(() => { + state = { indexPatternRefs: [], existingFields: {}, isFirstExistenceFetch: false, @@ -1410,7 +1413,8 @@ describe('IndexPattern Data Source', () => { }, currentIndexPatternId: '1', }; - const warnings = indexPatternDatasource.getWarningMessages!(state, { + + framePublicAPI = { activeData: { first: { type: 'datatable', @@ -1433,20 +1437,39 @@ describe('IndexPattern Data Source', () => { ], }, }, - } as unknown as FramePublicAPI); - expect(warnings!.length).toBe(2); - expect((warnings![0] as React.ReactElement).props.id).toEqual( - 'xpack.lens.indexPattern.timeShiftSmallWarning' - ); - expect((warnings![1] as React.ReactElement).props.id).toEqual( - 'xpack.lens.indexPattern.timeShiftMultipleWarning' - ); + } as unknown as FramePublicAPI; + }); + + it('should return mismatched time shifts', () => { + const warnings = indexPatternDatasource.getWarningMessages!(state, framePublicAPI); + + expect(warnings!.map((item) => (item as React.ReactElement).props.id)).toMatchInlineSnapshot(` + Array [ + "xpack.lens.indexPattern.timeShiftSmallWarning", + "xpack.lens.indexPattern.timeShiftMultipleWarning", + ] + `); + }); + + it('should show different types of warning messages', () => { + framePublicAPI.activeData!.first.columns[0].meta.sourceParams!.hasPrecisionError = true; + + const warnings = indexPatternDatasource.getWarningMessages!(state, framePublicAPI); + + expect(warnings!.map((item) => (item as React.ReactElement).props.id)).toMatchInlineSnapshot(` + Array [ + "xpack.lens.indexPattern.timeShiftSmallWarning", + "xpack.lens.indexPattern.timeShiftMultipleWarning", + "xpack.lens.indexPattern.precisionErrorWarning", + ] + `); }); it('should prepend each error with its layer number on multi-layer chart', () => { (getErrorMessages as jest.Mock).mockClear(); (getErrorMessages as jest.Mock).mockReturnValueOnce(['error 1', 'error 2']); - const state: IndexPatternPrivateState = { + + state = { indexPatternRefs: [], existingFields: {}, isFirstExistenceFetch: false, @@ -1465,6 +1488,7 @@ describe('IndexPattern Data Source', () => { }, currentIndexPatternId: '1', }; + expect(indexPatternDatasource.getErrorMessages(state)).toEqual([ { longMessage: 'Layer 1 error: error 1', shortMessage: '' }, { longMessage: 'Layer 1 error: error 2', shortMessage: '' }, diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.tsx index bdcc0e621cc3..b970ad092c7f 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.tsx @@ -57,7 +57,7 @@ import { UiActionsStart } from '../../../../../src/plugins/ui_actions/public'; import { GeoFieldWorkspacePanel } from '../editor_frame_service/editor_frame/workspace_panel/geo_field_workspace_panel'; import { DraggingIdentifier } from '../drag_drop'; import { getStateTimeShiftWarningMessages } from './time_shift_utils'; - +import { getPrecisionErrorWarningMessages } from './utils'; export type { OperationType, IndexPatternColumn } from './operations'; export { deleteColumn } from './operations'; @@ -502,7 +502,12 @@ export function getIndexPatternDatasource({ }); return messages.length ? messages : undefined; }, - getWarningMessages: getStateTimeShiftWarningMessages, + getWarningMessages: (state, frame) => { + return [ + ...(getStateTimeShiftWarningMessages(state, frame) || []), + ...getPrecisionErrorWarningMessages(state, frame, core.docLinks), + ]; + }, checkIntegrity: (state) => { const ids = Object.values(state.layers || {}).map(({ indexPatternId }) => indexPatternId); return ids.filter((id) => !state.indexPatterns[id]); diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/utils.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/utils.test.tsx new file mode 100644 index 000000000000..05be5c66fe5d --- /dev/null +++ b/x-pack/plugins/lens/public/indexpattern_datasource/utils.test.tsx @@ -0,0 +1,61 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { getPrecisionErrorWarningMessages } from './utils'; +import type { IndexPatternPrivateState } from './types'; +import type { FramePublicAPI } from '../types'; +import type { DocLinksStart } from 'kibana/public'; + +describe('indexpattern_datasource utils', () => { + describe('getPrecisionErrorWarningMessages', () => { + let state: IndexPatternPrivateState; + let framePublicAPI: FramePublicAPI; + let docLinks: DocLinksStart; + + beforeEach(() => { + state = {} as IndexPatternPrivateState; + framePublicAPI = { + activeData: { + id: { + columns: [ + { + meta: { + sourceParams: { + hasPrecisionError: false, + }, + }, + }, + ], + }, + }, + } as unknown as FramePublicAPI; + + docLinks = { + links: { + aggs: { + terms_doc_count_error: 'http://terms_doc_count_error', + }, + }, + } as DocLinksStart; + }); + test('should not show precisionError if hasPrecisionError is false', () => { + expect(getPrecisionErrorWarningMessages(state, framePublicAPI, docLinks)).toHaveLength(0); + }); + + test('should not show precisionError if hasPrecisionError is not defined', () => { + delete framePublicAPI.activeData!.id.columns[0].meta.sourceParams!.hasPrecisionError; + + expect(getPrecisionErrorWarningMessages(state, framePublicAPI, docLinks)).toHaveLength(0); + }); + + test('should show precisionError if hasPrecisionError is true', () => { + framePublicAPI.activeData!.id.columns[0].meta.sourceParams!.hasPrecisionError = true; + + expect(getPrecisionErrorWarningMessages(state, framePublicAPI, docLinks)).toHaveLength(1); + }); + }); +}); diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/utils.ts b/x-pack/plugins/lens/public/indexpattern_datasource/utils.tsx similarity index 55% rename from x-pack/plugins/lens/public/indexpattern_datasource/utils.ts rename to x-pack/plugins/lens/public/indexpattern_datasource/utils.tsx index a4e36367cef4..6d3f75a403dd 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/utils.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/utils.tsx @@ -5,17 +5,30 @@ * 2.0. */ -import { DataType } from '../types'; -import { IndexPattern, IndexPatternLayer, DraggedField } from './types'; +import React from 'react'; +import { FormattedMessage } from '@kbn/i18n/react'; +import type { DocLinksStart } from 'kibana/public'; +import { EuiLink, EuiTextColor } from '@elastic/eui'; + +import { DatatableColumn } from 'src/plugins/expressions'; +import type { DataType, FramePublicAPI } from '../types'; +import type { + IndexPattern, + IndexPatternLayer, + DraggedField, + IndexPatternPrivateState, +} from './types'; import type { BaseIndexPatternColumn, FieldBasedIndexPatternColumn, ReferenceBasedIndexPatternColumn, } from './operations/definitions/column_types'; + import { operationDefinitionMap, IndexPatternColumn } from './operations'; import { getInvalidFieldMessage } from './operations/definitions/helpers'; import { isQueryValid } from './operations/definitions/filters'; +import { checkColumnForPrecisionError } from '../../../../../src/plugins/data/common'; /** * Normalizes the specified operation type. (e.g. document operations @@ -101,3 +114,60 @@ export function fieldIsInvalid(column: IndexPatternColumn | undefined, indexPatt } return !!getInvalidFieldMessage(column, indexPattern)?.length; } + +export function getPrecisionErrorWarningMessages( + state: IndexPatternPrivateState, + { activeData }: FramePublicAPI, + docLinks: DocLinksStart +) { + const warningMessages: React.ReactNode[] = []; + + if (state && activeData) { + Object.values(activeData) + .reduce((acc: DatatableColumn[], { columns }) => [...acc, ...columns], []) + .forEach((column) => { + if (checkColumnForPrecisionError(column)) { + warningMessages.push( + {column.name}, + topValues: ( + + + + ), + filters: ( + + + + ), + link: ( + + + + ), + }} + /> + ); + } + }); + } + + return warningMessages; +} diff --git a/x-pack/plugins/lens/public/plugin.ts b/x-pack/plugins/lens/public/plugin.ts index 1532b2b09910..fb0a922c7e9a 100644 --- a/x-pack/plugins/lens/public/plugin.ts +++ b/x-pack/plugins/lens/public/plugin.ts @@ -201,6 +201,8 @@ export class LensPlugin { plugins.fieldFormats.deserialize ); + const visualizationMap = await this.editorFrameService!.loadVisualizations(); + return { attributeService: getLensAttributeService(coreStart, plugins), capabilities: coreStart.application.capabilities, @@ -208,6 +210,7 @@ export class LensPlugin { timefilter: plugins.data.query.timefilter.timefilter, expressionRenderer: plugins.expressions.ReactExpressionRenderer, documentToExpression: this.editorFrameService!.documentToExpression, + visualizationMap, indexPatternService: plugins.data.indexPatterns, uiActions: plugins.uiActions, usageCollection, diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/configuration_step_form.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/configuration_step_form.tsx index 21090ce671d0..720dcd232d2f 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/configuration_step_form.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/configuration_step_form.tsx @@ -667,17 +667,6 @@ export const ConfigurationStepForm: FC = ({ )} - - - - = ({ setUnsupportedFieldsError={setUnsupportedFieldsError} setFormState={setFormState} /> + + + + {showScatterplotMatrix && ( <> = (prop const forceInput = useRef(null); const { toasts } = useNotifications(); + const { + services: { + application: { capabilities }, + }, + } = useMlKibana(); const onChange = (str: string) => { setAdvancedEditorRawString(str); }; + const canCreateDataView = useMemo( + () => + capabilities.savedObjectsManagement.edit === true || capabilities.indexPatterns.save === true, + [capabilities] + ); + const debouncedJobIdCheck = useMemo( () => debounce(async () => { @@ -200,18 +220,34 @@ export const CreateAnalyticsAdvancedEditor: FC = (prop {!isJobCreated && ( + {i18n.translate( + 'xpack.ml.dataframe.analytics.create.dataViewPermissionWarning', + { + defaultMessage: 'You need permission to create data views.', + } + )} + , + ] + : []), + ...(createIndexPattern && destinationIndexPatternTitleExists + ? [ + i18n.translate('xpack.ml.dataframe.analytics.create.dataViewExistsError', { + defaultMessage: 'A data view with this title already exists.', + }), + ] + : []), + ]} > = ({ setCurrentStep, }) => { const { - services: { docLinks, notifications }, + services: { + docLinks, + notifications, + application: { capabilities }, + }, } = useMlKibana(); const createIndexLink = docLinks.links.apis.createIndex; const { setFormState } = actions; @@ -71,6 +75,11 @@ export const DetailsStepForm: FC = ({ (cloneJob !== undefined && resultsField === DEFAULT_RESULTS_FIELD) ); + const canCreateDataView = useMemo( + () => + capabilities.savedObjectsManagement.edit === true || capabilities.indexPatterns.save === true, + [capabilities] + ); const forceInput = useRef(null); const isStepInvalid = @@ -149,6 +158,12 @@ export const DetailsStepForm: FC = ({ } }, [destIndexSameAsId, jobId]); + useEffect(() => { + if (canCreateDataView === false) { + setFormState({ createIndexPattern: false }); + } + }, [capabilities]); + return ( = ({ + {i18n.translate('xpack.ml.dataframe.analytics.create.dataViewPermissionWarning', { + defaultMessage: 'You need permission to create data views.', + })} + , + ] + : []), ...(createIndexPattern && destinationIndexPatternTitleExists ? [ i18n.translate('xpack.ml.dataframe.analytics.create.dataViewExistsError', { @@ -373,7 +399,7 @@ export const DetailsStepForm: FC = ({ ]} > = ({ destIndex }) => { const { services: { http: { basePath }, + application: { capabilities }, }, } = useMlKibana(); + const canCreateDataView = useMemo( + () => + capabilities.savedObjectsManagement.edit === true || capabilities.indexPatterns.save === true, + [capabilities] + ); + return ( <> - - - ), }} /> + {canCreateDataView === true ? ( + + + + ), + }} + /> + ) : null} ); diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_map/use_map_action.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_map/use_map_action.tsx index 94568b4f5980..6fdcc047bce9 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_map/use_map_action.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_map/use_map_action.tsx @@ -6,10 +6,12 @@ */ import React, { useCallback, useMemo } from 'react'; +import { cloneDeep } from 'lodash'; import { useMlLocator, useNavigateToPath } from '../../../../../contexts/kibana'; import { DataFrameAnalyticsListAction, DataFrameAnalyticsListRow } from '../analytics_list/common'; import { ML_PAGES } from '../../../../../../../common/constants/locator'; import { getViewLinkStatus } from '../action_view/get_view_link_status'; +import { useUrlState } from '../../../../../util/url_state'; import { mapActionButtonText, MapButton } from './map_button'; @@ -18,14 +20,25 @@ export const useMapAction = () => { const mlLocator = useMlLocator()!; const navigateToPath = useNavigateToPath(); - const clickHandler = useCallback(async (item: DataFrameAnalyticsListRow) => { - const path = await mlLocator.getUrl({ - page: ML_PAGES.DATA_FRAME_ANALYTICS_MAP, - pageState: { jobId: item.id }, - }); + const [globalState] = useUrlState('_g'); - await navigateToPath(path, false); - }, []); + const clickHandler = useCallback( + async (item: DataFrameAnalyticsListRow) => { + const globalStateClone = cloneDeep(globalState || {}); + delete globalStateClone.ml; + + const path = await mlLocator.getUrl({ + page: ML_PAGES.DATA_FRAME_ANALYTICS_MAP, + pageState: { + jobId: item.id, + globalState: globalStateClone, + }, + }); + + await navigateToPath(path, false); + }, + [globalState] + ); const action: DataFrameAnalyticsListAction = useMemo( () => ({ diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/analytics_list.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/analytics_list.tsx index 8423e569a99f..a773fffdac99 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/analytics_list.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/analytics_list.tsx @@ -39,6 +39,7 @@ import { useTableSettings } from './use_table_settings'; import { RefreshAnalyticsListButton } from '../refresh_analytics_list_button'; import { ListingPageUrlState } from '../../../../../../../common/types/common'; import { JobsAwaitingNodeWarning } from '../../../../../components/jobs_awaiting_node_warning'; +import { useRefresh } from '../../../../../routing/use_refresh'; const filters: EuiSearchBarProps['filters'] = [ { @@ -119,6 +120,8 @@ export const DataFrameAnalyticsList: FC = ({ const [errorMessage, setErrorMessage] = useState(undefined); const [jobsAwaitingNodeCount, setJobsAwaitingNodeCount] = useState(0); + const refreshObs = useRefresh(); + const disabled = !checkPermission('canCreateDataFrameAnalytics') || !checkPermission('canStartStopDataFrameAnalytics'); @@ -174,6 +177,13 @@ export const DataFrameAnalyticsList: FC = ({ isManagementTable ); + useEffect( + function updateOnTimerRefresh() { + getAnalyticsCallback(); + }, + [refreshObs] + ); + const { columns, modals } = useColumns( expandedRowItemIds, setExpandedRowItemIds, diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/use_refresh_interval.ts b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/use_refresh_interval.ts index c2335e4d5d01..0f236984f587 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/use_refresh_interval.ts +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/use_refresh_interval.ts @@ -8,6 +8,7 @@ import React, { useEffect } from 'react'; import { useMlKibana } from '../../../../../contexts/kibana'; +import { useUrlState } from '../../../../../util/url_state'; import { DEFAULT_REFRESH_INTERVAL_MS, @@ -20,6 +21,7 @@ export const useRefreshInterval = ( setBlockRefresh: React.Dispatch> ) => { const { services } = useMlKibana(); + const [globalState] = useUrlState('_g'); const { timefilter } = services.data.query.timefilter; const { refresh } = useRefreshAnalyticsList(); @@ -35,7 +37,9 @@ export const useRefreshInterval = ( initAutoRefresh(); function initAutoRefresh() { - const { value } = timefilter.getRefreshInterval(); + const interval = globalState?.refreshInterval ?? timefilter.getRefreshInterval(); + const { value } = interval; + if (value === 0) { // the auto refresher starts in an off state // so switch it on and set the interval to 30s diff --git a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/utils.js b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/utils.js index fe09ed45f127..d6926950dce7 100644 --- a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/utils.js +++ b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/utils.js @@ -220,9 +220,21 @@ export async function cloneJob(jobId) { ]); const dataViewNames = await getDataViewNames(); - const jobIndicesAvailable = dataViewNames.includes(datafeed.indices.join(',')); + const dataViewTitle = datafeed.indices.join(','); + const jobIndicesAvailable = dataViewNames.includes(dataViewTitle); if (jobIndicesAvailable === false) { + const warningText = i18n.translate( + 'xpack.ml.jobsList.managementActions.noSourceDataViewForClone', + { + defaultMessage: + 'Unable to clone the anomaly detection job {jobId}. No data view exists for index {dataViewTitle}.', + values: { jobId, dataViewTitle }, + } + ); + getToastNotificationService().displayDangerToast(warningText, { + 'data-test-subj': 'mlCloneJobNoDataViewExistsWarningToast', + }); return; } diff --git a/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js b/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js index cad5bb68fb62..31cdfa5df057 100644 --- a/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js +++ b/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js @@ -1203,15 +1203,16 @@ class TimeseriesChartIntl extends Component { .call(brush) .selectAll('rect') .attr('y', -1) - .attr('height', contextChartHeight + swimlaneHeight + 1); + .attr('height', contextChartHeight + swimlaneHeight + 1) + .attr('width', this.vizWidth); + + const handleBrushExtent = brush.extent(); // move the left and right resize areas over to // be under the handles contextGroup.selectAll('.w rect').attr('x', -10).attr('width', 10); - contextGroup.selectAll('.e rect').attr('x', 0).attr('width', 10); - - const handleBrushExtent = brush.extent(); + contextGroup.selectAll('.e rect').attr('transform', null).attr('width', 10); const topBorder = contextGroup .append('rect') @@ -1247,6 +1248,7 @@ class TimeseriesChartIntl extends Component { function brushing() { const brushExtent = brush.extent(); mask.reveal(brushExtent); + leftHandle.attr('x', contextXScale(brushExtent[0]) - 10); rightHandle.attr('x', contextXScale(brushExtent[1]) + 0); diff --git a/x-pack/plugins/ml/server/models/data_recognizer/modules/apm_transaction/manifest.json b/x-pack/plugins/ml/server/models/data_recognizer/modules/apm_transaction/manifest.json index f8feaef3be5f..3332fad66b3e 100644 --- a/x-pack/plugins/ml/server/models/data_recognizer/modules/apm_transaction/manifest.json +++ b/x-pack/plugins/ml/server/models/data_recognizer/modules/apm_transaction/manifest.json @@ -1,29 +1,29 @@ { "id": "apm_transaction", "title": "APM", - "description": "Detect anomalies in transactions from your APM services.", + "description": "Detect anomalies in transaction latency, throughput and failure rate from your APM services for metric data.", "type": "Transaction data", "logoFile": "logo.json", - "defaultIndexPattern": "apm-*-transaction", + "defaultIndexPattern": "apm-*-metric,metrics-apm*", "query": { "bool": { "filter": [ - { "term": { "processor.event": "transaction" } }, - { "exists": { "field": "transaction.duration" } } + { "term": { "processor.event": "metric" } }, + { "term": { "metricset.name": "transaction" } } ] } }, "jobs": [ { - "id": "high_mean_transaction_duration", - "file": "high_mean_transaction_duration.json" + "id": "apm_tx_metrics", + "file": "apm_tx_metrics.json" } ], "datafeeds": [ { - "id": "datafeed-high_mean_transaction_duration", - "file": "datafeed_high_mean_transaction_duration.json", - "job_id": "high_mean_transaction_duration" + "id": "datafeed-apm_tx_metrics", + "file": "datafeed_apm_tx_metrics.json", + "job_id": "apm_tx_metrics" } ] } diff --git a/x-pack/plugins/ml/server/models/data_recognizer/modules/apm_transaction/ml/apm_tx_metrics.json b/x-pack/plugins/ml/server/models/data_recognizer/modules/apm_transaction/ml/apm_tx_metrics.json new file mode 100644 index 000000000000..f93b4fb009a1 --- /dev/null +++ b/x-pack/plugins/ml/server/models/data_recognizer/modules/apm_transaction/ml/apm_tx_metrics.json @@ -0,0 +1,53 @@ +{ + "job_type": "anomaly_detector", + "groups": [ + "apm" + ], + "description": "Detects anomalies in transaction latency, throughput and error percentage for metric data.", + "analysis_config": { + "bucket_span": "15m", + "summary_count_field_name" : "doc_count", + "detectors" : [ + { + "detector_description" : "high latency by transaction type for an APM service", + "function" : "high_mean", + "field_name" : "transaction_latency", + "by_field_name" : "transaction.type", + "partition_field_name" : "service.name" + }, + { + "detector_description" : "transaction throughput for an APM service", + "function" : "mean", + "field_name" : "transaction_throughput", + "by_field_name" : "transaction.type", + "partition_field_name" : "service.name" + }, + { + "detector_description" : "failed transaction rate for an APM service", + "function" : "high_mean", + "field_name" : "failed_transaction_rate", + "by_field_name" : "transaction.type", + "partition_field_name" : "service.name" + } + ], + "influencers" : [ + "transaction.type", + "service.name" + ] + }, + "analysis_limits": { + "model_memory_limit": "32mb" + }, + "data_description": { + "time_field" : "@timestamp", + "time_format" : "epoch_ms" + }, + "model_plot_config": { + "enabled" : true, + "annotations_enabled" : true + }, + "results_index_name" : "custom-apm", + "custom_settings": { + "created_by": "ml-module-apm-transaction" + } +} diff --git a/x-pack/plugins/ml/server/models/data_recognizer/modules/apm_transaction/ml/datafeed_apm_tx_metrics.json b/x-pack/plugins/ml/server/models/data_recognizer/modules/apm_transaction/ml/datafeed_apm_tx_metrics.json new file mode 100644 index 000000000000..4d19cdc9f533 --- /dev/null +++ b/x-pack/plugins/ml/server/models/data_recognizer/modules/apm_transaction/ml/datafeed_apm_tx_metrics.json @@ -0,0 +1,98 @@ +{ + "job_id": "JOB_ID", + "indices": [ + "INDEX_PATTERN_NAME" + ], + "chunking_config" : { + "mode" : "off" + }, + "query": { + "bool": { + "filter": [ + { "term": { "processor.event": "metric" } }, + { "term": { "metricset.name": "transaction" } } + ] + } + }, + "aggregations" : { + "buckets" : { + "composite" : { + "size" : 5000, + "sources" : [ + { + "date" : { + "date_histogram" : { + "field" : "@timestamp", + "fixed_interval" : "90s" + } + } + }, + { + "transaction.type" : { + "terms" : { + "field" : "transaction.type" + } + } + }, + { + "service.name" : { + "terms" : { + "field" : "service.name" + } + } + } + ] + }, + "aggs" : { + "@timestamp" : { + "max" : { + "field" : "@timestamp" + } + }, + "transaction_throughput" : { + "rate" : { + "unit" : "minute" + } + }, + "transaction_latency" : { + "avg" : { + "field" : "transaction.duration.histogram" + } + }, + "error_count" : { + "filter" : { + "term" : { + "event.outcome" : "failure" + } + }, + "aggs" : { + "actual_error_count" : { + "value_count" : { + "field" : "event.outcome" + } + } + } + }, + "success_count" : { + "filter" : { + "term" : { + "event.outcome" : "success" + } + } + }, + "failed_transaction_rate" : { + "bucket_script" : { + "buckets_path" : { + "failure_count" : "error_count>_count", + "success_count" : "success_count>_count" + }, + "script" : "if ((params.failure_count + params.success_count)==0){return 0;}else{return 100 * (params.failure_count/(params.failure_count + params.success_count));}" + } + } + } + } + }, + "indices_options": { + "ignore_unavailable": true + } +} diff --git a/x-pack/plugins/ml/server/models/data_recognizer/modules/apm_transaction/ml/datafeed_high_mean_transaction_duration.json b/x-pack/plugins/ml/server/models/data_recognizer/modules/apm_transaction/ml/datafeed_high_mean_transaction_duration.json deleted file mode 100644 index 882bd93fd937..000000000000 --- a/x-pack/plugins/ml/server/models/data_recognizer/modules/apm_transaction/ml/datafeed_high_mean_transaction_duration.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "job_id": "JOB_ID", - "indices": [ - "INDEX_PATTERN_NAME" - ], - "query": { - "bool": { - "filter": [ - { "term": { "processor.event": "transaction" } }, - { "exists": { "field": "transaction.duration.us" } } - ] - } - }, - "indices_options": { - "ignore_unavailable": true - } -} diff --git a/x-pack/plugins/ml/server/models/data_recognizer/modules/apm_transaction/ml/high_mean_transaction_duration.json b/x-pack/plugins/ml/server/models/data_recognizer/modules/apm_transaction/ml/high_mean_transaction_duration.json deleted file mode 100644 index 77284cb275cd..000000000000 --- a/x-pack/plugins/ml/server/models/data_recognizer/modules/apm_transaction/ml/high_mean_transaction_duration.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "job_type": "anomaly_detector", - "groups": [ - "apm" - ], - "description": "Detect transaction duration anomalies across transaction types for your APM services.", - "analysis_config": { - "bucket_span": "15m", - "detectors": [ - { - "detector_description": "high duration by transaction type for an APM service", - "function": "high_mean", - "field_name": "transaction.duration.us", - "by_field_name": "transaction.type", - "partition_field_name": "service.name" - } - ], - "influencers": [ - "transaction.type", - "service.name" - ] - }, - "analysis_limits": { - "model_memory_limit": "32mb" - }, - "data_description": { - "time_field": "@timestamp" - }, - "model_plot_config": { - "enabled": true - }, - "custom_settings": { - "created_by": "ml-module-apm-transaction" - } -} diff --git a/x-pack/plugins/monitoring/public/alerts/lib/alerts_toast.tsx b/x-pack/plugins/monitoring/public/alerts/lib/alerts_toast.tsx index d752ec154089..10c8f7155134 100644 --- a/x-pack/plugins/monitoring/public/alerts/lib/alerts_toast.tsx +++ b/x-pack/plugins/monitoring/public/alerts/lib/alerts_toast.tsx @@ -18,7 +18,7 @@ export interface EnableAlertResponse { disabledWatcherClusterAlerts?: boolean; } -const showTlsAndEncryptionError = () => { +const showApiKeyAndEncryptionError = () => { const settingsUrl = Legacy.shims.docLinks.links.alerting.generalSettings; Legacy.shims.toastNotifications.addWarning({ @@ -32,7 +32,7 @@ const showTlsAndEncryptionError = () => {

{i18n.translate('xpack.monitoring.healthCheck.tlsAndEncryptionError', { - defaultMessage: `Stack monitoring alerts require Transport Layer Security between Kibana and Elasticsearch, and an encryption key in your kibana.yml file.`, + defaultMessage: `Stack Monitoring rules require API keys to be enabled and an encryption key to be configured.`, })}

@@ -97,7 +97,7 @@ export const showAlertsToast = (response: EnableAlertResponse) => { response; if (isSufficientlySecure === false || hasPermanentEncryptionKey === false) { - showTlsAndEncryptionError(); + showApiKeyAndEncryptionError(); } else if (disabledWatcherClusterAlerts === false) { showUnableToDisableWatcherClusterAlertsError(); } else if (disabledWatcherClusterAlerts === true) { diff --git a/x-pack/plugins/monitoring/server/lib/details/get_metrics.ts b/x-pack/plugins/monitoring/server/lib/details/get_metrics.ts index 83bb18169ae1..a8de5529d8ca 100644 --- a/x-pack/plugins/monitoring/server/lib/details/get_metrics.ts +++ b/x-pack/plugins/monitoring/server/lib/details/get_metrics.ts @@ -6,7 +6,6 @@ */ import moment from 'moment'; -import Bluebird from 'bluebird'; import { checkParam } from '../error_missing_required'; import { getSeries } from './get_series'; import { calculateTimeseriesInterval } from '../calculate_timeseries_interval'; @@ -40,25 +39,29 @@ export async function getMetrics( min = max - numOfBuckets * bucketSize * 1000; } - return Bluebird.map(metricSet, (metric: Metric) => { - // metric names match the literal metric name, but they can be supplied in groups or individually - let metricNames; + return Promise.all( + metricSet.map((metric: Metric) => { + // metric names match the literal metric name, but they can be supplied in groups or individually + let metricNames; - if (typeof metric !== 'string') { - metricNames = metric.keys; - } else { - metricNames = [metric]; - } + if (typeof metric !== 'string') { + metricNames = typeof metric.keys === 'string' ? [metric.keys] : metric.keys; + } else { + metricNames = [metric]; + } - return Bluebird.map(metricNames, (metricName) => { - return getSeries(req, indexPattern, metricName, metricOptions, filters, groupBy, { - min, - max, - bucketSize, - timezone, - }); - }); - }).then((rows) => { + return Promise.all( + metricNames.map((metricName) => { + return getSeries(req, indexPattern, metricName, metricOptions, filters, groupBy, { + min, + max, + bucketSize, + timezone, + }); + }) + ); + }) + ).then((rows) => { const data: Record = {}; metricSet.forEach((key, index) => { // keyName must match the value stored in the html template diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/verify_alerting_security.ts b/x-pack/plugins/monitoring/server/lib/elasticsearch/verify_alerting_security.ts deleted file mode 100644 index f5f9c80e0e4d..000000000000 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/verify_alerting_security.ts +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { RequestHandlerContext } from 'kibana/server'; -import { EncryptedSavedObjectsPluginSetup } from '../../../../encrypted_saved_objects/server'; - -export interface AlertingFrameworkHealth { - isSufficientlySecure: boolean; - hasPermanentEncryptionKey: boolean; -} - -export interface XPackUsageSecurity { - security?: { - enabled?: boolean; - ssl?: { - http?: { - enabled?: boolean; - }; - }; - }; -} - -export class AlertingSecurity { - public static readonly getSecurityHealth = async ( - context: RequestHandlerContext, - encryptedSavedObjects?: EncryptedSavedObjectsPluginSetup - ): Promise => { - const { - security: { - enabled: isSecurityEnabled = false, - ssl: { http: { enabled: isTLSEnabled = false } = {} } = {}, - } = {}, - } = ( - await context.core.elasticsearch.client.asInternalUser.transport.request({ - method: 'GET', - path: '/_xpack/usage', - }) - ).body as XPackUsageSecurity; - - return { - isSufficientlySecure: !isSecurityEnabled || (isSecurityEnabled && isTLSEnabled), - hasPermanentEncryptionKey: encryptedSavedObjects?.canEncrypt === true, - }; - }; -} diff --git a/x-pack/plugins/monitoring/server/lib/kibana/get_kibanas_for_clusters.ts b/x-pack/plugins/monitoring/server/lib/kibana/get_kibanas_for_clusters.ts index 4e806c07ee66..5326976ec99a 100644 --- a/x-pack/plugins/monitoring/server/lib/kibana/get_kibanas_for_clusters.ts +++ b/x-pack/plugins/monitoring/server/lib/kibana/get_kibanas_for_clusters.ts @@ -5,7 +5,6 @@ * 2.0. */ -import Bluebird from 'bluebird'; import { chain, find } from 'lodash'; import { LegacyRequest, Cluster, Bucket } from '../../types'; import { checkParam } from '../error_missing_required'; @@ -36,182 +35,184 @@ export function getKibanasForClusters( const start = req.payload.timeRange.min; const end = req.payload.timeRange.max; - return Bluebird.map(clusters, (cluster) => { - const clusterUuid = cluster.elasticsearch?.cluster?.id ?? cluster.cluster_uuid; - const metric = KibanaClusterMetric.getMetricFields(); - const params = { - index: kbnIndexPattern, - size: 0, - ignore_unavailable: true, - body: { - query: createQuery({ - types: ['stats', 'kibana_stats'], - start, - end, - clusterUuid, - metric, - }), - aggs: { - kibana_uuids: { - terms: { - field: 'kibana_stats.kibana.uuid', - size: config.get('monitoring.ui.max_bucket_size'), - }, - aggs: { - latest_report: { - terms: { - field: 'kibana_stats.timestamp', - size: 1, - order: { - _key: 'desc', - }, - }, - aggs: { - response_time_max: { - max: { - field: 'kibana_stats.response_times.max', + return Promise.all( + clusters.map((cluster) => { + const clusterUuid = cluster.elasticsearch?.cluster?.id ?? cluster.cluster_uuid; + const metric = KibanaClusterMetric.getMetricFields(); + const params = { + index: kbnIndexPattern, + size: 0, + ignore_unavailable: true, + body: { + query: createQuery({ + types: ['stats', 'kibana_stats'], + start, + end, + clusterUuid, + metric, + }), + aggs: { + kibana_uuids: { + terms: { + field: 'kibana_stats.kibana.uuid', + size: config.get('monitoring.ui.max_bucket_size'), + }, + aggs: { + latest_report: { + terms: { + field: 'kibana_stats.timestamp', + size: 1, + order: { + _key: 'desc', }, }, - memory_rss: { - max: { - field: 'kibana_stats.process.memory.resident_set_size_in_bytes', + aggs: { + response_time_max: { + max: { + field: 'kibana_stats.response_times.max', + }, }, - }, - memory_heap_size_limit: { - max: { - field: 'kibana_stats.process.memory.heap.size_limit', + memory_rss: { + max: { + field: 'kibana_stats.process.memory.resident_set_size_in_bytes', + }, }, - }, - concurrent_connections: { - max: { - field: 'kibana_stats.concurrent_connections', + memory_heap_size_limit: { + max: { + field: 'kibana_stats.process.memory.heap.size_limit', + }, }, - }, - requests_total: { - max: { - field: 'kibana_stats.requests.total', + concurrent_connections: { + max: { + field: 'kibana_stats.concurrent_connections', + }, + }, + requests_total: { + max: { + field: 'kibana_stats.requests.total', + }, }, }, }, - }, - response_time_max_per: { - max_bucket: { - buckets_path: 'latest_report>response_time_max', + response_time_max_per: { + max_bucket: { + buckets_path: 'latest_report>response_time_max', + }, }, - }, - memory_rss_per: { - max_bucket: { - buckets_path: 'latest_report>memory_rss', + memory_rss_per: { + max_bucket: { + buckets_path: 'latest_report>memory_rss', + }, }, - }, - memory_heap_size_limit_per: { - max_bucket: { - buckets_path: 'latest_report>memory_heap_size_limit', + memory_heap_size_limit_per: { + max_bucket: { + buckets_path: 'latest_report>memory_heap_size_limit', + }, }, - }, - concurrent_connections_per: { - max_bucket: { - buckets_path: 'latest_report>concurrent_connections', + concurrent_connections_per: { + max_bucket: { + buckets_path: 'latest_report>concurrent_connections', + }, }, - }, - requests_total_per: { - max_bucket: { - buckets_path: 'latest_report>requests_total', + requests_total_per: { + max_bucket: { + buckets_path: 'latest_report>requests_total', + }, }, }, }, - }, - response_time_max: { - max_bucket: { - buckets_path: 'kibana_uuids>response_time_max_per', - }, - }, - memory_rss: { - sum_bucket: { - buckets_path: 'kibana_uuids>memory_rss_per', + response_time_max: { + max_bucket: { + buckets_path: 'kibana_uuids>response_time_max_per', + }, }, - }, - memory_heap_size_limit: { - sum_bucket: { - buckets_path: 'kibana_uuids>memory_heap_size_limit_per', + memory_rss: { + sum_bucket: { + buckets_path: 'kibana_uuids>memory_rss_per', + }, }, - }, - concurrent_connections: { - sum_bucket: { - buckets_path: 'kibana_uuids>concurrent_connections_per', + memory_heap_size_limit: { + sum_bucket: { + buckets_path: 'kibana_uuids>memory_heap_size_limit_per', + }, }, - }, - requests_total: { - sum_bucket: { - buckets_path: 'kibana_uuids>requests_total_per', + concurrent_connections: { + sum_bucket: { + buckets_path: 'kibana_uuids>concurrent_connections_per', + }, }, - }, - status: { - terms: { - field: 'kibana_stats.kibana.status', - order: { - max_timestamp: 'desc', + requests_total: { + sum_bucket: { + buckets_path: 'kibana_uuids>requests_total_per', }, }, - aggs: { - max_timestamp: { - max: { - field: 'timestamp', + status: { + terms: { + field: 'kibana_stats.kibana.status', + order: { + max_timestamp: 'desc', + }, + }, + aggs: { + max_timestamp: { + max: { + field: 'timestamp', + }, }, }, }, }, }, - }, - }; + }; - const { callWithRequest } = req.server.plugins.elasticsearch.getCluster('monitoring'); - return callWithRequest(req, 'search', params).then((result) => { - const aggregations = result.aggregations ?? {}; - const kibanaUuids = aggregations.kibana_uuids?.buckets ?? []; - const statusBuckets = aggregations.status?.buckets ?? []; + const { callWithRequest } = req.server.plugins.elasticsearch.getCluster('monitoring'); + return callWithRequest(req, 'search', params).then((result) => { + const aggregations = result.aggregations ?? {}; + const kibanaUuids = aggregations.kibana_uuids?.buckets ?? []; + const statusBuckets = aggregations.status?.buckets ?? []; - // everything is initialized such that it won't impact any rollup - let status = null; - let requestsTotal = 0; - let connections = 0; - let responseTime = 0; - let memorySize = 0; - let memoryLimit = 0; + // everything is initialized such that it won't impact any rollup + let status = null; + let requestsTotal = 0; + let connections = 0; + let responseTime = 0; + let memorySize = 0; + let memoryLimit = 0; - // if the cluster has kibana instances at all - if (kibanaUuids.length) { - // get instance status by finding the latest status bucket - const latestTimestamp = chain(statusBuckets) - .map((bucket) => bucket.max_timestamp.value) - .max() - .value(); - const latestBucket = find( - statusBuckets, - (bucket) => bucket.max_timestamp.value === latestTimestamp - ); - status = latestBucket.key; + // if the cluster has kibana instances at all + if (kibanaUuids.length) { + // get instance status by finding the latest status bucket + const latestTimestamp = chain(statusBuckets) + .map((bucket) => bucket.max_timestamp.value) + .max() + .value(); + const latestBucket = find( + statusBuckets, + (bucket) => bucket.max_timestamp.value === latestTimestamp + ); + status = latestBucket.key; - requestsTotal = aggregations.requests_total?.value; - connections = aggregations.concurrent_connections?.value; - responseTime = aggregations.response_time_max?.value; - memorySize = aggregations.memory_rss?.value; - memoryLimit = aggregations.memory_heap_size_limit?.value; - } + requestsTotal = aggregations.requests_total?.value; + connections = aggregations.concurrent_connections?.value; + responseTime = aggregations.response_time_max?.value; + memorySize = aggregations.memory_rss?.value; + memoryLimit = aggregations.memory_heap_size_limit?.value; + } - return { - clusterUuid, - stats: { - uuids: kibanaUuids.map(({ key }: Bucket) => key), - status, - requests_total: requestsTotal, - concurrent_connections: connections, - response_time_max: responseTime, - memory_size: memorySize, - memory_limit: memoryLimit, - count: kibanaUuids.length, - }, - }; - }); - }); + return { + clusterUuid, + stats: { + uuids: kibanaUuids.map(({ key }: Bucket) => key), + status, + requests_total: requestsTotal, + concurrent_connections: connections, + response_time_max: responseTime, + memory_size: memorySize, + memory_limit: memoryLimit, + count: kibanaUuids.length, + }, + }; + }); + }) + ); } diff --git a/x-pack/plugins/monitoring/server/lib/logstash/get_logstash_for_clusters.ts b/x-pack/plugins/monitoring/server/lib/logstash/get_logstash_for_clusters.ts index 480b7176b7ab..03c87bfdde1a 100644 --- a/x-pack/plugins/monitoring/server/lib/logstash/get_logstash_for_clusters.ts +++ b/x-pack/plugins/monitoring/server/lib/logstash/get_logstash_for_clusters.ts @@ -5,7 +5,6 @@ * 2.0. */ -import Bluebird from 'bluebird'; import { get } from 'lodash'; import { LegacyRequest, Cluster, Bucket } from '../../types'; import { LOGSTASH } from '../../../common/constants'; @@ -48,208 +47,210 @@ export function getLogstashForClusters( const end = req.payload.timeRange.max; const config = req.server.config(); - return Bluebird.map(clusters, (cluster) => { - const clusterUuid = get(cluster, 'elasticsearch.cluster.id', cluster.cluster_uuid); - const params = { - index: lsIndexPattern, - size: 0, - ignore_unavailable: true, - body: { - query: createQuery({ - types: ['stats', 'logstash_stats'], - start, - end, - clusterUuid, - metric: LogstashClusterMetric.getMetricFields(), - }), - aggs: { - logstash_uuids: { - terms: { - field: 'logstash_stats.logstash.uuid', - size: config.get('monitoring.ui.max_bucket_size'), - }, - aggs: { - latest_report: { - terms: { - field: 'logstash_stats.timestamp', - size: 1, - order: { - _key: 'desc', - }, - }, - aggs: { - memory_used: { - max: { - field: 'logstash_stats.jvm.mem.heap_used_in_bytes', + return Promise.all( + clusters.map((cluster) => { + const clusterUuid = get(cluster, 'elasticsearch.cluster.id', cluster.cluster_uuid); + const params = { + index: lsIndexPattern, + size: 0, + ignore_unavailable: true, + body: { + query: createQuery({ + types: ['stats', 'logstash_stats'], + start, + end, + clusterUuid, + metric: LogstashClusterMetric.getMetricFields(), + }), + aggs: { + logstash_uuids: { + terms: { + field: 'logstash_stats.logstash.uuid', + size: config.get('monitoring.ui.max_bucket_size'), + }, + aggs: { + latest_report: { + terms: { + field: 'logstash_stats.timestamp', + size: 1, + order: { + _key: 'desc', }, }, - memory: { - max: { - field: 'logstash_stats.jvm.mem.heap_max_in_bytes', + aggs: { + memory_used: { + max: { + field: 'logstash_stats.jvm.mem.heap_used_in_bytes', + }, }, - }, - events_in_total: { - max: { - field: 'logstash_stats.events.in', + memory: { + max: { + field: 'logstash_stats.jvm.mem.heap_max_in_bytes', + }, }, - }, - events_out_total: { - max: { - field: 'logstash_stats.events.out', + events_in_total: { + max: { + field: 'logstash_stats.events.in', + }, + }, + events_out_total: { + max: { + field: 'logstash_stats.events.out', + }, }, }, }, - }, - memory_used_per_node: { - max_bucket: { - buckets_path: 'latest_report>memory_used', + memory_used_per_node: { + max_bucket: { + buckets_path: 'latest_report>memory_used', + }, }, - }, - memory_per_node: { - max_bucket: { - buckets_path: 'latest_report>memory', + memory_per_node: { + max_bucket: { + buckets_path: 'latest_report>memory', + }, }, - }, - events_in_total_per_node: { - max_bucket: { - buckets_path: 'latest_report>events_in_total', + events_in_total_per_node: { + max_bucket: { + buckets_path: 'latest_report>events_in_total', + }, }, - }, - events_out_total_per_node: { - max_bucket: { - buckets_path: 'latest_report>events_out_total', + events_out_total_per_node: { + max_bucket: { + buckets_path: 'latest_report>events_out_total', + }, }, }, }, - }, - logstash_versions: { - terms: { - field: 'logstash_stats.logstash.version', - size: config.get('monitoring.ui.max_bucket_size'), - }, - }, - pipelines_nested: { - nested: { - path: 'logstash_stats.pipelines', + logstash_versions: { + terms: { + field: 'logstash_stats.logstash.version', + size: config.get('monitoring.ui.max_bucket_size'), + }, }, - aggs: { - pipelines: { - sum_bucket: { - buckets_path: 'queue_types>num_pipelines', - }, + pipelines_nested: { + nested: { + path: 'logstash_stats.pipelines', }, - queue_types: { - terms: { - field: 'logstash_stats.pipelines.queue.type', - size: config.get('monitoring.ui.max_bucket_size'), + aggs: { + pipelines: { + sum_bucket: { + buckets_path: 'queue_types>num_pipelines', + }, }, - aggs: { - num_pipelines: { - cardinality: { - field: 'logstash_stats.pipelines.id', + queue_types: { + terms: { + field: 'logstash_stats.pipelines.queue.type', + size: config.get('monitoring.ui.max_bucket_size'), + }, + aggs: { + num_pipelines: { + cardinality: { + field: 'logstash_stats.pipelines.id', + }, }, }, }, }, }, - }, - pipelines_nested_mb: { - nested: { - path: 'logstash.node.stats.pipelines', - }, - aggs: { - pipelines: { - sum_bucket: { - buckets_path: 'queue_types>num_pipelines', - }, + pipelines_nested_mb: { + nested: { + path: 'logstash.node.stats.pipelines', }, - queue_types: { - terms: { - field: 'logstash.node.stats.pipelines.queue.type', - size: config.get('monitoring.ui.max_bucket_size'), + aggs: { + pipelines: { + sum_bucket: { + buckets_path: 'queue_types>num_pipelines', + }, }, - aggs: { - num_pipelines: { - cardinality: { - field: 'logstash.node.stats.pipelines.id', + queue_types: { + terms: { + field: 'logstash.node.stats.pipelines.queue.type', + size: config.get('monitoring.ui.max_bucket_size'), + }, + aggs: { + num_pipelines: { + cardinality: { + field: 'logstash.node.stats.pipelines.id', + }, }, }, }, }, }, - }, - events_in_total: { - sum_bucket: { - buckets_path: 'logstash_uuids>events_in_total_per_node', + events_in_total: { + sum_bucket: { + buckets_path: 'logstash_uuids>events_in_total_per_node', + }, }, - }, - events_out_total: { - sum_bucket: { - buckets_path: 'logstash_uuids>events_out_total_per_node', + events_out_total: { + sum_bucket: { + buckets_path: 'logstash_uuids>events_out_total_per_node', + }, }, - }, - memory_used: { - sum_bucket: { - buckets_path: 'logstash_uuids>memory_used_per_node', + memory_used: { + sum_bucket: { + buckets_path: 'logstash_uuids>memory_used_per_node', + }, }, - }, - memory: { - sum_bucket: { - buckets_path: 'logstash_uuids>memory_per_node', + memory: { + sum_bucket: { + buckets_path: 'logstash_uuids>memory_per_node', + }, }, - }, - max_uptime: { - max: { - field: 'logstash_stats.jvm.uptime_in_millis', + max_uptime: { + max: { + field: 'logstash_stats.jvm.uptime_in_millis', + }, }, }, }, - }, - }; + }; - const { callWithRequest } = req.server.plugins.elasticsearch.getCluster('monitoring'); - return callWithRequest(req, 'search', params).then((result) => { - const aggregations = get(result, 'aggregations', {}); - const logstashUuids = get(aggregations, 'logstash_uuids.buckets', []); - const logstashVersions = get(aggregations, 'logstash_versions.buckets', []); + const { callWithRequest } = req.server.plugins.elasticsearch.getCluster('monitoring'); + return callWithRequest(req, 'search', params).then((result) => { + const aggregations = get(result, 'aggregations', {}); + const logstashUuids = get(aggregations, 'logstash_uuids.buckets', []); + const logstashVersions = get(aggregations, 'logstash_versions.buckets', []); - // everything is initialized such that it won't impact any rollup - let eventsInTotal = 0; - let eventsOutTotal = 0; - let memory = 0; - let memoryUsed = 0; - let maxUptime = 0; + // everything is initialized such that it won't impact any rollup + let eventsInTotal = 0; + let eventsOutTotal = 0; + let memory = 0; + let memoryUsed = 0; + let maxUptime = 0; - // if the cluster has logstash instances at all - if (logstashUuids.length) { - eventsInTotal = get(aggregations, 'events_in_total.value'); - eventsOutTotal = get(aggregations, 'events_out_total.value'); - memory = get(aggregations, 'memory.value'); - memoryUsed = get(aggregations, 'memory_used.value'); - maxUptime = get(aggregations, 'max_uptime.value'); - } + // if the cluster has logstash instances at all + if (logstashUuids.length) { + eventsInTotal = get(aggregations, 'events_in_total.value'); + eventsOutTotal = get(aggregations, 'events_out_total.value'); + memory = get(aggregations, 'memory.value'); + memoryUsed = get(aggregations, 'memory_used.value'); + maxUptime = get(aggregations, 'max_uptime.value'); + } - let types = get(aggregations, 'pipelines_nested_mb.queue_types.buckets', []); - if (!types || types.length === 0) { - types = aggregations.pipelines_nested?.queue_types.buckets ?? []; - } + let types = get(aggregations, 'pipelines_nested_mb.queue_types.buckets', []); + if (!types || types.length === 0) { + types = aggregations.pipelines_nested?.queue_types.buckets ?? []; + } - return { - clusterUuid, - stats: { - node_count: logstashUuids.length, - events_in_total: eventsInTotal, - events_out_total: eventsOutTotal, - avg_memory: memory, - avg_memory_used: memoryUsed, - max_uptime: maxUptime, - pipeline_count: - get(aggregations, 'pipelines_nested_mb.pipelines.value') || - get(aggregations, 'pipelines_nested.pipelines.value', 0), - queue_types: getQueueTypes(types), - versions: logstashVersions.map((versionBucket: Bucket) => versionBucket.key), - }, - }; - }); - }); + return { + clusterUuid, + stats: { + node_count: logstashUuids.length, + events_in_total: eventsInTotal, + events_out_total: eventsOutTotal, + avg_memory: memory, + avg_memory_used: memoryUsed, + max_uptime: maxUptime, + pipeline_count: + get(aggregations, 'pipelines_nested_mb.pipelines.value') || + get(aggregations, 'pipelines_nested.pipelines.value', 0), + queue_types: getQueueTypes(types), + versions: logstashVersions.map((versionBucket: Bucket) => versionBucket.key), + }, + }; + }); + }) + ); } diff --git a/x-pack/plugins/monitoring/server/plugin.ts b/x-pack/plugins/monitoring/server/plugin.ts index 557a9b5e2a3d..ff07ea0f4a26 100644 --- a/x-pack/plugins/monitoring/server/plugin.ts +++ b/x-pack/plugins/monitoring/server/plugin.ts @@ -202,6 +202,7 @@ export class MonitoringPlugin router, licenseService: this.licenseService, encryptedSavedObjects: plugins.encryptedSavedObjects, + alerting: plugins.alerting, logger: this.log, }); initInfraSource(config, plugins.infra); diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/alerts/enable.ts b/x-pack/plugins/monitoring/server/routes/api/v1/alerts/enable.ts index 6724819c30d5..7185d399b353 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/alerts/enable.ts +++ b/x-pack/plugins/monitoring/server/routes/api/v1/alerts/enable.ts @@ -11,7 +11,6 @@ import { AlertsFactory } from '../../../../alerts'; import { LegacyServer, RouteDependencies } from '../../../../types'; import { ALERT_ACTION_TYPE_LOG } from '../../../../../common/constants'; import { ActionResult } from '../../../../../../actions/common'; -import { AlertingSecurity } from '../../../../lib/elasticsearch/verify_alerting_security'; import { disableWatcherClusterAlerts } from '../../../../lib/alerts/disable_watcher_cluster_alerts'; import { AlertTypeParams, SanitizedAlert } from '../../../../../../alerting/common'; @@ -38,12 +37,14 @@ export function enableAlertsRoute(server: LegacyServer, npRoute: RouteDependenci const alerts = AlertsFactory.getAll(); if (alerts.length) { - const { isSufficientlySecure, hasPermanentEncryptionKey } = - await AlertingSecurity.getSecurityHealth(context, npRoute.encryptedSavedObjects); + const { isSufficientlySecure, hasPermanentEncryptionKey } = npRoute.alerting + ?.getSecurityHealth + ? await npRoute.alerting?.getSecurityHealth() + : { isSufficientlySecure: false, hasPermanentEncryptionKey: false }; if (!isSufficientlySecure || !hasPermanentEncryptionKey) { server.log.info( - `Skipping alert creation for "${context.infra.spaceId}" space; Stack monitoring alerts require Transport Layer Security between Kibana and Elasticsearch, and an encryption key in your kibana.yml file.` + `Skipping rule creation for "${context.infra.spaceId}" space; Stack Monitoring rules require API keys to be enabled and an encryption key to be configured.` ); return response.ok({ body: { diff --git a/x-pack/plugins/monitoring/server/types.ts b/x-pack/plugins/monitoring/server/types.ts index 14071aafaea1..14023ccce41a 100644 --- a/x-pack/plugins/monitoring/server/types.ts +++ b/x-pack/plugins/monitoring/server/types.ts @@ -28,6 +28,7 @@ import { PluginSetupContract as AlertingPluginSetupContract, } from '../../alerting/server'; import { InfraPluginSetup, InfraRequestHandlerContext } from '../../infra/server'; +import { PluginSetupContract as AlertingPluginSetup } from '../../alerting/server'; import { LicensingPluginStart } from '../../licensing/server'; import { PluginSetupContract as FeaturesPluginSetupContract } from '../../features/server'; import { EncryptedSavedObjectsPluginSetup } from '../../encrypted_saved_objects/server'; @@ -80,6 +81,7 @@ export interface RouteDependencies { router: IRouter; licenseService: MonitoringLicenseService; encryptedSavedObjects?: EncryptedSavedObjectsPluginSetup; + alerting?: AlertingPluginSetup; logger: Logger; } diff --git a/x-pack/plugins/observability/public/components/app/cases/all_cases/index.tsx b/x-pack/plugins/observability/public/components/app/cases/all_cases/index.tsx index bc0151052434..4b5747534360 100644 --- a/x-pack/plugins/observability/public/components/app/cases/all_cases/index.tsx +++ b/x-pack/plugins/observability/public/components/app/cases/all_cases/index.tsx @@ -61,7 +61,7 @@ export const AllCases = React.memo(({ userCanCrud }) => { }, }, disableAlerts: true, - showTitle: false, + showTitle: true, userCanCrud, owner: [CASES_OWNER], }); diff --git a/x-pack/plugins/observability/public/components/app/cases/translations.ts b/x-pack/plugins/observability/public/components/app/cases/translations.ts index a85b0bc744e6..af016be0182a 100644 --- a/x-pack/plugins/observability/public/components/app/cases/translations.ts +++ b/x-pack/plugins/observability/public/components/app/cases/translations.ts @@ -92,10 +92,6 @@ export const OPTIONAL = i18n.translate('xpack.observability.cases.caseView.optio defaultMessage: 'Optional', }); -export const PAGE_TITLE = i18n.translate('xpack.observability.cases.pageTitle', { - defaultMessage: 'Cases', -}); - export const CREATE_CASE = i18n.translate('xpack.observability.cases.caseView.createCase', { defaultMessage: 'Create case', }); diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/rtl_helpers.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/rtl_helpers.tsx index 612cbfcc4bfd..04d74844beb8 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/rtl_helpers.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/rtl_helpers.tsx @@ -23,7 +23,7 @@ import { ObservabilityPublicPluginsStart } from '../../../plugin'; import { EuiThemeProvider } from '../../../../../../../src/plugins/kibana_react/common'; import { lensPluginMock } from '../../../../../lens/public/mocks'; import * as useAppIndexPatternHook from './hooks/use_app_index_pattern'; -import { IndexPatternContextProvider } from './hooks/use_app_index_pattern'; +import { IndexPatternContext, IndexPatternContextProvider } from './hooks/use_app_index_pattern'; import { AllSeries, SeriesContextValue, UrlStorageContext } from './hooks/use_series_storage'; import * as fetcherHook from '../../../hooks/use_fetcher'; @@ -234,7 +234,7 @@ export const mockUseHasData = () => { return { spy, onRefreshTimeRange }; }; -export const mockAppIndexPattern = () => { +export const mockAppIndexPattern = (props?: Partial) => { const loadIndexPattern = jest.fn(); const spy = jest.spyOn(useAppIndexPatternHook, 'useAppIndexPatternContext').mockReturnValue({ indexPattern: mockIndexPattern, @@ -244,6 +244,7 @@ export const mockAppIndexPattern = () => { loadIndexPattern, indexPatterns: { ux: mockIndexPattern } as unknown as Record, indexPatternErrors: {} as any, + ...(props || {}), }); return { spy, loadIndexPattern }; }; diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/report_metric_options.test.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/report_metric_options.test.tsx new file mode 100644 index 000000000000..767b765ba1f1 --- /dev/null +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/report_metric_options.test.tsx @@ -0,0 +1,55 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { screen } from '@testing-library/react'; +import { mockAppIndexPattern, mockIndexPattern, mockUxSeries, render } from '../rtl_helpers'; +import { getDefaultConfigs } from '../configurations/default_configs'; +import { PERCENTILE } from '../configurations/constants'; +import { ReportMetricOptions } from './report_metric_options'; + +describe('ReportMetricOptions', function () { + const dataViewSeries = getDefaultConfigs({ + reportType: 'kpi-over-time', + indexPattern: mockIndexPattern, + dataType: 'ux', + }); + + it('should render properly', async function () { + render( + + ); + + expect(await screen.findByText('No data available')).toBeInTheDocument(); + }); + + it('should display loading if index pattern is not available and is loading', async function () { + mockAppIndexPattern({ loading: true, indexPatterns: undefined }); + const { container } = render( + + ); + + expect(container.getElementsByClassName('euiLoadingSpinner').length).toBe(1); + }); + + it('should not display loading if index pattern is already loaded', async function () { + mockAppIndexPattern({ loading: true }); + render( + + ); + + expect(await screen.findByText('Page load time')).toBeInTheDocument(); + }); +}); diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/report_metric_options.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/report_metric_options.tsx index 410356d0078d..bc7c2328dcbb 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/report_metric_options.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/report_metric_options.tsx @@ -127,7 +127,7 @@ export function ReportMetricOptions({ seriesId, series, seriesConfig }: Props) { )} {series.selectedMetricField && - (indexPattern && !loading ? ( + (indexPattern ? ( {alertData.link && !isInApp && ( diff --git a/x-pack/plugins/observability/public/pages/cases/all_cases.tsx b/x-pack/plugins/observability/public/pages/cases/all_cases.tsx index 4ac7c4cfd92a..76c54a470ff8 100644 --- a/x-pack/plugins/observability/public/pages/cases/all_cases.tsx +++ b/x-pack/plugins/observability/public/pages/cases/all_cases.tsx @@ -8,7 +8,6 @@ import React from 'react'; import { AllCases } from '../../components/app/cases/all_cases'; -import * as i18n from '../../components/app/cases/translations'; import { CaseFeatureNoPermissions } from './feature_no_permissions'; import { useGetUserCasesPermissions } from '../../hooks/use_get_user_cases_permissions'; @@ -45,9 +44,6 @@ export const AllCasesPage = React.memo(() => { {i18n.PAGE_TITLE}, - }} > diff --git a/x-pack/plugins/observability/public/utils/no_data_config.ts b/x-pack/plugins/observability/public/utils/no_data_config.ts index c8e7daaf688b..fdd70401e709 100644 --- a/x-pack/plugins/observability/public/utils/no_data_config.ts +++ b/x-pack/plugins/observability/public/utils/no_data_config.ts @@ -32,7 +32,7 @@ export function getNoDataConfig({ defaultMessage: 'Use Beats and APM agents to send observability data to Elasticsearch. We make it easy with support for many popular systems, apps, and languages.', }), - href: basePath.prepend(`/app/home#/tutorial/apm`), + href: basePath.prepend(`/app/integrations/browse`), }, }, docsLink, diff --git a/x-pack/plugins/osquery/public/agents/use_agent_policy_agent_ids.ts b/x-pack/plugins/osquery/public/agents/use_agent_policy_agent_ids.ts index 65a2520e07d0..77ca08e28418 100644 --- a/x-pack/plugins/osquery/public/agents/use_agent_policy_agent_ids.ts +++ b/x-pack/plugins/osquery/public/agents/use_agent_policy_agent_ids.ts @@ -9,7 +9,7 @@ import { map } from 'lodash'; import { i18n } from '@kbn/i18n'; import { useQuery } from 'react-query'; -import { AGENT_SAVED_OBJECT_TYPE, Agent } from '../../../fleet/common'; +import { AGENTS_PREFIX, Agent } from '../../../fleet/common'; import { useErrorToast } from '../common/hooks/use_error_toast'; import { useKibana } from '../common/lib/kibana'; @@ -30,7 +30,7 @@ export const useAgentPolicyAgentIds = ({ return useQuery<{ agents: Agent[] }, unknown, string[]>( ['agentPolicyAgentIds', agentPolicyId], () => { - const kuery = `${AGENT_SAVED_OBJECT_TYPE}.policy_id:${agentPolicyId}`; + const kuery = `${AGENTS_PREFIX}.policy_id:${agentPolicyId}`; return http.get(`/internal/osquery/fleet_wrapper/agents`, { query: { diff --git a/x-pack/plugins/osquery/public/components/app.tsx b/x-pack/plugins/osquery/public/components/app.tsx index f4c805d37535..ef249d5b8c7a 100644 --- a/x-pack/plugins/osquery/public/components/app.tsx +++ b/x-pack/plugins/osquery/public/components/app.tsx @@ -9,7 +9,17 @@ import React, { useMemo } from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; -import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem, EuiTabs, EuiTab } from '@elastic/eui'; +import { + EuiButtonEmpty, + EuiFlexGroup, + EuiFlexItem, + EuiTabs, + EuiTab, + EuiLoadingElastic, + EuiPage, + EuiPageBody, + EuiPageContent, +} from '@elastic/eui'; import { useLocation } from 'react-router-dom'; import { Container, Nav, Wrapper } from './layouts'; @@ -24,6 +34,24 @@ const OsqueryAppComponent = () => { const section = useMemo(() => location.pathname.split('/')[1] ?? 'overview', [location.pathname]); const { data: osqueryIntegration, isFetched } = useOsqueryIntegrationStatus(); + if (!isFetched) { + return ( + + + + + + + + ); + } + if (isFetched && osqueryIntegration?.install_status !== 'installed') { return ; } diff --git a/x-pack/plugins/osquery/server/routes/fleet_wrapper/get_agent_policies.ts b/x-pack/plugins/osquery/server/routes/fleet_wrapper/get_agent_policies.ts index accfc2d9ef4d..06641cc60e13 100644 --- a/x-pack/plugins/osquery/server/routes/fleet_wrapper/get_agent_policies.ts +++ b/x-pack/plugins/osquery/server/routes/fleet_wrapper/get_agent_policies.ts @@ -5,7 +5,7 @@ * 2.0. */ -import bluebird from 'bluebird'; +import pMap from 'p-map'; import { schema } from '@kbn/config-schema'; import { filter, uniq, map } from 'lodash'; import { satisfies } from 'semver'; @@ -47,7 +47,7 @@ export const getAgentPoliciesRoute = (router: IRouter, osqueryContext: OsqueryAp const agentPolicies = await agentPolicyService?.getByIds(soClient, agentPolicyIds); if (agentPolicies?.length) { - await bluebird.map( + await pMap( agentPolicies, (agentPolicy: GetAgentPoliciesResponseItem) => agentService diff --git a/x-pack/plugins/osquery/server/routes/status/create_status_route.ts b/x-pack/plugins/osquery/server/routes/status/create_status_route.ts index 630ec8b3743c..ae79ef851bed 100644 --- a/x-pack/plugins/osquery/server/routes/status/create_status_route.ts +++ b/x-pack/plugins/osquery/server/routes/status/create_status_route.ts @@ -107,6 +107,50 @@ export const createStatusRoute = (router: IRouter, osqueryContext: OsqueryAppCon pkgName: OSQUERY_INTEGRATION_NAME, }); + const agentPolicyIds = uniq(map(policyPackages?.items, 'policy_id')); + const agentPolicies = mapKeys( + await agentPolicyService?.getByIds(internalSavedObjectsClient, agentPolicyIds), + 'id' + ); + + await Promise.all( + map(migrationObject.packs, async (packObject) => { + await internalSavedObjectsClient.create( + packSavedObjectType, + { + // @ts-expect-error update types + name: packObject.name, + // @ts-expect-error update types + description: packObject.description, + // @ts-expect-error update types + queries: convertPackQueriesToSO(packObject.queries), + // @ts-expect-error update types + enabled: packObject.enabled, + created_at: new Date().toISOString(), + created_by: 'system', + updated_at: new Date().toISOString(), + updated_by: 'system', + }, + { + // @ts-expect-error update types + references: packObject.policy_ids.map((policyId: string) => ({ + id: policyId, + name: agentPolicies[policyId].name, + type: AGENT_POLICY_SAVED_OBJECT_TYPE, + })), + refresh: 'wait_for', + } + ); + }) + ); + + // delete unnecessary package policies + await packagePolicyService?.delete( + internalSavedObjectsClient, + esClient, + migrationObject.packagePoliciesToDelete + ); + // updatePackagePolicies await Promise.all( map(migrationObject.agentPolicyToPackage, async (value, key) => { @@ -151,49 +195,6 @@ export const createStatusRoute = (router: IRouter, osqueryContext: OsqueryAppCon } }) ); - - const agentPolicyIds = uniq(map(policyPackages?.items, 'policy_id')); - const agentPolicies = mapKeys( - await agentPolicyService?.getByIds(internalSavedObjectsClient, agentPolicyIds), - 'id' - ); - - await Promise.all( - map(migrationObject.packs, async (packObject) => { - await internalSavedObjectsClient.create( - packSavedObjectType, - { - // @ts-expect-error update types - name: packObject.name, - // @ts-expect-error update types - description: packObject.description, - // @ts-expect-error update types - queries: convertPackQueriesToSO(packObject.queries), - // @ts-expect-error update types - enabled: packObject.enabled, - created_at: new Date().toISOString(), - created_by: 'system', - updated_at: new Date().toISOString(), - updated_by: 'system', - }, - { - // @ts-expect-error update types - references: packObject.policy_ids.map((policyId: string) => ({ - id: policyId, - name: agentPolicies[policyId].name, - type: AGENT_POLICY_SAVED_OBJECT_TYPE, - })), - refresh: 'wait_for', - } - ); - }) - ); - - await packagePolicyService?.delete( - internalSavedObjectsClient, - esClient, - migrationObject.packagePoliciesToDelete - ); // eslint-disable-next-line no-empty } catch (e) {} } diff --git a/x-pack/plugins/reporting/common/constants.ts b/x-pack/plugins/reporting/common/constants.ts index cafab65677ee..1eef032945e6 100644 --- a/x-pack/plugins/reporting/common/constants.ts +++ b/x-pack/plugins/reporting/common/constants.ts @@ -121,7 +121,7 @@ export const REPORTING_REDIRECT_LOCATOR_STORE_KEY = '__REPORTING_REDIRECT_LOCATO * be injected to the page */ export const getRedirectAppPath = () => { - return '/app/management/insightsAndAlerting/reporting/r'; + return '/app/reportingRedirect'; }; // Statuses diff --git a/x-pack/plugins/reporting/common/job_utils.ts b/x-pack/plugins/reporting/common/job_utils.ts index d8b4503cfefb..c1fd2eb5eb8c 100644 --- a/x-pack/plugins/reporting/common/job_utils.ts +++ b/x-pack/plugins/reporting/common/job_utils.ts @@ -5,7 +5,32 @@ * 2.0. */ +import { + CSV_JOB_TYPE, + PDF_JOB_TYPE, + PNG_JOB_TYPE, + PDF_JOB_TYPE_V2, + PNG_JOB_TYPE_V2, + CSV_JOB_TYPE_DEPRECATED, +} from './constants'; + // TODO: Remove this code once everyone is using the new PDF format, then we can also remove the legacy // export type entirely export const isJobV2Params = ({ sharingData }: { sharingData: Record }): boolean => sharingData.locatorParams != null; + +export const prettyPrintJobType = (type: string) => { + switch (type) { + case PDF_JOB_TYPE: + case PDF_JOB_TYPE_V2: + return 'PDF'; + case CSV_JOB_TYPE: + case CSV_JOB_TYPE_DEPRECATED: + return 'CSV'; + case PNG_JOB_TYPE: + case PNG_JOB_TYPE_V2: + return 'PNG'; + default: + return type; + } +}; diff --git a/x-pack/plugins/reporting/common/types/base.ts b/x-pack/plugins/reporting/common/types/base.ts index 44960c57f61c..a44378979ac3 100644 --- a/x-pack/plugins/reporting/common/types/base.ts +++ b/x-pack/plugins/reporting/common/types/base.ts @@ -7,6 +7,7 @@ import type { Ensure, SerializableRecord } from '@kbn/utility-types'; import type { LayoutParams } from './layout'; +import { LocatorParams } from './url'; export type JobId = string; @@ -21,9 +22,19 @@ export type BaseParams = Ensure< SerializableRecord >; +export type BaseParamsV2 = BaseParams & { + locatorParams: LocatorParams[]; +}; + // base params decorated with encrypted headers that come into runJob functions export interface BasePayload extends BaseParams { headers: string; spaceId?: string; isDeprecated?: boolean; } + +export interface BasePayloadV2 extends BaseParamsV2 { + headers: string; + spaceId?: string; + isDeprecated?: boolean; +} diff --git a/x-pack/plugins/reporting/common/types/index.ts b/x-pack/plugins/reporting/common/types/index.ts index 75e8cb0af969..8612400e8b39 100644 --- a/x-pack/plugins/reporting/common/types/index.ts +++ b/x-pack/plugins/reporting/common/types/index.ts @@ -6,9 +6,9 @@ */ import type { Size, LayoutParams } from './layout'; -import type { JobId, BaseParams, BasePayload } from './base'; +import type { JobId, BaseParams, BaseParamsV2, BasePayload, BasePayloadV2 } from './base'; -export type { JobId, BaseParams, BasePayload }; +export type { JobId, BaseParams, BaseParamsV2, BasePayload, BasePayloadV2 }; export type { Size, LayoutParams }; export type { DownloadReportFn, diff --git a/x-pack/plugins/reporting/common/types/url.ts b/x-pack/plugins/reporting/common/types/url.ts index dfb8ee9f908e..28e935713c45 100644 --- a/x-pack/plugins/reporting/common/types/url.ts +++ b/x-pack/plugins/reporting/common/types/url.ts @@ -14,9 +14,7 @@ export type DownloadReportFn = (jobId: JobId) => DownloadLink; type ManagementLink = string; export type ManagementLinkFn = () => ManagementLink; -export interface LocatorParams< - P extends SerializableRecord = SerializableRecord & { forceNow?: string } -> { +export interface LocatorParams

{ id: string; version: string; params: P; diff --git a/x-pack/plugins/reporting/public/lib/job.tsx b/x-pack/plugins/reporting/public/lib/job.tsx index d5d0695aaefb..d5d77ac18aa5 100644 --- a/x-pack/plugins/reporting/public/lib/job.tsx +++ b/x-pack/plugins/reporting/public/lib/job.tsx @@ -12,6 +12,7 @@ import moment from 'moment'; import React from 'react'; import { JOB_STATUSES } from '../../common/constants'; import { + BaseParamsV2, JobId, ReportApiJSON, ReportOutput, @@ -34,6 +35,7 @@ export class Job { public objectType: ReportPayload['objectType']; public title: ReportPayload['title']; public isDeprecated: ReportPayload['isDeprecated']; + public spaceId: ReportPayload['spaceId']; public browserTimezone?: ReportPayload['browserTimezone']; public layout: ReportPayload['layout']; @@ -57,6 +59,8 @@ export class Job { public max_size_reached?: TaskRunResult['max_size_reached']; public warnings?: TaskRunResult['warnings']; + public locatorParams?: BaseParamsV2['locatorParams']; + constructor(report: ReportApiJSON) { this.id = report.id; this.index = report.index; @@ -82,9 +86,11 @@ export class Job { this.content_type = report.output?.content_type; this.isDeprecated = report.payload.isDeprecated || false; + this.spaceId = report.payload.spaceId; this.csv_contains_formulas = report.output?.csv_contains_formulas; this.max_size_reached = report.output?.max_size_reached; this.warnings = report.output?.warnings; + this.locatorParams = (report.payload as BaseParamsV2).locatorParams; } getStatusMessage() { @@ -167,6 +173,25 @@ export class Job { ); } + /** + * Returns a user friendly version of the report job creation date + */ + getCreatedAtDate(): string { + return this.formatDate(this.created_at); + } + + /** + * Returns a user friendly version of the user that created the report job + */ + getCreatedBy(): string { + return ( + this.created_by || + i18n.translate('xpack.reporting.jobCreatedBy.unknownUserPlaceholderText', { + defaultMessage: 'Unknown', + }) + ); + } + getCreatedAtLabel() { if (this.created_by) { return ( @@ -191,15 +216,20 @@ export class Job { } } + getDeprecatedMessage(): undefined | string { + if (this.isDeprecated) { + return i18n.translate('xpack.reporting.jobWarning.exportTypeDeprecated', { + defaultMessage: + 'This is a deprecated export type. Automation of this report will need to be re-created for compatibility with future versions of Kibana.', + }); + } + } + getWarnings() { const warnings: string[] = []; - if (this.isDeprecated) { - warnings.push( - i18n.translate('xpack.reporting.jobWarning.exportTypeDeprecated', { - defaultMessage: - 'This is a deprecated export type. Automation of this report will need to be re-created for compatibility with future versions of Kibana.', - }) - ); + const deprecatedMessage = this.getDeprecatedMessage(); + if (deprecatedMessage) { + warnings.push(deprecatedMessage); } if (this.csv_contains_formulas) { @@ -234,6 +264,10 @@ export class Job { } } + getPrettyStatusTimestamp() { + return this.formatDate(this.getStatusTimestamp()); + } + private formatDate(timestamp: string) { try { return moment(timestamp).format('YYYY-MM-DD @ hh:mm A'); diff --git a/x-pack/plugins/reporting/public/lib/reporting_api_client/reporting_api_client.ts b/x-pack/plugins/reporting/public/lib/reporting_api_client/reporting_api_client.ts index b27c2a65be96..c44427f3ca9e 100644 --- a/x-pack/plugins/reporting/public/lib/reporting_api_client/reporting_api_client.ts +++ b/x-pack/plugins/reporting/public/lib/reporting_api_client/reporting_api_client.ts @@ -10,12 +10,14 @@ import { stringify } from 'query-string'; import rison from 'rison-node'; import type { HttpFetchQuery } from 'src/core/public'; import { HttpSetup, IUiSettingsClient } from 'src/core/public'; +import { buildKibanaPath } from '../../../common/build_kibana_path'; import { API_BASE_GENERATE, API_BASE_URL, API_GENERATE_IMMEDIATE, API_LIST_URL, API_MIGRATE_ILM_POLICY_URL, + getRedirectAppPath, REPORTING_MANAGEMENT_HOME, } from '../../../common/constants'; import { @@ -73,6 +75,19 @@ export class ReportingAPIClient implements IReportingAPI { private kibanaVersion: string ) {} + public getKibanaAppHref(job: Job): string { + const searchParams = stringify({ jobId: job.id }); + + const path = buildKibanaPath({ + basePath: this.http.basePath.serverBasePath, + spaceId: job.spaceId, + appPath: getRedirectAppPath(), + }); + + const href = `${path}?${searchParams}`; + return href; + } + public getReportURL(jobId: string) { const apiBaseUrl = this.http.basePath.prepend(API_LIST_URL); const downloadLink = `${apiBaseUrl}/download/${jobId}`; diff --git a/x-pack/plugins/reporting/public/management/__snapshots__/report_info_button.test.tsx.snap b/x-pack/plugins/reporting/public/management/__snapshots__/report_info_button.test.tsx.snap deleted file mode 100644 index e8b9362db752..000000000000 --- a/x-pack/plugins/reporting/public/management/__snapshots__/report_info_button.test.tsx.snap +++ /dev/null @@ -1,256 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`ReportInfoButton handles button click flyout on click 1`] = ` - -`; - -exports[`ReportInfoButton opens flyout with fetch error info 1`] = ` -Array [ - -

-
- , -
-
, -] -`; - -exports[`ReportInfoButton opens flyout with info 1`] = ` -Array [ - -
- - - - - - - - - - - - - - - - -
- -
- - -
- - -
-`; diff --git a/x-pack/plugins/reporting/public/management/ilm_policy_link.tsx b/x-pack/plugins/reporting/public/management/components/ilm_policy_link.tsx similarity index 90% rename from x-pack/plugins/reporting/public/management/ilm_policy_link.tsx rename to x-pack/plugins/reporting/public/management/components/ilm_policy_link.tsx index 1dccb11dbbbc..dfb884c24e91 100644 --- a/x-pack/plugins/reporting/public/management/ilm_policy_link.tsx +++ b/x-pack/plugins/reporting/public/management/components/ilm_policy_link.tsx @@ -11,8 +11,8 @@ import { i18n } from '@kbn/i18n'; import { EuiButtonEmpty } from '@elastic/eui'; import type { ApplicationStart } from 'src/core/public'; -import { ILM_POLICY_NAME } from '../../common/constants'; -import { LocatorPublic, SerializableRecord } from '../shared_imports'; +import { ILM_POLICY_NAME } from '../../../common/constants'; +import { LocatorPublic, SerializableRecord } from '../../shared_imports'; interface Props { navigateToUrl: ApplicationStart['navigateToUrl']; diff --git a/x-pack/plugins/reporting/public/management/components/index.ts b/x-pack/plugins/reporting/public/management/components/index.ts new file mode 100644 index 000000000000..10c34ed628a1 --- /dev/null +++ b/x-pack/plugins/reporting/public/management/components/index.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { MigrateIlmPolicyCallOut } from './migrate_ilm_policy_callout'; +export { IlmPolicyLink } from './ilm_policy_link'; +export { ReportDeleteButton } from './report_delete_button'; +export { ReportDiagnostic } from './report_diagnostic'; +export { ReportStatusIndicator } from './report_status_indicator'; +export { ReportInfoFlyout } from './report_info_flyout'; diff --git a/x-pack/plugins/reporting/public/management/migrate_ilm_policy_callout/ilm_policy_migration_needed_callout.tsx b/x-pack/plugins/reporting/public/management/components/migrate_ilm_policy_callout/ilm_policy_migration_needed_callout.tsx similarity index 90% rename from x-pack/plugins/reporting/public/management/migrate_ilm_policy_callout/ilm_policy_migration_needed_callout.tsx rename to x-pack/plugins/reporting/public/management/components/migrate_ilm_policy_callout/ilm_policy_migration_needed_callout.tsx index e96cb842d55c..7eb54049a15a 100644 --- a/x-pack/plugins/reporting/public/management/migrate_ilm_policy_callout/ilm_policy_migration_needed_callout.tsx +++ b/x-pack/plugins/reporting/public/management/components/migrate_ilm_policy_callout/ilm_policy_migration_needed_callout.tsx @@ -9,13 +9,14 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import type { FunctionComponent } from 'react'; import React, { useState } from 'react'; +import useMountedState from 'react-use/lib/useMountedState'; import { EuiCallOut, EuiButton, EuiCode } from '@elastic/eui'; import type { NotificationsSetup } from 'src/core/public'; -import { ILM_POLICY_NAME } from '../../../common/constants'; +import { ILM_POLICY_NAME } from '../../../../common/constants'; -import { useInternalApiClient } from '../../lib/reporting_api_client'; +import { useInternalApiClient } from '../../../lib/reporting_api_client'; const i18nTexts = { title: i18n.translate('xpack.reporting.listing.ilmPolicyCallout.migrationNeededTitle', { @@ -63,6 +64,7 @@ export const IlmPolicyMigrationNeededCallOut: FunctionComponent = ({ onMigrationDone, }) => { const [isMigratingIndices, setIsMigratingIndices] = useState(false); + const isMounted = useMountedState(); const { apiClient } = useInternalApiClient(); @@ -78,7 +80,7 @@ export const IlmPolicyMigrationNeededCallOut: FunctionComponent = ({ toastMessage: e.body?.message, }); } finally { - setIsMigratingIndices(false); + if (isMounted()) setIsMigratingIndices(false); } }; diff --git a/x-pack/plugins/reporting/public/management/migrate_ilm_policy_callout/index.tsx b/x-pack/plugins/reporting/public/management/components/migrate_ilm_policy_callout/index.tsx similarity index 92% rename from x-pack/plugins/reporting/public/management/migrate_ilm_policy_callout/index.tsx rename to x-pack/plugins/reporting/public/management/components/migrate_ilm_policy_callout/index.tsx index 892cbcdde5ed..0c2359acdb67 100644 --- a/x-pack/plugins/reporting/public/management/migrate_ilm_policy_callout/index.tsx +++ b/x-pack/plugins/reporting/public/management/components/migrate_ilm_policy_callout/index.tsx @@ -11,7 +11,7 @@ import { EuiSpacer, EuiFlexItem } from '@elastic/eui'; import { NotificationsSetup } from 'src/core/public'; -import { useIlmPolicyStatus } from '../../lib/ilm_policy_status_context'; +import { useIlmPolicyStatus } from '../../../lib/ilm_policy_status_context'; import { IlmPolicyMigrationNeededCallOut } from './ilm_policy_migration_needed_callout'; diff --git a/x-pack/plugins/reporting/public/management/report_delete_button.tsx b/x-pack/plugins/reporting/public/management/components/report_delete_button.tsx similarity index 59% rename from x-pack/plugins/reporting/public/management/report_delete_button.tsx rename to x-pack/plugins/reporting/public/management/components/report_delete_button.tsx index da1ce9dd9e1c..d91560ddd86f 100644 --- a/x-pack/plugins/reporting/public/management/report_delete_button.tsx +++ b/x-pack/plugins/reporting/public/management/components/report_delete_button.tsx @@ -6,9 +6,10 @@ */ import { EuiButton, EuiConfirmModal } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; import React, { Fragment, PureComponent } from 'react'; -import { Job } from '../lib/job'; -import { ListingProps } from './'; +import { Job } from '../../lib/job'; +import { ListingProps } from '../'; type DeleteFn = () => Promise; type Props = { jobsToDelete: Job[]; performDelete: DeleteFn } & ListingProps; @@ -31,34 +32,25 @@ export class ReportDeleteButton extends PureComponent { } private renderConfirm() { - const { intl, jobsToDelete } = this.props; + const { jobsToDelete } = this.props; const title = jobsToDelete.length > 1 - ? intl.formatMessage( - { - id: 'xpack.reporting.listing.table.deleteNumConfirmTitle', - defaultMessage: `Delete {num} reports?`, - }, - { num: jobsToDelete.length } - ) - : intl.formatMessage( - { - id: 'xpack.reporting.listing.table.deleteConfirmTitle', - defaultMessage: `Delete the "{name}" report?`, - }, - { name: jobsToDelete[0].title } - ); - const message = intl.formatMessage({ - id: 'xpack.reporting.listing.table.deleteConfirmMessage', + ? i18n.translate('xpack.reporting.listing.table.deleteNumConfirmTitle', { + defaultMessage: `Delete {num} reports?`, + values: { num: jobsToDelete.length }, + }) + : i18n.translate('xpack.reporting.listing.table.deleteConfirmTitle', { + defaultMessage: `Delete the "{name}" report?`, + values: { name: jobsToDelete[0].title }, + }); + const message = i18n.translate('xpack.reporting.listing.table.deleteConfirmMessage', { defaultMessage: `You can't recover deleted reports.`, }); - const confirmButtonText = intl.formatMessage({ - id: 'xpack.reporting.listing.table.deleteConfirmButton', + const confirmButtonText = i18n.translate('xpack.reporting.listing.table.deleteConfirmButton', { defaultMessage: `Delete`, }); - const cancelButtonText = intl.formatMessage({ - id: 'xpack.reporting.listing.table.deleteCancelButton', + const cancelButtonText = i18n.translate('xpack.reporting.listing.table.deleteCancelButton', { defaultMessage: `Cancel`, }); @@ -78,7 +70,7 @@ export class ReportDeleteButton extends PureComponent { } public render() { - const { jobsToDelete, intl } = this.props; + const { jobsToDelete } = this.props; if (jobsToDelete.length === 0) return null; return ( @@ -89,13 +81,10 @@ export class ReportDeleteButton extends PureComponent { color={'danger'} data-test-subj="deleteReportButton" > - {intl.formatMessage( - { - id: 'xpack.reporting.listing.table.deleteReportButton', - defaultMessage: `Delete {num, plural, one {report} other {reports} }`, - }, - { num: jobsToDelete.length } - )} + {i18n.translate('xpack.reporting.listing.table.deleteReportButton', { + defaultMessage: `Delete {num, plural, one {report} other {reports} }`, + values: { num: jobsToDelete.length }, + })} {this.state.showConfirm ? this.renderConfirm() : null} diff --git a/x-pack/plugins/reporting/public/management/report_diagnostic.tsx b/x-pack/plugins/reporting/public/management/components/report_diagnostic.tsx similarity index 98% rename from x-pack/plugins/reporting/public/management/report_diagnostic.tsx rename to x-pack/plugins/reporting/public/management/components/report_diagnostic.tsx index ce585fe427e6..124ce9af891a 100644 --- a/x-pack/plugins/reporting/public/management/report_diagnostic.tsx +++ b/x-pack/plugins/reporting/public/management/components/report_diagnostic.tsx @@ -21,7 +21,7 @@ import { EuiText, EuiTitle, } from '@elastic/eui'; -import { ReportingAPIClient, DiagnoseResponse } from '../lib/reporting_api_client'; +import { ReportingAPIClient, DiagnoseResponse } from '../../lib/reporting_api_client'; interface Props { apiClient: ReportingAPIClient; diff --git a/x-pack/plugins/reporting/public/management/components/report_info_button.tsx b/x-pack/plugins/reporting/public/management/components/report_info_button.tsx new file mode 100644 index 000000000000..26e495e5908d --- /dev/null +++ b/x-pack/plugins/reporting/public/management/components/report_info_button.tsx @@ -0,0 +1,52 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiButtonEmpty, EuiToolTip } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import React, { FunctionComponent } from 'react'; +import { Job } from '../../lib/job'; + +interface Props { + job: Job; + onClick: () => void; +} + +export const ReportInfoButton: FunctionComponent = ({ job, onClick }) => { + let message = i18n.translate('xpack.reporting.listing.table.reportInfoButtonTooltip', { + defaultMessage: 'See report info.', + }); + if (job.getError()) { + message = i18n.translate('xpack.reporting.listing.table.reportInfoAndErrorButtonTooltip', { + defaultMessage: 'See report info and error message.', + }); + } else if (job.getWarnings()) { + message = i18n.translate('xpack.reporting.listing.table.reportInfoAndWarningsButtonTooltip', { + defaultMessage: 'See report info and warnings.', + }); + } + + const showReportInfoCopy = i18n.translate( + 'xpack.reporting.listing.table.showReportInfoAriaLabel', + { + defaultMessage: 'Show report info', + } + ); + + return ( + + + {showReportInfoCopy} + + + ); +}; diff --git a/x-pack/plugins/reporting/public/management/components/report_info_flyout.tsx b/x-pack/plugins/reporting/public/management/components/report_info_flyout.tsx new file mode 100644 index 000000000000..2a7d52cf9403 --- /dev/null +++ b/x-pack/plugins/reporting/public/management/components/report_info_flyout.tsx @@ -0,0 +1,93 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FunctionComponent, useState, useEffect } from 'react'; +import useMountedState from 'react-use/lib/useMountedState'; +import { + EuiFlyout, + EuiFlyoutBody, + EuiFlyoutHeader, + EuiPortal, + EuiText, + EuiTitle, + EuiLoadingSpinner, +} from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; + +import { Job } from '../../lib/job'; +import { useInternalApiClient } from '../../lib/reporting_api_client'; + +import { ReportInfoFlyoutContent } from './report_info_flyout_content'; + +interface Props { + onClose: () => void; + job: Job; +} + +export const ReportInfoFlyout: FunctionComponent = ({ onClose, job }) => { + const [isLoading, setIsLoading] = useState(true); + const [loadingError, setLoadingError] = useState(); + const [info, setInfo] = useState(); + const isMounted = useMountedState(); + const { apiClient } = useInternalApiClient(); + + useEffect(() => { + (async function loadInfo() { + if (isLoading) { + try { + const infoResponse = await apiClient.getInfo(job.id); + if (isMounted()) { + setInfo(infoResponse); + } + } catch (err) { + if (isMounted()) { + setLoadingError(err); + } + } finally { + if (isMounted()) { + setIsLoading(false); + } + } + } + })(); + }, [isLoading, apiClient, job.id, isMounted]); + + return ( + + + + +

+ {loadingError + ? i18n.translate('xpack.reporting.listing.table.reportInfoUnableToFetch', { + defaultMessage: 'Unable to fetch report info.', + }) + : i18n.translate('xpack.reporting.listing.table.reportCalloutTitle', { + defaultMessage: 'Report info', + })} +

+
+
+ + {isLoading ? ( + + ) : loadingError ? undefined : !!info ? ( + + + + ) : undefined} + +
+
+ ); +}; diff --git a/x-pack/plugins/reporting/public/management/components/report_info_flyout_content.tsx b/x-pack/plugins/reporting/public/management/components/report_info_flyout_content.tsx new file mode 100644 index 000000000000..25199c4abaa6 --- /dev/null +++ b/x-pack/plugins/reporting/public/management/components/report_info_flyout_content.tsx @@ -0,0 +1,193 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FunctionComponent } from 'react'; +import { i18n } from '@kbn/i18n'; +import { EuiDescriptionList, EuiSpacer, EuiText } from '@elastic/eui'; + +import type { Job } from '../../lib/job'; +import { USES_HEADLESS_JOB_TYPES } from '../../../common/constants'; + +const NA = i18n.translate('xpack.reporting.listing.infoPanel.notApplicableLabel', { + defaultMessage: 'N/A', +}); + +const UNKNOWN = i18n.translate('xpack.reporting.listing.infoPanel.unknownLabel', { + defaultMessage: 'unknown', +}); + +const getDimensions = (info: Job): string => { + const defaultDimensions = { width: null, height: null }; + const { width, height } = info.layout?.dimensions || defaultDimensions; + if (width && height) { + return `Width: ${width} x Height: ${height}`; + } + return UNKNOWN; +}; + +interface Props { + info: Job; +} + +export const ReportInfoFlyoutContent: FunctionComponent = ({ info }) => { + const timeout = info.timeout ? info.timeout.toString() : NA; + + const jobInfo = [ + { + title: i18n.translate('xpack.reporting.listing.infoPanel.titleInfo', { + defaultMessage: 'Title', + }), + description: info.title || NA, + }, + { + title: i18n.translate('xpack.reporting.listing.infoPanel.createdAtInfo', { + defaultMessage: 'Created at', + }), + description: info.getCreatedAtLabel(), + }, + { + title: i18n.translate('xpack.reporting.listing.infoPanel.statusInfo', { + defaultMessage: 'Status', + }), + description: info.getStatus(), + }, + { + title: i18n.translate('xpack.reporting.listing.infoPanel.tzInfo', { + defaultMessage: 'Time zone', + }), + description: info.browserTimezone || NA, + }, + ]; + + const processingInfo = [ + { + title: i18n.translate('xpack.reporting.listing.infoPanel.startedAtInfo', { + defaultMessage: 'Started at', + }), + description: info.started_at || NA, + }, + { + title: i18n.translate('xpack.reporting.listing.infoPanel.completedAtInfo', { + defaultMessage: 'Completed at', + }), + description: info.completed_at || NA, + }, + { + title: i18n.translate('xpack.reporting.listing.infoPanel.processedByInfo', { + defaultMessage: 'Processed by', + }), + description: + info.kibana_name && info.kibana_id ? `${info.kibana_name} (${info.kibana_id})` : NA, + }, + { + title: i18n.translate('xpack.reporting.listing.infoPanel.contentTypeInfo', { + defaultMessage: 'Content type', + }), + description: info.content_type || NA, + }, + { + title: i18n.translate('xpack.reporting.listing.infoPanel.sizeInfo', { + defaultMessage: 'Size in bytes', + }), + description: info.size?.toString() || NA, + }, + { + title: i18n.translate('xpack.reporting.listing.infoPanel.attemptsInfo', { + defaultMessage: 'Attempts', + }), + description: info.attempts.toString(), + }, + { + title: i18n.translate('xpack.reporting.listing.infoPanel.maxAttemptsInfo', { + defaultMessage: 'Max attempts', + }), + description: info.max_attempts?.toString() || NA, + }, + { + title: i18n.translate('xpack.reporting.listing.infoPanel.timeoutInfo', { + defaultMessage: 'Timeout', + }), + description: timeout, + }, + { + title: i18n.translate('xpack.reporting.listing.infoPanel.exportTypeInfo', { + defaultMessage: 'Export type', + }), + description: info.isDeprecated + ? i18n.translate('xpack.reporting.listing.table.reportCalloutExportTypeDeprecated', { + defaultMessage: '{jobtype} (DEPRECATED)', + values: { jobtype: info.jobtype }, + }) + : info.jobtype, + }, + + // TODO: when https://github.com/elastic/kibana/pull/106137 is merged, add kibana version field + ]; + + const jobScreenshot = [ + { + title: i18n.translate('xpack.reporting.listing.infoPanel.dimensionsInfo', { + defaultMessage: 'Dimensions', + }), + description: getDimensions(info), + }, + { + title: i18n.translate('xpack.reporting.listing.infoPanel.layoutInfo', { + defaultMessage: 'Layout', + }), + description: info.layout?.id || UNKNOWN, + }, + { + title: i18n.translate('xpack.reporting.listing.infoPanel.browserTypeInfo', { + defaultMessage: 'Browser type', + }), + description: info.browser_type || NA, + }, + ]; + + const warnings = info.getWarnings(); + const warningsInfo = warnings && [ + { + title: Warnings, + description: {warnings}, + }, + ]; + + const errored = info.getError(); + const errorInfo = errored && [ + { + title: Error, + description: {errored}, + }, + ]; + + return ( + <> + + + + {USES_HEADLESS_JOB_TYPES.includes(info.jobtype) ? ( + <> + + + + ) : null} + {warningsInfo ? ( + <> + + + + ) : null} + {errorInfo ? ( + <> + + + + ) : null} + + ); +}; diff --git a/x-pack/plugins/reporting/public/management/components/report_status_indicator.tsx b/x-pack/plugins/reporting/public/management/components/report_status_indicator.tsx new file mode 100644 index 000000000000..21fd0fc76745 --- /dev/null +++ b/x-pack/plugins/reporting/public/management/components/report_status_indicator.tsx @@ -0,0 +1,101 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC, useMemo } from 'react'; +import { i18n } from '@kbn/i18n'; +import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiLoadingSpinner, EuiToolTip } from '@elastic/eui'; + +import type { Job } from '../../lib/job'; +import { JOB_STATUSES } from '../../../common/constants'; +import { jobHasIssues } from '../utils'; + +interface Props { + job: Job; +} + +const i18nTexts = { + completed: i18n.translate('xpack.reporting.statusIndicator.completedLabel', { + defaultMessage: 'Done', + }), + completedWithWarnings: i18n.translate( + 'xpack.reporting.statusIndicator.completedWithWarningsLabel', + { + defaultMessage: 'Done, warnings detected', + } + ), + pending: i18n.translate('xpack.reporting.statusIndicator.pendingLabel', { + defaultMessage: 'Pending', + }), + processing: ({ attempt, of }: { attempt: number; of?: number }) => + of !== undefined + ? i18n.translate('xpack.reporting.statusIndicator.processingMaxAttemptsLabel', { + defaultMessage: `Processing, attempt {attempt} of {of}`, + values: { attempt, of }, + }) + : i18n.translate('xpack.reporting.statusIndicator.processingLabel', { + defaultMessage: `Processing, attempt {attempt}`, + values: { attempt }, + }), + failed: i18n.translate('xpack.reporting.statusIndicator.failedLabel', { + defaultMessage: 'Failed', + }), + unknown: i18n.translate('xpack.reporting.statusIndicator.unknownLabel', { + defaultMessage: 'Unknown', + }), + lastStatusUpdate: ({ date }: { date: string }) => + i18n.translate('xpack.reporting.statusIndicator.lastStatusUpdateLabel', { + defaultMessage: 'Updated at {date}', + values: { date }, + }), +}; + +export const ReportStatusIndicator: FC = ({ job }) => { + const hasIssues = useMemo(() => jobHasIssues(job), [job]); + + let icon: JSX.Element; + let statusText: string; + + switch (job.status) { + case JOB_STATUSES.COMPLETED: + if (hasIssues) { + icon = ; + statusText = i18nTexts.completedWithWarnings; + break; + } + icon = ; + statusText = i18nTexts.completed; + break; + case JOB_STATUSES.WARNINGS: + icon = ; + statusText = i18nTexts.completedWithWarnings; + break; + case JOB_STATUSES.PENDING: + icon = ; + statusText = i18nTexts.pending; + break; + case JOB_STATUSES.PROCESSING: + icon = ; + statusText = i18nTexts.processing({ attempt: job.attempts, of: job.max_attempts }); + break; + case JOB_STATUSES.FAILED: + icon = ; + statusText = i18nTexts.failed; + break; + default: + icon = ; + statusText = i18nTexts.unknown; + } + + return ( + + + {icon} + {statusText} + + + ); +}; diff --git a/x-pack/plugins/reporting/public/management/index.ts b/x-pack/plugins/reporting/public/management/index.ts index 4d324135288d..7bd7845051d2 100644 --- a/x-pack/plugins/reporting/public/management/index.ts +++ b/x-pack/plugins/reporting/public/management/index.ts @@ -5,7 +5,6 @@ * 2.0. */ -import { InjectedIntl } from '@kbn/i18n/react'; import { ApplicationStart, ToastsSetup } from 'src/core/public'; import { LicensingPluginSetup } from '../../../licensing/public'; import { UseIlmPolicyStatusReturn } from '../lib/ilm_policy_status_context'; @@ -14,7 +13,6 @@ import { ClientConfigType } from '../plugin'; import type { SharePluginSetup } from '../shared_imports'; export interface ListingProps { - intl: InjectedIntl; apiClient: ReportingAPIClient; capabilities: ApplicationStart['capabilities']; license$: LicensingPluginSetup['license$']; // FIXME: license$ is deprecated diff --git a/x-pack/plugins/reporting/public/management/report_download_button.tsx b/x-pack/plugins/reporting/public/management/report_download_button.tsx deleted file mode 100644 index f21c83fbf42d..000000000000 --- a/x-pack/plugins/reporting/public/management/report_download_button.tsx +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { EuiButtonIcon, EuiToolTip } from '@elastic/eui'; -import { InjectedIntl } from '@kbn/i18n/react'; -import React, { FunctionComponent } from 'react'; -import { JOB_STATUSES } from '../../common/constants'; -import { Job as ListingJob } from '../lib/job'; -import { ReportingAPIClient } from '../lib/reporting_api_client'; - -interface Props { - intl: InjectedIntl; - apiClient: ReportingAPIClient; - job: ListingJob; -} - -export const ReportDownloadButton: FunctionComponent = (props: Props) => { - const { job, apiClient, intl } = props; - - if (job.status !== JOB_STATUSES.COMPLETED && job.status !== JOB_STATUSES.WARNINGS) { - return null; - } - - const button = ( - apiClient.downloadReport(job.id)} - iconType="importAction" - aria-label={intl.formatMessage({ - id: 'xpack.reporting.listing.table.downloadReportAriaLabel', - defaultMessage: 'Download report', - })} - /> - ); - - const warnings = job.getWarnings(); - if (warnings) { - return ( - - {button} - - ); - } - - return ( - - {button} - - ); -}; diff --git a/x-pack/plugins/reporting/public/management/report_info_button.test.tsx b/x-pack/plugins/reporting/public/management/report_info_button.test.tsx deleted file mode 100644 index c52027355ac5..000000000000 --- a/x-pack/plugins/reporting/public/management/report_info_button.test.tsx +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; -import { mountWithIntl } from '@kbn/test/jest'; -import { coreMock } from '../../../../../src/core/public/mocks'; -import { Job } from '../lib/job'; -import { ReportInfoButton } from './report_info_button'; - -jest.mock('../lib/reporting_api_client'); - -import { ReportingAPIClient } from '../lib/reporting_api_client'; - -const coreSetup = coreMock.createSetup(); -const apiClient = new ReportingAPIClient(coreSetup.http, coreSetup.uiSettings, '7.15.0'); - -const job = new Job({ - id: 'abc-123', - index: '.reporting-2020.04.12', - migration_version: '7.15.0', - attempts: 0, - browser_type: 'chromium', - created_at: '2020-04-14T21:01:13.064Z', - created_by: 'elastic', - jobtype: 'printable_pdf', - max_attempts: 1, - meta: { layout: 'preserve_layout', objectType: 'canvas workpad' }, - payload: { - browserTimezone: 'America/Phoenix', - version: '7.15.0-test', - layout: { dimensions: { height: 720, width: 1080 }, id: 'preserve_layout' }, - objectType: 'canvas workpad', - title: 'My Canvas Workpad', - }, - process_expiration: '1970-01-01T00:00:00.000Z', - status: 'pending', - timeout: 300000, -}); - -describe('ReportInfoButton', () => { - it('handles button click flyout on click', () => { - const wrapper = mountWithIntl(); - const input = wrapper.find('[data-test-subj="reportInfoButton"]').hostNodes(); - expect(input).toMatchSnapshot(); - }); - - it('opens flyout with info', async () => { - const wrapper = mountWithIntl(); - const input = wrapper.find('[data-test-subj="reportInfoButton"]').hostNodes(); - - input.simulate('click'); - - const flyout = wrapper.find('[data-test-subj="reportInfoFlyout"]'); - expect(flyout).toMatchSnapshot(); - - expect(apiClient.getInfo).toHaveBeenCalledTimes(1); - expect(apiClient.getInfo).toHaveBeenCalledWith('abc-123'); - }); - - it('opens flyout with fetch error info', () => { - // simulate fetch failure - apiClient.getInfo = jest.fn(() => { - throw new Error('Could not fetch the job info'); - }); - - const wrapper = mountWithIntl(); - const input = wrapper.find('[data-test-subj="reportInfoButton"]').hostNodes(); - - input.simulate('click'); - - const flyout = wrapper.find('[data-test-subj="reportInfoFlyout"]'); - expect(flyout).toMatchSnapshot(); - - expect(apiClient.getInfo).toHaveBeenCalledTimes(1); - expect(apiClient.getInfo).toHaveBeenCalledWith('abc-123'); - }); -}); diff --git a/x-pack/plugins/reporting/public/management/report_info_button.tsx b/x-pack/plugins/reporting/public/management/report_info_button.tsx deleted file mode 100644 index 7a70286785e4..000000000000 --- a/x-pack/plugins/reporting/public/management/report_info_button.tsx +++ /dev/null @@ -1,377 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { - EuiButtonIcon, - EuiDescriptionList, - EuiFlyout, - EuiFlyoutBody, - EuiFlyoutHeader, - EuiPortal, - EuiSpacer, - EuiText, - EuiTitle, - EuiToolTip, -} from '@elastic/eui'; -import { injectI18n } from '@kbn/i18n/react'; -import React, { Component } from 'react'; -import { USES_HEADLESS_JOB_TYPES } from '../../common/constants'; -import { Job } from '../lib/job'; -import { ReportingAPIClient } from '../lib/reporting_api_client'; -import { ListingProps } from '.'; - -interface Props extends Pick { - apiClient: ReportingAPIClient; - job: Job; -} - -interface State { - isLoading: boolean; - isFlyoutVisible: boolean; - calloutTitle: string; - info: Job | null; - error: Error | null; -} - -const NA = 'n/a'; -const UNKNOWN = 'unknown'; - -const getDimensions = (info: Job): string => { - const defaultDimensions = { width: null, height: null }; - const { width, height } = info.layout?.dimensions || defaultDimensions; - if (width && height) { - return `Width: ${width} x Height: ${height}`; - } - return UNKNOWN; -}; - -class ReportInfoButtonUi extends Component { - private mounted?: boolean; - - constructor(props: Props) { - super(props); - - this.state = { - isLoading: false, - isFlyoutVisible: false, - calloutTitle: props.intl.formatMessage({ - id: 'xpack.reporting.listing.table.reportCalloutTitle', - defaultMessage: 'Report info', - }), - info: null, - error: null, - }; - - this.closeFlyout = this.closeFlyout.bind(this); - this.showFlyout = this.showFlyout.bind(this); - } - - public renderInfo() { - const { info, error: err } = this.state; - if (err) { - return err.message; - } - if (!info) { - return null; - } - - const timeout = info.timeout ? info.timeout.toString() : NA; - - const jobInfo = [ - { - title: this.props.intl.formatMessage({ - id: 'xpack.reporting.listing.infoPanel.titleInfo', - defaultMessage: 'Title', - }), - description: info.title || NA, - }, - { - title: this.props.intl.formatMessage({ - id: 'xpack.reporting.listing.infoPanel.createdAtInfo', - defaultMessage: 'Created at', - }), - description: info.getCreatedAtLabel(), - }, - { - title: this.props.intl.formatMessage({ - id: 'xpack.reporting.listing.infoPanel.statusInfo', - defaultMessage: 'Status', - }), - description: info.getStatus(), - }, - { - title: this.props.intl.formatMessage({ - id: 'xpack.reporting.listing.infoPanel.tzInfo', - defaultMessage: 'Time zone', - }), - description: info.browserTimezone || NA, - }, - ]; - - const processingInfo = [ - { - title: this.props.intl.formatMessage({ - id: 'xpack.reporting.listing.infoPanel.startedAtInfo', - defaultMessage: 'Started at', - }), - description: info.started_at || NA, - }, - { - title: this.props.intl.formatMessage({ - id: 'xpack.reporting.listing.infoPanel.completedAtInfo', - defaultMessage: 'Completed at', - }), - description: info.completed_at || NA, - }, - { - title: this.props.intl.formatMessage({ - id: 'xpack.reporting.listing.infoPanel.processedByInfo', - defaultMessage: 'Processed by', - }), - description: - info.kibana_name && info.kibana_id ? `${info.kibana_name} (${info.kibana_id})` : NA, - }, - { - title: this.props.intl.formatMessage({ - id: 'xpack.reporting.listing.infoPanel.contentTypeInfo', - defaultMessage: 'Content type', - }), - description: info.content_type || NA, - }, - { - title: this.props.intl.formatMessage({ - id: 'xpack.reporting.listing.infoPanel.sizeInfo', - defaultMessage: 'Size in bytes', - }), - description: info.size?.toString() || NA, - }, - { - title: this.props.intl.formatMessage({ - id: 'xpack.reporting.listing.infoPanel.attemptsInfo', - defaultMessage: 'Attempts', - }), - description: info.attempts.toString(), - }, - { - title: this.props.intl.formatMessage({ - id: 'xpack.reporting.listing.infoPanel.maxAttemptsInfo', - defaultMessage: 'Max attempts', - }), - description: info.max_attempts?.toString() || NA, - }, - { - title: this.props.intl.formatMessage({ - id: 'xpack.reporting.listing.infoPanel.timeoutInfo', - defaultMessage: 'Timeout', - }), - description: timeout, - }, - { - title: this.props.intl.formatMessage({ - id: 'xpack.reporting.listing.infoPanel.exportTypeInfo', - defaultMessage: 'Export type', - }), - description: info.isDeprecated - ? this.props.intl.formatMessage( - { - id: 'xpack.reporting.listing.table.reportCalloutExportTypeDeprecated', - defaultMessage: '{jobtype} (DEPRECATED)', - }, - { jobtype: info.jobtype } - ) - : info.jobtype, - }, - - // TODO when https://github.com/elastic/kibana/pull/106137 is merged, add kibana version field - ]; - - const jobScreenshot = [ - { - title: this.props.intl.formatMessage({ - id: 'xpack.reporting.listing.infoPanel.dimensionsInfo', - defaultMessage: 'Dimensions', - }), - description: getDimensions(info), - }, - { - title: this.props.intl.formatMessage({ - id: 'xpack.reporting.listing.infoPanel.layoutInfo', - defaultMessage: 'Layout', - }), - description: info.layout?.id || UNKNOWN, - }, - { - title: this.props.intl.formatMessage({ - id: 'xpack.reporting.listing.infoPanel.browserTypeInfo', - defaultMessage: 'Browser type', - }), - description: info.browser_type || NA, - }, - ]; - - const warnings = info.getWarnings(); - const warningsInfo = warnings && [ - { - title: Warnings, - description: {warnings}, - }, - ]; - - const errored = info.getError(); - const errorInfo = errored && [ - { - title: Error, - description: {errored}, - }, - ]; - - return ( - <> - - - - {USES_HEADLESS_JOB_TYPES.includes(info.jobtype) ? ( - <> - - - - ) : null} - {warningsInfo ? ( - <> - - - - ) : null} - {errorInfo ? ( - <> - - - - ) : null} - - ); - } - - public componentWillUnmount() { - this.mounted = false; - } - - public componentDidMount() { - this.mounted = true; - } - - public render() { - const job = this.props.job; - let flyout; - - if (this.state.isFlyoutVisible) { - flyout = ( - - - - -

{this.state.calloutTitle}

-
-
- - {this.renderInfo()} - -
-
- ); - } - - let message = this.props.intl.formatMessage({ - id: 'xpack.reporting.listing.table.reportInfoButtonTooltip', - defaultMessage: 'See report info.', - }); - if (job.getError()) { - message = this.props.intl.formatMessage({ - id: 'xpack.reporting.listing.table.reportInfoAndErrorButtonTooltip', - defaultMessage: 'See report info and error message.', - }); - } else if (job.getWarnings()) { - message = this.props.intl.formatMessage({ - id: 'xpack.reporting.listing.table.reportInfoAndWarningsButtonTooltip', - defaultMessage: 'See report info and warnings.', - }); - } - - let buttonIconType = 'iInCircle'; - let buttonColor: 'primary' | 'danger' | 'warning' = 'primary'; - if (job.getWarnings() || job.getError()) { - buttonIconType = 'alert'; - buttonColor = 'danger'; - } - if (job.getWarnings()) { - buttonColor = 'warning'; - } - - return ( - <> - - - - {flyout} - - ); - } - - private loadInfo = async () => { - this.setState({ isLoading: true }); - try { - const info = await this.props.apiClient.getInfo(this.props.job.id); - if (this.mounted) { - this.setState({ isLoading: false, info }); - } - } catch (err) { - if (this.mounted) { - this.setState({ - isLoading: false, - calloutTitle: this.props.intl.formatMessage({ - id: 'xpack.reporting.listing.table.reportInfoUnableToFetch', - defaultMessage: 'Unable to fetch report info.', - }), - info: null, - error: err, - }); - } - } - }; - - private closeFlyout = () => { - this.setState({ - isFlyoutVisible: false, - info: null, // force re-read for next click - }); - }; - - private showFlyout = () => { - this.setState({ isFlyoutVisible: true }); - - if (!this.state.info) { - this.loadInfo(); - } - }; -} - -export const ReportInfoButton = injectI18n(ReportInfoButtonUi); diff --git a/x-pack/plugins/reporting/public/management/report_listing.scss b/x-pack/plugins/reporting/public/management/report_listing.scss new file mode 100644 index 000000000000..7e85838ba09c --- /dev/null +++ b/x-pack/plugins/reporting/public/management/report_listing.scss @@ -0,0 +1,7 @@ +.kbnReporting { + &__reportListing { + &__typeIcon { + padding-left: $euiSizeS; + } + } +} diff --git a/x-pack/plugins/reporting/public/management/report_listing.test.tsx b/x-pack/plugins/reporting/public/management/report_listing.test.tsx index 5e80c2d666c2..577d64be38a5 100644 --- a/x-pack/plugins/reporting/public/management/report_listing.test.tsx +++ b/x-pack/plugins/reporting/public/management/report_listing.test.tsx @@ -7,16 +7,17 @@ import { registerTestBed } from '@kbn/test/jest'; import type { SerializableRecord, UnwrapPromise } from '@kbn/utility-types'; -import type { DeeplyMockedKeys } from '@kbn/utility-types/jest'; import React from 'react'; import { act } from 'react-dom/test-utils'; import type { Observable } from 'rxjs'; +import type { IUiSettingsClient } from 'src/core/public'; import { ListingProps as Props, ReportListing } from '.'; import type { NotificationsSetup } from '../../../../../src/core/public'; import { applicationServiceMock, httpServiceMock, notificationServiceMock, + coreMock, } from '../../../../../src/core/public/mocks'; import type { LocatorPublic, SharePluginSetup } from '../../../../../src/plugins/share/public'; import type { ILicense } from '../../../licensing/public'; @@ -65,12 +66,18 @@ const mockJobs: ReportApiJSON[] = [ id: 'k90e51pk1ieucbae0c3t8wo2', attempts: 0, created_at: '2020-04-14T21:01:13.064Z', - jobtype: 'printable_pdf', + jobtype: 'printable_pdf_v2', meta: { layout: 'preserve_layout', objectType: 'canvas workpad' }, payload: { + spaceId: 'my-space', objectType: 'canvas workpad', title: 'My Canvas Workpad', - }, + locatorParams: [ + { + id: 'MY_APP', + }, + ], + } as any, status: 'pending', }), buildMockReport({ @@ -201,12 +208,6 @@ const mockJobs: ReportApiJSON[] = [ }), ]; -const reportingAPIClient = { - list: jest.fn(() => Promise.resolve(mockJobs.map((j) => new Job(j)))), - total: jest.fn(() => Promise.resolve(18)), - migrateReportingIndicesIlmPolicy: jest.fn(), -} as unknown as DeeplyMockedKeys; - const validCheck = { check: () => ({ state: 'VALID', @@ -233,11 +234,13 @@ const mockPollConfig = { describe('ReportListing', () => { let httpService: ReturnType; + let uiSettingsClient: IUiSettingsClient; let applicationService: ReturnType; let ilmLocator: undefined | LocatorPublic; let urlService: SharePluginSetup['url']; let testBed: UnwrapPromise>; let toasts: NotificationsSetup['toasts']; + let reportingAPIClient: ReportingAPIClient; const createTestBed = registerTestBed( (props?: Partial) => ( @@ -290,6 +293,7 @@ describe('ReportListing', () => { beforeEach(async () => { toasts = notificationServiceMock.createSetupContract().toasts; httpService = httpServiceMock.createSetupContract(); + uiSettingsClient = coreMock.createSetup().uiSettings; applicationService = applicationServiceMock.createStartContract(); applicationService.capabilities = { catalogue: {}, @@ -300,6 +304,16 @@ describe('ReportListing', () => { getUrl: jest.fn(), } as unknown as LocatorPublic; + reportingAPIClient = new ReportingAPIClient(httpService, uiSettingsClient, 'x.x.x'); + + jest + .spyOn(reportingAPIClient, 'list') + .mockImplementation(() => Promise.resolve(mockJobs.map((j) => new Job(j)))); + jest.spyOn(reportingAPIClient, 'total').mockImplementation(() => Promise.resolve(18)); + jest + .spyOn(reportingAPIClient, 'migrateReportingIndicesIlmPolicy') + .mockImplementation(jest.fn()); + urlService = { locators: { get: () => ilmLocator, @@ -312,10 +326,9 @@ describe('ReportListing', () => { jest.clearAllMocks(); }); - it('Report job listing with some items', () => { - const { actions } = testBed; - const table = actions.findListTable(); - expect(table).toMatchSnapshot(); + it('renders a listing with some items', () => { + const { find } = testBed; + expect(find('reportDownloadLink').length).toBe(mockJobs.length); }); it('subscribes to license changes, and unsubscribes on dismount', async () => { @@ -334,6 +347,21 @@ describe('ReportListing', () => { expect(unsubscribeMock).toHaveBeenCalled(); }); + it('navigates to a Kibana App in a new tab and is spaces aware', () => { + const { find } = testBed; + + jest.spyOn(window, 'open').mockImplementation(jest.fn()); + jest.spyOn(window, 'focus').mockImplementation(jest.fn()); + + find('euiCollapsedItemActionsButton').first().simulate('click'); + find('reportOpenInKibanaApp').first().simulate('click'); + + expect(window.open).toHaveBeenCalledWith( + '/s/my-space/app/reportingRedirect?jobId=k90e51pk1ieucbae0c3t8wo2', + '_blank' + ); + }); + describe('ILM policy', () => { beforeEach(async () => { httpService = httpServiceMock.createSetupContract(); @@ -414,7 +442,9 @@ describe('ReportListing', () => { it('informs users when migrations failed', async () => { const status: IlmPolicyMigrationStatus = 'indices-not-managed-by-policy'; httpService.get.mockResolvedValueOnce({ status }); - reportingAPIClient.migrateReportingIndicesIlmPolicy.mockRejectedValueOnce(new Error('oops!')); + (reportingAPIClient.migrateReportingIndicesIlmPolicy as jest.Mock).mockRejectedValueOnce( + new Error('oops!') + ); await runSetup(); const { actions } = testBed; diff --git a/x-pack/plugins/reporting/public/management/report_listing.tsx b/x-pack/plugins/reporting/public/management/report_listing.tsx index 6b4677801125..46c375cd8880 100644 --- a/x-pack/plugins/reporting/public/management/report_listing.tsx +++ b/x-pack/plugins/reporting/public/management/report_listing.tsx @@ -12,15 +12,17 @@ import { EuiLoadingSpinner, EuiPageHeader, EuiSpacer, - EuiText, - EuiTextColor, + EuiBasicTableColumn, + EuiIconTip, + EuiLink, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { FormattedMessage, injectI18n } from '@kbn/i18n/react'; +import { FormattedMessage } from '@kbn/i18n/react'; import { Component, default as React, Fragment } from 'react'; import { Subscription } from 'rxjs'; import { ILicense } from '../../../licensing/public'; -import { REPORT_TABLE_ID, REPORT_TABLE_ROW_ID } from '../../common/constants'; +import { REPORT_TABLE_ID, REPORT_TABLE_ROW_ID, JOB_STATUSES } from '../../common/constants'; +import { prettyPrintJobType } from '../../common/job_utils'; import { Poller } from '../../common/poller'; import { durationToNumber } from '../../common/schema_utils'; import { useIlmPolicyStatus } from '../lib/ilm_policy_status_context'; @@ -28,13 +30,20 @@ import { Job } from '../lib/job'; import { checkLicense } from '../lib/license_check'; import { useInternalApiClient } from '../lib/reporting_api_client'; import { useKibana } from '../shared_imports'; -import { IlmPolicyLink } from './ilm_policy_link'; -import { MigrateIlmPolicyCallOut } from './migrate_ilm_policy_callout'; -import { ReportDeleteButton } from './report_delete_button'; -import { ReportDiagnostic } from './report_diagnostic'; -import { ReportDownloadButton } from './report_download_button'; -import { ReportInfoButton } from './report_info_button'; import { ListingProps as Props } from './'; +import { PDF_JOB_TYPE_V2, PNG_JOB_TYPE_V2 } from '../../common/constants'; +import { + IlmPolicyLink, + MigrateIlmPolicyCallOut, + ReportDeleteButton, + ReportDiagnostic, + ReportStatusIndicator, + ReportInfoFlyout, +} from './components'; +import { guessAppIconTypeFromObjectType } from './utils'; +import './report_listing.scss'; + +type TableColumn = EuiBasicTableColumn; interface State { page: number; @@ -45,6 +54,7 @@ interface State { showLinks: boolean; enableLinks: boolean; badLicenseMessage: string; + selectedJob: undefined | Job; } class ReportListingUi extends Component { @@ -65,6 +75,7 @@ class ReportListingUi extends Component { showLinks: false, enableLinks: false, badLicenseMessage: '', + selectedJob: undefined, }; this.isInitialJobsFetch = true; @@ -177,23 +188,19 @@ class ReportListingUi extends Component { await this.props.apiClient.deleteReport(job.id); this.removeJob(job); this.props.toasts.addSuccess( - this.props.intl.formatMessage( - { - id: 'xpack.reporting.listing.table.deleteConfim', - defaultMessage: `The {reportTitle} report was deleted`, + i18n.translate('xpack.reporting.listing.table.deleteConfim', { + defaultMessage: `The {reportTitle} report was deleted`, + values: { + reportTitle: job.title, }, - { reportTitle: job.title } - ) + }) ); } catch (error) { this.props.toasts.addDanger( - this.props.intl.formatMessage( - { - id: 'xpack.reporting.listing.table.deleteFailedErrorMessage', - defaultMessage: `The report was not deleted: {error}`, - }, - { error } - ) + i18n.translate('xpack.reporting.listing.table.deleteFailedErrorMessage', { + defaultMessage: `The report was not deleted: {error}`, + values: { error }, + }) ); throw error; } @@ -240,8 +247,7 @@ class ReportListingUi extends Component { if (fetchError.message === 'Failed to fetch') { this.props.toasts.addDanger( fetchError.message || - this.props.intl.formatMessage({ - id: 'xpack.reporting.listing.table.requestFailedErrorMessage', + i18n.translate('xpack.reporting.listing.table.requestFailedErrorMessage', { defaultMessage: 'Request failed', }) ); @@ -265,61 +271,176 @@ class ReportListingUi extends Component { return this.state.showLinks && this.state.enableLinks; }; - private renderTable() { - const { intl } = this.props; + /** + * Widths like this are not the best, but the auto-layout does not play well with text in links. We can update + * this with something that works better on all screen sizes. This works for desktop, mobile fallback is provided on a + * per column basis. + */ + private readonly tableColumnWidths = { + type: '5%', + title: '30%', + status: '20%', + createdAt: '25%', + content: '10%', + actions: '10%', + }; - const tableColumns = [ + private renderTable() { + const { tableColumnWidths } = this; + const tableColumns: TableColumn[] = [ + { + field: 'type', + width: tableColumnWidths.type, + name: i18n.translate('xpack.reporting.listing.tableColumns.typeTitle', { + defaultMessage: 'Type', + }), + render: (_type: string, job) => { + return ( +
+ +
+ ); + }, + mobileOptions: { + show: true, + render: (job) => { + return
{job.objectType}
; + }, + }, + }, { field: 'title', - name: intl.formatMessage({ - id: 'xpack.reporting.listing.tableColumns.reportTitle', - defaultMessage: 'Report', + name: i18n.translate('xpack.reporting.listing.tableColumns.reportTitle', { + defaultMessage: 'Title', }), - render: (objectTitle: string, job: Job) => { + width: tableColumnWidths.title, + render: (objectTitle: string, job) => { return (
-
{objectTitle}
- - {job.objectType} - + this.setState({ selectedJob: job })}> + {objectTitle || + i18n.translate('xpack.reporting.listing.table.noTitleLabel', { + defaultMessage: 'Untitled', + })} +
); }, + mobileOptions: { + header: false, + width: '100%', // This is not recognized by EUI types but has an effect, leaving for now + } as unknown as { header: boolean }, + }, + { + field: 'status', + width: tableColumnWidths.status, + name: i18n.translate('xpack.reporting.listing.tableColumns.statusTitle', { + defaultMessage: 'Status', + }), + render: (_status: string, job) => { + return ( + + + + ); + }, + mobileOptions: { + show: false, + }, }, { field: 'created_at', - name: intl.formatMessage({ - id: 'xpack.reporting.listing.tableColumns.createdAtTitle', + width: tableColumnWidths.createdAt, + name: i18n.translate('xpack.reporting.listing.tableColumns.createdAtTitle', { defaultMessage: 'Created at', }), - render: (_createdAt: string, job: Job) => ( -
{job.getCreatedAtLabel()}
+ render: (_createdAt: string, job) => ( +
{job.getCreatedAtDate()}
), + mobileOptions: { + show: false, + }, }, { - field: 'status', - name: intl.formatMessage({ - id: 'xpack.reporting.listing.tableColumns.statusTitle', - defaultMessage: 'Status', + field: 'content', + width: tableColumnWidths.content, + name: i18n.translate('xpack.reporting.listing.tableColumns.content', { + defaultMessage: 'Content', }), - render: (_status: string, job: Job) => ( -
{job.getStatusLabel()}
- ), + render: (_status: string, job) => prettyPrintJobType(job.jobtype), + mobileOptions: { + show: false, + }, }, { - name: intl.formatMessage({ - id: 'xpack.reporting.listing.tableColumns.actionsTitle', + name: i18n.translate('xpack.reporting.listing.tableColumns.actionsTitle', { defaultMessage: 'Actions', }), + width: tableColumnWidths.actions, actions: [ { - render: (job: Job) => { - return ( -
- - -
- ); + isPrimary: true, + 'data-test-subj': 'reportDownloadLink', + type: 'icon', + icon: 'download', + name: i18n.translate('xpack.reporting.listing.table.downloadReportButtonLabel', { + defaultMessage: 'Download report', + }), + description: i18n.translate('xpack.reporting.listing.table.downloadReportDescription', { + defaultMessage: 'Download this report in a new tab.', + }), + onClick: (job) => this.props.apiClient.downloadReport(job.id), + enabled: (job) => + job.status === JOB_STATUSES.COMPLETED || job.status === JOB_STATUSES.WARNINGS, + }, + { + name: i18n.translate( + 'xpack.reporting.listing.table.viewReportingInfoActionButtonLabel', + { + defaultMessage: 'View report info', + } + ), + description: i18n.translate( + 'xpack.reporting.listing.table.viewReportingInfoActionButtonDescription', + { + defaultMessage: 'View additional information about this report.', + } + ), + type: 'icon', + icon: 'iInCircle', + onClick: (job) => this.setState({ selectedJob: job }), + }, + { + name: i18n.translate('xpack.reporting.listing.table.openInKibanaAppLabel', { + defaultMessage: 'Open in Kibana App', + }), + 'data-test-subj': 'reportOpenInKibanaApp', + description: i18n.translate( + 'xpack.reporting.listing.table.openInKibanaAppDescription', + { + defaultMessage: 'Open the Kibana App where this report was generated.', + } + ), + available: (job) => + [PDF_JOB_TYPE_V2, PNG_JOB_TYPE_V2].some( + (linkableJobType) => linkableJobType === job.jobtype + ), + type: 'icon', + icon: 'popout', + onClick: (job) => { + const href = this.props.apiClient.getKibanaAppHref(job); + window.open(href, '_blank'); + window.focus(); }, }, ], @@ -358,12 +479,10 @@ class ReportListingUi extends Component { columns={tableColumns} noItemsMessage={ this.state.isLoading - ? intl.formatMessage({ - id: 'xpack.reporting.listing.table.loadingReportsDescription', + ? i18n.translate('xpack.reporting.listing.table.loadingReportsDescription', { defaultMessage: 'Loading reports', }) - : intl.formatMessage({ - id: 'xpack.reporting.listing.table.noCreatedReportsDescription', + : i18n.translate('xpack.reporting.listing.table.noCreatedReportsDescription', { defaultMessage: 'No reports have been created', }) } @@ -374,13 +493,17 @@ class ReportListingUi extends Component { data-test-subj={REPORT_TABLE_ID} rowProps={() => ({ 'data-test-subj': REPORT_TABLE_ROW_ID })} /> + {!!this.state.selectedJob && ( + this.setState({ selectedJob: undefined })} + job={this.state.selectedJob} + /> + )} ); } } -const PrivateReportListing = injectI18n(ReportListingUi); - export const ReportListing = ( props: Omit ) => { @@ -392,7 +515,7 @@ export const ReportListing = ( }, } = useKibana(); return ( - { + switch (type) { + case 'search': + return 'discoverApp'; + case 'dashboard': + return 'dashboardApp'; + case 'visualization': + return 'visualizeApp'; + case 'canvas workpad': + return 'canvasApp'; + default: + return 'apps'; + } +}; + +export const jobHasIssues = (job: Job): boolean => { + return ( + Boolean(job.getWarnings()) || + [JOB_STATUSES.WARNINGS, JOB_STATUSES.FAILED].some((status) => job.status === status) + ); +}; diff --git a/x-pack/plugins/reporting/public/plugin.ts b/x-pack/plugins/reporting/public/plugin.ts index 7fd6047470a0..fe80ed679c8e 100644 --- a/x-pack/plugins/reporting/public/plugin.ts +++ b/x-pack/plugins/reporting/public/plugin.ts @@ -41,9 +41,9 @@ import type { UiActionsSetup, UiActionsStart, } from './shared_imports'; +import { AppNavLinkStatus } from './shared_imports'; import { ReportingCsvShareProvider } from './share_context_menu/register_csv_reporting'; import { reportingScreenshotShareProvider } from './share_context_menu/register_pdf_png_reporting'; -import { isRedirectAppPath } from './utils'; export interface ClientConfigType { poll: { jobsRefresh: { interval: number; intervalErrorMultiplier: number } }; @@ -173,15 +173,6 @@ export class ReportingPublicPlugin title: this.title, order: 1, mount: async (params) => { - // The redirect app will be mounted if reporting is opened on a specific path. The redirect app expects a - // specific environment to be present so that it can navigate to a specific application. This is used by - // report generation to navigate to the correct place with full app state. - if (isRedirectAppPath(params.history.location.pathname)) { - const { mountRedirectApp } = await import('./redirect'); - return mountRedirectApp({ ...params, share, apiClient }); - } - - // Otherwise load the reporting management UI. params.setBreadcrumbs([{ text: this.breadcrumbText }]); const [[start], { mountManagementSection }] = await Promise.all([ getStartServices(), @@ -208,6 +199,19 @@ export class ReportingPublicPlugin }, }); + core.application.register({ + id: 'reportingRedirect', + mount: async (params) => { + const { mountRedirectApp } = await import('./redirect'); + return mountRedirectApp({ ...params, share, apiClient }); + }, + title: 'Reporting redirect app', + searchable: false, + chromeless: true, + exactRoute: true, + navLinkStatus: AppNavLinkStatus.hidden, + }); + uiActions.addTriggerAction( CONTEXT_MENU_TRIGGER, new ReportingCsvPanelAction({ core, apiClient, startServices$, license$, usesUiCapabilities }) diff --git a/x-pack/plugins/reporting/public/redirect/mount_redirect_app.tsx b/x-pack/plugins/reporting/public/redirect/mount_redirect_app.tsx index 4bf6d40acb17..eb34fc71cbf4 100644 --- a/x-pack/plugins/reporting/public/redirect/mount_redirect_app.tsx +++ b/x-pack/plugins/reporting/public/redirect/mount_redirect_app.tsx @@ -9,12 +9,13 @@ import { render, unmountComponentAtNode } from 'react-dom'; import React from 'react'; import { EuiErrorBoundary } from '@elastic/eui'; -import type { ManagementAppMountParams, SharePluginSetup } from '../shared_imports'; +import type { AppMountParameters } from 'kibana/public'; +import type { SharePluginSetup } from '../shared_imports'; import type { ReportingAPIClient } from '../lib/reporting_api_client'; import { RedirectApp } from './redirect_app'; -interface MountParams extends ManagementAppMountParams { +interface MountParams extends AppMountParameters { apiClient: ReportingAPIClient; share: SharePluginSetup; } diff --git a/x-pack/plugins/reporting/public/redirect/redirect_app.scss b/x-pack/plugins/reporting/public/redirect/redirect_app.scss new file mode 100644 index 000000000000..7e6b40e8231e --- /dev/null +++ b/x-pack/plugins/reporting/public/redirect/redirect_app.scss @@ -0,0 +1,8 @@ +.reportingRedirectApp { + &__interstitialPage { + /* + Create some padding above and below the page so that the errors (if any) display nicely. + */ + margin: $euiSizeXXL auto; + } +} diff --git a/x-pack/plugins/reporting/public/redirect/redirect_app.tsx b/x-pack/plugins/reporting/public/redirect/redirect_app.tsx index cf027e2a4619..4b271b17c5e8 100644 --- a/x-pack/plugins/reporting/public/redirect/redirect_app.tsx +++ b/x-pack/plugins/reporting/public/redirect/redirect_app.tsx @@ -7,8 +7,9 @@ import React, { useEffect, useState } from 'react'; import type { FunctionComponent } from 'react'; +import { parse } from 'query-string'; import { i18n } from '@kbn/i18n'; -import { EuiTitle, EuiCallOut, EuiCodeBlock } from '@elastic/eui'; +import { EuiCallOut, EuiCodeBlock } from '@elastic/eui'; import type { ScopedHistory } from 'src/core/public'; @@ -18,6 +19,8 @@ import { LocatorParams } from '../../common/types'; import { ReportingAPIClient } from '../lib/reporting_api_client'; import type { SharePluginSetup } from '../shared_imports'; +import './redirect_app.scss'; + interface Props { apiClient: ReportingAPIClient; history: ScopedHistory; @@ -28,9 +31,6 @@ const i18nTexts = { errorTitle: i18n.translate('xpack.reporting.redirectApp.errorTitle', { defaultMessage: 'Redirect error', }), - redirectingTitle: i18n.translate('xpack.reporting.redirectApp.redirectingMessage', { - defaultMessage: 'Redirecting...', - }), consoleMessagePrefix: i18n.translate( 'xpack.reporting.redirectApp.redirectConsoleErrorPrefixLabel', { @@ -39,36 +39,51 @@ const i18nTexts = { ), }; -export const RedirectApp: FunctionComponent = ({ share }) => { +export const RedirectApp: FunctionComponent = ({ share, apiClient }) => { const [error, setError] = useState(); useEffect(() => { - try { - const locatorParams = (window as unknown as Record)[ - REPORTING_REDIRECT_LOCATOR_STORE_KEY - ]; + (async () => { + try { + let locatorParams: undefined | LocatorParams; - if (!locatorParams) { - throw new Error('Could not find locator params for report'); - } + const { jobId } = parse(window.location.search); - share.navigate(locatorParams); - } catch (e) { - setError(e); - // eslint-disable-next-line no-console - console.error(i18nTexts.consoleMessagePrefix, e.message); - throw e; - } - }, [share]); + if (jobId) { + const result = await apiClient.getInfo(jobId as string); + locatorParams = result?.locatorParams?.[0]; + } else { + locatorParams = (window as unknown as Record)[ + REPORTING_REDIRECT_LOCATOR_STORE_KEY + ]; + } + + if (!locatorParams) { + throw new Error('Could not find locator params for report'); + } + + share.navigate(locatorParams); + } catch (e) { + setError(e); + // eslint-disable-next-line no-console + console.error(i18nTexts.consoleMessagePrefix, e.message); + throw e; + } + })(); + }, [share, apiClient]); - return error ? ( - -

{error.message}

- {error.stack && {error.stack}} -
- ) : ( - -

{i18nTexts.redirectingTitle}

-
+ return ( +
+ {error ? ( + +

{error.message}

+ {error.stack && {error.stack}} +
+ ) : ( + // We don't show anything on this page, the share service will handle showing any issues with + // using the locator +
+ )} +
); }; diff --git a/x-pack/plugins/reporting/public/shared_imports.ts b/x-pack/plugins/reporting/public/shared_imports.ts index 30e6cd12e3ed..037dc5e374d2 100644 --- a/x-pack/plugins/reporting/public/shared_imports.ts +++ b/x-pack/plugins/reporting/public/shared_imports.ts @@ -7,6 +7,8 @@ export type { SharePluginSetup, SharePluginStart, LocatorPublic } from 'src/plugins/share/public'; +export { AppNavLinkStatus } from '../../../../src/core/public'; + export type { UseRequestResponse } from '../../../../src/plugins/es_ui_shared/public'; export { useRequest } from '../../../../src/plugins/es_ui_shared/public'; diff --git a/x-pack/plugins/reporting/server/export_types/common/pdf/index.test.ts b/x-pack/plugins/reporting/server/export_types/common/pdf/index.test.ts index e336e5f124a2..74a247d4568a 100644 --- a/x-pack/plugins/reporting/server/export_types/common/pdf/index.test.ts +++ b/x-pack/plugins/reporting/server/export_types/common/pdf/index.test.ts @@ -14,7 +14,8 @@ const imageBase64 = Buffer.from( 'base64' ); -describe('PdfMaker', () => { +// FLAKY: https://github.com/elastic/kibana/issues/118484 +describe.skip('PdfMaker', () => { it('makes PDF using PrintLayout mode', async () => { const config = createMockConfig(createMockConfigSchema()); const layout = new PrintLayout(config.get('capture')); diff --git a/x-pack/plugins/reporting/server/export_types/common/v2/get_full_redirect_app_url.test.ts b/x-pack/plugins/reporting/server/export_types/common/v2/get_full_redirect_app_url.test.ts index 7a2ec5b83e7f..69baf143156f 100644 --- a/x-pack/plugins/reporting/server/export_types/common/v2/get_full_redirect_app_url.test.ts +++ b/x-pack/plugins/reporting/server/export_types/common/v2/get_full_redirect_app_url.test.ts @@ -33,13 +33,13 @@ describe('getFullRedirectAppUrl', () => { test('smoke test', () => { expect(getFullRedirectAppUrl(config, 'test', undefined)).toBe( - 'http://localhost:1234/test/s/test/app/management/insightsAndAlerting/reporting/r' + 'http://localhost:1234/test/s/test/app/reportingRedirect' ); }); test('adding forceNow', () => { expect(getFullRedirectAppUrl(config, 'test', 'TEST with a space')).toBe( - 'http://localhost:1234/test/s/test/app/management/insightsAndAlerting/reporting/r?forceNow=TEST%20with%20a%20space' + 'http://localhost:1234/test/s/test/app/reportingRedirect?forceNow=TEST%20with%20a%20space' ); }); }); diff --git a/x-pack/plugins/reporting/server/export_types/png_v2/execute_job.test.ts b/x-pack/plugins/reporting/server/export_types/png_v2/execute_job.test.ts index 3cf3c057e7b9..ba076f98996b 100644 --- a/x-pack/plugins/reporting/server/export_types/png_v2/execute_job.test.ts +++ b/x-pack/plugins/reporting/server/export_types/png_v2/execute_job.test.ts @@ -102,7 +102,7 @@ test(`passes browserTimezone to generatePng`, async () => { "warning": [Function], }, Array [ - "localhost:80undefined/app/management/insightsAndAlerting/reporting/r?forceNow=test", + "localhost:80undefined/app/reportingRedirect?forceNow=test", Object { "id": "test", "params": Object {}, diff --git a/x-pack/plugins/reporting/server/routes/diagnostic/browser.test.ts b/x-pack/plugins/reporting/server/routes/diagnostic/browser.test.ts index 7b4cc2008a67..a27ce6a49b1a 100644 --- a/x-pack/plugins/reporting/server/routes/diagnostic/browser.test.ts +++ b/x-pack/plugins/reporting/server/routes/diagnostic/browser.test.ts @@ -10,6 +10,7 @@ import { spawn } from 'child_process'; import { createInterface } from 'readline'; import { setupServer } from 'src/core/server/test_utils'; import supertest from 'supertest'; +import * as Rx from 'rxjs'; import { ReportingCore } from '../..'; import { createMockConfigSchema, @@ -28,8 +29,10 @@ type SetupServerReturn = UnwrapPromise>; const devtoolMessage = 'DevTools listening on (ws://localhost:4000)'; const fontNotFoundMessage = 'Could not find the default font'; -// FLAKY: https://github.com/elastic/kibana/issues/89369 -describe.skip('POST /diagnose/browser', () => { +const wait = (ms: number): Rx.Observable<0> => + Rx.from(new Promise<0>((resolve) => setTimeout(() => resolve(0), ms))); + +describe('POST /diagnose/browser', () => { jest.setTimeout(6000); const reportingSymbol = Symbol('reporting'); const mockLogger = createMockLevelLogger(); @@ -53,6 +56,9 @@ describe.skip('POST /diagnose/browser', () => { () => ({ usesUiCapabilities: () => false }) ); + // Make all uses of 'Rx.timer' return an observable that completes in 50ms + jest.spyOn(Rx, 'timer').mockImplementation(() => wait(50)); + core = await createMockReportingCore( config, createMockPluginSetup({ @@ -79,6 +85,7 @@ describe.skip('POST /diagnose/browser', () => { }); afterEach(async () => { + jest.restoreAllMocks(); await server.stop(); }); diff --git a/x-pack/plugins/rule_registry/server/rule_data_plugin_service/resource_installer.ts b/x-pack/plugins/rule_registry/server/rule_data_plugin_service/resource_installer.ts index 3798506eeacd..bfdec28a5098 100644 --- a/x-pack/plugins/rule_registry/server/rule_data_plugin_service/resource_installer.ts +++ b/x-pack/plugins/rule_registry/server/rule_data_plugin_service/resource_installer.ts @@ -309,6 +309,7 @@ export class ResourceInstaller { template: { settings: { + hidden: true, 'index.lifecycle': { name: ilmPolicyName, // TODO: fix the types in the ES package, they don't include rollover_alias??? diff --git a/x-pack/plugins/security/public/components/breadcrumb.test.tsx b/x-pack/plugins/security/public/components/breadcrumb.test.tsx new file mode 100644 index 000000000000..00cd4be90a78 --- /dev/null +++ b/x-pack/plugins/security/public/components/breadcrumb.test.tsx @@ -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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { render } from '@testing-library/react'; +import React from 'react'; + +import { coreMock } from 'src/core/public/mocks'; + +import { Breadcrumb, BreadcrumbsProvider, createBreadcrumbsChangeHandler } from './breadcrumb'; + +describe('security breadcrumbs', () => { + const setBreadcrumbs = jest.fn(); + const { chrome } = coreMock.createStart(); + + beforeEach(() => { + setBreadcrumbs.mockReset(); + chrome.docTitle.reset.mockReset(); + chrome.docTitle.change.mockReset(); + }); + + it('rendering one breadcrumb and it should NOT have an href attributes', async () => { + render( + + +
{'Find'}
+
+
+ ); + + expect(setBreadcrumbs).toHaveBeenCalledTimes(1); + expect(setBreadcrumbs).toHaveBeenCalledWith([{ text: 'Find' }]); + }); + + it('rendering two breadcrumb and our last breadcrumb should NOT have an href attributes', async () => { + render( + + +
{'Find'}
+ +
{'Sandy is a sweet dog'}
+
+
+
+ ); + + expect(setBreadcrumbs).toHaveBeenCalledTimes(1); + expect(setBreadcrumbs).toHaveBeenCalledWith([{ href: '/', text: 'Find' }, { text: 'Sandy' }]); + }); + + it('rendering three breadcrumb and our last breadcrumb should NOT have an href attributes', async () => { + render( + + +
{'Find'}
+ +
{'Sandy is a sweet dog'}
+ +
{'Sandy is a mutts'}
+
+
+
+
+ ); + + expect(setBreadcrumbs).toHaveBeenCalledTimes(1); + expect(setBreadcrumbs).toHaveBeenCalledWith([ + { href: '/', text: 'Find' }, + { href: '/sandy', text: 'Sandy' }, + { text: 'Breed' }, + ]); + }); +}); diff --git a/x-pack/plugins/security/public/components/breadcrumb.tsx b/x-pack/plugins/security/public/components/breadcrumb.tsx index 353f738501cb..4706f60712ad 100644 --- a/x-pack/plugins/security/public/components/breadcrumb.tsx +++ b/x-pack/plugins/security/public/components/breadcrumb.tsx @@ -80,11 +80,17 @@ export const BreadcrumbsProvider: FunctionComponent = const breadcrumbsRef = useRef([]); const handleChange = (breadcrumbs: BreadcrumbProps[]) => { + const newBreadcrumbs = breadcrumbs.map((item, index) => { + if (index === breadcrumbs.length - 1) { + return { ...item, href: undefined }; + } + return item; + }); if (onChange) { - onChange(breadcrumbs); + onChange(newBreadcrumbs); } else if (services.chrome) { const setBreadcrumbs = createBreadcrumbsChangeHandler(services.chrome); - setBreadcrumbs(breadcrumbs); + setBreadcrumbs(newBreadcrumbs); } }; diff --git a/x-pack/plugins/security/public/management/api_keys/api_keys_management_app.test.tsx b/x-pack/plugins/security/public/management/api_keys/api_keys_management_app.test.tsx index d2611864e77a..922fd59c56d1 100644 --- a/x-pack/plugins/security/public/management/api_keys/api_keys_management_app.test.tsx +++ b/x-pack/plugins/security/public/management/api_keys/api_keys_management_app.test.tsx @@ -56,7 +56,7 @@ describe('apiKeysManagementApp', () => { }); expect(setBreadcrumbs).toHaveBeenCalledTimes(1); - expect(setBreadcrumbs).toHaveBeenCalledWith([{ href: '/', text: 'API keys' }]); + expect(setBreadcrumbs).toHaveBeenCalledWith([{ text: 'API keys' }]); expect(docTitle.change).toHaveBeenCalledWith(['API keys']); expect(docTitle.reset).not.toHaveBeenCalled(); expect(container).toMatchInlineSnapshot(` diff --git a/x-pack/plugins/security/public/management/role_mappings/role_mappings_management_app.test.tsx b/x-pack/plugins/security/public/management/role_mappings/role_mappings_management_app.test.tsx index e73abc3b1eea..f6d17327b711 100644 --- a/x-pack/plugins/security/public/management/role_mappings/role_mappings_management_app.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/role_mappings_management_app.test.tsx @@ -5,6 +5,14 @@ * 2.0. */ +import { act } from '@testing-library/react'; +import { noop } from 'lodash'; + +import { coreMock, scopedHistoryMock } from 'src/core/public/mocks'; +import type { Unmount } from 'src/plugins/management/public/types'; + +import { roleMappingsManagementApp } from './role_mappings_management_app'; + jest.mock('./role_mappings_grid', () => ({ RoleMappingsGridPage: (props: any) => // `docLinks` object is too big to include into test snapshot, so we just check its existence. @@ -23,24 +31,23 @@ jest.mock('./edit_role_mapping', () => ({ })}`, })); -import { coreMock, scopedHistoryMock } from 'src/core/public/mocks'; - -import { roleMappingsManagementApp } from './role_mappings_management_app'; - async function mountApp(basePath: string, pathname: string) { const container = document.createElement('div'); const setBreadcrumbs = jest.fn(); const startServices = await coreMock.createSetup().getStartServices(); - const unmount = await roleMappingsManagementApp - .create({ getStartServices: () => Promise.resolve(startServices) as any }) - .mount({ - basePath, - element: container, - setBreadcrumbs, - history: scopedHistoryMock.create({ pathname }), - }); + let unmount: Unmount = noop; + await act(async () => { + unmount = await roleMappingsManagementApp + .create({ getStartServices: () => Promise.resolve(startServices) as any }) + .mount({ + basePath, + element: container, + setBreadcrumbs, + history: scopedHistoryMock.create({ pathname }), + }); + }); return { unmount, container, setBreadcrumbs, docTitle: startServices[0].chrome.docTitle }; } @@ -65,7 +72,7 @@ describe('roleMappingsManagementApp', () => { const { setBreadcrumbs, container, unmount, docTitle } = await mountApp('/', '/'); expect(setBreadcrumbs).toHaveBeenCalledTimes(1); - expect(setBreadcrumbs).toHaveBeenCalledWith([{ href: `/`, text: 'Role Mappings' }]); + expect(setBreadcrumbs).toHaveBeenCalledWith([{ text: 'Role Mappings' }]); expect(docTitle.change).toHaveBeenCalledWith('Role Mappings'); expect(docTitle.reset).not.toHaveBeenCalled(); expect(container).toMatchInlineSnapshot(` @@ -114,8 +121,8 @@ describe('roleMappingsManagementApp', () => { expect(setBreadcrumbs).toHaveBeenCalledTimes(1); expect(setBreadcrumbs).toHaveBeenCalledWith([ - { href: `/`, text: 'Role Mappings' }, - { href: `/edit/${encodeURIComponent(roleMappingName)}`, text: roleMappingName }, + { href: '/', text: 'Role Mappings' }, + { text: roleMappingName }, ]); expect(docTitle.change).toHaveBeenCalledWith('Role Mappings'); expect(docTitle.reset).not.toHaveBeenCalled(); @@ -139,9 +146,8 @@ describe('roleMappingsManagementApp', () => { expect(setBreadcrumbs).toHaveBeenCalledTimes(1); expect(setBreadcrumbs).toHaveBeenCalledWith([ - { href: `/`, text: 'Role Mappings' }, + { href: '/', text: 'Role Mappings' }, { - href: '/edit/some%20%E5%AE%89%E5%85%A8%E6%80%A7%20role%20mapping', text: roleMappingName, }, ]); diff --git a/x-pack/plugins/security/public/management/role_mappings/role_mappings_management_app.tsx b/x-pack/plugins/security/public/management/role_mappings/role_mappings_management_app.tsx index 4dfc9b43642b..22d09e9e2a67 100644 --- a/x-pack/plugins/security/public/management/role_mappings/role_mappings_management_app.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/role_mappings_management_app.tsx @@ -7,13 +7,18 @@ import React from 'react'; import { render, unmountComponentAtNode } from 'react-dom'; -import { Route, Router, Switch, useParams } from 'react-router-dom'; +import { Route, Router, useParams } from 'react-router-dom'; import { i18n } from '@kbn/i18n'; import type { StartServicesAccessor } from 'src/core/public'; import type { RegisterManagementAppArgs } from 'src/plugins/management/public'; import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public'; +import { + Breadcrumb, + BreadcrumbsProvider, + createBreadcrumbsChangeHandler, +} from '../../components/breadcrumb'; import type { PluginStartDependencies } from '../../plugin'; import { tryDecodeURIComponent } from '../url_utils'; @@ -27,21 +32,12 @@ export const roleMappingsManagementApp = Object.freeze({ const title = i18n.translate('xpack.security.management.roleMappingsTitle', { defaultMessage: 'Role Mappings', }); + return { id: this.id, order: 40, title, async mount({ element, setBreadcrumbs, history }) { - const [coreStart] = await getStartServices(); - const roleMappingsBreadcrumbs = [ - { - text: title, - href: `/`, - }, - ]; - - coreStart.chrome.docTitle.change(title); - const [ [core], { RoleMappingsGridPage }, @@ -56,20 +52,9 @@ export const roleMappingsManagementApp = Object.freeze({ import('../roles'), ]); + core.chrome.docTitle.change(title); + const roleMappingsAPIClient = new RoleMappingsAPIClient(core.http); - const RoleMappingsGridPageWithBreadcrumbs = () => { - setBreadcrumbs(roleMappingsBreadcrumbs); - return ( - - ); - }; const EditRoleMappingsPageWithBreadcrumbs = () => { const { name } = useParams<{ name?: string }>(); @@ -78,26 +63,26 @@ export const roleMappingsManagementApp = Object.freeze({ // See https://github.com/elastic/kibana/issues/82440 const decodedName = name ? tryDecodeURIComponent(name) : undefined; - setBreadcrumbs([ - ...roleMappingsBreadcrumbs, - name + const breadcrumbObj = + name && decodedName ? { text: decodedName, href: `/edit/${encodeURIComponent(name)}` } : { text: i18n.translate('xpack.security.roleMappings.createBreadcrumb', { defaultMessage: 'Create', }), - }, - ]); + }; return ( - + + + ); }; @@ -105,14 +90,25 @@ export const roleMappingsManagementApp = Object.freeze({ - - - - - - - - + + + + + + + + + + , @@ -120,7 +116,6 @@ export const roleMappingsManagementApp = Object.freeze({ ); return () => { - coreStart.chrome.docTitle.reset(); unmountComponentAtNode(element); }; }, diff --git a/x-pack/plugins/security/public/management/roles/roles_management_app.test.tsx b/x-pack/plugins/security/public/management/roles/roles_management_app.test.tsx index 4b10c2d5cf13..faab47a858d6 100644 --- a/x-pack/plugins/security/public/management/roles/roles_management_app.test.tsx +++ b/x-pack/plugins/security/public/management/roles/roles_management_app.test.tsx @@ -5,7 +5,11 @@ * 2.0. */ +import { act } from '@testing-library/react'; +import { noop } from 'lodash'; + import { coreMock, scopedHistoryMock } from 'src/core/public/mocks'; +import type { Unmount } from 'src/plugins/management/public/types'; import { featuresPluginMock } from '../../../../features/public/mocks'; import { licenseMock } from '../../../common/licensing/index.mock'; @@ -29,20 +33,23 @@ async function mountApp(basePath: string, pathname: string) { const featuresStart = featuresPluginMock.createStart(); const coreStart = coreMock.createStart(); - const unmount = await rolesManagementApp - .create({ - license: licenseMock.create(), - fatalErrors, - getStartServices: jest - .fn() - .mockResolvedValue([coreStart, { data: {}, features: featuresStart }]), - }) - .mount({ - basePath, - element: container, - setBreadcrumbs, - history: scopedHistoryMock.create({ pathname }), - }); + let unmount: Unmount = noop; + await act(async () => { + unmount = await rolesManagementApp + .create({ + license: licenseMock.create(), + fatalErrors, + getStartServices: jest + .fn() + .mockResolvedValue([coreStart, { data: {}, features: featuresStart }]), + }) + .mount({ + basePath, + element: container, + setBreadcrumbs, + history: scopedHistoryMock.create({ pathname }), + }); + }); return { unmount, container, setBreadcrumbs, docTitle: coreStart.chrome.docTitle }; } @@ -71,7 +78,7 @@ describe('rolesManagementApp', () => { const { setBreadcrumbs, container, unmount, docTitle } = await mountApp('/', '/'); expect(setBreadcrumbs).toHaveBeenCalledTimes(1); - expect(setBreadcrumbs).toHaveBeenCalledWith([{ href: `/`, text: 'Roles' }]); + expect(setBreadcrumbs).toHaveBeenCalledWith([{ text: 'Roles' }]); expect(docTitle.change).toHaveBeenCalledWith('Roles'); expect(docTitle.reset).not.toHaveBeenCalled(); expect(container).toMatchInlineSnapshot(` @@ -116,10 +123,7 @@ describe('rolesManagementApp', () => { ); expect(setBreadcrumbs).toHaveBeenCalledTimes(1); - expect(setBreadcrumbs).toHaveBeenCalledWith([ - { href: `/`, text: 'Roles' }, - { href: `/edit/${encodeURIComponent(roleName)}`, text: roleName }, - ]); + expect(setBreadcrumbs).toHaveBeenCalledWith([{ href: `/`, text: 'Roles' }, { text: roleName }]); expect(docTitle.change).toHaveBeenCalledWith('Roles'); expect(docTitle.reset).not.toHaveBeenCalled(); expect(container).toMatchInlineSnapshot(` @@ -169,7 +173,6 @@ describe('rolesManagementApp', () => { expect(setBreadcrumbs).toHaveBeenCalledWith([ { href: `/`, text: 'Roles' }, { - href: '/edit/some%20%E5%AE%89%E5%85%A8%E6%80%A7%20role', text: roleName, }, ]); diff --git a/x-pack/plugins/security/public/management/roles/roles_management_app.tsx b/x-pack/plugins/security/public/management/roles/roles_management_app.tsx index 8936f506066e..fcd037a861ed 100644 --- a/x-pack/plugins/security/public/management/roles/roles_management_app.tsx +++ b/x-pack/plugins/security/public/management/roles/roles_management_app.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { render, unmountComponentAtNode } from 'react-dom'; -import { Route, Router, Switch, useParams } from 'react-router-dom'; +import { Route, Router, useParams } from 'react-router-dom'; import { i18n } from '@kbn/i18n'; import type { FatalErrorsSetup, StartServicesAccessor } from 'src/core/public'; @@ -15,6 +15,11 @@ import type { RegisterManagementAppArgs } from 'src/plugins/management/public'; import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public'; import type { SecurityLicense } from '../../../common/licensing'; +import { + Breadcrumb, + BreadcrumbsProvider, + createBreadcrumbsChangeHandler, +} from '../../components/breadcrumb'; import type { PluginStartDependencies } from '../../plugin'; import { tryDecodeURIComponent } from '../url_utils'; @@ -35,13 +40,6 @@ export const rolesManagementApp = Object.freeze({ order: 20, title, async mount({ element, setBreadcrumbs, history }) { - const rolesBreadcrumbs = [ - { - text: title, - href: `/`, - }, - ]; - const [ [startServices, { data, features, spaces }], { RolesGridPage }, @@ -72,16 +70,6 @@ export const rolesManagementApp = Object.freeze({ chrome.docTitle.change(title); const rolesAPIClient = new RolesAPIClient(http); - const RolesGridPageWithBreadcrumbs = () => { - setBreadcrumbs(rolesBreadcrumbs); - return ( - - ); - }; const EditRolePageWithBreadcrumbs = ({ action }: { action: 'edit' | 'clone' }) => { const { roleName } = useParams<{ roleName?: string }>(); @@ -90,38 +78,38 @@ export const rolesManagementApp = Object.freeze({ // See https://github.com/elastic/kibana/issues/82440 const decodedRoleName = roleName ? tryDecodeURIComponent(roleName) : undefined; - setBreadcrumbs([ - ...rolesBreadcrumbs, - action === 'edit' && roleName + const breadcrumbObj = + action === 'edit' && roleName && decodedRoleName ? { text: decodedRoleName, href: `/edit/${encodeURIComponent(roleName)}` } : { text: i18n.translate('xpack.security.roles.createBreadcrumb', { defaultMessage: 'Create', }), - }, - ]); + }; const spacesApiUi = spaces?.ui; return ( - + + + ); }; @@ -129,26 +117,32 @@ export const rolesManagementApp = Object.freeze({ - - - - - - - - - - - + + + + + + + + + + + + + , - element ); return () => { - chrome.docTitle.reset(); unmountComponentAtNode(element); }; }, diff --git a/x-pack/plugins/security/public/management/users/users_management_app.test.tsx b/x-pack/plugins/security/public/management/users/users_management_app.test.tsx index f4fed153d997..f25fb211cb9d 100644 --- a/x-pack/plugins/security/public/management/users/users_management_app.test.tsx +++ b/x-pack/plugins/security/public/management/users/users_management_app.test.tsx @@ -5,7 +5,11 @@ * 2.0. */ +import { act } from '@testing-library/react'; +import { noop } from 'lodash'; + import { coreMock, scopedHistoryMock } from 'src/core/public/mocks'; +import type { Unmount } from 'src/plugins/management/public/types'; import { securityMock } from '../../mocks'; import { usersManagementApp } from './users_management_app'; @@ -22,16 +26,19 @@ describe('usersManagementApp', () => { const setBreadcrumbs = jest.fn(); const history = scopedHistoryMock.create({ pathname: '/create' }); - const unmount = await usersManagementApp.create({ authc, getStartServices }).mount({ - basePath: '/', - element, - setBreadcrumbs, - history, + let unmount: Unmount = noop; + await act(async () => { + unmount = await usersManagementApp.create({ authc, getStartServices }).mount({ + basePath: '/', + element, + setBreadcrumbs, + history, + }); }); expect(setBreadcrumbs).toHaveBeenLastCalledWith([ { href: '/', text: 'Users' }, - { href: '/create', text: 'Create' }, + { text: 'Create' }, ]); unmount(); diff --git a/x-pack/plugins/security/public/management/users/users_management_app.tsx b/x-pack/plugins/security/public/management/users/users_management_app.tsx index f6a2956c7ad4..7957599da7f5 100644 --- a/x-pack/plugins/security/public/management/users/users_management_app.tsx +++ b/x-pack/plugins/security/public/management/users/users_management_app.tsx @@ -119,7 +119,6 @@ export const usersManagementApp = Object.freeze({ ); return () => { - coreStart.chrome.docTitle.reset(); unmountComponentAtNode(element); }; }, diff --git a/x-pack/plugins/security_solution/common/endpoint/constants.ts b/x-pack/plugins/security_solution/common/endpoint/constants.ts index 178a2b68a4aa..fc418df95602 100644 --- a/x-pack/plugins/security_solution/common/endpoint/constants.ts +++ b/x-pack/plugins/security_solution/common/endpoint/constants.ts @@ -15,6 +15,9 @@ export const ENDPOINT_ACTION_RESPONSES_INDEX = `${ENDPOINT_ACTION_RESPONSES_DS}- export const eventsIndexPattern = 'logs-endpoint.events.*'; export const alertsIndexPattern = 'logs-endpoint.alerts-*'; +// metadata datastream +export const METADATA_DATASTREAM = 'metrics-endpoint.metadata-default'; + /** index pattern for the data source index (data stream) that the Endpoint streams documents to */ export const metadataIndexPattern = 'metrics-endpoint.metadata-*'; diff --git a/x-pack/plugins/security_solution/common/endpoint/data_loaders/index_endpoint_hosts.ts b/x-pack/plugins/security_solution/common/endpoint/data_loaders/index_endpoint_hosts.ts index de564019db6d..ed75823cd30d 100644 --- a/x-pack/plugins/security_solution/common/endpoint/data_loaders/index_endpoint_hosts.ts +++ b/x-pack/plugins/security_solution/common/endpoint/data_loaders/index_endpoint_hosts.ts @@ -8,6 +8,7 @@ import { Client } from '@elastic/elasticsearch'; import { cloneDeep, merge } from 'lodash'; import { AxiosResponse } from 'axios'; +import uuid from 'uuid'; // eslint-disable-next-line import/no-extraneous-dependencies import { KbnClient } from '@kbn/test'; import { DeleteByQueryResponse } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; @@ -139,12 +140,13 @@ export async function indexEndpointHostDocs({ if (enrollFleet) { const { id: appliedPolicyId, name: appliedPolicyName } = hostMetadata.Endpoint.policy.applied; + const uniqueAppliedPolicyName = `${appliedPolicyName}-${uuid.v4()}`; // If we don't yet have a "real" policy record, then create it now in ingest (package config) if (!realPolicies[appliedPolicyId]) { const createdPolicies = await indexFleetEndpointPolicy( kbnClient, - appliedPolicyName, + uniqueAppliedPolicyName, epmEndpointPackage.version ); diff --git a/x-pack/plugins/security_solution/cypress/integration/detection_alerts/alerts_details.spec.ts b/x-pack/plugins/security_solution/cypress/integration/detection_alerts/alerts_details.spec.ts index 033a12dd9de3..116ee4d3820f 100644 --- a/x-pack/plugins/security_solution/cypress/integration/detection_alerts/alerts_details.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/detection_alerts/alerts_details.spec.ts @@ -5,7 +5,13 @@ * 2.0. */ -import { ALERT_FLYOUT, CELL_TEXT, JSON_TEXT, TABLE_ROWS } from '../../screens/alerts_details'; +import { + ALERT_FLYOUT, + CELL_TEXT, + JSON_TEXT, + TABLE_CONTAINER, + TABLE_ROWS, +} from '../../screens/alerts_details'; import { expandFirstAlert, @@ -65,4 +71,20 @@ describe('Alert details with unmapped fields', () => { cy.get(CELL_TEXT).eq(4).should('have.text', expectedUnmmappedField.text); }); }); + + // This test makes sure that the table does not overflow horizontally + it('Table does not scroll horizontally', () => { + openTable(); + + cy.get(ALERT_FLYOUT) + .find(TABLE_CONTAINER) + .within(($tableContainer) => { + expect($tableContainer[0].scrollLeft).to.equal(0); + + // Try to scroll left and make sure that the table hasn't actually scrolled + $tableContainer[0].scroll({ left: 1000 }); + + expect($tableContainer[0].scrollLeft).to.equal(0); + }); + }); }); diff --git a/x-pack/plugins/security_solution/cypress/screens/alerts.ts b/x-pack/plugins/security_solution/cypress/screens/alerts.ts index a46f65acaf97..0d2eab221b49 100644 --- a/x-pack/plugins/security_solution/cypress/screens/alerts.ts +++ b/x-pack/plugins/security_solution/cypress/screens/alerts.ts @@ -12,7 +12,7 @@ export const ALERTS = '[data-test-subj="events-viewer-panel"] [data-test-subj="e export const ALERTS_COUNT = '[data-test-subj="events-viewer-panel"] [data-test-subj="server-side-event-count"]'; -export const ALERT_CHECKBOX = '[data-test-subj="select-event"].euiCheckbox__input'; +export const ALERT_CHECKBOX = '[data-test-subj~="select-event"].euiCheckbox__input'; export const ALERT_GRID_CELL = '[data-test-subj="dataGridRowCell"]'; diff --git a/x-pack/plugins/security_solution/cypress/screens/alerts_details.ts b/x-pack/plugins/security_solution/cypress/screens/alerts_details.ts index 584fba05452f..85a4fa257a95 100644 --- a/x-pack/plugins/security_solution/cypress/screens/alerts_details.ts +++ b/x-pack/plugins/security_solution/cypress/screens/alerts_details.ts @@ -34,6 +34,8 @@ export const TABLE_CELL = '.euiTableRowCell'; export const TABLE_TAB = '[data-test-subj="tableTab"]'; +export const TABLE_CONTAINER = '[data-test-subj="event-fields-browser"]'; + export const TABLE_ROWS = '.euiTableRow'; export const THREAT_DETAILS_ACCORDION = '.euiAccordion__triggerWrapper'; diff --git a/x-pack/plugins/security_solution/cypress/screens/timeline.ts b/x-pack/plugins/security_solution/cypress/screens/timeline.ts index 619e7d01f10e..a37cd5e22ca0 100644 --- a/x-pack/plugins/security_solution/cypress/screens/timeline.ts +++ b/x-pack/plugins/security_solution/cypress/screens/timeline.ts @@ -20,8 +20,8 @@ export const ATTACH_TIMELINE_TO_EXISTING_CASE_ICON = export const BULK_ACTIONS = '[data-test-subj="utility-bar-action-button"]'; -export const CASE = (id: string) => { - return `[data-test-subj="cases-table-row-${id}"]`; +export const SELECT_CASE = (id: string) => { + return `[data-test-subj="cases-table-row-select-${id}"]`; }; export const CELL = '[data-test-subj="statefulCell"]'; @@ -149,6 +149,8 @@ export const TIMELINE_ADD_FIELD_BUTTON = '[data-test-subj="addField"]'; export const TIMELINE_DATA_PROVIDER_FIELD = '[data-test-subj="field"]'; +export const TIMELINE_DATA_PROVIDER_FIELD_INPUT = '[data-test-subj="comboBoxSearchInput"]'; + export const TIMELINE_DATA_PROVIDER_OPERATOR = `[data-test-subj="operator"]`; export const TIMELINE_DATA_PROVIDER_VALUE = `[data-test-subj="value"]`; diff --git a/x-pack/plugins/security_solution/cypress/tasks/timeline.ts b/x-pack/plugins/security_solution/cypress/tasks/timeline.ts index 01a3b6f18be8..24eb2e325d32 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/timeline.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/timeline.ts @@ -17,7 +17,6 @@ import { ATTACH_TIMELINE_TO_CASE_BUTTON, ATTACH_TIMELINE_TO_EXISTING_CASE_ICON, ATTACH_TIMELINE_TO_NEW_CASE_ICON, - CASE, CLOSE_TIMELINE_BTN, COMBO_BOX, COMBO_BOX_INPUT, @@ -35,6 +34,7 @@ import { RESET_FIELDS, SAVE_FILTER_BTN, SEARCH_OR_FILTER_CONTAINER, + SELECT_CASE, SERVER_SIDE_EVENT_COUNT, STAR_ICON, TIMELINE_CHANGES_IN_PROGRESS, @@ -69,6 +69,7 @@ import { TIMELINE_TAB_CONTENT_EQL, TIMESTAMP_HOVER_ACTION_OVERFLOW_BTN, PINNED_TAB_BUTTON, + TIMELINE_DATA_PROVIDER_FIELD_INPUT, } from '../screens/timeline'; import { REFRESH_BUTTON, TIMELINE } from '../screens/timelines'; @@ -176,8 +177,9 @@ export const addFilter = (filter: TimelineFilter): Cypress.Chainable> => { cy.get(TIMELINE_ADD_FIELD_BUTTON).click(); cy.get(LOADING_INDICATOR).should('not.exist'); - cy.get(TIMELINE_DATA_PROVIDER_VALUE).should('have.focus'); // make sure the focus is ready before start typing - + cy.get(TIMELINE_DATA_PROVIDER_FIELD) + .find(TIMELINE_DATA_PROVIDER_FIELD_INPUT) + .should('have.focus'); // make sure the focus is ready before start typing cy.get(TIMELINE_DATA_PROVIDER_FIELD) .find(COMBO_BOX_INPUT) .type(`${filter.field}{downarrow}{enter}`); @@ -344,7 +346,7 @@ export const resetFields = () => { }; export const selectCase = (caseId: string) => { - cy.get(CASE(caseId)).click(); + cy.get(SELECT_CASE(caseId)).click(); }; export const waitForTimelineChanges = () => { diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/event_fields_browser.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/event_fields_browser.tsx index b0e818d08678..384e9d72b078 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/event_fields_browser.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/event_fields_browser.tsx @@ -281,6 +281,7 @@ export const EventFieldsBrowser = React.memo( rowProps={onSetRowProps} search={search} sorting={false} + data-test-subj="event-fields-browser" /> ); diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/table/field_value_cell.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/table/field_value_cell.tsx index 0685582b3388..62aad5178520 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/table/field_value_cell.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/table/field_value_cell.tsx @@ -72,6 +72,7 @@ export const FieldValueCell = React.memo( isObjectArray={data.isObjectArray} value={value} linkValue={(getLinkValue && getLinkValue(data.field)) ?? linkValue} + truncate={false} /> )} diff --git a/x-pack/plugins/security_solution/public/common/mock/endpoint/app_context_render.tsx b/x-pack/plugins/security_solution/public/common/mock/endpoint/app_context_render.tsx index ed207c9d7618..6d5d2dcbc7b4 100644 --- a/x-pack/plugins/security_solution/public/common/mock/endpoint/app_context_render.tsx +++ b/x-pack/plugins/security_solution/public/common/mock/endpoint/app_context_render.tsx @@ -10,7 +10,7 @@ import { createMemoryHistory, MemoryHistory } from 'history'; import { render as reactRender, RenderOptions, RenderResult } from '@testing-library/react'; import { Action, Reducer, Store } from 'redux'; import { AppDeepLink } from 'kibana/public'; -import { QueryClient, QueryClientProvider } from 'react-query'; +import { QueryClient, QueryClientProvider, setLogger } from 'react-query'; import { coreMock } from '../../../../../../../src/core/public/mocks'; import { StartPlugins, StartServices } from '../../../types'; import { depsStartMock } from './dependencies_start_mock'; @@ -30,6 +30,15 @@ import { fleetGetPackageListHttpMock } from '../../../management/pages/mocks'; type UiRender = (ui: React.ReactElement, options?: RenderOptions) => RenderResult; +// hide react-query output in console +setLogger({ + error: () => {}, + // eslint-disable-next-line no-console + log: console.log, + // eslint-disable-next-line no-console + warn: console.warn, +}); + /** * Mocked app root context renderer */ @@ -86,14 +95,6 @@ const experimentalFeaturesReducer: Reducer { middlewareSpy.actionSpyMiddleware, ]); + const queryClient = new QueryClient({ + defaultOptions: { + queries: { + // turns retries off + retry: false, + // prevent jest did not exit errors + cacheTime: Infinity, + }, + }, + }); + const AppWrapper: React.FC<{ children: React.ReactElement }> = ({ children }) => ( diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/translations.ts b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/translations.ts index 15ff91cac509..ca1b1f57b839 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/translations.ts +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/translations.ts @@ -551,7 +551,8 @@ export const IMPORT_RULE_BTN_TITLE = i18n.translate( export const SELECT_RULE = i18n.translate( 'xpack.securitySolution.detectionEngine.components.importRuleModal.selectRuleDescription', { - defaultMessage: 'Select Security rules (as exported from the Detection Rules page) to import', + defaultMessage: + 'Select rules and actions (as exported from the Security > Rules page) to import', } ); diff --git a/x-pack/plugins/security_solution/public/management/components/artifact_entry_card/artifact_entry_card.tsx b/x-pack/plugins/security_solution/public/management/components/artifact_entry_card/artifact_entry_card.tsx index 89d2f029e953..87d40cba26a2 100644 --- a/x-pack/plugins/security_solution/public/management/components/artifact_entry_card/artifact_entry_card.tsx +++ b/x-pack/plugins/security_solution/public/management/components/artifact_entry_card/artifact_entry_card.tsx @@ -64,7 +64,7 @@ export const ArtifactEntryCard = memo( return ( - + ( {!hideDescription && ( <> - + {artifact.description} @@ -91,7 +91,7 @@ export const ArtifactEntryCard = memo( {!hideComments ? ( <> - + ) : null} @@ -99,7 +99,7 @@ export const ArtifactEntryCard = memo( - + - + ( ({ name, createdDate, updatedDate, actions, 'data-test-subj': dataTestSubj }) => { const getTestId = useTestIdGenerator(dataTestSubj); return ( - + @@ -51,7 +56,7 @@ export const CardHeader = memo( - + ); diff --git a/x-pack/plugins/security_solution/public/management/components/artifact_entry_card/components/card_section_panel.tsx b/x-pack/plugins/security_solution/public/management/components/artifact_entry_card/components/card_section_panel.tsx index 75e55a72f7f0..8838d5a799d3 100644 --- a/x-pack/plugins/security_solution/public/management/components/artifact_entry_card/components/card_section_panel.tsx +++ b/x-pack/plugins/security_solution/public/management/components/artifact_entry_card/components/card_section_panel.tsx @@ -16,6 +16,15 @@ export type CardSectionPanelProps = Exclude< const StyledEuiPanel = styled(EuiPanel)` padding: 32px; + &.top-section { + padding-bottom: 24px; + } + &.bottom-section { + padding-top: 24px; + } + &.artifact-entry-collapsible-card { + padding: 24px !important; + } `; export const CardSectionPanel = memo((props) => { diff --git a/x-pack/plugins/security_solution/public/management/components/artifact_entry_card/components/effect_scope.tsx b/x-pack/plugins/security_solution/public/management/components/artifact_entry_card/components/effect_scope.tsx index 83d9ee001f02..802548f20507 100644 --- a/x-pack/plugins/security_solution/public/management/components/artifact_entry_card/components/effect_scope.tsx +++ b/x-pack/plugins/security_solution/public/management/components/artifact_entry_card/components/effect_scope.tsx @@ -107,6 +107,7 @@ export const WithContextMenu = memo( return ( 1 ? 'rightCenter' : 'rightUp'} diff --git a/x-pack/plugins/security_solution/public/management/components/context_menu_with_router_support/context_menu_item_nav_by_router.tsx b/x-pack/plugins/security_solution/public/management/components/context_menu_with_router_support/context_menu_item_nav_by_router.tsx index 1a410c977b0d..81f3cc5fa373 100644 --- a/x-pack/plugins/security_solution/public/management/components/context_menu_with_router_support/context_menu_item_nav_by_router.tsx +++ b/x-pack/plugins/security_solution/public/management/components/context_menu_with_router_support/context_menu_item_nav_by_router.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import React, { memo } from 'react'; +import React, { memo, useMemo } from 'react'; import { EuiContextMenuItem, EuiContextMenuItemProps, @@ -36,6 +36,7 @@ export interface ContextMenuItemNavByRouterProps extends EuiContextMenuItemProps const StyledEuiContextMenuItem = styled(EuiContextMenuItem)` .additional-info { display: none; + max-width: 50%; } &:hover { .additional-info { @@ -69,6 +70,18 @@ export const ContextMenuItemNavByRouter = memo( onClick, }); const getTestId = useTestIdGenerator(otherMenuItemProps['data-test-subj']); + const hoverComponentInstance = useMemo(() => { + // If the `hoverInfo` is not an object (ex. text, number), then auto-add the text truncation className. + // Adding this when the `hoverInfo` is a react component could cause issue, thus in htose cases, we + // assume the componet will handle how the data is truncated (if applicable) + const cssClassNames = `additional-info ${ + 'object' !== typeof hoverInfo ? 'eui-textTruncate' : '' + }`; + + return hoverInfo ? ( + {hoverInfo} + ) : null; + }, [hoverInfo]); return ( ( > {children}
- {hoverInfo && ( - {hoverInfo} - )} + {hoverComponentInstance} ) : ( <> {children} - {hoverInfo && ( - {hoverInfo} - )} + {hoverComponentInstance} )} diff --git a/x-pack/plugins/security_solution/public/management/components/context_menu_with_router_support/context_menu_with_router_support.test.tsx b/x-pack/plugins/security_solution/public/management/components/context_menu_with_router_support/context_menu_with_router_support.test.tsx index 288c0c074e93..40ced60ea1e0 100644 --- a/x-pack/plugins/security_solution/public/management/components/context_menu_with_router_support/context_menu_with_router_support.test.tsx +++ b/x-pack/plugins/security_solution/public/management/components/context_menu_with_router_support/context_menu_with_router_support.test.tsx @@ -118,6 +118,17 @@ describe('When using the ContextMenuWithRouterSupport component', () => { expect(renderResult.getByTestId('testMenu-item-2-truncateWrapper')).not.toBeNull(); }); + it('should render popup menu with a fixed width that matches the `maxWidth` value', () => { + render({ maxWidth: '300px', fixedWidth: true }); + clickMenuTriggerButton(); + const contextMenuPanelStyles = getContextMenuPanel()! + .querySelector('.euiContextMenuPanel')! + .getAttribute('style'); + + expect(contextMenuPanelStyles).toMatch(/width:\W*300px/); + expect(contextMenuPanelStyles).not.toMatch(/max-width:\W*300px/); + }); + it('should navigate using the router when item is clicked', () => { render(); clickMenuTriggerButton(); diff --git a/x-pack/plugins/security_solution/public/management/components/context_menu_with_router_support/context_menu_with_router_support.tsx b/x-pack/plugins/security_solution/public/management/components/context_menu_with_router_support/context_menu_with_router_support.tsx index cc9b652ff934..85013b82fb2d 100644 --- a/x-pack/plugins/security_solution/public/management/components/context_menu_with_router_support/context_menu_with_router_support.tsx +++ b/x-pack/plugins/security_solution/public/management/components/context_menu_with_router_support/context_menu_with_router_support.tsx @@ -32,6 +32,11 @@ export interface ContextMenuWithRouterSupportProps * overwritten to `true`. Setting this prop's value to `undefined` will suppress the default behaviour. */ maxWidth?: CSSProperties['maxWidth']; + /** + * If `true`, then the menu will have a fixed width and will not be adjusted if the content it holds + * is shorter than `maxWidth` prop value. + */ + fixedWidth?: boolean; /** * The max height for the popup menu. Default is `255px`. */ @@ -57,6 +62,7 @@ export const ContextMenuWithRouterSupport = memo>; + type AdditionalPanelProps = Partial< + Omit, 'style'> + > & { + style: Required>['style']; + }; const additionalContextMenuPanelProps = useMemo(() => { const newAdditionalProps: AdditionalPanelProps = { + className: 'eui-yScroll', style: {}, }; - if (maxWidth) { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - newAdditionalProps.style!.maxWidth = maxWidth; + if (maxWidth && !fixedWidth) { + newAdditionalProps.style.maxWidth = maxWidth; } if (maxHeight) { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - newAdditionalProps.style!.overflowY = 'scroll'; - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - newAdditionalProps.style!.maxHeight = maxHeight; + newAdditionalProps.style.maxHeight = maxHeight; + } + + if (fixedWidth) { + newAdditionalProps.style.width = maxWidth ?? '32ch'; } return newAdditionalProps; - }, [maxWidth, maxHeight]); + }, [maxWidth, fixedWidth, maxHeight]); return ( !isPagingDisabled && activityLogLoaded && !activityLogData.length, + [isPagingDisabled, activityLogLoaded, activityLogData] + ); + const loadMoreTrigger = useRef(null); const getActivityLog = useCallback( (entries: IntersectionObserverEntry[]) => { @@ -120,7 +125,7 @@ export const EndpointActivityLog = memo( <> - {!isPagingDisabled && activityLogLoaded && !activityLogData.length && ( + {showCallout && ( <> {activityLogLoading && } - {(!activityLogLoading || !isPagingDisabled) && ( - + {(!activityLogLoading || !isPagingDisabled) && !showCallout && ( + )} {isPagingDisabled && !activityLogLoading && ( diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.test.tsx b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.test.tsx index 5db501f5e09a..a71acd66650d 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.test.tsx @@ -7,6 +7,7 @@ import React from 'react'; import * as reactTestingLibrary from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; import { EndpointList } from './index'; import '../../../../common/mock/match_media'; @@ -133,7 +134,7 @@ jest.mock('../../../../common/hooks/use_license'); describe('when on the endpoint list page', () => { const docGenerator = new EndpointDocGenerator(); - const { act, screen, fireEvent } = reactTestingLibrary; + const { act, screen, fireEvent, waitFor } = reactTestingLibrary; let render: () => ReturnType; let history: AppContextTestRender['history']; @@ -885,16 +886,14 @@ describe('when on the endpoint list page', () => { await middlewareSpy.waitForAction('serverReturnedEndpointList'); }); const hostNameLinks = renderResult.getAllByTestId('hostnameCellLink'); - reactTestingLibrary.fireEvent.click(hostNameLinks[0]); + userEvent.click(hostNameLinks[0]); }); afterEach(reactTestingLibrary.cleanup); it('should show the endpoint details flyout', async () => { const activityLogTab = await renderResult.findByTestId('activity_log'); - reactTestingLibrary.act(() => { - reactTestingLibrary.fireEvent.click(activityLogTab); - }); + userEvent.click(activityLogTab); await middlewareSpy.waitForAction('endpointDetailsActivityLogChanged'); reactTestingLibrary.act(() => { dispatchEndpointDetailsActivityLogChanged('success', getMockData()); @@ -905,9 +904,7 @@ describe('when on the endpoint list page', () => { it('should display log accurately', async () => { const activityLogTab = await renderResult.findByTestId('activity_log'); - reactTestingLibrary.act(() => { - reactTestingLibrary.fireEvent.click(activityLogTab); - }); + userEvent.click(activityLogTab); await middlewareSpy.waitForAction('endpointDetailsActivityLogChanged'); reactTestingLibrary.act(() => { dispatchEndpointDetailsActivityLogChanged('success', getMockData()); @@ -920,9 +917,7 @@ describe('when on the endpoint list page', () => { it('should display log accurately with endpoint responses', async () => { const activityLogTab = await renderResult.findByTestId('activity_log'); - reactTestingLibrary.act(() => { - reactTestingLibrary.fireEvent.click(activityLogTab); - }); + userEvent.click(activityLogTab); await middlewareSpy.waitForAction('endpointDetailsActivityLogChanged'); reactTestingLibrary.act(() => { dispatchEndpointDetailsActivityLogChanged( @@ -939,9 +934,7 @@ describe('when on the endpoint list page', () => { it('should display empty state when API call has failed', async () => { const activityLogTab = await renderResult.findByTestId('activity_log'); - reactTestingLibrary.act(() => { - reactTestingLibrary.fireEvent.click(activityLogTab); - }); + userEvent.click(activityLogTab); await middlewareSpy.waitForAction('endpointDetailsActivityLogChanged'); reactTestingLibrary.act(() => { dispatchEndpointDetailsActivityLogChanged('failed', getMockData()); @@ -952,9 +945,7 @@ describe('when on the endpoint list page', () => { it('should not display empty state when no log data', async () => { const activityLogTab = await renderResult.findByTestId('activity_log'); - reactTestingLibrary.act(() => { - reactTestingLibrary.fireEvent.click(activityLogTab); - }); + userEvent.click(activityLogTab); await middlewareSpy.waitForAction('endpointDetailsActivityLogChanged'); reactTestingLibrary.act(() => { dispatchEndpointDetailsActivityLogChanged('success', { @@ -977,7 +968,12 @@ describe('when on the endpoint list page', () => { const userChangedUrlChecker = middlewareSpy.waitForAction('userChangedUrl'); reactTestingLibrary.act(() => { history.push( - `${MANAGEMENT_PATH}/endpoints?page_index=0&page_size=10&selected_endpoint=1&show=activity_log` + getEndpointDetailsPath({ + page_index: '0', + page_size: '10', + name: 'endpointActivityLog', + selected_endpoint: '1', + }) ); }); const changedUrlAction = await userChangedUrlChecker; @@ -996,7 +992,43 @@ describe('when on the endpoint list page', () => { const userChangedUrlChecker = middlewareSpy.waitForAction('userChangedUrl'); reactTestingLibrary.act(() => { history.push( - `${MANAGEMENT_PATH}/endpoints?page_index=0&page_size=10&selected_endpoint=1&show=activity_log` + getEndpointDetailsPath({ + page_index: '0', + page_size: '10', + name: 'endpointActivityLog', + selected_endpoint: '1', + }) + ); + }); + const changedUrlAction = await userChangedUrlChecker; + expect(changedUrlAction.payload.search).toEqual( + '?page_index=0&page_size=10&selected_endpoint=1&show=activity_log' + ); + await middlewareSpy.waitForAction('endpointDetailsActivityLogChanged'); + reactTestingLibrary.act(() => { + dispatchEndpointDetailsActivityLogChanged('success', { + page: 1, + pageSize: 50, + startDate: 'now-1d', + endDate: 'now', + data: [], + }); + }); + + const activityLogCallout = await renderResult.findByTestId('activityLogNoDataCallout'); + expect(activityLogCallout).not.toBeNull(); + }); + + it('should not display scroll trigger when showing callout message', async () => { + const userChangedUrlChecker = middlewareSpy.waitForAction('userChangedUrl'); + reactTestingLibrary.act(() => { + history.push( + getEndpointDetailsPath({ + page_index: '0', + page_size: '10', + name: 'endpointActivityLog', + selected_endpoint: '1', + }) ); }); const changedUrlAction = await userChangedUrlChecker; @@ -1016,13 +1048,25 @@ describe('when on the endpoint list page', () => { const activityLogCallout = await renderResult.findByTestId('activityLogNoDataCallout'); expect(activityLogCallout).not.toBeNull(); + // scroll to the bottom by pressing down arrow key + // and keep it pressed + userEvent.keyboard('ArrowDown>'); + // end scrolling after 1s + await waitFor(() => {}); + userEvent.keyboard('/ArrowDown'); + expect(await renderResult.queryByTestId('activityLogLoadMoreTrigger')).toBeNull(); }); it('should correctly display non-empty comments only for actions', async () => { const userChangedUrlChecker = middlewareSpy.waitForAction('userChangedUrl'); reactTestingLibrary.act(() => { history.push( - `${MANAGEMENT_PATH}/endpoints?page_index=0&page_size=10&selected_endpoint=1&show=activity_log` + getEndpointDetailsPath({ + page_index: '0', + page_size: '10', + name: 'endpointActivityLog', + selected_endpoint: '1', + }) ); }); const changedUrlAction = await userChangedUrlChecker; diff --git a/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/store/action.ts b/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/store/action.ts index 7a9b1dc60c44..6b712d470d29 100644 --- a/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/store/action.ts +++ b/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/store/action.ts @@ -9,11 +9,6 @@ import { UpdateExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list- import { Action } from 'redux'; import { HostIsolationExceptionsPageState } from '../types'; -export type HostIsolationExceptionsPageDataChanged = - Action<'hostIsolationExceptionsPageDataChanged'> & { - payload: HostIsolationExceptionsPageState['entries']; - }; - export type HostIsolationExceptionsFormStateChanged = Action<'hostIsolationExceptionsFormStateChanged'> & { payload: HostIsolationExceptionsPageState['form']['status']; @@ -28,8 +23,6 @@ export type HostIsolationExceptionsCreateEntry = Action<'hostIsolationExceptions payload: HostIsolationExceptionsPageState['form']['entry']; }; -export type HostIsolationExceptionsRefreshList = Action<'hostIsolationExceptionsRefreshList'>; - export type HostIsolationExceptionsMarkToEdit = Action<'hostIsolationExceptionsMarkToEdit'> & { payload: { id: string; @@ -41,10 +34,8 @@ export type HostIsolationExceptionsSubmitEdit = Action<'hostIsolationExceptionsS }; export type HostIsolationExceptionsPageAction = - | HostIsolationExceptionsPageDataChanged | HostIsolationExceptionsCreateEntry | HostIsolationExceptionsFormStateChanged - | HostIsolationExceptionsRefreshList | HostIsolationExceptionsFormEntryChanged | HostIsolationExceptionsMarkToEdit | HostIsolationExceptionsSubmitEdit; diff --git a/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/store/middleware.test.ts b/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/store/middleware.test.ts index a59a289f79be..fe666800059b 100644 --- a/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/store/middleware.test.ts +++ b/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/store/middleware.test.ts @@ -11,8 +11,6 @@ import { } from '@kbn/securitysolution-io-ts-list-types'; import { applyMiddleware, createStore, Store } from 'redux'; import { coreMock } from '../../../../../../../../src/core/public/mocks'; -import { getFoundExceptionListItemSchemaMock } from '../../../../../../lists/common/schemas/response/found_exception_list_item_schema.mock'; -import { HOST_ISOLATION_EXCEPTIONS_PATH } from '../../../../../common/constants'; import { AppAction } from '../../../../common/store/actions'; import { createSpyMiddleware, @@ -25,7 +23,6 @@ import { } from '../../../state'; import { createHostIsolationExceptionItem, - getHostIsolationExceptionItems, getOneHostIsolationExceptionItem, updateOneHostIsolationExceptionItem, } from '../service'; @@ -34,10 +31,8 @@ import { createEmptyHostIsolationException } from '../utils'; import { initialHostIsolationExceptionsPageState } from './builders'; import { createHostIsolationExceptionsPageMiddleware } from './middleware'; import { hostIsolationExceptionsPageReducer } from './reducer'; -import { getListFetchError } from './selector'; jest.mock('../service'); -const getHostIsolationExceptionItemsMock = getHostIsolationExceptionItems as jest.Mock; const createHostIsolationExceptionItemMock = createHostIsolationExceptionItem as jest.Mock; const getOneHostIsolationExceptionItemMock = getOneHostIsolationExceptionItem as jest.Mock; const updateOneHostIsolationExceptionItemMock = updateOneHostIsolationExceptionItem as jest.Mock; @@ -79,84 +74,6 @@ describe('Host isolation exceptions middleware', () => { }); }); - describe('when on the List page', () => { - const changeUrl = (searchParams: string = '') => { - store.dispatch({ - type: 'userChangedUrl', - payload: { - pathname: HOST_ISOLATION_EXCEPTIONS_PATH, - search: searchParams, - hash: '', - key: 'miniMe', - }, - }); - }; - - beforeEach(() => { - getHostIsolationExceptionItemsMock.mockReset(); - getHostIsolationExceptionItemsMock.mockImplementation(getFoundExceptionListItemSchemaMock); - }); - - it.each([ - [undefined, undefined], - [3, 50], - ])( - 'should trigger api call to retrieve host isolation exceptions params page_index[%s] page_size[%s]', - async (pageIndex, perPage) => { - changeUrl((pageIndex && perPage && `?page_index=${pageIndex}&page_size=${perPage}`) || ''); - await spyMiddleware.waitForAction('hostIsolationExceptionsPageDataChanged', { - validate({ payload }) { - return isLoadedResourceState(payload); - }, - }); - - expect(getHostIsolationExceptionItemsMock).toHaveBeenCalledWith( - expect.objectContaining({ - page: (pageIndex ?? 0) + 1, - perPage: perPage ?? 10, - filter: undefined, - }) - ); - } - ); - - it('should clear up previous page and apply a filter configuration when a filter is used', async () => { - changeUrl('?filter=testMe'); - await spyMiddleware.waitForAction('hostIsolationExceptionsPageDataChanged', { - validate({ payload }) { - return isLoadedResourceState(payload); - }, - }); - expect(getHostIsolationExceptionItemsMock).toHaveBeenCalledWith( - expect.objectContaining({ - page: 1, - perPage: 10, - filter: - '(exception-list-agnostic.attributes.name:(*testMe*) OR exception-list-agnostic.attributes.description:(*testMe*) OR exception-list-agnostic.attributes.entries.value:(*testMe*))', - }) - ); - }); - - it('should dispatch a Failure if an API error was encountered', async () => { - getHostIsolationExceptionItemsMock.mockRejectedValue({ - body: { message: 'error message', statusCode: 500, error: 'Internal Server Error' }, - }); - - changeUrl(); - await spyMiddleware.waitForAction('hostIsolationExceptionsPageDataChanged', { - validate({ payload }) { - return isFailedResourceState(payload); - }, - }); - - expect(getListFetchError(store.getState())).toEqual({ - message: 'error message', - statusCode: 500, - error: 'Internal Server Error', - }); - }); - }); - describe('When adding an item to host isolation exceptions', () => { let entry: CreateExceptionListItemSchema; beforeEach(() => { diff --git a/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/store/middleware.ts b/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/store/middleware.ts index f4e49b1ea02d..7d6fff88b687 100644 --- a/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/store/middleware.ts +++ b/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/store/middleware.ts @@ -8,31 +8,24 @@ import { CreateExceptionListItemSchema, ExceptionListItemSchema, - FoundExceptionListItemSchema, UpdateExceptionListItemSchema, } from '@kbn/securitysolution-io-ts-list-types'; import { CoreStart, HttpSetup, HttpStart } from 'kibana/public'; -import { matchPath } from 'react-router-dom'; import { transformNewItemOutput, transformOutput } from '@kbn/securitysolution-list-hooks'; -import { AppLocation, Immutable, ImmutableObject } from '../../../../../common/endpoint/types'; +import { ImmutableObject } from '../../../../../common/endpoint/types'; import { ImmutableMiddleware, ImmutableMiddlewareAPI } from '../../../../common/store'; import { AppAction } from '../../../../common/store/actions'; -import { MANAGEMENT_ROUTING_HOST_ISOLATION_EXCEPTIONS_PATH } from '../../../common/constants'; -import { parseQueryFilterToKQL } from '../../../common/utils'; import { createFailedResourceState, createLoadedResourceState, createLoadingResourceState, - asStaleResourceState, } from '../../../state/async_resource_builders'; import { - getHostIsolationExceptionItems, createHostIsolationExceptionItem, getOneHostIsolationExceptionItem, updateOneHostIsolationExceptionItem, } from '../service'; import { HostIsolationExceptionsPageState } from '../types'; -import { getCurrentListPageDataState, getCurrentLocation } from './selector'; import { HostIsolationExceptionsPageAction } from './action'; export const SEARCHABLE_FIELDS: Readonly = [`name`, `description`, `entries.value`]; @@ -47,14 +40,6 @@ export const createHostIsolationExceptionsPageMiddleware = ( return (store) => (next) => async (action) => { next(action); - if (action.type === 'userChangedUrl' && isHostIsolationExceptionsPage(action.payload)) { - loadHostIsolationExceptionsList(store, coreStart.http); - } - - if (action.type === 'hostIsolationExceptionsRefreshList') { - loadHostIsolationExceptionsList(store, coreStart.http); - } - if (action.type === 'hostIsolationExceptionsCreateEntry') { createHostIsolationException(store, coreStart.http); } @@ -104,57 +89,6 @@ async function createHostIsolationException( } } -async function loadHostIsolationExceptionsList( - store: ImmutableMiddlewareAPI< - HostIsolationExceptionsPageState, - HostIsolationExceptionsPageAction - >, - http: HttpStart -) { - const { dispatch } = store; - try { - const { - page_size: pageSize, - page_index: pageIndex, - filter, - } = getCurrentLocation(store.getState()); - const query = { - http, - page: pageIndex + 1, - perPage: pageSize, - filter: parseQueryFilterToKQL(filter, SEARCHABLE_FIELDS) || undefined, - }; - - dispatch({ - type: 'hostIsolationExceptionsPageDataChanged', - payload: createLoadingResourceState( - asStaleResourceState(getCurrentListPageDataState(store.getState())) - ), - }); - - const entries = await getHostIsolationExceptionItems(query); - - dispatch({ - type: 'hostIsolationExceptionsPageDataChanged', - payload: createLoadedResourceState(entries), - }); - } catch (error) { - dispatch({ - type: 'hostIsolationExceptionsPageDataChanged', - payload: createFailedResourceState(error.body ?? error), - }); - } -} - -function isHostIsolationExceptionsPage(location: Immutable) { - return ( - matchPath(location.pathname ?? '', { - path: MANAGEMENT_ROUTING_HOST_ISOLATION_EXCEPTIONS_PATH, - exact: true, - }) !== null - ); -} - async function loadHostIsolationExceptionsItem( store: ImmutableMiddlewareAPI< HostIsolationExceptionsPageState, diff --git a/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/store/reducer.ts b/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/store/reducer.ts index d89e8abef5aa..afa82f3f8b20 100644 --- a/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/store/reducer.ts +++ b/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/store/reducer.ts @@ -65,12 +65,6 @@ export const hostIsolationExceptionsPageReducer: StateReducer = ( }, }; } - case 'hostIsolationExceptionsPageDataChanged': { - return { - ...state, - entries: action.payload, - }; - } case 'userChangedUrl': return userChangedUrl(state, action); } diff --git a/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/store/selector.ts b/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/store/selector.ts index 9e7963725994..43009ddd1d03 100644 --- a/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/store/selector.ts +++ b/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/store/selector.ts @@ -5,115 +5,20 @@ * 2.0. */ -import { Pagination } from '@elastic/eui'; -import { - ExceptionListItemSchema, - FoundExceptionListItemSchema, - UpdateExceptionListItemSchema, -} from '@kbn/securitysolution-io-ts-list-types'; +import { UpdateExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types'; import { createSelector } from 'reselect'; import { Immutable } from '../../../../../common/endpoint/types'; import { ServerApiError } from '../../../../common/types'; -import { - MANAGEMENT_DEFAULT_PAGE_SIZE, - MANAGEMENT_PAGE_SIZE_OPTIONS, -} from '../../../common/constants'; -import { - getLastLoadedResourceState, - isFailedResourceState, - isLoadedResourceState, - isLoadingResourceState, -} from '../../../state/async_resource_state'; +import { isFailedResourceState } from '../../../state/async_resource_state'; import { HostIsolationExceptionsPageState } from '../types'; type StoreState = Immutable; type HostIsolationExceptionsSelector = (state: StoreState) => T; -export const getCurrentListPageState: HostIsolationExceptionsSelector = (state) => { - return state; -}; - -export const getCurrentListPageDataState: HostIsolationExceptionsSelector = ( - state -) => state.entries; - -const getListApiSuccessResponse: HostIsolationExceptionsSelector< - Immutable | undefined -> = createSelector(getCurrentListPageDataState, (listPageData) => { - return getLastLoadedResourceState(listPageData)?.data; -}); - -export const getListItems: HostIsolationExceptionsSelector> = - createSelector(getListApiSuccessResponse, (apiResponseData) => { - return apiResponseData?.data || []; - }); - -export const getTotalListItems: HostIsolationExceptionsSelector> = createSelector( - getListApiSuccessResponse, - (apiResponseData) => { - return apiResponseData?.total || 0; - } -); - -export const getListPagination: HostIsolationExceptionsSelector = createSelector( - getListApiSuccessResponse, - // memoized via `reselect` until the API response changes - (response) => { - return { - totalItemCount: response?.total ?? 0, - pageSize: response?.per_page ?? MANAGEMENT_DEFAULT_PAGE_SIZE, - pageSizeOptions: [...MANAGEMENT_PAGE_SIZE_OPTIONS], - pageIndex: (response?.page ?? 1) - 1, - }; - } -); - -export const getListIsLoading: HostIsolationExceptionsSelector = createSelector( - getCurrentListPageDataState, - (listDataState) => isLoadingResourceState(listDataState) -); - -export const getListFetchError: HostIsolationExceptionsSelector< - Immutable | undefined -> = createSelector(getCurrentListPageDataState, (listPageDataState) => { - return (isFailedResourceState(listPageDataState) && listPageDataState.error) || undefined; -}); - export const getCurrentLocation: HostIsolationExceptionsSelector = ( state ) => state.location; -export const getDeletionState: HostIsolationExceptionsSelector = - createSelector(getCurrentListPageState, (listState) => listState.deletion); - -export const showDeleteModal: HostIsolationExceptionsSelector = createSelector( - getDeletionState, - ({ item }) => { - return Boolean(item); - } -); - -export const isDeletionInProgress: HostIsolationExceptionsSelector = createSelector( - getDeletionState, - ({ status }) => { - return isLoadingResourceState(status); - } -); - -export const wasDeletionSuccessful: HostIsolationExceptionsSelector = createSelector( - getDeletionState, - ({ status }) => { - return isLoadedResourceState(status); - } -); - -export const getDeleteError: HostIsolationExceptionsSelector = - createSelector(getDeletionState, ({ status }) => { - if (isFailedResourceState(status)) { - return status.error; - } - }); - const getFormState: HostIsolationExceptionsSelector = (state) => { return state.form; }; diff --git a/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/components/form_flyout.tsx b/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/components/form_flyout.tsx index 0ee77f1b408a..b73e3ac6f011 100644 --- a/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/components/form_flyout.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/components/form_flyout.tsx @@ -26,6 +26,7 @@ import React, { memo, useCallback, useEffect, useMemo, useState } from 'react'; import { useDispatch } from 'react-redux'; import { useHistory } from 'react-router-dom'; import { Dispatch } from 'redux'; +import { useQueryClient } from 'react-query'; import { Loader } from '../../../../../common/components/loader'; import { useToasts } from '../../../../../common/lib/kibana'; import { getHostIsolationExceptionsListPath } from '../../../../common/routing'; @@ -62,6 +63,7 @@ export const HostIsolationExceptionsFormFlyout: React.FC<{}> = memo(() => { const creationFailure = useHostIsolationExceptionsSelector(getFormStatusFailure); const exceptionToEdit = useHostIsolationExceptionsSelector(getExceptionToEdit); const navigateCallback = useHostIsolationExceptionsNavigateCallback(); + const queryClient = useQueryClient(); const history = useHistory(); const [formHasError, setFormHasError] = useState(true); @@ -115,8 +117,17 @@ export const HostIsolationExceptionsFormFlyout: React.FC<{}> = memo(() => { } else { toasts.addSuccess(getCreationSuccessMessage(exception.name)); } + queryClient.invalidateQueries('hostIsolationExceptions'); } - }, [creationSuccessful, dispatch, exception?.item_id, exception?.name, onCancel, toasts]); + }, [ + creationSuccessful, + dispatch, + exception?.item_id, + exception?.name, + onCancel, + queryClient, + toasts, + ]); // handle load item to edit error useEffect(() => { diff --git a/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/hooks.ts b/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/hooks.ts index 50ae96305c4b..0b18a5b61bd0 100644 --- a/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/hooks.ts +++ b/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/hooks.ts @@ -7,6 +7,9 @@ import { useCallback, useEffect, useState } from 'react'; import { useSelector } from 'react-redux'; import { useHistory } from 'react-router-dom'; +import { FoundExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types'; +import { QueryObserverResult, useQuery } from 'react-query'; +import { ServerApiError } from '../../../../common/types'; import { useHttp } from '../../../../common/lib/kibana/hooks'; import { useEndpointPrivileges } from '../../../../common/components/user_privileges/endpoint'; import { State } from '../../../../common/store'; @@ -15,9 +18,10 @@ import { MANAGEMENT_STORE_HOST_ISOLATION_EXCEPTIONS_NAMESPACE, } from '../../../common/constants'; import { getHostIsolationExceptionsListPath } from '../../../common/routing'; -import { getHostIsolationExceptionSummary } from '../service'; +import { getHostIsolationExceptionItems, getHostIsolationExceptionSummary } from '../service'; import { getCurrentLocation } from '../store/selector'; import { HostIsolationExceptionsPageLocation, HostIsolationExceptionsPageState } from '../types'; +import { parseQueryFilterToKQL } from '../../../common/utils'; export function useHostIsolationExceptionsSelector( selector: (state: HostIsolationExceptionsPageState) => R @@ -69,3 +73,25 @@ export function useCanSeeHostIsolationExceptionsMenu() { return canSeeMenu; } + +const SEARCHABLE_FIELDS: Readonly = [`name`, `description`, `entries.value`]; + +export function useFetchHostIsolationExceptionsList(): QueryObserverResult< + FoundExceptionListItemSchema, + ServerApiError +> { + const http = useHttp(); + const location = useHostIsolationExceptionsSelector(getCurrentLocation); + + return useQuery( + ['hostIsolationExceptions', 'list', location.filter, location.page_size, location.page_index], + () => { + return getHostIsolationExceptionItems({ + http, + page: location.page_index + 1, + perPage: location.page_size, + filter: parseQueryFilterToKQL(location.filter, SEARCHABLE_FIELDS) || undefined, + }); + } + ); +} diff --git a/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/host_isolation_exceptions_list.test.tsx b/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/host_isolation_exceptions_list.test.tsx index 2911264d7061..f6f68f1f6e97 100644 --- a/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/host_isolation_exceptions_list.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/host_isolation_exceptions_list.test.tsx @@ -5,13 +5,12 @@ * 2.0. */ -import { act } from '@testing-library/react'; +import { act, waitFor, waitForElementToBeRemoved } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import React from 'react'; import { getFoundExceptionListItemSchemaMock } from '../../../../../../lists/common/schemas/response/found_exception_list_item_schema.mock'; import { HOST_ISOLATION_EXCEPTIONS_PATH } from '../../../../../common/constants'; import { AppContextTestRender, createAppRootMockRenderer } from '../../../../common/mock/endpoint'; -import { isFailedResourceState, isLoadedResourceState } from '../../../state'; import { getHostIsolationExceptionItems } from '../service'; import { HostIsolationExceptionsList } from './host_isolation_exceptions_list'; import { useEndpointPrivileges } from '../../../../common/components/user_privileges/endpoint'; @@ -26,31 +25,25 @@ describe('When on the host isolation exceptions page', () => { let render: () => ReturnType; let renderResult: ReturnType; let history: AppContextTestRender['history']; - let waitForAction: AppContextTestRender['middlewareSpy']['waitForAction']; let mockedContext: AppContextTestRender; const useEndpointPrivilegesMock = useEndpointPrivileges as jest.Mock; + const waitForApiCall = () => { + return waitFor(() => expect(getHostIsolationExceptionItemsMock).toHaveBeenCalled()); + }; beforeEach(() => { - getHostIsolationExceptionItemsMock.mockReset(); + getHostIsolationExceptionItemsMock.mockClear(); mockedContext = createAppRootMockRenderer(); ({ history } = mockedContext); render = () => (renderResult = mockedContext.render()); - waitForAction = mockedContext.middlewareSpy.waitForAction; act(() => { history.push(HOST_ISOLATION_EXCEPTIONS_PATH); }); }); + describe('When on the host isolation list page', () => { - const dataReceived = () => - act(async () => { - await waitForAction('hostIsolationExceptionsPageDataChanged', { - validate(action) { - return isLoadedResourceState(action.payload); - }, - }); - }); describe('And no data exists', () => { beforeEach(async () => { getHostIsolationExceptionItemsMock.mockReturnValue({ @@ -63,40 +56,47 @@ describe('When on the host isolation exceptions page', () => { it('should show the Empty message', async () => { render(); - await dataReceived(); + await waitForApiCall(); expect(renderResult.getByTestId('hostIsolationExceptionsEmpty')).toBeTruthy(); }); it('should not display the search bar', async () => { render(); - await dataReceived(); + await waitForApiCall(); expect(renderResult.queryByTestId('searchExceptions')).toBeFalsy(); }); }); + describe('And data exists', () => { beforeEach(async () => { getHostIsolationExceptionItemsMock.mockImplementation(getFoundExceptionListItemSchemaMock); }); - it('should show loading indicator while retrieving data', async () => { + it('should show loading indicator while retrieving data and hide it when it gets it', async () => { let releaseApiResponse: (value?: unknown) => void; + // make the request wait getHostIsolationExceptionItemsMock.mockReturnValue( new Promise((resolve) => (releaseApiResponse = resolve)) ); render(); + await waitForApiCall(); + // see if loader is present expect(renderResult.getByTestId('hostIsolationExceptionsContent-loader')).toBeTruthy(); - const wasReceived = dataReceived(); - releaseApiResponse!(); - await wasReceived; - expect(renderResult.container.querySelector('.euiProgress')).toBeNull(); + // release the request + releaseApiResponse!(getFoundExceptionListItemSchemaMock()); + + // check the loader is gone + await waitForElementToBeRemoved( + renderResult.getByTestId('hostIsolationExceptionsContent-loader') + ); }); it('should display the search bar and item count', async () => { render(); - await dataReceived(); + await waitForApiCall(); expect(renderResult.getByTestId('searchExceptions')).toBeTruthy(); expect(renderResult.getByTestId('hostIsolationExceptions-totalCount').textContent).toBe( 'Showing 1 exception' @@ -105,7 +105,7 @@ describe('When on the host isolation exceptions page', () => { it('should show items on the list', async () => { render(); - await dataReceived(); + await waitForApiCall(); expect(renderResult.getByTestId('hostIsolationExceptionsCard')).toBeTruthy(); }); @@ -114,15 +114,8 @@ describe('When on the host isolation exceptions page', () => { getHostIsolationExceptionItemsMock.mockImplementation(() => { throw new Error('Server is too far away'); }); - const errorDispatched = act(async () => { - await waitForAction('hostIsolationExceptionsPageDataChanged', { - validate(action) { - return isFailedResourceState(action.payload); - }, - }); - }); render(); - await errorDispatched; + await waitForApiCall(); expect( renderResult.getByTestId('hostIsolationExceptionsContent-error').textContent ).toEqual(' Server is too far away'); @@ -131,7 +124,7 @@ describe('When on the host isolation exceptions page', () => { it('should show the searchbar when no results from search', async () => { // render the page with data render(); - await dataReceived(); + await waitForApiCall(); // check if the searchbar is there expect(renderResult.getByTestId('searchExceptions')).toBeTruthy(); @@ -149,7 +142,7 @@ describe('When on the host isolation exceptions page', () => { userEvent.click(renderResult.getByTestId('searchButton')); // wait for the page render - await dataReceived(); + await waitForApiCall(); // check the url changed expect(mockedContext.history.location.search).toBe('?filter=this%20does%20not%20exists'); @@ -167,16 +160,16 @@ describe('When on the host isolation exceptions page', () => { it('should show the create flyout when the add button is pressed', async () => { render(); - await dataReceived(); + await waitForApiCall(); userEvent.click(renderResult.getByTestId('hostIsolationExceptionsListAddButton')); - await dataReceived(); + await waitForApiCall(); expect(renderResult.getByTestId('hostIsolationExceptionsCreateEditFlyout')).toBeTruthy(); }); it('should show the create flyout when the show location is create', async () => { history.push(`${HOST_ISOLATION_EXCEPTIONS_PATH}?show=create`); render(); - await dataReceived(); + await waitForApiCall(); expect(renderResult.getByTestId('hostIsolationExceptionsCreateEditFlyout')).toBeTruthy(); expect(renderResult.queryByTestId('hostIsolationExceptionsCreateEditFlyout')).toBeTruthy(); }); diff --git a/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/host_isolation_exceptions_list.tsx b/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/host_isolation_exceptions_list.tsx index 14a5bae00998..010a435ec761 100644 --- a/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/host_isolation_exceptions_list.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/host_isolation_exceptions_list.tsx @@ -7,21 +7,14 @@ import { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types'; import { i18n } from '@kbn/i18n'; -import React, { Dispatch, useCallback, useEffect, useState } from 'react'; +import React, { useCallback, useEffect, useState } from 'react'; import { EuiButton, EuiText, EuiSpacer } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { useHistory } from 'react-router-dom'; -import { useDispatch } from 'react-redux'; import { ExceptionItem } from '../../../../common/components/exceptions/viewer/exception_item'; +import { getCurrentLocation } from '../store/selector'; import { - getCurrentLocation, - getListFetchError, - getListIsLoading, - getListItems, - getListPagination, - getTotalListItems, -} from '../store/selector'; -import { + useFetchHostIsolationExceptionsList, useHostIsolationExceptionsNavigateCallback, useHostIsolationExceptionsSelector, } from './hooks'; @@ -39,7 +32,10 @@ import { } from './components/translations'; import { getEndpointListPath } from '../../../common/routing'; import { useEndpointPrivileges } from '../../../../common/components/user_privileges/endpoint'; -import { HostIsolationExceptionsPageAction } from '../store/action'; +import { + MANAGEMENT_DEFAULT_PAGE_SIZE, + MANAGEMENT_PAGE_SIZE_OPTIONS, +} from '../../../common/constants'; type HostIsolationExceptionPaginatedContent = PaginatedContentProps< Immutable, @@ -47,19 +43,26 @@ type HostIsolationExceptionPaginatedContent = PaginatedContentProps< >; export const HostIsolationExceptionsList = () => { - const listItems = useHostIsolationExceptionsSelector(getListItems); - const totalCountListItems = useHostIsolationExceptionsSelector(getTotalListItems); - const pagination = useHostIsolationExceptionsSelector(getListPagination); - const isLoading = useHostIsolationExceptionsSelector(getListIsLoading); - const fetchError = useHostIsolationExceptionsSelector(getListFetchError); + const history = useHistory(); + const privileges = useEndpointPrivileges(); + const location = useHostIsolationExceptionsSelector(getCurrentLocation); - const dispatch = useDispatch>(); const navigateCallback = useHostIsolationExceptionsNavigateCallback(); const [itemToDelete, setItemToDelete] = useState(null); - const history = useHistory(); - const privileges = useEndpointPrivileges(); + const { isLoading, data, error, refetch } = useFetchHostIsolationExceptionsList(); + + const pagination = { + totalItemCount: data?.total ?? 0, + pageSize: data?.per_page ?? MANAGEMENT_DEFAULT_PAGE_SIZE, + pageSizeOptions: [...MANAGEMENT_PAGE_SIZE_OPTIONS], + pageIndex: (data?.page ?? 1) - 1, + }; + + const listItems = data?.data || []; + const totalCountListItems = data?.total || 0; + const showFlyout = privileges.canIsolateHost && !!location.show; const hasDataToShow = !!location.filter || listItems.length > 0; @@ -125,9 +128,7 @@ export const HostIsolationExceptionsList = () => { const handleCloseDeleteDialog = (forceRefresh: boolean = false) => { if (forceRefresh) { - dispatch({ - type: 'hostIsolationExceptionsRefreshList', - }); + refetch(); } setItemToDelete(null); }; @@ -201,7 +202,7 @@ export const HostIsolationExceptionsList = () => { ItemComponent={ArtifactEntryCard} itemComponentProps={handleItemComponentProps} onChange={handlePaginatedContentChange} - error={fetchError?.message} + error={error?.message} loading={isLoading} pagination={pagination} contentClassName="host-isolation-exceptions-container" diff --git a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/trusted_apps_grid/__snapshots__/index.test.tsx.snap b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/trusted_apps_grid/__snapshots__/index.test.tsx.snap index f22cc1179f0d..64eca93be8bc 100644 --- a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/trusted_apps_grid/__snapshots__/index.test.tsx.snap +++ b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/trusted_apps_grid/__snapshots__/index.test.tsx.snap @@ -385,11 +385,15 @@ exports[`TrustedAppsGrid renders correctly when loaded data 1`] = ` position: relative; } -.c5 { +.c6 { padding-top: 2px; } -.c6 { +.c5 { + margin-bottom: 4px !important; +} + +.c7 { margin: 6px; } @@ -401,6 +405,18 @@ exports[`TrustedAppsGrid renders correctly when loaded data 1`] = ` padding: 32px; } +.c4.top-section { + padding-bottom: 24px; +} + +.c4.bottom-section { + padding-top: 24px; +} + +.c4.artifact-entry-collapsible-card { + padding: 24px !important; +} + .c0 .trusted-app + .trusted-app { margin-top: 24px; } @@ -423,14 +439,14 @@ exports[`TrustedAppsGrid renders correctly when loaded data 1`] = ` data-test-subj="trustedAppCard" >
( useEffect(() => { disableScrolling(); - focusInput(); return () => { enableScrolling(); }; @@ -189,94 +187,92 @@ export const StatefulEditDataProvider = React.memo( return ( - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - {type !== DataProviderType.template && - updatedOperator.length > 0 && - updatedOperator[0].label !== i18n.EXISTS && - updatedOperator[0].label !== i18n.DOES_NOT_EXIST ? ( - - + - ) : null} + + - - - + + + + {type !== DataProviderType.template && + updatedOperator.length > 0 && + updatedOperator[0].label !== i18n.EXISTS && + updatedOperator[0].label !== i18n.DOES_NOT_EXIST ? ( - - - - {i18n.SAVE} - - - + + + - - + ) : null} + + + + + + + + + + {i18n.SAVE} + + + + + ); } diff --git a/x-pack/plugins/security_solution/scripts/endpoint/event_filters/index.ts b/x-pack/plugins/security_solution/scripts/endpoint/event_filters/index.ts index e0dd10876930..15758b5afd20 100644 --- a/x-pack/plugins/security_solution/scripts/endpoint/event_filters/index.ts +++ b/x-pack/plugins/security_solution/scripts/endpoint/event_filters/index.ts @@ -8,7 +8,7 @@ import { run, RunFn, createFailError } from '@kbn/dev-utils'; import { KbnClient } from '@kbn/test'; import { AxiosError } from 'axios'; -import bluebird from 'bluebird'; +import pMap from 'p-map'; import type { CreateExceptionListSchema } from '@kbn/securitysolution-io-ts-list-types'; import { ENDPOINT_EVENT_FILTERS_LIST_DESCRIPTION, @@ -70,7 +70,7 @@ const createEventFilters: RunFn = async ({ flags, log }) => { await ensureCreateEndpointEventFiltersList(kbn); - await bluebird.map( + await pMap( Array.from({ length: flags.count as unknown as number }), () => kbn diff --git a/x-pack/plugins/security_solution/scripts/endpoint/host_isolation_exceptions/index.ts b/x-pack/plugins/security_solution/scripts/endpoint/host_isolation_exceptions/index.ts index 15f0b2f65cb9..779aee0bb1dc 100644 --- a/x-pack/plugins/security_solution/scripts/endpoint/host_isolation_exceptions/index.ts +++ b/x-pack/plugins/security_solution/scripts/endpoint/host_isolation_exceptions/index.ts @@ -8,7 +8,7 @@ import { run, RunFn, createFailError } from '@kbn/dev-utils'; import { KbnClient } from '@kbn/test'; import { AxiosError } from 'axios'; -import bluebird from 'bluebird'; +import pMap from 'p-map'; import type { CreateExceptionListSchema } from '@kbn/securitysolution-io-ts-list-types'; import { ENDPOINT_HOST_ISOLATION_EXCEPTIONS_LIST_DESCRIPTION, @@ -70,7 +70,7 @@ const createHostIsolationException: RunFn = async ({ flags, log }) => { await ensureCreateEndpointHostIsolationExceptionList(kbn); - await bluebird.map( + await pMap( Array.from({ length: flags.count as unknown as number }), () => kbn diff --git a/x-pack/plugins/security_solution/scripts/endpoint/trusted_apps/index.ts b/x-pack/plugins/security_solution/scripts/endpoint/trusted_apps/index.ts index d20d29a34754..97695ec60062 100644 --- a/x-pack/plugins/security_solution/scripts/endpoint/trusted_apps/index.ts +++ b/x-pack/plugins/security_solution/scripts/endpoint/trusted_apps/index.ts @@ -8,7 +8,7 @@ import minimist from 'minimist'; import { ToolingLog } from '@kbn/dev-utils'; import { KbnClient } from '@kbn/test'; -import bluebird from 'bluebird'; +import pMap from 'p-map'; import { basename } from 'path'; import { AxiosResponse } from 'axios'; import { TRUSTED_APPS_CREATE_API, TRUSTED_APPS_LIST_API } from '../../../common/endpoint/constants'; @@ -113,7 +113,7 @@ export const run: (options?: RunOptions) => Promise = async ({ return () => policyIds[randomN(policyIds.length)]; })(); - return bluebird.map( + return pMap( Array.from({ length: count }), async () => { const body = trustedAppGenerator.generateTrustedAppForCreate(); diff --git a/x-pack/plugins/security_solution/server/endpoint/endpoint_app_context_services.ts b/x-pack/plugins/security_solution/server/endpoint/endpoint_app_context_services.ts index d06739d9b859..68ee826eca01 100644 --- a/x-pack/plugins/security_solution/server/endpoint/endpoint_app_context_services.ts +++ b/x-pack/plugins/security_solution/server/endpoint/endpoint_app_context_services.ts @@ -123,7 +123,10 @@ export class EndpointAppContextService { return this.startDependencies?.agentService; } - public getPackagePolicyService(): PackagePolicyServiceInterface | undefined { + public getPackagePolicyService(): PackagePolicyServiceInterface { + if (!this.startDependencies?.packagePolicyService) { + throw new EndpointAppContentServicesNotStartedError(); + } return this.startDependencies?.packagePolicyService; } diff --git a/x-pack/plugins/security_solution/server/endpoint/mocks.ts b/x-pack/plugins/security_solution/server/endpoint/mocks.ts index 6c2df2d09f6d..c428cf49b1e1 100644 --- a/x-pack/plugins/security_solution/server/endpoint/mocks.ts +++ b/x-pack/plugins/security_solution/server/endpoint/mocks.ts @@ -87,22 +87,36 @@ export const createMockEndpointAppContextServiceStartContract = (): jest.Mocked => { const config = createMockConfig(); + const logger = loggingSystemMock.create().get('mock_endpoint_app_context'); const casesClientMock = createCasesClientMock(); const savedObjectsStart = savedObjectsServiceMock.createStartContract(); const agentService = createMockAgentService(); const agentPolicyService = createMockAgentPolicyService(); + const packagePolicyService = createPackagePolicyServiceMock(); const endpointMetadataService = new EndpointMetadataService( savedObjectsStart, agentService, - agentPolicyService + agentPolicyService, + packagePolicyService, + logger ); + packagePolicyService.list.mockImplementation(async (_, options) => { + return { + items: [], + total: 0, + page: options.page ?? 1, + perPage: options.perPage ?? 10, + }; + }); + return { agentService, agentPolicyService, endpointMetadataService, + packagePolicyService, + logger, packageService: createMockPackageService(), - logger: loggingSystemMock.create().get('mock_endpoint_app_context'), manifestManager: getManifestManagerMock(), security: securityMock.createStart(), alerting: alertsMock.createStart(), @@ -113,7 +127,6 @@ export const createMockEndpointAppContextServiceStartContract = Parameters >(), exceptionListsClient: listMock.getExceptionListClient(), - packagePolicyService: createPackagePolicyServiceMock(), cases: { getCasesClientWithRequest: jest.fn(async () => casesClientMock), }, diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/actions/isolation.test.ts b/x-pack/plugins/security_solution/server/endpoint/routes/actions/isolation.test.ts index a483a33ea4c8..29a4e5ce0b29 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/actions/isolation.test.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/actions/isolation.test.ts @@ -45,7 +45,7 @@ import { LogsEndpointAction, } from '../../../../common/endpoint/types'; import { EndpointDocGenerator } from '../../../../common/endpoint/generate_data'; -import { legacyMetadataSearchResponse } from '../metadata/support/test_support'; +import { legacyMetadataSearchResponseMock } from '../metadata/support/test_support'; import { AGENT_ACTIONS_INDEX, ElasticsearchAssetType } from '../../../../../fleet/common'; import { CasesClientMock } from '../../../../../cases/server/client/mocks'; @@ -211,7 +211,7 @@ describe('Host Isolation', () => { const mockSearchResponse = jest .fn() .mockImplementation(() => - Promise.resolve({ body: legacyMetadataSearchResponse(searchResponse) }) + Promise.resolve({ body: legacyMetadataSearchResponseMock(searchResponse) }) ); if (indexExists) { ctx.core.elasticsearch.client.asInternalUser.index = mockIndexResponse; diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/handlers.ts b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/handlers.ts index c72b1307d04b..384fde6c7cea 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/handlers.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/handlers.ts @@ -6,8 +6,6 @@ */ import Boom from '@hapi/boom'; -import type { TransportResult } from '@elastic/elasticsearch'; -import { SearchResponse, SearchTotalHits } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { TypeOf } from '@kbn/config-schema'; import { @@ -22,7 +20,6 @@ import { import { HostInfo, HostMetadata, - UnitedAgentMetadata, HostResultList, HostStatus, } from '../../../../common/endpoint/types'; @@ -30,10 +27,10 @@ import type { SecuritySolutionRequestHandlerContext } from '../../../types'; import { getESQueryHostMetadataByID, + getPagingProperties, kibanaRequestToMetadataListESQuery, - buildUnitedIndexQuery, } from './query_builders'; -import { Agent, AgentPolicy, PackagePolicy } from '../../../../../fleet/common/types/models'; +import { Agent, PackagePolicy } from '../../../../../fleet/common/types/models'; import { AgentNotFoundError } from '../../../../../fleet/server'; import { EndpointAppContext, HostListQueryResult } from '../../types'; import { GetMetadataListRequestSchema, GetMetadataRequestSchema } from './index'; @@ -46,9 +43,8 @@ import { queryResponseToHostListResult, queryResponseToHostResult, } from './support/query_strategies'; -import { NotFoundError } from '../../errors'; +import { EndpointError, NotFoundError } from '../../errors'; import { EndpointHostUnEnrolledError } from '../../services/metadata'; -import { getAgentStatus } from '../../../../../fleet/common/services/agent_status'; export interface MetadataRequestContext { esClient?: IScopedClusterClient; @@ -58,16 +54,6 @@ export interface MetadataRequestContext { savedObjectsClient?: SavedObjectsClientContract; } -/** - * 00000000-0000-0000-0000-000000000000 is initial Elastic Agent id sent by Endpoint before policy is configured - * 11111111-1111-1111-1111-111111111111 is Elastic Agent id sent by Endpoint when policy does not contain an id - */ - -const IGNORED_ELASTIC_AGENT_IDS = [ - '00000000-0000-0000-0000-000000000000', - '11111111-1111-1111-1111-111111111111', -]; - export const getLogger = (endpointAppContext: EndpointAppContext): Logger => { return endpointAppContext.logFactory.get('metadata'); }; @@ -109,39 +95,69 @@ export const getMetadataListRequestHandler = function ( SecuritySolutionRequestHandlerContext > { return async (context, request, response) => { - const agentService = endpointAppContext.service.getAgentService(); - if (agentService === undefined) { - throw new Error('agentService not available'); + const endpointMetadataService = endpointAppContext.service.getEndpointMetadataService(); + if (!endpointMetadataService) { + throw new EndpointError('endpoint metadata service not available'); } - const endpointPolicies = await getAllEndpointPackagePolicies( - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - endpointAppContext.service.getPackagePolicyService()!, - context.core.savedObjects.client - ); + let doesUnitedIndexExist = false; + let didUnitedIndexError = false; + let body: HostResultList = { + hosts: [], + total: 0, + request_page_size: 0, + request_page_index: 0, + }; - const { unitedIndexExists, unitedQueryResponse } = await queryUnitedIndex( - context, - request, - endpointAppContext, - logger, - endpointPolicies - ); - if (unitedIndexExists) { - return response.ok({ - body: unitedQueryResponse, - }); + try { + doesUnitedIndexExist = await endpointMetadataService.doesUnitedIndexExist( + context.core.elasticsearch.client.asCurrentUser + ); + } catch (error) { + // for better UX, try legacy query instead of immediately failing on united index error + didUnitedIndexError = true; } - return response.ok({ - body: await legacyListMetadataQuery( + // If no unified Index present, then perform a search using the legacy approach + if (!doesUnitedIndexExist || didUnitedIndexError) { + const endpointPolicies = await getAllEndpointPackagePolicies( + endpointAppContext.service.getPackagePolicyService(), + context.core.savedObjects.client + ); + + body = await legacyListMetadataQuery( context, request, endpointAppContext, logger, endpointPolicies - ), - }); + ); + return response.ok({ body }); + } + + // Unified index is installed and being used - perform search using new approach + try { + const pagingProperties = await getPagingProperties(request, endpointAppContext); + const { data, page, total, pageSize } = await endpointMetadataService.getHostMetadataList( + context.core.elasticsearch.client.asCurrentUser, + { + page: pagingProperties.pageIndex + 1, + pageSize: pagingProperties.pageSize, + filters: request.body?.filters || {}, + } + ); + + body = { + hosts: data, + request_page_index: page - 1, + total, + request_page_size: pageSize, + }; + } catch (error) { + return errorHandler(logger, response, error); + } + + return response.ok({ body }); }; }; @@ -412,6 +428,9 @@ async function legacyListMetadataQuery( ): Promise { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const agentService = endpointAppContext.service.getAgentService()!; + if (agentService === undefined) { + throw new Error('agentService not available'); + } const metadataRequestContext: MetadataRequestContext = { esClient: context.core.elasticsearch.client, @@ -429,15 +448,15 @@ async function legacyListMetadataQuery( ); const statusesToFilter = request?.body?.filters?.host_status ?? []; - const statusIds = await findAgentIdsByStatus( + const statusAgentIds = await findAgentIdsByStatus( agentService, context.core.elasticsearch.client.asCurrentUser, statusesToFilter ); const queryParams = await kibanaRequestToMetadataListESQuery(request, endpointAppContext, { - unenrolledAgentIds: unenrolledAgentIds.concat(IGNORED_ELASTIC_AGENT_IDS), - statusAgentIds: statusIds, + unenrolledAgentIds, + statusAgentIds, }); const result = await context.core.elasticsearch.client.asCurrentUser.search( @@ -446,118 +465,3 @@ async function legacyListMetadataQuery( const hostListQueryResult = queryResponseToHostListResult(result.body); return mapToHostResultList(queryParams, hostListQueryResult, metadataRequestContext); } - -async function queryUnitedIndex( - context: SecuritySolutionRequestHandlerContext, - request: KibanaRequest, - endpointAppContext: EndpointAppContext, - logger: Logger, - endpointPolicies: PackagePolicy[] -): Promise<{ - unitedIndexExists: boolean; - unitedQueryResponse: HostResultList; -}> { - const endpointPolicyIds = endpointPolicies.map((policy) => policy.policy_id); - const unitedIndexQuery = await buildUnitedIndexQuery( - request, - endpointAppContext, - IGNORED_ELASTIC_AGENT_IDS, - endpointPolicyIds - ); - - let unitedMetadataQueryResponse: TransportResult, unknown>; - try { - unitedMetadataQueryResponse = - await context.core.elasticsearch.client.asCurrentUser.search( - unitedIndexQuery - ); - } catch (error) { - const errorType = error?.meta?.body?.error?.type ?? ''; - - // no united index means that the endpoint package hasn't been upgraded yet - // this is expected so we fall back to the legacy query - // errors other than index_not_found_exception are unexpected - if (errorType !== 'index_not_found_exception') { - logger.error(error); - throw error; - } - return { - unitedIndexExists: false, - unitedQueryResponse: {} as HostResultList, - }; - } - - const { hits: docs, total: docsCount } = unitedMetadataQueryResponse?.body?.hits || {}; - const agentPolicyIds: string[] = docs.map((doc) => doc._source?.united?.agent?.policy_id ?? ''); - - const agentPolicies = - (await endpointAppContext.service - .getAgentPolicyService() - ?.getByIds(context.core.savedObjects.client, agentPolicyIds)) ?? []; - - const agentPoliciesMap: Record = agentPolicies.reduce( - (acc, agentPolicy) => ({ - ...acc, - [agentPolicy.id]: { - ...agentPolicy, - }, - }), - {} - ); - - const endpointPoliciesMap: Record = endpointPolicies.reduce( - (acc, packagePolicy) => ({ - ...acc, - [packagePolicy.policy_id]: packagePolicy, - }), - {} - ); - - const hosts = docs - .filter((doc) => { - const { endpoint: metadata, agent } = doc?._source?.united ?? {}; - return metadata && agent; - }) - .map((doc) => { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const { endpoint: metadata, agent } = doc!._source!.united!; - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const agentPolicy = agentPoliciesMap[agent.policy_id!]; - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const endpointPolicy = endpointPoliciesMap[agent.policy_id!]; - const fleetAgentStatus = getAgentStatus(agent as Agent); - - return { - metadata, - host_status: fleetAgentStatusToEndpointHostStatus(fleetAgentStatus), - policy_info: { - agent: { - applied: { - id: agent.policy_id || '', - revision: agent.policy_revision || 0, - }, - configured: { - id: agentPolicy?.id || '', - revision: agentPolicy?.revision || 0, - }, - }, - endpoint: { - id: endpointPolicy?.id || '', - revision: endpointPolicy?.revision || 0, - }, - }, - } as HostInfo; - }); - - const unitedQueryResponse: HostResultList = { - request_page_size: unitedIndexQuery.size, - request_page_index: unitedIndexQuery.from, - total: (docsCount as SearchTotalHits).value, - hosts, - }; - - return { - unitedIndexExists: true, - unitedQueryResponse, - }; -} diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/metadata.test.ts b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/metadata.test.ts index 7c2e5de92848..c0be1c7530cb 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/metadata.test.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/metadata.test.ts @@ -34,7 +34,10 @@ import { import { createMockConfig } from '../../../lib/detection_engine/routes/__mocks__'; import { EndpointDocGenerator } from '../../../../common/endpoint/generate_data'; import { Agent, ElasticsearchAssetType } from '../../../../../fleet/common/types/models'; -import { legacyMetadataSearchResponse, unitedMetadataSearchResponse } from './support/test_support'; +import { + legacyMetadataSearchResponseMock, + unitedMetadataSearchResponseMock, +} from './support/test_support'; import { PackageService } from '../../../../../fleet/server/services'; import { HOST_METADATA_LIST_ROUTE, @@ -76,6 +79,9 @@ describe('test endpoint route', () => { let mockAgentService: Required< ReturnType >['agentService']; + let mockAgentPolicyService: Required< + ReturnType + >['agentPolicyService']; let endpointAppContextService: EndpointAppContextService; let startContract: EndpointAppContextServiceStartContract; const noUnenrolledAgent = { @@ -138,6 +144,7 @@ describe('test endpoint route', () => { endpointAppContextService.setup(createMockEndpointAppContextServiceSetupContract()); endpointAppContextService.start({ ...startContract, packageService: mockPackageService }); mockAgentService = startContract.agentService!; + mockAgentPolicyService = startContract.agentPolicyService!; registerEndpointRoutes(routerMock, { logFactory: loggingSystemMock.create(), @@ -151,7 +158,7 @@ describe('test endpoint route', () => { it('should fallback to legacy index if index not found', async () => { const mockRequest = httpServerMock.createKibanaRequest({}); - const response = legacyMetadataSearchResponse( + const response = legacyMetadataSearchResponseMock( new EndpointDocGenerator().generateHostMetadata() ); (mockScopedClient.asCurrentUser.search as jest.Mock) @@ -195,7 +202,7 @@ describe('test endpoint route', () => { page_size: 10, }, { - page_index: 1, + page_index: 0, }, ], @@ -208,13 +215,13 @@ describe('test endpoint route', () => { mockAgentService.getAgentStatusById = jest.fn().mockReturnValue('error'); mockAgentService.listAgents = jest.fn().mockReturnValue(noUnenrolledAgent); + mockAgentPolicyService.getByIds = jest.fn().mockResolvedValueOnce([]); const metadata = new EndpointDocGenerator().generateHostMetadata(); const esSearchMock = mockScopedClient.asCurrentUser.search as jest.Mock; - esSearchMock.mockImplementationOnce(() => - Promise.resolve({ - body: unitedMetadataSearchResponse(metadata), - }) - ); + esSearchMock.mockResolvedValueOnce({}); + esSearchMock.mockResolvedValueOnce({ + body: unitedMetadataSearchResponseMock(metadata), + }); [routeConfig, routeHandler] = routerMock.post.mock.calls.find(([{ path }]) => path.startsWith(`${HOST_METADATA_LIST_ROUTE}`) )!; @@ -225,9 +232,11 @@ describe('test endpoint route', () => { mockResponse ); - expect(esSearchMock).toHaveBeenCalledTimes(1); + expect(esSearchMock).toHaveBeenCalledTimes(2); expect(esSearchMock.mock.calls[0][0]?.index).toEqual(METADATA_UNITED_INDEX); - expect(esSearchMock.mock.calls[0][0]?.body?.query).toEqual({ + expect(esSearchMock.mock.calls[0][0]?.size).toEqual(1); + expect(esSearchMock.mock.calls[1][0]?.index).toEqual(METADATA_UNITED_INDEX); + expect(esSearchMock.mock.calls[1][0]?.body?.query).toEqual({ bool: { must: [ { @@ -363,7 +372,7 @@ describe('test endpoint route', () => { expect(endpointResultList.hosts.length).toEqual(1); expect(endpointResultList.hosts[0].metadata).toEqual(metadata); expect(endpointResultList.total).toEqual(1); - expect(endpointResultList.request_page_index).toEqual(10); + expect(endpointResultList.request_page_index).toEqual(0); expect(endpointResultList.request_page_size).toEqual(10); }); }); @@ -412,7 +421,7 @@ describe('test endpoint route', () => { it('test find the latest of all endpoints', async () => { const mockRequest = httpServerMock.createKibanaRequest({}); - const response = legacyMetadataSearchResponse( + const response = legacyMetadataSearchResponseMock( new EndpointDocGenerator().generateHostMetadata() ); (mockScopedClient.asCurrentUser.search as jest.Mock) @@ -466,7 +475,9 @@ describe('test endpoint route', () => { }) .mockImplementationOnce(() => Promise.resolve({ - body: legacyMetadataSearchResponse(new EndpointDocGenerator().generateHostMetadata()), + body: legacyMetadataSearchResponseMock( + new EndpointDocGenerator().generateHostMetadata() + ), }) ); [routeConfig, routeHandler] = routerMock.post.mock.calls.find(([{ path }]) => @@ -526,7 +537,9 @@ describe('test endpoint route', () => { }) .mockImplementationOnce(() => Promise.resolve({ - body: legacyMetadataSearchResponse(new EndpointDocGenerator().generateHostMetadata()), + body: legacyMetadataSearchResponseMock( + new EndpointDocGenerator().generateHostMetadata() + ), }) ); [routeConfig, routeHandler] = routerMock.post.mock.calls.find(([{ path }]) => @@ -602,7 +615,7 @@ describe('test endpoint route', () => { const mockRequest = httpServerMock.createKibanaRequest({ params: { id: 'BADID' } }); (mockScopedClient.asCurrentUser.search as jest.Mock).mockImplementationOnce(() => - Promise.resolve({ body: legacyMetadataSearchResponse() }) + Promise.resolve({ body: legacyMetadataSearchResponseMock() }) ); mockAgentService.getAgentStatusById = jest.fn().mockReturnValue('error'); @@ -630,7 +643,7 @@ describe('test endpoint route', () => { }); it('should return a single endpoint with status healthy', async () => { - const response = legacyMetadataSearchResponse( + const response = legacyMetadataSearchResponseMock( new EndpointDocGenerator().generateHostMetadata() ); const mockRequest = httpServerMock.createKibanaRequest({ @@ -666,7 +679,7 @@ describe('test endpoint route', () => { }); it('should return a single endpoint with status unhealthy when AgentService throw 404', async () => { - const response = legacyMetadataSearchResponse( + const response = legacyMetadataSearchResponseMock( new EndpointDocGenerator().generateHostMetadata() ); @@ -703,7 +716,7 @@ describe('test endpoint route', () => { }); it('should return a single endpoint with status unhealthy when status is not offline, online or enrolling', async () => { - const response = legacyMetadataSearchResponse( + const response = legacyMetadataSearchResponseMock( new EndpointDocGenerator().generateHostMetadata() ); @@ -741,7 +754,7 @@ describe('test endpoint route', () => { }); it('should throw error when endpoint agent is not active', async () => { - const response = legacyMetadataSearchResponse( + const response = legacyMetadataSearchResponseMock( new EndpointDocGenerator().generateHostMetadata() ); diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/query_builders.fixtures.ts b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/query_builders.fixtures.ts index d2ad9831748b..67a1b1621109 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/query_builders.fixtures.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/query_builders.fixtures.ts @@ -11,7 +11,10 @@ export const expectedCompleteUnitedIndexQuery = { bool: { must_not: { terms: { - 'agent.id': ['test-agent-id'], + 'agent.id': [ + '00000000-0000-0000-0000-000000000000', + '11111111-1111-1111-1111-111111111111', + ], }, }, filter: [ diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/query_builders.test.ts b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/query_builders.test.ts index 46a16e48c7ed..a0cb5aad552d 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/query_builders.test.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/query_builders.test.ts @@ -16,8 +16,6 @@ import { createMockConfig } from '../../../lib/detection_engine/routes/__mocks__ import { metadataCurrentIndexPattern } from '../../../../common/endpoint/constants'; import { parseExperimentalConfigValue } from '../../../../common/experimental_features'; import { get } from 'lodash'; -import { KibanaRequest } from 'kibana/server'; -import { EndpointAppContext } from '../../types'; import { expectedCompleteUnitedIndexQuery } from './query_builders.fixtures'; describe('query builder', () => { @@ -55,19 +53,6 @@ describe('query builder', () => { }); }); - it('queries for all endpoints when no specific parameters requested', async () => { - const mockRequest = httpServerMock.createKibanaRequest({ - body: {}, - }); - const query = await kibanaRequestToMetadataListESQuery(mockRequest, { - logFactory: loggingSystemMock.create(), - service: new EndpointAppContextService(), - config: () => Promise.resolve(createMockConfig()), - experimentalFeatures: parseExperimentalConfigValue(createMockConfig().enableExperimental), - }); - expect(query.body.query).toHaveProperty('match_all'); - }); - it('excludes unenrolled elastic agents when they exist, by default', async () => { const unenrolledElasticAgentId = '1fdca33f-799f-49f4-939c-ea4383c77672'; const mockRequest = httpServerMock.createKibanaRequest({ @@ -89,8 +74,24 @@ describe('query builder', () => { expect(query.body.query).toEqual({ bool: { must_not: [ - { terms: { 'elastic.agent.id': [unenrolledElasticAgentId] } }, - { terms: { 'HostDetails.elastic.agent.id': [unenrolledElasticAgentId] } }, + { + terms: { + 'elastic.agent.id': [ + '00000000-0000-0000-0000-000000000000', + '11111111-1111-1111-1111-111111111111', + unenrolledElasticAgentId, + ], + }, + }, + { + terms: { + 'HostDetails.elastic.agent.id': [ + '00000000-0000-0000-0000-000000000000', + '11111111-1111-1111-1111-111111111111', + unenrolledElasticAgentId, + ], + }, + }, ], }, }); @@ -154,31 +155,42 @@ describe('query builder', () => { } ); - expect(query.body.query.bool.must).toContainEqual({ - bool: { - must_not: [ - // both of these should exist, since the schema can be *either* - { terms: { 'elastic.agent.id': [unenrolledElasticAgentId] } }, - { terms: { 'HostDetails.elastic.agent.id': [unenrolledElasticAgentId] } }, - ], - }, - }); - expect(query.body.query.bool.must).toContainEqual({ - bool: { - must_not: { - bool: { - should: [ - { - match: { - 'host.ip': '10.140.73.246', - }, + expect(query.body.query.bool.must).toEqual([ + { + bool: { + must_not: [ + { + terms: { + 'elastic.agent.id': [ + '00000000-0000-0000-0000-000000000000', + '11111111-1111-1111-1111-111111111111', + '1fdca33f-799f-49f4-939c-ea4383c77672', + ], }, - ], - minimum_should_match: 1, + }, + { + terms: { + 'HostDetails.elastic.agent.id': [ + '00000000-0000-0000-0000-000000000000', + '11111111-1111-1111-1111-111111111111', + '1fdca33f-799f-49f4-939c-ea4383c77672', + ], + }, + }, + ], + }, + }, + { + bool: { + must_not: { + bool: { + minimum_should_match: 1, + should: [{ match: { 'host.ip': '10.140.73.246' } }], + }, }, }, }, - }); + ]); } ); }); @@ -209,24 +221,18 @@ describe('query builder', () => { }); describe('buildUnitedIndexQuery', () => { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - let mockRequest: KibanaRequest; - let mockEndpointAppContext: EndpointAppContext; - const filters = { kql: '', host_status: [] }; - beforeEach(() => { - mockRequest = httpServerMock.createKibanaRequest({ body: { filters } }); - mockEndpointAppContext = { - logFactory: loggingSystemMock.create(), - service: new EndpointAppContextService(), - config: () => Promise.resolve(createMockConfig()), - experimentalFeatures: parseExperimentalConfigValue(createMockConfig().enableExperimental), - }; - }); - it('correctly builds empty query', async () => { - const query = await buildUnitedIndexQuery(mockRequest, mockEndpointAppContext, [], []); + const query = await buildUnitedIndexQuery({ page: 1, pageSize: 10, filters: {} }, []); const expected = { bool: { + must_not: { + terms: { + 'agent.id': [ + '00000000-0000-0000-0000-000000000000', + '11111111-1111-1111-1111-111111111111', + ], + }, + }, filter: [ { terms: { @@ -257,15 +263,16 @@ describe('query builder', () => { }); it('correctly builds query', async () => { - mockRequest.body.filters.kql = 'united.endpoint.host.os.name : *'; - mockRequest.body.filters.host_status = ['healthy']; - const ignoredAgentIds: string[] = ['test-agent-id']; - const endpointPolicyIds: string[] = ['test-endpoint-policy-id']; const query = await buildUnitedIndexQuery( - mockRequest, - mockEndpointAppContext, - ignoredAgentIds, - endpointPolicyIds + { + page: 1, + pageSize: 10, + filters: { + kql: 'united.endpoint.host.os.name : *', + host_status: ['healthy'], + }, + }, + ['test-endpoint-policy-id'] ); const expected = expectedCompleteUnitedIndexQuery; expect(query.body.query).toEqual(expected); diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/query_builders.ts b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/query_builders.ts index 8f10bc79bc0f..73325a92a332 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/query_builders.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/query_builders.ts @@ -12,9 +12,18 @@ import { METADATA_UNITED_INDEX, } from '../../../../common/endpoint/constants'; import { KibanaRequest } from '../../../../../../../src/core/server'; -import { EndpointAppContext } from '../../types'; +import { EndpointAppContext, GetHostMetadataListQuery } from '../../types'; import { buildStatusesKuery } from './support/agent_status'; +/** + * 00000000-0000-0000-0000-000000000000 is initial Elastic Agent id sent by Endpoint before policy is configured + * 11111111-1111-1111-1111-111111111111 is Elastic Agent id sent by Endpoint when policy does not contain an id + */ +const IGNORED_ELASTIC_AGENT_IDS = [ + '00000000-0000-0000-0000-000000000000', + '11111111-1111-1111-1111-111111111111', +]; + export interface QueryBuilderOptions { unenrolledAgentIds?: string[]; statusAgentIds?: string[]; @@ -53,7 +62,7 @@ export async function kibanaRequestToMetadataListESQuery( body: { query: buildQueryBody( request, - queryBuilderOptions?.unenrolledAgentIds, + IGNORED_ELASTIC_AGENT_IDS.concat(queryBuilderOptions?.unenrolledAgentIds ?? []), queryBuilderOptions?.statusAgentIds ), track_total_hits: true, @@ -65,7 +74,7 @@ export async function kibanaRequestToMetadataListESQuery( }; } -async function getPagingProperties( +export async function getPagingProperties( // eslint-disable-next-line @typescript-eslint/no-explicit-any request: KibanaRequest, endpointAppContext: EndpointAppContext @@ -82,7 +91,7 @@ async function getPagingProperties( } return { pageSize: pagingProperties.page_size || config.endpointResultListDefaultPageSize, - pageIndex: pagingProperties.page_index || config.endpointResultListDefaultFirstPageIndex, + pageIndex: pagingProperties.page_index ?? config.endpointResultListDefaultFirstPageIndex, }; } @@ -214,24 +223,26 @@ export function getESQueryHostMetadataByIDs(agentIDs: string[]) { }; } +interface BuildUnitedIndexQueryResponse { + body: { + query: Record; + track_total_hits: boolean; + sort: estypes.SearchSortContainer[]; + }; + from: number; + size: number; + index: string; +} export async function buildUnitedIndexQuery( - // eslint-disable-next-line @typescript-eslint/no-explicit-any - request: KibanaRequest, - endpointAppContext: EndpointAppContext, - ignoredAgentIds: string[] | undefined, + { page = 1, pageSize = 10, filters = {} }: GetHostMetadataListQuery, endpointPolicyIds: string[] = [] - // eslint-disable-next-line @typescript-eslint/no-explicit-any -): Promise> { - const pagingProperties = await getPagingProperties(request, endpointAppContext); - const statusesToFilter = request?.body?.filters?.host_status ?? []; +): Promise { + const statusesToFilter = filters?.host_status ?? []; const statusesKuery = buildStatusesKuery(statusesToFilter); - const filterIgnoredAgents = - ignoredAgentIds && ignoredAgentIds.length > 0 - ? { - must_not: { terms: { 'agent.id': ignoredAgentIds } }, - } - : null; + const filterIgnoredAgents = { + must_not: { terms: { 'agent.id': IGNORED_ELASTIC_AGENT_IDS } }, + }; const filterEndpointPolicyAgents = { filter: [ // must contain an endpoint policy id @@ -259,20 +270,16 @@ export async function buildUnitedIndexQuery( }, }; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - let query: Record = - filterIgnoredAgents || filterEndpointPolicyAgents - ? idFilter - : { - match_all: {}, - }; + let query: BuildUnitedIndexQueryResponse['body']['query'] = idFilter; - if (statusesKuery || request?.body?.filters?.kql) { - const kqlQuery = toElasticsearchQuery(fromKueryExpression(request.body.filters.kql)); + if (statusesKuery || filters?.kql) { + const kqlQuery = toElasticsearchQuery(fromKueryExpression(filters.kql ?? '')); const q = []; + if (filterIgnoredAgents || filterEndpointPolicyAgents) { q.push(idFilter); } + if (statusesKuery) { q.push(toElasticsearchQuery(fromKueryExpression(statusesKuery))); } @@ -288,8 +295,8 @@ export async function buildUnitedIndexQuery( track_total_hits: true, sort: MetadataSortMethod, }, - from: pagingProperties.pageIndex * pagingProperties.pageSize, - size: pagingProperties.pageSize, + from: (page - 1) * pageSize, + size: pageSize, index: METADATA_UNITED_INDEX, }; } diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/support/test_support.ts b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/support/test_support.ts index 2ffcc06915e7..6f8a0f83bf84 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/support/test_support.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/support/test_support.ts @@ -6,10 +6,11 @@ */ import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { Agent } from '../../../../../../fleet/common'; import { METADATA_UNITED_INDEX } from '../../../../../common/endpoint/constants'; import { HostMetadata, UnitedAgentMetadata } from '../../../../../common/endpoint/types'; -export function legacyMetadataSearchResponse( +export function legacyMetadataSearchResponseMock( hostMetadata?: HostMetadata ): estypes.SearchResponse { return { @@ -44,8 +45,9 @@ export function legacyMetadataSearchResponse( } as unknown as estypes.SearchResponse; } -export function unitedMetadataSearchResponse( - hostMetadata?: HostMetadata +export function unitedMetadataSearchResponseMock( + hostMetadata: HostMetadata = {} as HostMetadata, + agent: Agent = {} as Agent ): estypes.SearchResponse { return { took: 15, @@ -73,7 +75,9 @@ export function unitedMetadataSearchResponse( id: 'test-agent-id', }, united: { - agent: {}, + agent: { + ...agent, + }, endpoint: { ...hostMetadata, }, diff --git a/x-pack/plugins/security_solution/server/endpoint/services/metadata/endpoint_metadata_service.test.ts b/x-pack/plugins/security_solution/server/endpoint/services/metadata/endpoint_metadata_service.test.ts index c175fedda388..d3cc7b32bbc1 100644 --- a/x-pack/plugins/security_solution/server/endpoint/services/metadata/endpoint_metadata_service.test.ts +++ b/x-pack/plugins/security_solution/server/endpoint/services/metadata/endpoint_metadata_service.test.ts @@ -12,18 +12,28 @@ import { import { elasticsearchServiceMock } from '../../../../../../../src/core/server/mocks'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths import { ElasticsearchClientMock } from '../../../../../../../src/core/server/elasticsearch/client/mocks'; -import { legacyMetadataSearchResponse } from '../../routes/metadata/support/test_support'; +import { + legacyMetadataSearchResponseMock, + unitedMetadataSearchResponseMock, +} from '../../routes/metadata/support/test_support'; import { EndpointDocGenerator } from '../../../../common/endpoint/generate_data'; -import { getESQueryHostMetadataByFleetAgentIds } from '../../routes/metadata/query_builders'; +import { + getESQueryHostMetadataByFleetAgentIds, + buildUnitedIndexQuery, +} from '../../routes/metadata/query_builders'; import { EndpointError } from '../../errors'; import { HostMetadata } from '../../../../common/endpoint/types'; +import { Agent } from '../../../../../fleet/common'; +import { AgentPolicyServiceInterface } from '../../../../../fleet/server/services'; describe('EndpointMetadataService', () => { let testMockedContext: EndpointMetadataServiceTestContextMock; let metadataService: EndpointMetadataServiceTestContextMock['endpointMetadataService']; let esClient: ElasticsearchClientMock; + let endpointDocGenerator: EndpointDocGenerator; beforeEach(() => { + endpointDocGenerator = new EndpointDocGenerator('seed'); testMockedContext = createEndpointMetadataServiceTestContextMock(); metadataService = testMockedContext.endpointMetadataService; esClient = elasticsearchServiceMock.createScopedClusterClient().asInternalUser; @@ -35,10 +45,10 @@ describe('EndpointMetadataService', () => { beforeEach(() => { fleetAgentIds = ['one', 'two']; - endpointMetadataDoc = new EndpointDocGenerator().generateHostMetadata(); + endpointMetadataDoc = endpointDocGenerator.generateHostMetadata(); esClient.search.mockReturnValue( elasticsearchServiceMock.createSuccessTransportRequestPromise( - legacyMetadataSearchResponse(endpointMetadataDoc) + legacyMetadataSearchResponseMock(endpointMetadataDoc) ) ); }); @@ -66,4 +76,133 @@ describe('EndpointMetadataService', () => { expect(response).toEqual([endpointMetadataDoc]); }); }); + + describe('#doesUnitedIndexExist', () => { + it('should return true if united index found', async () => { + const esMockResponse = elasticsearchServiceMock.createSuccessTransportRequestPromise( + unitedMetadataSearchResponseMock() + ); + esClient.search.mockResolvedValue(esMockResponse); + const doesIndexExist = await metadataService.doesUnitedIndexExist(esClient); + + expect(doesIndexExist).toEqual(true); + }); + + it('should return false if united index not found', async () => { + const esMockResponse = elasticsearchServiceMock.createErrorTransportRequestPromise({ + meta: { body: { error: { type: 'index_not_found_exception' } } }, + }); + esClient.search.mockResolvedValue(esMockResponse); + const doesIndexExist = await metadataService.doesUnitedIndexExist(esClient); + + expect(doesIndexExist).toEqual(false); + }); + + it('should throw wrapped error if es error other than index not found', async () => { + const esMockResponse = elasticsearchServiceMock.createErrorTransportRequestPromise({}); + esClient.search.mockResolvedValue(esMockResponse); + const response = metadataService.doesUnitedIndexExist(esClient); + await expect(response).rejects.toThrow(EndpointError); + }); + }); + + describe('#getHostMetadataList', () => { + let agentPolicyServiceMock: jest.Mocked; + + beforeEach(() => { + agentPolicyServiceMock = testMockedContext.agentPolicyService; + esClient = elasticsearchServiceMock.createScopedClusterClient().asCurrentUser; + }); + + it('should throw wrapped error if es error', async () => { + const esMockResponse = elasticsearchServiceMock.createErrorTransportRequestPromise({}); + esClient.search.mockResolvedValue(esMockResponse); + const metadataListResponse = metadataService.getHostMetadataList(esClient); + await expect(metadataListResponse).rejects.toThrow(EndpointError); + }); + + it('should correctly list HostMetadata', async () => { + const policyId = 'test-agent-policy-id'; + const packagePolicies = [ + Object.assign(endpointDocGenerator.generatePolicyPackagePolicy(), { + id: 'test-package-policy-id', + policy_id: policyId, + revision: 1, + }), + ]; + const packagePolicyIds = packagePolicies.map((policy) => policy.policy_id); + const agentPolicies = [ + Object.assign(endpointDocGenerator.generateAgentPolicy(), { + id: policyId, + revision: 2, + package_policies: packagePolicies, + }), + ]; + const agentPolicyIds = agentPolicies.map((policy) => policy.id); + const endpointMetadataDoc = endpointDocGenerator.generateHostMetadata(); + const mockAgent = { + policy_id: agentPolicies[0].id, + policy_revision: agentPolicies[0].revision, + } as unknown as Agent; + const mockDoc = unitedMetadataSearchResponseMock(endpointMetadataDoc, mockAgent); + const esMockResponse = await elasticsearchServiceMock.createSuccessTransportRequestPromise( + mockDoc + ); + + esClient.search.mockResolvedValue(esMockResponse); + agentPolicyServiceMock.getByIds.mockResolvedValue(agentPolicies); + testMockedContext.packagePolicyService.list.mockImplementation( + async (_, { page, perPage }) => { + const response = { + items: packagePolicies, + page: page ?? 1, + total: packagePolicies.length, + perPage: packagePolicies.length, + }; + + if ((page ?? 1) > 1) { + response.items = []; + } + + return response; + } + ); + + const metadataListResponse = await metadataService.getHostMetadataList(esClient); + const unitedIndexQuery = await buildUnitedIndexQuery( + { page: 1, pageSize: 10, filters: {} }, + packagePolicyIds + ); + + expect(esClient.search).toBeCalledWith(unitedIndexQuery); + expect(agentPolicyServiceMock.getByIds).toBeCalledWith(expect.anything(), agentPolicyIds); + expect(metadataListResponse).toEqual({ + pageSize: 10, + page: 1, + total: 1, + data: [ + { + metadata: endpointMetadataDoc, + host_status: 'inactive', + policy_info: { + agent: { + applied: { + id: mockAgent.policy_id, + revision: mockAgent.policy_revision, + }, + configured: { + id: agentPolicies[0].id, + revision: agentPolicies[0].revision, + }, + }, + endpoint: { + id: packagePolicies[0].id, + revision: packagePolicies[0].revision, + }, + }, + }, + ], + }); + }); + }); }); diff --git a/x-pack/plugins/security_solution/server/endpoint/services/metadata/endpoint_metadata_service.ts b/x-pack/plugins/security_solution/server/endpoint/services/metadata/endpoint_metadata_service.ts index 23c21e431a34..be8a6625c111 100644 --- a/x-pack/plugins/security_solution/server/endpoint/services/metadata/endpoint_metadata_service.ts +++ b/x-pack/plugins/security_solution/server/endpoint/services/metadata/endpoint_metadata_service.ts @@ -11,22 +11,34 @@ import { SavedObjectsClientContract, SavedObjectsServiceStart, } from 'kibana/server'; -import { HostInfo, HostMetadata } from '../../../../common/endpoint/types'; + +import { TransportResult } from '@elastic/elasticsearch'; +import { SearchTotalHits, SearchResponse } from '@elastic/elasticsearch/lib/api/types'; +import { + HostInfo, + HostMetadata, + MaybeImmutable, + PolicyData, + UnitedAgentMetadata, +} from '../../../../common/endpoint/types'; import { Agent, AgentPolicy, PackagePolicy } from '../../../../../fleet/common'; import { AgentNotFoundError, AgentPolicyServiceInterface, AgentService, + PackagePolicyServiceInterface, } from '../../../../../fleet/server'; import { EndpointHostNotFoundError, EndpointHostUnEnrolledError, FleetAgentNotFoundError, FleetAgentPolicyNotFoundError, + FleetEndpointPackagePolicyNotFoundError, } from './errors'; import { getESQueryHostMetadataByFleetAgentIds, getESQueryHostMetadataByID, + buildUnitedIndexQuery, } from '../../routes/metadata/query_builders'; import { queryResponseToHostListResult, @@ -40,11 +52,28 @@ import { } from '../../utils'; import { EndpointError } from '../../errors'; import { createInternalReadonlySoClient } from '../../utils/create_internal_readonly_so_client'; +import { GetHostMetadataListQuery } from '../../types'; +import { METADATA_UNITED_INDEX } from '../../../../common/endpoint/constants'; +import { getAllEndpointPackagePolicies } from '../../routes/metadata/support/endpoint_package_policies'; +import { getAgentStatus } from '../../../../../fleet/common/services/agent_status'; type AgentPolicyWithPackagePolicies = Omit & { package_policies: PackagePolicy[]; }; +const isAgentPolicyWithPackagePolicies = ( + agentPolicy: AgentPolicy | AgentPolicyWithPackagePolicies +): agentPolicy is AgentPolicyWithPackagePolicies => { + if ( + agentPolicy.package_policies.length === 0 || + typeof agentPolicy.package_policies[0] !== 'string' + ) { + return true; + } + + return false; +}; + export class EndpointMetadataService { /** * For internal use only by the `this.DANGEROUS_INTERNAL_SO_CLIENT` @@ -56,6 +85,7 @@ export class EndpointMetadataService { private savedObjectsStart: SavedObjectsServiceStart, private readonly agentService: AgentService, private readonly agentPolicyService: AgentPolicyServiceInterface, + private readonly packagePolicyService: PackagePolicyServiceInterface, private readonly logger?: Logger ) {} @@ -161,52 +191,119 @@ export class EndpointMetadataService { ); } - // ------------------------------------------------------------------------------ - // Any failures in enriching the Host form this point should NOT cause an error - // ------------------------------------------------------------------------------ - try { - let fleetAgentPolicy: AgentPolicyWithPackagePolicies | undefined; - let endpointPackagePolicy: PackagePolicy | undefined; - - // Get Agent Policy and Endpoint Package Policy - if (fleetAgent) { - try { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - fleetAgentPolicy = await this.getFleetAgentPolicy(fleetAgent.policy_id!); - endpointPackagePolicy = fleetAgentPolicy.package_policies.find( - (policy) => policy.package?.name === 'endpoint' + return this.enrichHostMetadata(esClient, endpointMetadata, fleetAgent); + } + + /** + * Enriches a host metadata document with data from fleet + * @param esClient + * @param endpointMetadata + * @param _fleetAgent + * @param _fleetAgentPolicy + * @param _endpointPackagePolicy + * @private + */ + // eslint-disable-next-line complexity + private async enrichHostMetadata( + esClient: ElasticsearchClient, + endpointMetadata: HostMetadata, + /** + * If undefined, it will be retrieved from Fleet using the ID in the endpointMetadata. + * If passing in an `Agent` record that was retrieved from the Endpoint Unified transform index, + * ensure that its `.status` property is properly set to the calculated value done by + * fleet `getAgentStatus()` method. + */ + _fleetAgent?: MaybeImmutable, + /** If undefined, it will be retrieved from Fleet using data from the endpointMetadata */ + _fleetAgentPolicy?: + | MaybeImmutable + | MaybeImmutable, + /** If undefined, it will be retrieved from Fleet using the ID in the endpointMetadata */ + _endpointPackagePolicy?: MaybeImmutable + ): Promise { + let fleetAgentId = endpointMetadata.elastic.agent.id; + // casting below is done only to remove `immutable<>` from the object if they are defined as such + let fleetAgent = _fleetAgent as Agent | undefined; + let fleetAgentPolicy = _fleetAgentPolicy as + | AgentPolicy + | AgentPolicyWithPackagePolicies + | undefined; + let endpointPackagePolicy = _endpointPackagePolicy as PackagePolicy | undefined; + + if (!fleetAgent) { + try { + if (!fleetAgentId) { + fleetAgentId = endpointMetadata.agent.id; + this.logger?.warn( + new EndpointError( + `Missing elastic fleet agent id on Endpoint Metadata doc - using Endpoint agent.id instead: ${fleetAgentId}` + ) ); - } catch (error) { - this.logger?.error(error); + } + + fleetAgent = await this.getFleetAgent(esClient, fleetAgentId); + } catch (error) { + if (error instanceof FleetAgentNotFoundError) { + this.logger?.warn(`agent with id ${fleetAgentId} not found`); + } else { + throw error; } } + } - return { - metadata: endpointMetadata, - host_status: fleetAgent - ? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - fleetAgentStatusToEndpointHostStatus(fleetAgent.status!) - : DEFAULT_ENDPOINT_HOST_STATUS, - policy_info: { - agent: { - applied: { - revision: fleetAgent?.policy_revision ?? 0, - id: fleetAgent?.policy_id ?? '', - }, - configured: { - revision: fleetAgentPolicy?.revision ?? 0, - id: fleetAgentPolicy?.id ?? '', - }, + if (!fleetAgentPolicy && fleetAgent) { + try { + fleetAgentPolicy = await this.getFleetAgentPolicy(fleetAgent.policy_id ?? ''); + } catch (error) { + this.logger?.error(error); + } + } + + // The fleetAgentPolicy might have the endpoint policy in the `package_policies`, lets check that first + if ( + !endpointPackagePolicy && + fleetAgentPolicy && + isAgentPolicyWithPackagePolicies(fleetAgentPolicy) + ) { + endpointPackagePolicy = fleetAgentPolicy.package_policies.find( + (policy) => policy.package?.name === 'endpoint' + ); + } + + // if we still don't have an endpoint package policy, try retrieving it from fleet + if (!endpointPackagePolicy) { + try { + endpointPackagePolicy = await this.getFleetEndpointPackagePolicy( + endpointMetadata.Endpoint.policy.applied.id + ); + } catch (error) { + this.logger?.error(error); + } + } + + return { + metadata: endpointMetadata, + host_status: fleetAgent + ? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + fleetAgentStatusToEndpointHostStatus(fleetAgent.status!) + : DEFAULT_ENDPOINT_HOST_STATUS, + policy_info: { + agent: { + applied: { + revision: fleetAgent?.policy_revision ?? 0, + id: fleetAgent?.policy_id ?? '', }, - endpoint: { - revision: endpointPackagePolicy?.revision ?? 0, - id: endpointPackagePolicy?.id ?? '', + configured: { + revision: fleetAgentPolicy?.revision ?? 0, + id: fleetAgentPolicy?.id ?? '', }, }, - }; - } catch (error) { - throw wrapErrorIfNeeded(error); - } + endpoint: { + revision: endpointPackagePolicy?.revision ?? 0, + id: endpointPackagePolicy?.id ?? '', + }, + }, + }; } /** @@ -247,4 +344,139 @@ export class EndpointMetadataService { `Fleet agent policy with id ${agentPolicyId} not found` ); } + + /** + * Retrieve an endpoint policy from fleet + * @param endpointPolicyId + * @throws + */ + async getFleetEndpointPackagePolicy(endpointPolicyId: string): Promise { + const endpointPackagePolicy = await this.packagePolicyService + .get(this.DANGEROUS_INTERNAL_SO_CLIENT, endpointPolicyId) + .catch(catchAndWrapError); + + if (!endpointPackagePolicy) { + throw new FleetEndpointPackagePolicyNotFoundError( + `Fleet endpoint package policy with id ${endpointPolicyId} not found` + ); + } + + return endpointPackagePolicy as PolicyData; + } + + /** + * Returns whether the united metadata index exists + * + * @param esClient + * + * @throws + */ + async doesUnitedIndexExist(esClient: ElasticsearchClient): Promise { + try { + await esClient.search({ + index: METADATA_UNITED_INDEX, + size: 1, + }); + return true; + } catch (error) { + const errorType = error?.meta?.body?.error?.type ?? ''; + // only index not found is expected + if (errorType !== 'index_not_found_exception') { + const err = wrapErrorIfNeeded(error); + this.logger?.error(err); + throw err; + } + } + + return false; + } + + /** + * Retrieve list of host metadata. Only supports new united index. + * + * @param esClient + * @param queryOptions + * + * @throws + */ + async getHostMetadataList( + esClient: ElasticsearchClient, + queryOptions: GetHostMetadataListQuery = {} + ): Promise<{ data: HostInfo[]; total: number; page: number; pageSize: number }> { + const endpointPolicies = await getAllEndpointPackagePolicies( + this.packagePolicyService, + this.DANGEROUS_INTERNAL_SO_CLIENT + ); + const endpointPolicyIds = endpointPolicies.map((policy) => policy.policy_id); + const unitedIndexQuery = await buildUnitedIndexQuery(queryOptions, endpointPolicyIds); + + let unitedMetadataQueryResponse: TransportResult, unknown>; + + try { + unitedMetadataQueryResponse = await esClient.search(unitedIndexQuery); + } catch (error) { + const err = wrapErrorIfNeeded(error); + this.logger?.error(err); + throw err; + } + + const { hits: docs, total: docsCount } = unitedMetadataQueryResponse?.body?.hits || {}; + const agentPolicyIds: string[] = docs.map((doc) => doc._source?.united?.agent?.policy_id ?? ''); + + const agentPolicies = + (await this.agentPolicyService + .getByIds(this.DANGEROUS_INTERNAL_SO_CLIENT, agentPolicyIds) + .catch(catchAndWrapError)) ?? []; + + const agentPoliciesMap: Record = agentPolicies.reduce( + (acc, agentPolicy) => ({ + ...acc, + [agentPolicy.id]: { + ...agentPolicy, + }, + }), + {} + ); + + const endpointPoliciesMap: Record = endpointPolicies.reduce( + (acc, packagePolicy) => ({ + ...acc, + [packagePolicy.policy_id]: packagePolicy, + }), + {} + ); + + const hosts: HostInfo[] = []; + + for (const doc of docs) { + const { endpoint: metadata, agent: _agent } = doc?._source?.united ?? {}; + + if (metadata && _agent) { + // `_agent: Agent` here is the record stored in the unified index, whose `status` **IS NOT** the + // calculated status returned by the normal fleet API/Service. So lets calculated it before + // passing this on to other methods that expect an `Agent` type + const agent: typeof _agent = { + ..._agent, + // Casting below necessary to remove `Immutable<>` from the type + status: getAgentStatus(_agent as Agent), + }; + + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const agentPolicy = agentPoliciesMap[agent.policy_id!]; + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const endpointPolicy = endpointPoliciesMap[agent.policy_id!]; + + hosts.push( + await this.enrichHostMetadata(esClient, metadata, agent, agentPolicy, endpointPolicy) + ); + } + } + + return { + data: hosts, + pageSize: unitedIndexQuery.size, + page: unitedIndexQuery.from + 1, + total: (docsCount as unknown as SearchTotalHits).value, + }; + } } diff --git a/x-pack/plugins/security_solution/server/endpoint/services/metadata/errors.ts b/x-pack/plugins/security_solution/server/endpoint/services/metadata/errors.ts index f61ad79a4c92..c825211fede2 100644 --- a/x-pack/plugins/security_solution/server/endpoint/services/metadata/errors.ts +++ b/x-pack/plugins/security_solution/server/endpoint/services/metadata/errors.ts @@ -16,3 +16,5 @@ export class EndpointHostUnEnrolledError extends EndpointError {} export class FleetAgentNotFoundError extends NotFoundError {} export class FleetAgentPolicyNotFoundError extends NotFoundError {} + +export class FleetEndpointPackagePolicyNotFoundError extends NotFoundError {} diff --git a/x-pack/plugins/security_solution/server/endpoint/services/metadata/mocks.ts b/x-pack/plugins/security_solution/server/endpoint/services/metadata/mocks.ts index 147d8e11b567..166f83450092 100644 --- a/x-pack/plugins/security_solution/server/endpoint/services/metadata/mocks.ts +++ b/x-pack/plugins/security_solution/server/endpoint/services/metadata/mocks.ts @@ -11,9 +11,23 @@ import { savedObjectsServiceMock } from '../../../../../../../src/core/server/mo import { createMockAgentPolicyService, createMockAgentService, + createPackagePolicyServiceMock, } from '../../../../../fleet/server/mocks'; import { AgentPolicyServiceInterface, AgentService } from '../../../../../fleet/server'; +const createCustomizedPackagePolicyService = () => { + const service = createPackagePolicyServiceMock(); + service.list.mockImplementation(async (_, options) => { + return { + items: [], + total: 0, + page: options.page ?? 1, + perPage: options.perPage ?? 10, + }; + }); + return service; +}; + /** * Endpoint Metadata Service test context. Includes an instance of `EndpointMetadataService` along with the * dependencies that were used to initialize that instance. @@ -22,24 +36,30 @@ export interface EndpointMetadataServiceTestContextMock { savedObjectsStart: jest.Mocked; agentService: jest.Mocked; agentPolicyService: jest.Mocked; + packagePolicyService: ReturnType; endpointMetadataService: EndpointMetadataService; } export const createEndpointMetadataServiceTestContextMock = ( savedObjectsStart: jest.Mocked = savedObjectsServiceMock.createStartContract(), agentService: jest.Mocked = createMockAgentService(), - agentPolicyService: jest.Mocked = createMockAgentPolicyService() + agentPolicyService: jest.Mocked = createMockAgentPolicyService(), + packagePolicyService: ReturnType< + typeof createPackagePolicyServiceMock + > = createCustomizedPackagePolicyService() ): EndpointMetadataServiceTestContextMock => { const endpointMetadataService = new EndpointMetadataService( savedObjectsStart, agentService, - agentPolicyService + agentPolicyService, + packagePolicyService ); return { savedObjectsStart, agentService, agentPolicyService, + packagePolicyService, endpointMetadataService, }; }; diff --git a/x-pack/plugins/security_solution/server/endpoint/types.ts b/x-pack/plugins/security_solution/server/endpoint/types.ts index bc52b759b9f0..919e62785f69 100644 --- a/x-pack/plugins/security_solution/server/endpoint/types.ts +++ b/x-pack/plugins/security_solution/server/endpoint/types.ts @@ -7,10 +7,12 @@ import { LoggerFactory } from 'kibana/server'; +import { TypeOf } from '@kbn/config-schema'; import { ConfigType } from '../config'; import { EndpointAppContextService } from './endpoint_app_context_services'; import { HostMetadata } from '../../common/endpoint/types'; import { ExperimentalFeatures } from '../../common/experimental_features'; +import { endpointFilters } from './routes/metadata'; /** * The context for Endpoint apps. @@ -35,3 +37,11 @@ export interface HostQueryResult { resultLength: number; result: HostMetadata | undefined; } + +// FIXME: when new Host Metadata list API is created (and existing one deprecated - 8.0?), move this type out of here and created it from Schema +export interface GetHostMetadataListQuery { + /* page number 1 based - not an index */ + page?: number; + pageSize?: number; + filters?: Partial>; +} diff --git a/x-pack/plugins/security_solution/server/index.ts b/x-pack/plugins/security_solution/server/index.ts index 16a4992e6869..43da8f5d8f0e 100644 --- a/x-pack/plugins/security_solution/server/index.ts +++ b/x-pack/plugins/security_solution/server/index.ts @@ -21,26 +21,31 @@ export const config: PluginConfigDescriptor = { }, schema: configSchema, deprecations: ({ renameFromRoot }) => [ - renameFromRoot('xpack.siem.enabled', 'xpack.securitySolution.enabled'), + renameFromRoot('xpack.siem.enabled', 'xpack.securitySolution.enabled', { level: 'critical' }), renameFromRoot( 'xpack.siem.maxRuleImportExportSize', - 'xpack.securitySolution.maxRuleImportExportSize' + 'xpack.securitySolution.maxRuleImportExportSize', + { level: 'critical' } ), renameFromRoot( 'xpack.siem.maxRuleImportPayloadBytes', - 'xpack.securitySolution.maxRuleImportPayloadBytes' + 'xpack.securitySolution.maxRuleImportPayloadBytes', + { level: 'critical' } ), renameFromRoot( 'xpack.siem.maxTimelineImportExportSize', - 'xpack.securitySolution.maxTimelineImportExportSize' + 'xpack.securitySolution.maxTimelineImportExportSize', + { level: 'critical' } ), renameFromRoot( 'xpack.siem.maxTimelineImportPayloadBytes', - 'xpack.securitySolution.maxTimelineImportPayloadBytes' + 'xpack.securitySolution.maxTimelineImportPayloadBytes', + { level: 'critical' } ), renameFromRoot( `xpack.siem.${SIGNALS_INDEX_KEY}`, - `xpack.securitySolution.${SIGNALS_INDEX_KEY}` + `xpack.securitySolution.${SIGNALS_INDEX_KEY}`, + { level: 'critical' } ), ], }; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/update_rules_bulk_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/update_rules_bulk_route.ts index 80b77722e79b..db4887f14108 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/update_rules_bulk_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/update_rules_bulk_route.ts @@ -89,8 +89,7 @@ export const updateRulesBulkRoute = ( rulesClient, ruleStatusClient, defaultOutputIndex: siemClient.getSignalsIndex(), - existingRule, - migratedRule, + existingRule: migratedRule, ruleUpdate: payloadRule, isRuleRegistryEnabled, }); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/update_rules_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/update_rules_route.ts index 1aad28d110bd..d18171c48951 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/update_rules_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/update_rules_route.ts @@ -79,8 +79,7 @@ export const updateRulesRoute = ( isRuleRegistryEnabled, rulesClient, ruleStatusClient, - existingRule, - migratedRule, + existingRule: migratedRule, ruleUpdate: request.body, spaceId: context.securitySolution.getSpaceId(), }); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/types.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/types.ts index ed0f0447ad3b..f847e385e647 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/types.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/types.ts @@ -268,7 +268,6 @@ export interface UpdateRulesOptions { rulesClient: RulesClient; defaultOutputIndex: string; existingRule: SanitizedAlert | null | undefined; - migratedRule: SanitizedAlert | null | undefined; ruleUpdate: UpdateRulesSchema; } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/update_rules.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/update_rules.ts index ae16d0435e3d..eb406cffccbb 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/update_rules.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/update_rules.ts @@ -16,13 +16,7 @@ import { addTags } from './add_tags'; import { typeSpecificSnakeToCamel } from '../schemas/rule_converters'; import { internalRuleUpdate, RuleParams } from '../schemas/rule_schemas'; import { enableRule } from './enable_rule'; -import { - maybeMute, - transformToAlertThrottle, - transformToNotifyWhen, - updateActions, - updateThrottleNotifyWhen, -} from './utils'; +import { maybeMute, transformToAlertThrottle, transformToNotifyWhen } from './utils'; class UpdateError extends Error { public readonly statusCode: number; @@ -38,7 +32,6 @@ export const updateRules = async ({ ruleStatusClient, defaultOutputIndex, existingRule, - migratedRule, ruleUpdate, }: UpdateRulesOptions): Promise | null> => { if (existingRule == null) { @@ -86,24 +79,9 @@ export const updateRules = async ({ ...typeSpecificParams, }, schedule: { interval: ruleUpdate.interval ?? '5m' }, - actions: updateActions( - transformRuleToAlertAction, - migratedRule?.actions, - existingRule.actions, - ruleUpdate?.actions - ), - throttle: updateThrottleNotifyWhen( - transformToAlertThrottle, - migratedRule?.throttle, - existingRule.throttle, - ruleUpdate?.throttle - ), - notifyWhen: updateThrottleNotifyWhen( - transformToNotifyWhen, - migratedRule?.notifyWhen, - existingRule.notifyWhen, - ruleUpdate?.throttle - ), + actions: ruleUpdate.actions != null ? ruleUpdate.actions.map(transformRuleToAlertAction) : [], + throttle: transformToAlertThrottle(ruleUpdate.throttle), + notifyWhen: transformToNotifyWhen(ruleUpdate.throttle), }; const [validated, errors] = validate(newInternalRule, internalRuleUpdate); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/utils.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/utils.ts index c9e00486dc13..ec25b45dd159 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/utils.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/utils.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { pickBy, isEmpty, isEqual } from 'lodash/fp'; +import { pickBy, isEmpty } from 'lodash/fp'; import type { FromOrUndefined, MachineLearningJobIdOrUndefined, @@ -64,14 +64,10 @@ import { RulesClient } from '../../../../../alerting/server'; // eslint-disable-next-line no-restricted-imports import { LegacyRuleActions } from '../rule_actions/legacy_types'; import { FullResponseSchema } from '../../../../common/detection_engine/schemas/request'; -import { - transformAlertToRuleAction, - transformRuleToAlertAction, -} from '../../../../common/detection_engine/transform_actions'; +import { transformAlertToRuleAction } from '../../../../common/detection_engine/transform_actions'; // eslint-disable-next-line no-restricted-imports import { legacyRuleActionsSavedObjectType } from '../rule_actions/legacy_saved_object_mappings'; import { LegacyMigrateParams } from './types'; -import { RuleAlertAction } from '../../../../common/detection_engine/types'; export const calculateInterval = ( interval: string | undefined, @@ -368,35 +364,3 @@ export const legacyMigrate = async ({ } return rule; }; - -export const updateThrottleNotifyWhen = ( - transform: typeof transformToAlertThrottle | typeof transformToNotifyWhen, - migratedRuleThrottle: string | null | undefined, - existingRuleThrottle: string | null | undefined, - ruleUpdateThrottle: string | null | undefined -) => { - if (existingRuleThrottle == null && ruleUpdateThrottle == null && migratedRuleThrottle != null) { - return migratedRuleThrottle; - } - return transform(ruleUpdateThrottle); -}; - -export const updateActions = ( - transform: typeof transformRuleToAlertAction, - migratedRuleActions: AlertAction[] | null | undefined, - existingRuleActions: AlertAction[] | null | undefined, - ruleUpdateActions: RuleAlertAction[] | null | undefined -) => { - // if the existing rule actions and the rule update actions are equivalent (aka no change) - // but the migrated actions and the ruleUpdateActions (or existing rule actions, associatively) - // are not equivalent, we know that the rules' actions were migrated and we need to apply - // that change to the update request so it is not overwritten by the rule update payload - if ( - existingRuleActions?.length === 0 && - ruleUpdateActions == null && - !isEqual(existingRuleActions, migratedRuleActions) - ) { - return migratedRuleActions; - } - return ruleUpdateActions != null ? ruleUpdateActions.map(transform) : []; -}; diff --git a/x-pack/plugins/security_solution/server/plugin.ts b/x-pack/plugins/security_solution/server/plugin.ts index 843bd0ed7019..87f0ed7193a6 100644 --- a/x-pack/plugins/security_solution/server/plugin.ts +++ b/x-pack/plugins/security_solution/server/plugin.ts @@ -405,6 +405,8 @@ export class Plugin implements ISecuritySolutionPlugin { plugins.fleet?.agentService!, // eslint-disable-next-line @typescript-eslint/no-non-null-assertion plugins.fleet?.agentPolicyService!, + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + plugins.fleet?.packagePolicyService!, logger ), security: plugins.security, diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/home.helpers.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/home.helpers.ts index 71930efe1295..1e16fa2a4012 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/home.helpers.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/home.helpers.ts @@ -7,12 +7,18 @@ import { act } from 'react-dom/test-utils'; -import { registerTestBed, findTestSubject, TestBed, TestBedConfig, delay } from '@kbn/test/jest'; +import { + registerTestBed, + findTestSubject, + TestBed, + AsyncTestBedConfig, + delay, +} from '@kbn/test/jest'; import { SnapshotRestoreHome } from '../../../public/application/sections/home/home'; import { BASE_PATH } from '../../../public/application/constants'; import { WithAppDependencies } from './setup_environment'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [`${BASE_PATH}/repositories`], componentRoutePath: `${BASE_PATH}/:section(repositories|snapshots)/:repositoryName?/:snapshotId*`, diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_add.helpers.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_add.helpers.ts index b3eeaeedbbe5..a6e7c4a4c105 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_add.helpers.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_add.helpers.ts @@ -5,12 +5,12 @@ * 2.0. */ -import { registerTestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { PolicyAdd } from '../../../public/application/sections/policy_add'; import { formSetup, PolicyFormTestSubjects } from './policy_form.helpers'; import { WithAppDependencies } from './setup_environment'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: ['/add_policy'], componentRoutePath: '/add_policy', diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_edit.helpers.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_edit.helpers.ts index 71b500ac7326..2014d22ffbfb 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_edit.helpers.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_edit.helpers.ts @@ -5,13 +5,13 @@ * 2.0. */ -import { registerTestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { PolicyEdit } from '../../../public/application/sections/policy_edit'; import { WithAppDependencies } from './setup_environment'; import { POLICY_NAME } from './constant'; import { formSetup, PolicyFormTestSubjects } from './policy_form.helpers'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [`/edit_policy/${POLICY_NAME}`], componentRoutePath: '/edit_policy/:name', diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/repository_edit.helpers.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/repository_edit.helpers.ts index 9a6f0d9a76bd..f0563f2831a9 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/repository_edit.helpers.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/repository_edit.helpers.ts @@ -5,12 +5,12 @@ * 2.0. */ -import { registerTestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { RepositoryEdit } from '../../../public/application/sections/repository_edit'; import { WithAppDependencies } from './setup_environment'; import { REPOSITORY_NAME } from './constant'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [`/${REPOSITORY_NAME}`], componentRoutePath: '/:name', diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/restore_snapshot.helpers.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/restore_snapshot.helpers.ts index 9b82c1d5b636..123ae0cbb1c2 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/restore_snapshot.helpers.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/restore_snapshot.helpers.ts @@ -6,11 +6,11 @@ */ import { act } from 'react-dom/test-utils'; -import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { RestoreSnapshot } from '../../../public/application/sections/restore_snapshot'; import { WithAppDependencies } from './setup_environment'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: ['/add_policy'], componentRoutePath: '/add_policy', diff --git a/x-pack/plugins/spaces/public/management/spaces_management_app.test.tsx b/x-pack/plugins/spaces/public/management/spaces_management_app.test.tsx index 0b6df121cb16..aefff7fb3c76 100644 --- a/x-pack/plugins/spaces/public/management/spaces_management_app.test.tsx +++ b/x-pack/plugins/spaces/public/management/spaces_management_app.test.tsx @@ -77,7 +77,7 @@ describe('spacesManagementApp', () => { const { setBreadcrumbs, container, unmount, docTitle } = await mountApp('/', '/'); expect(setBreadcrumbs).toHaveBeenCalledTimes(1); - expect(setBreadcrumbs).toHaveBeenCalledWith([{ href: `/`, text: 'Spaces' }]); + expect(setBreadcrumbs).toHaveBeenCalledWith([{ text: 'Spaces' }]); expect(docTitle.change).toHaveBeenCalledWith('Spaces'); expect(docTitle.reset).not.toHaveBeenCalled(); expect(container).toMatchInlineSnapshot(` @@ -102,7 +102,7 @@ describe('spacesManagementApp', () => { expect(setBreadcrumbs).toHaveBeenCalledTimes(1); expect(setBreadcrumbs).toHaveBeenCalledWith([ { href: `/`, text: 'Spaces' }, - { href: '/create', text: 'Create' }, + { text: 'Create' }, ]); expect(docTitle.change).toHaveBeenCalledWith('Spaces'); expect(docTitle.reset).not.toHaveBeenCalled(); @@ -134,7 +134,7 @@ describe('spacesManagementApp', () => { expect(setBreadcrumbs).toHaveBeenCalledTimes(1); expect(setBreadcrumbs).toHaveBeenCalledWith([ { href: `/`, text: 'Spaces' }, - { href: `/edit/${spaceId}`, text: `space with id some-space` }, + { text: `space with id some-space` }, ]); expect(docTitle.change).toHaveBeenCalledWith('Spaces'); expect(docTitle.reset).not.toHaveBeenCalled(); diff --git a/x-pack/plugins/spaces/public/management/spaces_management_app.tsx b/x-pack/plugins/spaces/public/management/spaces_management_app.tsx index 5d44a1cd7863..8ea947a33037 100644 --- a/x-pack/plugins/spaces/public/management/spaces_management_app.tsx +++ b/x-pack/plugins/spaces/public/management/spaces_management_app.tsx @@ -43,18 +43,16 @@ export const spacesManagementApp = Object.freeze({ const [[coreStart, { features }], { SpacesGridPage }, { ManageSpacePage }] = await Promise.all([getStartServices(), import('./spaces_grid'), import('./edit_space')]); - const spacesBreadcrumbs = [ - { - text: title, - href: `/`, - }, - ]; + const spacesFirstBreadcrumb = { + text: title, + href: `/`, + }; const { notifications, i18n: i18nStart, application, chrome } = coreStart; chrome.docTitle.change(title); const SpacesGridPageWithBreadcrumbs = () => { - setBreadcrumbs(spacesBreadcrumbs); + setBreadcrumbs([{ ...spacesFirstBreadcrumb, href: undefined }]); return ( { setBreadcrumbs([ - ...spacesBreadcrumbs, + spacesFirstBreadcrumb, { text: i18n.translate('xpack.spaces.management.createSpaceBreadcrumb', { defaultMessage: 'Create', }), - href: '/create', }, ]); @@ -94,10 +91,9 @@ export const spacesManagementApp = Object.freeze({ const onLoadSpace = (space: Space) => { setBreadcrumbs([ - ...spacesBreadcrumbs, + spacesFirstBreadcrumb, { text: space.name, - href: `/edit/${encodeURIComponent(space.id)}`, }, ]); }; diff --git a/x-pack/plugins/spaces/public/nav_control/components/spaces_menu.scss b/x-pack/plugins/spaces/public/nav_control/components/spaces_menu.scss index 1f272260fc9c..f444b45192f8 100644 --- a/x-pack/plugins/spaces/public/nav_control/components/spaces_menu.scss +++ b/x-pack/plugins/spaces/public/nav_control/components/spaces_menu.scss @@ -3,8 +3,8 @@ } .spcMenu__spacesList { + @include euiYScrollWithShadows; max-height: $euiSizeXL * 10; - overflow-y: auto; } .spcMenu__searchFieldWrapper { @@ -18,4 +18,4 @@ .spcMenu__item { margin-left: $euiSizeM; -} \ No newline at end of file +} diff --git a/x-pack/plugins/task_manager/server/plugin.ts b/x-pack/plugins/task_manager/server/plugin.ts index 9a43cd5b8c1d..4e1db9c274b5 100644 --- a/x-pack/plugins/task_manager/server/plugin.ts +++ b/x-pack/plugins/task_manager/server/plugin.ts @@ -159,7 +159,7 @@ export class TaskManagerPlugin const taskStore = new TaskStore({ serializer, savedObjectsRepository, - esClient: elasticsearch.createClient('taskManager').asInternalUser, + esClient: elasticsearch.client.asInternalUser, index: TASK_MANAGER_INDEX, definitions: this.definitions, taskManagerId: `kibana:${this.taskManagerId!}`, diff --git a/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/checkbox.test.tsx b/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/checkbox.test.tsx index c5aba4506f39..56d2df3754fa 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/checkbox.test.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/checkbox.test.tsx @@ -45,8 +45,8 @@ describe('checkbox control column', () => { const { getByTestId } = render( ); - - fireEvent.click(getByTestId('select-event')); + const checkbox = getByTestId(/^select-event/); + fireEvent.click(checkbox); expect(onRowSelected).toHaveBeenCalled(); }); diff --git a/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/checkbox.tsx b/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/checkbox.tsx index 0d750a002914..6feb972b9a81 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/checkbox.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/checkbox.tsx @@ -7,6 +7,7 @@ import { EuiCheckbox, EuiLoadingSpinner } from '@elastic/eui'; import React, { useCallback } from 'react'; +import { ALERT_RULE_PRODUCER } from '@kbn/rule-data-utils'; import { ActionProps, HeaderActionProps } from '../../../../../common'; import * as i18n from './translations'; @@ -18,7 +19,10 @@ export const RowCheckBox = ({ columnValues, disabled, loadingEventIds, + data, }: ActionProps) => { + const ruleProducers = data.find((d) => d.field === ALERT_RULE_PRODUCER)?.value ?? []; + const ruleProducer = ruleProducers[0]; const handleSelectEvent = useCallback( (event: React.ChangeEvent) => { if (!disabled) { @@ -35,7 +39,7 @@ export const RowCheckBox = ({ ) : ( = React.memo( ({ overrides = {}, onChange, searchItems, stepDefineState }) => { const deps = useAppDependencies(); + const { capabilities } = deps.application; const toastNotifications = useToastNotifications(); const { esIndicesCreateIndex } = useDocumentationLinks(); @@ -83,9 +85,18 @@ export const StepDetailsForm: FC = React.memo( const [transformIds, setTransformIds] = useState([]); const [indexNames, setIndexNames] = useState([]); + const canCreateDataView = useMemo( + () => + capabilities.savedObjectsManagement.edit === true || + capabilities.indexPatterns.save === true, + [capabilities] + ); + // Index pattern state const [indexPatternTitles, setIndexPatternTitles] = useState([]); - const [createIndexPattern, setCreateIndexPattern] = useState(defaults.createIndexPattern); + const [createIndexPattern, setCreateIndexPattern] = useState( + canCreateDataView === false ? false : defaults.createIndexPattern + ); const [indexPatternAvailableTimeFields, setIndexPatternAvailableTimeFields] = useState< string[] >([]); @@ -443,18 +454,31 @@ export const StepDetailsForm: FC = React.memo( ) : null} + {i18n.translate('xpack.transform.stepDetailsForm.dataViewPermissionWarning', { + defaultMessage: 'You need permission to create data views.', + })} + , + ] + : []), + ...(createIndexPattern && indexPatternTitleExists + ? [ + i18n.translate('xpack.transform.stepDetailsForm.dataViewTitleError', { + defaultMessage: 'A data view with this title already exists.', + }), + ] + : []), + ]} > = ({ size }) => ( - + diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/alerts_list.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/alerts_list.tsx index 162f41605e91..27623654245e 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/alerts_list.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/alerts_list.tsx @@ -111,6 +111,8 @@ export const AlertsList: React.FunctionComponent = () => { } = useKibana().services; const canExecuteActions = hasExecuteActionsCapability(capabilities); + const [initialLoad, setInitialLoad] = useState(true); + const [noData, setNoData] = useState(true); const [actionTypes, setActionTypes] = useState([]); const [selectedIds, setSelectedIds] = useState([]); const [isPerformingAction, setIsPerformingAction] = useState(false); @@ -220,7 +222,8 @@ export const AlertsList: React.FunctionComponent = () => { }, []); async function loadAlertsData() { - const hasAnyAuthorizedAlertType = alertTypesState.data.size > 0; + const hasAnyAuthorizedAlertType = + alertTypesState.isInitialized && alertTypesState.data.size > 0; if (hasAnyAuthorizedAlertType) { setAlertsState({ ...alertsState, isLoading: true }); try { @@ -243,6 +246,15 @@ export const AlertsList: React.FunctionComponent = () => { if (!alertsResponse.data?.length && page.index > 0) { setPage({ ...page, index: 0 }); } + + const isFilterApplied = !( + isEmpty(searchText) && + isEmpty(typesFilter) && + isEmpty(actionTypesFilter) && + isEmpty(alertStatusesFilter) + ); + + setNoData(alertsResponse.data.length === 0 && !isFilterApplied); } catch (e) { toasts.addDanger({ title: i18n.translate( @@ -254,6 +266,7 @@ export const AlertsList: React.FunctionComponent = () => { }); setAlertsState({ ...alertsState, isLoading: false }); } + setInitialLoad(false); } } @@ -946,18 +959,22 @@ export const AlertsList: React.FunctionComponent = () => { ); - const loadedItems = convertAlertsToTableItems( - alertsState.data, - alertTypesState.data, - canExecuteActions - ); + // if initial load, show spinner + const getRulesList = () => { + if (noData && !alertsState.isLoading && !alertTypesState.isLoading) { + return authorizedToCreateAnyAlerts ? ( + setAlertFlyoutVisibility(true)} /> + ) : ( + noPermissionPrompt + ); + } - const isFilterApplied = !( - isEmpty(searchText) && - isEmpty(typesFilter) && - isEmpty(actionTypesFilter) && - isEmpty(alertStatusesFilter) - ); + if (initialLoad) { + return ; + } + + return table; + }; return (
@@ -988,15 +1005,7 @@ export const AlertsList: React.FunctionComponent = () => { }} /> - {loadedItems.length || isFilterApplied ? ( - table - ) : alertTypesState.isLoading || alertsState.isLoading ? ( - - ) : authorizedToCreateAnyAlerts ? ( - setAlertFlyoutVisibility(true)} /> - ) : ( - noPermissionPrompt - )} + {getRulesList()} {alertFlyoutVisible && ( = ({ } }, [hasIntersected, isIntersecting, setHasIntersected]); - const imgSrc = basePath + `/api/uptime/journey/screenshot/${checkGroup}/${stepIndex}`; + const imgSrc = basePath + `/internal/uptime/journey/screenshot/${checkGroup}/${stepIndex}`; // When loading a legacy screenshot, set `url` to full-size screenshot path. // Otherwise, we first need to composite the image. diff --git a/x-pack/plugins/uptime/public/state/api/dynamic_settings.ts b/x-pack/plugins/uptime/public/state/api/dynamic_settings.ts index 3aa300e69e3f..a7bacfbba346 100644 --- a/x-pack/plugins/uptime/public/state/api/dynamic_settings.ts +++ b/x-pack/plugins/uptime/public/state/api/dynamic_settings.ts @@ -12,8 +12,9 @@ import { DynamicSettingsSaveType, } from '../../../common/runtime_types'; import { apiService } from './utils'; +import { API_URLS } from '../../../common/constants'; -const apiPath = '/api/uptime/dynamic_settings'; +const apiPath = API_URLS.DYNAMIC_SETTINGS; interface SaveApiRequest { settings: DynamicSettings; diff --git a/x-pack/plugins/uptime/public/state/api/journey.ts b/x-pack/plugins/uptime/public/state/api/journey.ts index 05d4a9e35691..258d00c5d278 100644 --- a/x-pack/plugins/uptime/public/state/api/journey.ts +++ b/x-pack/plugins/uptime/public/state/api/journey.ts @@ -18,9 +18,10 @@ import { SyntheticsJourneyApiResponse, SyntheticsJourneyApiResponseType, } from '../../../common/runtime_types/ping/synthetics'; +import { API_URLS } from '../../../common/constants'; export async function fetchScreenshotBlockSet(params: string[]): Promise { - return apiService.post('/api/uptime/journey/screenshot/block', { + return apiService.post(API_URLS.JOURNEY_SCREENSHOT_BLOCKS, { hashes: params, }); } @@ -29,7 +30,7 @@ export async function fetchJourneySteps( params: FetchJourneyStepsParams ): Promise { return apiService.get( - `/api/uptime/journey/${params.checkGroup}`, + `/internal/uptime/journey/${params.checkGroup}`, { syntheticEventTypes: params.syntheticEventTypes }, SyntheticsJourneyApiResponseType ); @@ -40,11 +41,7 @@ export async function fetchJourneysFailedSteps({ }: { checkGroups: string[]; }): Promise { - return apiService.get( - `/api/uptime/journeys/failed_steps`, - { checkGroups }, - FailedStepsApiResponseType - ); + return apiService.get(API_URLS.JOURNEY_FAILED_STEPS, { checkGroups }, FailedStepsApiResponseType); } export async function fetchLastSuccessfulStep({ @@ -59,7 +56,7 @@ export async function fetchLastSuccessfulStep({ location?: string; }): Promise { return await apiService.get( - `/api/uptime/synthetics/step/success/`, + API_URLS.SYNTHETICS_SUCCESSFUL_STEP, { monitorId, timestamp, diff --git a/x-pack/plugins/uptime/public/state/api/network_events.ts b/x-pack/plugins/uptime/public/state/api/network_events.ts index ea3bb6e5183e..d9b3d518444a 100644 --- a/x-pack/plugins/uptime/public/state/api/network_events.ts +++ b/x-pack/plugins/uptime/public/state/api/network_events.ts @@ -11,12 +11,13 @@ import { SyntheticsNetworkEventsApiResponse, SyntheticsNetworkEventsApiResponseType, } from '../../../common/runtime_types'; +import { API_URLS } from '../../../common/constants'; export async function fetchNetworkEvents( params: FetchNetworkEventsParams ): Promise { return (await apiService.get( - `/api/uptime/network_events`, + API_URLS.NETWORK_EVENTS, { checkGroup: params.checkGroup, stepIndex: params.stepIndex, diff --git a/x-pack/plugins/uptime/public/state/api/snapshot.test.ts b/x-pack/plugins/uptime/public/state/api/snapshot.test.ts index 38be97d74844..01177eceb472 100644 --- a/x-pack/plugins/uptime/public/state/api/snapshot.test.ts +++ b/x-pack/plugins/uptime/public/state/api/snapshot.test.ts @@ -8,6 +8,7 @@ import { HttpFetchError } from 'src/core/public'; import { fetchSnapshotCount } from './snapshot'; import { apiService } from './utils'; +import { API_URLS } from '../../../common/constants'; describe('snapshot API', () => { let fetchMock: jest.SpyInstance>; @@ -36,7 +37,7 @@ describe('snapshot API', () => { }); expect(fetchMock).toHaveBeenCalledWith({ asResponse: false, - path: '/api/uptime/snapshot/count', + path: API_URLS.SNAPSHOT_COUNT, query: { dateRangeEnd: 'now', dateRangeStart: 'now-15m', diff --git a/x-pack/plugins/uptime/server/rest_api/dynamic_settings.ts b/x-pack/plugins/uptime/server/rest_api/dynamic_settings.ts index 637ac72e12ee..5d9947e23cf4 100644 --- a/x-pack/plugins/uptime/server/rest_api/dynamic_settings.ts +++ b/x-pack/plugins/uptime/server/rest_api/dynamic_settings.ts @@ -16,10 +16,11 @@ import { VALUE_MUST_BE_GREATER_THAN_ZERO, VALUE_MUST_BE_AN_INTEGER, } from '../../common/translations'; +import { API_URLS } from '../../common/constants'; export const createGetDynamicSettingsRoute: UMRestApiRouteFactory = (libs: UMServerLibs) => ({ method: 'GET', - path: '/api/uptime/dynamic_settings', + path: API_URLS.DYNAMIC_SETTINGS, validate: false, handler: async ({ savedObjectsClient }): Promise => { return savedObjectsAdapter.getUptimeDynamicSettings(savedObjectsClient); @@ -47,7 +48,7 @@ export const validateCertsValues = ( export const createPostDynamicSettingsRoute: UMRestApiRouteFactory = (libs: UMServerLibs) => ({ method: 'POST', - path: '/api/uptime/dynamic_settings', + path: API_URLS.DYNAMIC_SETTINGS, validate: { body: schema.object({ heartbeatIndices: schema.string(), diff --git a/x-pack/plugins/uptime/server/rest_api/network_events/get_network_events.ts b/x-pack/plugins/uptime/server/rest_api/network_events/get_network_events.ts index 21ca946e574d..0afe21413d4f 100644 --- a/x-pack/plugins/uptime/server/rest_api/network_events/get_network_events.ts +++ b/x-pack/plugins/uptime/server/rest_api/network_events/get_network_events.ts @@ -8,10 +8,11 @@ import { schema } from '@kbn/config-schema'; import { UMServerLibs } from '../../lib/lib'; import { UMRestApiRouteFactory } from '../types'; +import { API_URLS } from '../../../common/constants'; export const createNetworkEventsRoute: UMRestApiRouteFactory = (libs: UMServerLibs) => ({ method: 'GET', - path: '/api/uptime/network_events', + path: API_URLS.NETWORK_EVENTS, validate: { query: schema.object({ checkGroup: schema.string(), diff --git a/x-pack/plugins/uptime/server/rest_api/pings/journey_screenshot_blocks.ts b/x-pack/plugins/uptime/server/rest_api/pings/journey_screenshot_blocks.ts index 4b06a13d29f4..95c30b5f7368 100644 --- a/x-pack/plugins/uptime/server/rest_api/pings/journey_screenshot_blocks.ts +++ b/x-pack/plugins/uptime/server/rest_api/pings/journey_screenshot_blocks.ts @@ -10,6 +10,7 @@ import { isRight } from 'fp-ts/lib/Either'; import { schema } from '@kbn/config-schema'; import { UMServerLibs } from '../../lib/lib'; import { UMRestApiRouteFactory } from '../types'; +import { API_URLS } from '../../../common/constants'; function isStringArray(data: unknown): data is string[] { return isRight(t.array(t.string).decode(data)); @@ -17,7 +18,7 @@ function isStringArray(data: unknown): data is string[] { export const createJourneyScreenshotBlocksRoute: UMRestApiRouteFactory = (libs: UMServerLibs) => ({ method: 'POST', - path: '/api/uptime/journey/screenshot/block', + path: API_URLS.JOURNEY_SCREENSHOT_BLOCKS, validate: { body: schema.object({ hashes: schema.arrayOf(schema.string()), diff --git a/x-pack/plugins/uptime/server/rest_api/pings/journey_screenshots.ts b/x-pack/plugins/uptime/server/rest_api/pings/journey_screenshots.ts index 3e71051816d3..146460295f44 100644 --- a/x-pack/plugins/uptime/server/rest_api/pings/journey_screenshots.ts +++ b/x-pack/plugins/uptime/server/rest_api/pings/journey_screenshots.ts @@ -10,6 +10,7 @@ import { isRefResult, isFullScreenshot } from '../../../common/runtime_types/pin import { UMServerLibs } from '../../lib/lib'; import { ScreenshotReturnTypesUnion } from '../../lib/requests/get_journey_screenshot'; import { UMRestApiRouteFactory } from '../types'; +import { API_URLS } from '../../../common/constants'; function getSharedHeaders(stepName: string, totalSteps: number) { return { @@ -21,7 +22,7 @@ function getSharedHeaders(stepName: string, totalSteps: number) { export const createJourneyScreenshotRoute: UMRestApiRouteFactory = (libs: UMServerLibs) => ({ method: 'GET', - path: '/api/uptime/journey/screenshot/{checkGroup}/{stepIndex}', + path: API_URLS.JOURNEY_SCREENSHOT, validate: { params: schema.object({ checkGroup: schema.string(), diff --git a/x-pack/plugins/uptime/server/rest_api/pings/journeys.ts b/x-pack/plugins/uptime/server/rest_api/pings/journeys.ts index 7c3dcdfbe845..bfc5a52e3e01 100644 --- a/x-pack/plugins/uptime/server/rest_api/pings/journeys.ts +++ b/x-pack/plugins/uptime/server/rest_api/pings/journeys.ts @@ -8,10 +8,11 @@ import { schema } from '@kbn/config-schema'; import { UMServerLibs } from '../../lib/lib'; import { UMRestApiRouteFactory } from '../types'; +import { API_URLS } from '../../../common/constants'; export const createJourneyRoute: UMRestApiRouteFactory = (libs: UMServerLibs) => ({ method: 'GET', - path: '/api/uptime/journey/{checkGroup}', + path: API_URLS.JOURNEY_CREATE, validate: { params: schema.object({ checkGroup: schema.string(), @@ -54,7 +55,7 @@ export const createJourneyRoute: UMRestApiRouteFactory = (libs: UMServerLibs) => export const createJourneyFailedStepsRoute: UMRestApiRouteFactory = (libs: UMServerLibs) => ({ method: 'GET', - path: '/api/uptime/journeys/failed_steps', + path: API_URLS.JOURNEY_FAILED_STEPS, validate: { query: schema.object({ checkGroups: schema.arrayOf(schema.string()), diff --git a/x-pack/plugins/uptime/server/rest_api/synthetics/last_successful_step.ts b/x-pack/plugins/uptime/server/rest_api/synthetics/last_successful_step.ts index 81539459172c..99695bbce09a 100644 --- a/x-pack/plugins/uptime/server/rest_api/synthetics/last_successful_step.ts +++ b/x-pack/plugins/uptime/server/rest_api/synthetics/last_successful_step.ts @@ -13,10 +13,11 @@ import { } from '../../../common/runtime_types/ping/synthetics'; import { UMServerLibs } from '../../lib/lib'; import { UMRestApiRouteFactory } from '../types'; +import { API_URLS } from '../../../common/constants'; export const createLastSuccessfulStepRoute: UMRestApiRouteFactory = (libs: UMServerLibs) => ({ method: 'GET', - path: '/api/uptime/synthetics/step/success/', + path: API_URLS.SYNTHETICS_SUCCESSFUL_STEP, validate: { query: schema.object({ monitorId: schema.string(), diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_json.helpers.ts b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_json.helpers.ts index 696a266ca4a3..a276b717bc54 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_json.helpers.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_json.helpers.ts @@ -5,13 +5,13 @@ * 2.0. */ -import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { WatchEdit } from '../../../public/application/sections/watch_edit/components/watch_edit'; import { registerRouter } from '../../../public/application/lib/navigation'; import { ROUTES, WATCH_TYPES } from '../../../common/constants'; import { withAppContext } from './app_context.mock'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { onRouter: (router) => registerRouter(router), initialEntries: [`${ROUTES.API_ROOT}/watches/new-watch/${WATCH_TYPES.JSON}`], diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_threshold.helpers.ts b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_threshold.helpers.ts index caddf1df93d4..320f88eef265 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_threshold.helpers.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_threshold.helpers.ts @@ -5,13 +5,13 @@ * 2.0. */ -import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { WatchEdit } from '../../../public/application/sections/watch_edit/components/watch_edit'; import { registerRouter } from '../../../public/application/lib/navigation'; import { ROUTES, WATCH_TYPES } from '../../../common/constants'; import { withAppContext } from './app_context.mock'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { onRouter: (router) => registerRouter(router), initialEntries: [`${ROUTES.API_ROOT}/watches/new-watch/${WATCH_TYPES.THRESHOLD}`], diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_edit.helpers.ts b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_edit.helpers.ts index 957755c9e536..15489fa0a864 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_edit.helpers.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_edit.helpers.ts @@ -5,14 +5,14 @@ * 2.0. */ -import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { WatchEdit } from '../../../public/application/sections/watch_edit/components/watch_edit'; import { registerRouter } from '../../../public/application/lib/navigation'; import { ROUTES } from '../../../common/constants'; import { WATCH_ID } from './jest_constants'; import { withAppContext } from './app_context.mock'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { onRouter: (router) => registerRouter(router), initialEntries: [`${ROUTES.API_ROOT}/watches/watch/${WATCH_ID}/edit`], diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_list.helpers.ts b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_list.helpers.ts index c0643e70dded..d048a55422f6 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_list.helpers.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_list.helpers.ts @@ -7,12 +7,12 @@ import { act } from 'react-dom/test-utils'; -import { registerTestBed, findTestSubject, TestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, findTestSubject, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { WatchList } from '../../../public/application/sections/watch_list/components/watch_list'; import { ROUTES, REFRESH_INTERVALS } from '../../../common/constants'; import { withAppContext } from './app_context.mock'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [`${ROUTES.API_ROOT}/watches`], }, diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_status.helpers.ts b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_status.helpers.ts index 02b6908fc1d4..0578f9f1092a 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_status.helpers.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_status.helpers.ts @@ -7,13 +7,13 @@ import { act } from 'react-dom/test-utils'; -import { registerTestBed, findTestSubject, TestBed, TestBedConfig } from '@kbn/test/jest'; +import { registerTestBed, findTestSubject, TestBed, AsyncTestBedConfig } from '@kbn/test/jest'; import { WatchStatus } from '../../../public/application/sections/watch_status/components/watch_status'; import { ROUTES } from '../../../common/constants'; import { WATCH_ID } from './jest_constants'; import { withAppContext } from './app_context.mock'; -const testBedConfig: TestBedConfig = { +const testBedConfig: AsyncTestBedConfig = { memoryRouter: { initialEntries: [`${ROUTES.API_ROOT}/watches/watch/${WATCH_ID}/status`], componentRoutePath: `${ROUTES.API_ROOT}/watches/watch/:id/status`, diff --git a/x-pack/test/accessibility/apps/ml.ts b/x-pack/test/accessibility/apps/ml.ts index fd05d2af0774..eb086b86b914 100644 --- a/x-pack/test/accessibility/apps/ml.ts +++ b/x-pack/test/accessibility/apps/ml.ts @@ -13,7 +13,8 @@ export default function ({ getService }: FtrProviderContext) { const a11y = getService('a11y'); const ml = getService('ml'); - describe('ml', () => { + // FLAKY https://github.com/elastic/kibana/issues/118417 + describe.skip('ml', () => { const esArchiver = getService('esArchiver'); before(async () => { diff --git a/x-pack/test/accessibility/apps/spaces.ts b/x-pack/test/accessibility/apps/spaces.ts index 3dbdc1900ca3..c759d828abd1 100644 --- a/x-pack/test/accessibility/apps/spaces.ts +++ b/x-pack/test/accessibility/apps/spaces.ts @@ -18,7 +18,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const retry = getService('retry'); const toasts = getService('toasts'); - describe('Kibana spaces page meets a11y validations', () => { + // FLAKY: https://github.com/elastic/kibana/issues/100968 + describe.skip('Kibana spaces page meets a11y validations', () => { before(async () => { await esArchiver.load('x-pack/test/functional/es_archives/empty_kibana'); await PageObjects.common.navigateToApp('home'); diff --git a/x-pack/test/accessibility/apps/users.ts b/x-pack/test/accessibility/apps/users.ts index bafd608aa8de..8682cc8f0a88 100644 --- a/x-pack/test/accessibility/apps/users.ts +++ b/x-pack/test/accessibility/apps/users.ts @@ -88,11 +88,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('a11y test for edit user panel', async () => { + await PageObjects.settings.clickLinkText('Users'); await PageObjects.settings.clickLinkText('deleteA11y'); await a11y.testAppSnapshot(); }); it('a11y test for change password screen', async () => { + await PageObjects.settings.clickLinkText('Users'); await PageObjects.settings.clickLinkText('deleteA11y'); await find.clickByButtonText('Change password'); await a11y.testAppSnapshot(); @@ -100,6 +102,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('a11y test for deactivate user screen', async () => { + await PageObjects.settings.clickLinkText('Users'); await PageObjects.settings.clickLinkText('deleteA11y'); await find.clickByButtonText('Deactivate user'); await a11y.testAppSnapshot(); diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/index.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/index.ts index f9cb6175e6fa..f739d9d956cb 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/index.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/index.ts @@ -40,6 +40,7 @@ export default function alertingTests({ loadTestFile, getService }: FtrProviderC loadTestFile(require.resolve('./notify_when')); loadTestFile(require.resolve('./ephemeral')); loadTestFile(require.resolve('./event_log_alerts')); + loadTestFile(require.resolve('./scheduled_task_id')); // note that this test will destroy existing spaces loadTestFile(require.resolve('./migrations')); diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/scheduled_task_id.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/scheduled_task_id.ts new file mode 100644 index 000000000000..9f087b739213 --- /dev/null +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/scheduled_task_id.ts @@ -0,0 +1,112 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import expect from '@kbn/expect'; +import { getUrlPrefix, TaskManagerDoc, ObjectRemover, getTestAlertData } from '../../../common/lib'; +import { FtrProviderContext } from '../../../common/ftr_provider_context'; + +const MIGRATED_RULE_ID = '74f3e6d7-b7bb-477d-ac28-92ee22728e6e'; +const MIGRATED_TASK_ID = '329798f0-b0b0-11ea-9510-fdf248d5f2a4'; + +// eslint-disable-next-line import/no-default-export +export default function createScheduledTaskIdTests({ getService }: FtrProviderContext) { + const es = getService('es'); + const supertest = getService('supertest'); + const supertestWithoutAuth = getService('supertestWithoutAuth'); + const esArchiver = getService('esArchiver'); + + describe('scheduled task id', () => { + const objectRemover = new ObjectRemover(supertest); + async function getScheduledTask(id: string): Promise { + const scheduledTask = await es.get({ + id: `task:${id}`, + index: '.kibana_task_manager', + }); + return scheduledTask._source!; + } + + before(async () => { + await esArchiver.load('x-pack/test/functional/es_archives/rules_scheduled_task_id'); + }); + + after(async () => { + await esArchiver.unload('x-pack/test/functional/es_archives/rules_scheduled_task_id'); + }); + + it('cannot create rule with same ID as a scheduled task ID used by another rule', async () => { + const response = await supertest.get( + `${getUrlPrefix(``)}/api/alerting/rule/${MIGRATED_RULE_ID}` + ); + expect(response.status).to.eql(200); + expect(response.body.scheduled_task_id).to.eql(MIGRATED_TASK_ID); + + await supertest + .post(`${getUrlPrefix(``)}/api/alerting/rule/${MIGRATED_TASK_ID}`) + .set('kbn-xsrf', 'foo') + .send(getTestAlertData()) + .expect(409); + }); + + it('for migrated rules - sets scheduled task id to match rule id when rule is disabled then enabled', async () => { + const response = await supertest.get( + `${getUrlPrefix(``)}/api/alerting/rule/${MIGRATED_RULE_ID}` + ); + expect(response.status).to.eql(200); + expect(response.body.scheduled_task_id).to.eql(MIGRATED_TASK_ID); + + // scheduled task id should exist + const taskRecordLoaded = await getScheduledTask(MIGRATED_TASK_ID); + expect(JSON.parse(taskRecordLoaded.task.params)).to.eql({ + alertId: MIGRATED_RULE_ID, + spaceId: 'default', + }); + + await supertestWithoutAuth + .post(`${getUrlPrefix(``)}/api/alerting/rule/${MIGRATED_RULE_ID}/_disable`) + .set('kbn-xsrf', 'foo') + .expect(204); + + await supertestWithoutAuth + .post(`${getUrlPrefix(``)}/api/alerting/rule/${MIGRATED_RULE_ID}/_enable`) + .set('kbn-xsrf', 'foo') + .expect(204); + + try { + await getScheduledTask(MIGRATED_TASK_ID); + throw new Error('Should have removed scheduled task'); + } catch (e) { + expect(e.meta.statusCode).to.eql(404); + } + + // scheduled task id that is same as rule id should exist + const taskRecordNew = await getScheduledTask(MIGRATED_RULE_ID); + expect(JSON.parse(taskRecordNew.task.params)).to.eql({ + alertId: MIGRATED_RULE_ID, + spaceId: 'default', + }); + }); + + it('sets scheduled task id to rule id when rule is created', async () => { + const response = await supertestWithoutAuth + .post(`${getUrlPrefix(``)}/api/alerting/rule`) + .set('kbn-xsrf', 'foo') + .send(getTestAlertData()); + + expect(response.status).to.eql(200); + objectRemover.add('default', response.body.id, 'rule', 'alerting'); + + expect(response.body.scheduled_task_id).to.eql(response.body.id); + const taskRecord = await getScheduledTask(response.body.scheduled_task_id); + expect(taskRecord.type).to.eql('task'); + expect(taskRecord.task.taskType).to.eql('alerting:test.noop'); + expect(JSON.parse(taskRecord.task.params)).to.eql({ + alertId: response.body.id, + spaceId: 'default', + }); + }); + }); +} diff --git a/x-pack/test/api_integration/apis/ml/modules/recognize_module.ts b/x-pack/test/api_integration/apis/ml/modules/recognize_module.ts index 2742fbff294c..2a7266e50d2c 100644 --- a/x-pack/test/api_integration/apis/ml/modules/recognize_module.ts +++ b/x-pack/test/api_integration/apis/ml/modules/recognize_module.ts @@ -44,7 +44,7 @@ export default ({ getService }: FtrProviderContext) => { user: USER.ML_POWERUSER, expected: { responseCode: 200, - moduleIds: ['apm_jsbase', 'apm_transaction', 'apm_nodejs'], + moduleIds: ['apm_jsbase', 'apm_nodejs'], }, }, { @@ -202,6 +202,16 @@ export default ({ getService }: FtrProviderContext) => { moduleIds: ['nginx_data_stream'], }, }, + { + testTitleSuffix: 'for apm transaction dataset', + sourceDataArchive: 'x-pack/test/functional/es_archives/ml/module_apm_transaction', + indexPattern: 'ft_module_apm_transaction', + user: USER.ML_POWERUSER, + expected: { + responseCode: 200, + moduleIds: ['apm_transaction'], + }, + }, ]; async function executeRecognizeModuleRequest(indexPattern: string, user: USER, rspCode: number) { diff --git a/x-pack/test/api_integration/apis/ml/modules/setup_module.ts b/x-pack/test/api_integration/apis/ml/modules/setup_module.ts index c538fc0d9cb5..7c9c2ff185ea 100644 --- a/x-pack/test/api_integration/apis/ml/modules/setup_module.ts +++ b/x-pack/test/api_integration/apis/ml/modules/setup_module.ts @@ -190,13 +190,13 @@ export default ({ getService }: FtrProviderContext) => { { testTitleSuffix: 'for apm_transaction with prefix, startDatafeed true and estimateModelMemory true', - sourceDataArchive: 'x-pack/test/functional/es_archives/ml/module_apm', - indexPattern: { name: 'ft_module_apm', timeField: '@timestamp' }, + sourceDataArchive: 'x-pack/test/functional/es_archives/ml/module_apm_transaction', + indexPattern: { name: 'ft_module_apm_transaction', timeField: '@timestamp' }, module: 'apm_transaction', user: USER.ML_POWERUSER, requestBody: { prefix: 'pf5_', - indexPatternName: 'ft_module_apm', + indexPatternName: 'ft_module_apm_transaction', startDatafeed: true, end: Date.now(), }, @@ -204,7 +204,7 @@ export default ({ getService }: FtrProviderContext) => { responseCode: 200, jobs: [ { - jobId: 'pf5_high_mean_transaction_duration', + jobId: 'pf5_apm_tx_metrics', jobState: JOB_STATE.CLOSED, datafeedState: DATAFEED_STATE.STOPPED, }, diff --git a/x-pack/test/api_integration/apis/uptime/get_all_pings.ts b/x-pack/test/api_integration/apis/uptime/get_all_pings.ts index cf52d7282309..2658afd0d90d 100644 --- a/x-pack/test/api_integration/apis/uptime/get_all_pings.ts +++ b/x-pack/test/api_integration/apis/uptime/get_all_pings.ts @@ -9,6 +9,7 @@ import moment from 'moment'; import expect from '@kbn/expect'; import { PINGS_DATE_RANGE_START, PINGS_DATE_RANGE_END } from './constants'; import { FtrProviderContext } from '../../ftr_provider_context'; +import { API_URLS } from '../../../../plugins/uptime/common/constants'; export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); @@ -22,9 +23,12 @@ export default function ({ getService }: FtrProviderContext) { it('should get all pings stored in index', async () => { const { body: apiResponse } = await supertest - .get( - `/api/uptime/pings?sort=desc&from=${PINGS_DATE_RANGE_START}&to=${PINGS_DATE_RANGE_END}` - ) + .get(API_URLS.PINGS) + .query({ + sort: 'desc', + from: PINGS_DATE_RANGE_START, + to: PINGS_DATE_RANGE_END, + }) .expect(200); expect(apiResponse.total).to.be(2); @@ -34,7 +38,12 @@ export default function ({ getService }: FtrProviderContext) { it('should sort pings according to timestamp', async () => { const { body: apiResponse } = await supertest - .get(`/api/uptime/pings?sort=asc&from=${PINGS_DATE_RANGE_START}&to=${PINGS_DATE_RANGE_END}`) + .get(API_URLS.PINGS) + .query({ + sort: 'asc', + from: PINGS_DATE_RANGE_START, + to: PINGS_DATE_RANGE_END, + }) .expect(200); expect(apiResponse.total).to.be(2); @@ -45,9 +54,13 @@ export default function ({ getService }: FtrProviderContext) { it('should return results of n length', async () => { const { body: apiResponse } = await supertest - .get( - `/api/uptime/pings?sort=desc&size=1&from=${PINGS_DATE_RANGE_START}&to=${PINGS_DATE_RANGE_END}` - ) + .get(API_URLS.PINGS) + .query({ + sort: 'desc', + size: 1, + from: PINGS_DATE_RANGE_START, + to: PINGS_DATE_RANGE_END, + }) .expect(200); expect(apiResponse.total).to.be(2); @@ -59,7 +72,8 @@ export default function ({ getService }: FtrProviderContext) { const from = moment('2002-01-01').valueOf(); const to = moment('2002-01-02').valueOf(); const { body: apiResponse } = await supertest - .get(`/api/uptime/pings?from=${from}&to=${to}`) + .get(API_URLS.PINGS) + .query({ from, to }) .expect(200); expect(apiResponse.total).to.be(0); diff --git a/x-pack/test/api_integration/apis/uptime/rest/dynamic_settings.ts b/x-pack/test/api_integration/apis/uptime/rest/dynamic_settings.ts index d5cf2078e377..84e01ecef63d 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/dynamic_settings.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/dynamic_settings.ts @@ -12,13 +12,16 @@ import { DynamicSettingsType, DynamicSettings, } from '../../../../../plugins/uptime/common/runtime_types'; -import { DYNAMIC_SETTINGS_DEFAULTS } from '../../../../../plugins/uptime/common/constants'; +import { + DYNAMIC_SETTINGS_DEFAULTS, + API_URLS, +} from '../../../../../plugins/uptime/common/constants'; export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); describe('dynamic settings', () => { it('returns the defaults when no user settings have been saved', async () => { - const apiResponse = await supertest.get(`/api/uptime/dynamic_settings`); + const apiResponse = await supertest.get(API_URLS.DYNAMIC_SETTINGS); expect(apiResponse.body).to.eql(DYNAMIC_SETTINGS_DEFAULTS); expect(isRight(DynamicSettingsType.decode(apiResponse.body))).to.be.ok(); }); @@ -31,14 +34,14 @@ export default function ({ getService }: FtrProviderContext) { defaultConnectors: [], }; const postResponse = await supertest - .post(`/api/uptime/dynamic_settings`) + .post(API_URLS.DYNAMIC_SETTINGS) .set('kbn-xsrf', 'true') .send(newSettings); expect(postResponse.body).to.eql({ success: true }); expect(postResponse.status).to.eql(200); - const getResponse = await supertest.get(`/api/uptime/dynamic_settings`); + const getResponse = await supertest.get(API_URLS.DYNAMIC_SETTINGS); expect(getResponse.body).to.eql(newSettings); expect(isRight(DynamicSettingsType.decode(getResponse.body))).to.be.ok(); }); diff --git a/x-pack/test/api_integration/apis/uptime/rest/filters.ts b/x-pack/test/api_integration/apis/uptime/rest/filters.ts deleted file mode 100644 index 5603d142cdb6..000000000000 --- a/x-pack/test/api_integration/apis/uptime/rest/filters.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { expectFixtureEql } from './helper/expect_fixture_eql'; -import { FtrProviderContext } from '../../../ftr_provider_context'; - -const getApiPath = (dateRangeStart: string, dateRangeEnd: string, filters?: string) => - `/api/uptime/filters?dateRangeStart=${dateRangeStart}&dateRangeEnd=${dateRangeEnd}${ - filters ? `&filters=${filters}` : '' - }`; - -export default function ({ getService }: FtrProviderContext) { - const supertest = getService('supertest'); - - describe('filter group endpoint', () => { - const dateRangeStart = '2019-01-28T17:40:08.078Z'; - const dateRangeEnd = '2025-01-28T19:00:16.078Z'; - - it('returns expected filters', async () => { - const resp = await supertest.get(getApiPath(dateRangeStart, dateRangeEnd)); - expectFixtureEql(resp.body, 'filters'); - }); - }); -} diff --git a/x-pack/test/api_integration/apis/uptime/rest/monitor_duration.ts b/x-pack/test/api_integration/apis/uptime/rest/monitor_duration.ts index 92c5174c7263..4fa0837e2e81 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/monitor_duration.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/monitor_duration.ts @@ -7,6 +7,7 @@ import { expectFixtureEql } from './helper/expect_fixture_eql'; import { FtrProviderContext } from '../../../ftr_provider_context'; +import { API_URLS } from '../../../../../plugins/uptime/common/constants'; export default function ({ getService }: FtrProviderContext) { describe('monitor duration query', () => { @@ -18,9 +19,11 @@ export default function ({ getService }: FtrProviderContext) { const monitorId = '0002-up'; - const apiResponse = await supertest.get( - `/api/uptime/monitor/duration?monitorId=${monitorId}&dateStart=${dateStart}&dateEnd=${dateEnd}` - ); + const apiResponse = await supertest.get(API_URLS.MONITOR_DURATION).query({ + monitorId, + dateStart, + dateEnd, + }); const data = apiResponse.body; expectFixtureEql(data, 'monitor_charts'); }); @@ -31,9 +34,11 @@ export default function ({ getService }: FtrProviderContext) { const monitorId = '0002-up'; - const apiResponse = await supertest.get( - `/api/uptime/monitor/duration?monitorId=${monitorId}&dateStart=${dateStart}&dateEnd=${dateEnd}` - ); + const apiResponse = await supertest.get(API_URLS.MONITOR_DURATION).query({ + monitorId, + dateStart, + dateEnd, + }); const data = apiResponse.body; expectFixtureEql(data, 'monitor_charts_empty_sets'); diff --git a/x-pack/test/api_integration/apis/uptime/rest/monitor_latest_status.ts b/x-pack/test/api_integration/apis/uptime/rest/monitor_latest_status.ts index 69b1bd0324ee..036d3ad856f5 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/monitor_latest_status.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/monitor_latest_status.ts @@ -7,6 +7,7 @@ import { expectFixtureEql } from './helper/expect_fixture_eql'; import { FtrProviderContext } from '../../../ftr_provider_context'; +import { API_URLS } from '../../../../../plugins/uptime/common/constants'; export default function ({ getService }: FtrProviderContext) { describe('get monitor latest status API', () => { @@ -17,9 +18,11 @@ export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); it('returns the status for only the given monitor', async () => { - const apiResponse = await supertest.get( - `/api/uptime/monitor/status?monitorId=${monitorId}&dateStart=${dateStart}&dateEnd=${dateEnd}` - ); + const apiResponse = await supertest.get(API_URLS.MONITOR_STATUS).query({ + monitorId, + dateStart, + dateEnd, + }); expectFixtureEql(apiResponse.body, 'monitor_latest_status'); }); }); diff --git a/x-pack/test/api_integration/apis/uptime/rest/ping_histogram.ts b/x-pack/test/api_integration/apis/uptime/rest/ping_histogram.ts index 0d69b083d8f2..fcc0873be9a7 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/ping_histogram.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/ping_histogram.ts @@ -7,6 +7,7 @@ import { expectFixtureEql } from './helper/expect_fixture_eql'; import { FtrProviderContext } from '../../../ftr_provider_context'; +import { API_URLS } from '../../../../../plugins/uptime/common/constants'; export default function ({ getService }: FtrProviderContext) { describe('pingHistogram', () => { @@ -16,9 +17,10 @@ export default function ({ getService }: FtrProviderContext) { const dateStart = '2019-09-11T03:31:04.380Z'; const dateEnd = '2019-09-11T03:40:34.410Z'; - const apiResponse = await supertest.get( - `/api/uptime/ping/histogram?dateStart=${dateStart}&dateEnd=${dateEnd}` - ); + const apiResponse = await supertest.get(API_URLS.PING_HISTOGRAM).query({ + dateStart, + dateEnd, + }); const data = apiResponse.body; expectFixtureEql(data, 'ping_histogram'); @@ -29,9 +31,11 @@ export default function ({ getService }: FtrProviderContext) { const dateEnd = '2019-09-11T03:40:34.410Z'; const monitorId = '0002-up'; - const apiResponse = await supertest.get( - `/api/uptime/ping/histogram?monitorId=${monitorId}&dateStart=${dateStart}&dateEnd=${dateEnd}` - ); + const apiResponse = await supertest.get(API_URLS.PING_HISTOGRAM).query({ + monitorId, + dateStart, + dateEnd, + }); const data = apiResponse.body; expectFixtureEql(data, 'ping_histogram_by_id'); @@ -43,9 +47,11 @@ export default function ({ getService }: FtrProviderContext) { const filters = '{"bool":{"must":[{"match":{"monitor.status":{"query":"up","operator":"and"}}}]}}'; - const apiResponse = await supertest.get( - `/api/uptime/ping/histogram?dateStart=${dateStart}&dateEnd=${dateEnd}&filters=${filters}` - ); + const apiResponse = await supertest.get(API_URLS.PING_HISTOGRAM).query({ + dateStart, + dateEnd, + filters, + }); const data = apiResponse.body; expectFixtureEql(data, 'ping_histogram_by_filter'); diff --git a/x-pack/test/api_integration/apis/uptime/rest/ping_list.ts b/x-pack/test/api_integration/apis/uptime/rest/ping_list.ts index 860aae81703f..7a0367728eed 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/ping_list.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/ping_list.ts @@ -10,6 +10,7 @@ import { isLeft } from 'fp-ts/lib/Either'; import { PathReporter } from 'io-ts/lib/PathReporter'; import { PingsResponseType } from '../../../../../plugins/uptime/common/runtime_types'; import { FtrProviderContext } from '../../../ftr_provider_context'; +import { API_URLS } from '../../../../../plugins/uptime/common/constants'; function decodePingsResponseData(response: any) { const decoded = PingsResponseType.decode(response); @@ -33,7 +34,11 @@ export default function ({ getService }: FtrProviderContext) { const from = '2019-01-28T17:40:08.078Z'; const to = '2025-01-28T19:00:16.078Z'; - const apiResponse = await supertest.get(`/api/uptime/pings?from=${from}&to=${to}&size=10`); + const apiResponse = await supertest.get(API_URLS.PINGS).query({ + from, + to, + size: 10, + }); const { total, pings } = decodePingsResponseData(apiResponse.body); @@ -58,9 +63,11 @@ export default function ({ getService }: FtrProviderContext) { const to = '2025-01-28T19:00:16.078Z'; const size = 50; - const apiResponse = await supertest.get( - `/api/uptime/pings?from=${from}&to=${to}&size=${size}` - ); + const apiResponse = await supertest.get(API_URLS.PINGS).query({ + from, + to, + size, + }); const { total, pings } = decodePingsResponseData(apiResponse.body); @@ -126,9 +133,12 @@ export default function ({ getService }: FtrProviderContext) { const monitorId = '0001-up'; const size = 15; - const apiResponse = await supertest.get( - `/api/uptime/pings?from=${from}&to=${to}&monitorId=${monitorId}&size=${size}` - ); + const apiResponse = await supertest.get(API_URLS.PINGS).query({ + from, + to, + monitorId, + size, + }); const { total, pings } = decodePingsResponseData(apiResponse.body); @@ -160,9 +170,13 @@ export default function ({ getService }: FtrProviderContext) { const size = 5; const sort = 'asc'; - const apiResponse = await supertest.get( - `/api/uptime/pings?from=${from}&to=${to}&monitorId=${monitorId}&size=${size}&sort=${sort}` - ); + const apiResponse = await supertest.get(API_URLS.PINGS).query({ + from, + to, + monitorId, + size, + sort, + }); const { total, pings } = decodePingsResponseData(apiResponse.body); diff --git a/x-pack/test/api_integration/apis/uptime/rest/snapshot.ts b/x-pack/test/api_integration/apis/uptime/rest/snapshot.ts index 59393f7a4acf..e7f604116e30 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/snapshot.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/snapshot.ts @@ -8,6 +8,7 @@ import { expectFixtureEql } from './helper/expect_fixture_eql'; import { FtrProviderContext } from '../../../ftr_provider_context'; import { makeChecksWithStatus, getChecksDateRange } from './helper/make_checks'; +import { API_URLS } from '../../../../../plugins/uptime/common/constants'; export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); @@ -18,9 +19,10 @@ export default function ({ getService }: FtrProviderContext) { describe('when no data is present', async () => { it('returns a null snapshot', async () => { - const apiResponse = await supertest.get( - `/api/uptime/snapshot/count?dateRangeStart=${dateRangeStart}&dateRangeEnd=${dateRangeEnd}` - ); + const apiResponse = await supertest.get(API_URLS.SNAPSHOT_COUNT).query({ + dateRangeStart, + dateRangeEnd, + }); expectFixtureEql(apiResponse.body, 'snapshot_empty'); }); @@ -75,9 +77,10 @@ export default function ({ getService }: FtrProviderContext) { }); it('will count all statuses correctly', async () => { - const apiResponse = await supertest.get( - `/api/uptime/snapshot/count?dateRangeStart=${dateRange.start}&dateRangeEnd=${dateRange.end}` - ); + const apiResponse = await supertest.get(API_URLS.SNAPSHOT_COUNT).query({ + dateRangeStart: dateRange.start, + dateRangeEnd: dateRange.end, + }); expectFixtureEql(apiResponse.body, 'snapshot'); }); diff --git a/x-pack/test/apm_api_integration/tests/csm/csm_services.spec.ts b/x-pack/test/apm_api_integration/tests/csm/csm_services.spec.ts index 2d5f0ddf1cd4..657e2485e1c2 100644 --- a/x-pack/test/apm_api_integration/tests/csm/csm_services.spec.ts +++ b/x-pack/test/apm_api_integration/tests/csm/csm_services.spec.ts @@ -14,9 +14,11 @@ export default function rumServicesApiTests({ getService }: FtrProviderContext) registry.when('CSM Services without data', { config: 'trial', archives: [] }, () => { it('returns empty list', async () => { - const response = await supertest.get( - '/api/apm/rum-client/services?start=2020-06-28T10%3A24%3A46.055Z&end=2020-07-29T10%3A24%3A46.055Z&uiFilters=%7B%22agentName%22%3A%5B%22js-base%22%2C%22rum-js%22%5D%7D' - ); + const response = await supertest.get('/internal/apm/ux/services').query({ + start: '2020-06-28T10:24:46.055Z', + end: '2020-07-29T10:24:46.055Z', + uiFilters: '{"agentName":["js-base","rum-js"]}', + }); expect(response.status).to.be(200); expect(response.body.rumServices).to.eql([]); @@ -28,9 +30,11 @@ export default function rumServicesApiTests({ getService }: FtrProviderContext) { config: 'trial', archives: ['8.0.0', 'rum_8.0.0'] }, () => { it('returns rum services list', async () => { - const response = await supertest.get( - '/api/apm/rum-client/services?start=2020-06-28T10%3A24%3A46.055Z&end=2020-07-29T10%3A24%3A46.055Z&uiFilters=%7B%22agentName%22%3A%5B%22js-base%22%2C%22rum-js%22%5D%7D' - ); + const response = await supertest.get('/internal/apm/ux/services').query({ + start: '2020-06-28T10:24:46.055Z', + end: '2020-07-29T10:24:46.055Z', + uiFilters: '{"agentName":["js-base","rum-js"]}', + }); expect(response.status).to.be(200); diff --git a/x-pack/test/apm_api_integration/tests/csm/js_errors.spec.ts b/x-pack/test/apm_api_integration/tests/csm/js_errors.spec.ts index 5e4f30655227..b23f36534832 100644 --- a/x-pack/test/apm_api_integration/tests/csm/js_errors.spec.ts +++ b/x-pack/test/apm_api_integration/tests/csm/js_errors.spec.ts @@ -14,9 +14,13 @@ export default function rumJsErrorsApiTests({ getService }: FtrProviderContext) registry.when('CSM JS errors with data', { config: 'trial', archives: [] }, () => { it('returns no js errors', async () => { - const response = await supertest.get( - '/api/apm/rum-client/js-errors?pageSize=5&pageIndex=0&start=2020-09-07T20%3A35%3A54.654Z&end=2020-09-14T20%3A35%3A54.654Z&uiFilters=%7B%22serviceName%22%3A%5B%22elastic-co-rum-test%22%5D%7D' - ); + const response = await supertest.get('/internal/apm/ux/js-errors').query({ + pageSize: 5, + pageIndex: 0, + start: '2020-09-07T20:35:54.654Z', + end: '2020-09-14T20:35:54.654Z', + uiFilters: '{"serviceName":["elastic-co-rum-test"]}', + }); expect(response.status).to.be(200); expectSnapshot(response.body).toMatchInline(` @@ -34,9 +38,13 @@ export default function rumJsErrorsApiTests({ getService }: FtrProviderContext) { config: 'trial', archives: ['8.0.0', 'rum_test_data'] }, () => { it('returns js errors', async () => { - const response = await supertest.get( - '/api/apm/rum-client/js-errors?start=2021-01-18T12%3A20%3A17.202Z&end=2021-01-18T12%3A25%3A17.203Z&uiFilters=%7B%22environment%22%3A%22ENVIRONMENT_ALL%22%2C%22serviceName%22%3A%5B%22elastic-co-frontend%22%5D%7D&pageSize=5&pageIndex=0' - ); + const response = await supertest.get('/internal/apm/ux/js-errors').query({ + start: '2021-01-18T12:20:17.202Z', + end: '2021-01-18T12:25:17.203Z', + uiFilters: '{"environment":"ENVIRONMENT_ALL","serviceName":["elastic-co-frontend"]}', + pageSize: 5, + pageIndex: 0, + }); expect(response.status).to.be(200); diff --git a/x-pack/test/apm_api_integration/tests/csm/long_task_metrics.spec.ts b/x-pack/test/apm_api_integration/tests/csm/long_task_metrics.spec.ts index ef1e537585b7..756d10bc4558 100644 --- a/x-pack/test/apm_api_integration/tests/csm/long_task_metrics.spec.ts +++ b/x-pack/test/apm_api_integration/tests/csm/long_task_metrics.spec.ts @@ -14,9 +14,11 @@ export default function rumServicesApiTests({ getService }: FtrProviderContext) registry.when('CSM long task metrics without data', { config: 'trial', archives: [] }, () => { it('returns empty list', async () => { - const response = await supertest.get( - '/api/apm/rum-client/long-task-metrics?start=2020-09-07T20%3A35%3A54.654Z&end=2020-09-14T20%3A35%3A54.654Z&uiFilters=%7B%22serviceName%22%3A%5B%22elastic-co-rum-test%22%5D%7D' - ); + const response = await supertest.get('/internal/apm/ux/long-task-metrics').query({ + start: '2020-09-07T20:35:54.654Z', + end: '2020-09-14T20:35:54.654Z', + uiFilters: '{"serviceName":["elastic-co-rum-test"]}', + }); expect(response.status).to.be(200); expect(response.body).to.eql({ @@ -32,9 +34,11 @@ export default function rumServicesApiTests({ getService }: FtrProviderContext) { config: 'trial', archives: ['8.0.0', 'rum_8.0.0'] }, () => { it('returns web core vitals values', async () => { - const response = await supertest.get( - '/api/apm/rum-client/long-task-metrics?start=2020-09-07T20%3A35%3A54.654Z&end=2020-09-16T20%3A35%3A54.654Z&uiFilters=%7B%22serviceName%22%3A%5B%22kibana-frontend-8_0_0%22%5D%7D' - ); + const response = await supertest.get('/internal/apm/ux/long-task-metrics').query({ + start: '2020-09-07T20:35:54.654Z', + end: '2020-09-16T20:35:54.654Z', + uiFilters: '{"serviceName":["kibana-frontend-8_0_0"]}', + }); expect(response.status).to.be(200); diff --git a/x-pack/test/apm_api_integration/tests/csm/page_load_dist.spec.ts b/x-pack/test/apm_api_integration/tests/csm/page_load_dist.spec.ts index 1177b331c4c3..fd75a5cef33a 100644 --- a/x-pack/test/apm_api_integration/tests/csm/page_load_dist.spec.ts +++ b/x-pack/test/apm_api_integration/tests/csm/page_load_dist.spec.ts @@ -14,18 +14,25 @@ export default function rumServicesApiTests({ getService }: FtrProviderContext) registry.when('UX page load dist without data', { config: 'trial', archives: [] }, () => { it('returns empty list', async () => { - const response = await supertest.get( - '/api/apm/rum-client/page-load-distribution?start=2020-09-07T20%3A35%3A54.654Z&end=2020-09-14T20%3A35%3A54.654Z&uiFilters=%7B%22serviceName%22%3A%5B%22elastic-co-rum-test%22%5D%7D' - ); + const response = await supertest.get('/internal/apm/ux/page-load-distribution').query({ + start: '2020-09-07T20:35:54.654Z', + end: '2020-09-14T20:35:54.654Z', + uiFilters: '{"serviceName":["elastic-co-rum-test"]}', + }); expect(response.status).to.be(200); expectSnapshot(response.body).toMatch(); }); it('returns empty list with breakdowns', async () => { - const response = await supertest.get( - '/api/apm/rum-client/page-load-distribution/breakdown?start=2020-09-07T20%3A35%3A54.654Z&end=2020-09-14T20%3A35%3A54.654Z&uiFilters=%7B%22serviceName%22%3A%5B%22elastic-co-rum-test%22%5D%7D&breakdown=Browser' - ); + const response = await supertest + .get('/internal/apm/ux/page-load-distribution/breakdown') + .query({ + start: '2020-09-07T20:35:54.654Z', + end: '2020-09-14T20:35:54.654Z', + uiFilters: '{"serviceName":["elastic-co-rum-test"]}', + breakdown: 'Browser', + }); expect(response.status).to.be(200); expectSnapshot(response.body).toMatch(); @@ -37,18 +44,25 @@ export default function rumServicesApiTests({ getService }: FtrProviderContext) { config: 'trial', archives: ['8.0.0', 'rum_8.0.0'] }, () => { it('returns page load distribution', async () => { - const response = await supertest.get( - '/api/apm/rum-client/page-load-distribution?start=2020-09-07T20%3A35%3A54.654Z&end=2020-09-16T20%3A35%3A54.654Z&uiFilters=%7B%22serviceName%22%3A%5B%22kibana-frontend-8_0_0%22%5D%7D' - ); + const response = await supertest.get('/internal/apm/ux/page-load-distribution').query({ + start: '2020-09-07T20:35:54.654Z', + end: '2020-09-16T20:35:54.654Z', + uiFilters: '{"serviceName":["kibana-frontend-8_0_0"]}', + }); expect(response.status).to.be(200); expectSnapshot(response.body).toMatch(); }); it('returns page load distribution with breakdown', async () => { - const response = await supertest.get( - '/api/apm/rum-client/page-load-distribution/breakdown?start=2020-09-07T20%3A35%3A54.654Z&end=2020-09-16T20%3A35%3A54.654Z&uiFilters=%7B%22serviceName%22%3A%5B%22kibana-frontend-8_0_0%22%5D%7D&breakdown=Browser' - ); + const response = await supertest + .get('/internal/apm/ux/page-load-distribution/breakdown') + .query({ + start: '2020-09-07T20:35:54.654Z', + end: '2020-09-16T20:35:54.654Z', + uiFilters: '{"serviceName":["kibana-frontend-8_0_0"]}', + breakdown: 'Browser', + }); expect(response.status).to.be(200); diff --git a/x-pack/test/apm_api_integration/tests/csm/page_views.spec.ts b/x-pack/test/apm_api_integration/tests/csm/page_views.spec.ts index 40aa88aa5ad8..f699fc9f8a3b 100644 --- a/x-pack/test/apm_api_integration/tests/csm/page_views.spec.ts +++ b/x-pack/test/apm_api_integration/tests/csm/page_views.spec.ts @@ -14,18 +14,23 @@ export default function rumServicesApiTests({ getService }: FtrProviderContext) registry.when('CSM page views without data', { config: 'trial', archives: [] }, () => { it('returns empty list', async () => { - const response = await supertest.get( - '/api/apm/rum-client/page-view-trends?start=2020-09-07T20%3A35%3A54.654Z&end=2020-09-14T20%3A35%3A54.654Z&uiFilters=%7B%22serviceName%22%3A%5B%22elastic-co-rum-test%22%5D%7D' - ); + const response = await supertest.get('/internal/apm/ux/page-view-trends').query({ + start: '2020-09-07T20:35:54.654Z', + end: '2020-09-14T20:35:54.654Z', + uiFilters: '{"serviceName":["elastic-co-rum-test"]}', + }); expect(response.status).to.be(200); expectSnapshot(response.body).toMatch(); }); it('returns empty list with breakdowns', async () => { - const response = await supertest.get( - '/api/apm/rum-client/page-view-trends?start=2020-09-07T20%3A35%3A54.654Z&end=2020-09-14T20%3A35%3A54.654Z&uiFilters=%7B%22serviceName%22%3A%5B%22elastic-co-rum-test%22%5D%7D&breakdowns=%7B%22name%22%3A%22Browser%22%2C%22fieldName%22%3A%22user_agent.name%22%2C%22type%22%3A%22category%22%7D' - ); + const response = await supertest.get('/internal/apm/ux/page-view-trends').query({ + start: '2020-09-07T20:35:54.654Z', + end: '2020-09-14T20:35:54.654Z', + uiFilters: '{"serviceName":["elastic-co-rum-test"]}', + breakdowns: '{"name":"Browser","fieldName":"user_agent.name","type":"category"}', + }); expect(response.status).to.be(200); expectSnapshot(response.body).toMatch(); @@ -37,18 +42,23 @@ export default function rumServicesApiTests({ getService }: FtrProviderContext) { config: 'trial', archives: ['8.0.0', 'rum_8.0.0'] }, () => { it('returns page views', async () => { - const response = await supertest.get( - '/api/apm/rum-client/page-view-trends?start=2020-09-07T20%3A35%3A54.654Z&end=2020-09-16T20%3A35%3A54.654Z&uiFilters=%7B%22serviceName%22%3A%5B%22kibana-frontend-8_0_0%22%5D%7D' - ); + const response = await supertest.get('/internal/apm/ux/page-view-trends').query({ + start: '2020-09-07T20:35:54.654Z', + end: '2020-09-16T20:35:54.654Z', + uiFilters: '{"serviceName":["kibana-frontend-8_0_0"]}', + }); expect(response.status).to.be(200); expectSnapshot(response.body).toMatch(); }); it('returns page views with breakdown', async () => { - const response = await supertest.get( - '/api/apm/rum-client/page-view-trends?start=2020-09-07T20%3A35%3A54.654Z&end=2020-09-16T20%3A35%3A54.654Z&uiFilters=%7B%22serviceName%22%3A%5B%22kibana-frontend-8_0_0%22%5D%7D&breakdowns=%7B%22name%22%3A%22Browser%22%2C%22fieldName%22%3A%22user_agent.name%22%2C%22type%22%3A%22category%22%7D' - ); + const response = await supertest.get('/internal/apm/ux/page-view-trends').query({ + start: '2020-09-07T20:35:54.654Z', + end: '2020-09-16T20:35:54.654Z', + uiFilters: '{"serviceName":["kibana-frontend-8_0_0"]}', + breakdowns: '{"name":"Browser","fieldName":"user_agent.name","type":"category"}', + }); expect(response.status).to.be(200); diff --git a/x-pack/test/apm_api_integration/tests/csm/url_search.spec.ts b/x-pack/test/apm_api_integration/tests/csm/url_search.spec.ts index f45e82865983..89e56face934 100644 --- a/x-pack/test/apm_api_integration/tests/csm/url_search.spec.ts +++ b/x-pack/test/apm_api_integration/tests/csm/url_search.spec.ts @@ -14,9 +14,12 @@ export default function rumServicesApiTests({ getService }: FtrProviderContext) registry.when('CSM url search api without data', { config: 'trial', archives: [] }, () => { it('returns empty list', async () => { - const response = await supertest.get( - '/api/apm/rum-client/url-search?start=2020-09-07T20%3A35%3A54.654Z&end=2020-09-14T20%3A35%3A54.654Z&uiFilters=%7B%22serviceName%22%3A%5B%22elastic-co-rum-test%22%5D%7D&percentile=50' - ); + const response = await supertest.get('/internal/apm/ux/url-search').query({ + start: '2020-09-07T20:35:54.654Z', + end: '2020-09-14T20:35:54.654Z', + uiFilters: '{"serviceName":["elastic-co-rum-test"]}', + percentile: 50, + }); expect(response.status).to.be(200); expectSnapshot(response.body).toMatchInline(` @@ -33,9 +36,12 @@ export default function rumServicesApiTests({ getService }: FtrProviderContext) { config: 'trial', archives: ['8.0.0', 'rum_8.0.0'] }, () => { it('returns top urls when no query', async () => { - const response = await supertest.get( - '/api/apm/rum-client/url-search?start=2020-09-07T20%3A35%3A54.654Z&end=2020-09-16T20%3A35%3A54.654Z&uiFilters=%7B%22serviceName%22%3A%5B%22kibana-frontend-8_0_0%22%5D%7D&percentile=50' - ); + const response = await supertest.get('/internal/apm/ux/url-search').query({ + start: '2020-09-07T20:35:54.654Z', + end: '2020-09-16T20:35:54.654Z', + uiFilters: '{"serviceName":["kibana-frontend-8_0_0"]}', + percentile: 50, + }); expect(response.status).to.be(200); @@ -59,9 +65,13 @@ export default function rumServicesApiTests({ getService }: FtrProviderContext) }); it('returns specific results against query', async () => { - const response = await supertest.get( - '/api/apm/rum-client/url-search?start=2020-09-07T20%3A35%3A54.654Z&end=2020-09-16T20%3A35%3A54.654Z&uiFilters=%7B%22serviceName%22%3A%5B%22kibana-frontend-8_0_0%22%5D%7D&urlQuery=csm&percentile=50' - ); + const response = await supertest.get('/internal/apm/ux/url-search').query({ + start: '2020-09-07T20:35:54.654Z', + end: '2020-09-16T20:35:54.654Z', + uiFilters: '{"serviceName":["kibana-frontend-8_0_0"]}', + urlQuery: 'csm', + percentile: 50, + }); expect(response.status).to.be(200); diff --git a/x-pack/test/apm_api_integration/tests/csm/web_core_vitals.spec.ts b/x-pack/test/apm_api_integration/tests/csm/web_core_vitals.spec.ts index 421bafcb4064..882e9e23a431 100644 --- a/x-pack/test/apm_api_integration/tests/csm/web_core_vitals.spec.ts +++ b/x-pack/test/apm_api_integration/tests/csm/web_core_vitals.spec.ts @@ -14,9 +14,12 @@ export default function rumServicesApiTests({ getService }: FtrProviderContext) registry.when('CSM web core vitals without data', { config: 'trial', archives: [] }, () => { it('returns empty list', async () => { - const response = await supertest.get( - '/api/apm/rum-client/web-core-vitals?start=2020-09-07T20%3A35%3A54.654Z&end=2020-09-14T20%3A35%3A54.654Z&uiFilters=%7B%22serviceName%22%3A%5B%22elastic-co-rum-test%22%5D%7D&percentile=50' - ); + const response = await supertest.get('/internal/apm/ux/web-core-vitals').query({ + start: '2020-09-07T20:35:54.654Z', + end: '2020-09-14T20:35:54.654Z', + uiFilters: '{"serviceName":["elastic-co-rum-test"]}', + percentile: 50, + }); expect(response.status).to.be(200); expect(response.body).to.eql({ @@ -35,9 +38,12 @@ export default function rumServicesApiTests({ getService }: FtrProviderContext) { config: 'trial', archives: ['8.0.0', 'rum_8.0.0'] }, () => { it('returns web core vitals values', async () => { - const response = await supertest.get( - '/api/apm/rum-client/web-core-vitals?start=2020-09-07T20%3A35%3A54.654Z&end=2020-09-16T20%3A35%3A54.654Z&uiFilters=%7B%22serviceName%22%3A%5B%22kibana-frontend-8_0_0%22%5D%7D&percentile=50' - ); + const response = await supertest.get('/internal/apm/ux/web-core-vitals').query({ + start: '2020-09-07T20:35:54.654Z', + end: '2020-09-16T20:35:54.654Z', + uiFilters: '{"serviceName":["kibana-frontend-8_0_0"]}', + percentile: 50, + }); expect(response.status).to.be(200); diff --git a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/update_rules.ts b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/update_rules.ts index d6f69095c43c..819683b564c6 100644 --- a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/update_rules.ts +++ b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/update_rules.ts @@ -132,6 +132,59 @@ export default ({ getService }: FtrProviderContext) => { expect(bodyToCompare).to.eql(outputRule); }); + it('should update a single rule property and remove the action', async () => { + const [connector1] = await Promise.all([ + supertest + .post(`/api/actions/connector`) + .set('kbn-xsrf', 'foo') + .send({ + name: 'My action', + connector_type_id: '.slack', + secrets: { + webhookUrl: 'http://localhost:1234', + }, + }), + ]); + + const action1 = { + group: 'default', + id: connector1.body.id, + action_type_id: connector1.body.connector_type_id, + params: { + message: 'message', + }, + }; + + const ruleWithConnector: ReturnType = { + ...getSimpleRule('rule-1'), + actions: [action1], + }; + const createdRule = await createRule(supertest, log, ruleWithConnector); + expect(createdRule.actions.length).to.eql(1); + + // update a simple rule's name and remove the actions + const updatedRule = getSimpleRuleUpdate('rule-1'); + updatedRule.rule_id = ruleWithConnector.rule_id; + updatedRule.name = 'some other name'; + delete updatedRule.id; + + const { body } = await supertest + .put(DETECTION_ENGINE_RULES_URL) + .set('kbn-xsrf', 'true') + .send(updatedRule) + .expect(200); + + const outputRule = getSimpleRuleOutputWithoutRuleId(); + outputRule.name = 'some other name'; + outputRule.version = 2; + // Expect an empty array + outputRule.actions = []; + // Expect "no_actions" + outputRule.throttle = 'no_actions'; + const bodyToCompare = removeServerGeneratedPropertiesIncludingRuleId(body); + expect(bodyToCompare).to.eql(outputRule); + }); + it('should update a single rule property of name using an auto-generated rule_id and migrate the actions', async () => { const rule = getSimpleRule('rule-1'); delete rule.rule_id; @@ -150,10 +203,20 @@ export default ({ getService }: FtrProviderContext) => { ]); await createLegacyRuleAction(supertest, createRuleBody.id, connector.body.id); + const action1 = { + group: 'default', + id: connector.body.id, + action_type_id: connector.body.connector_type_id, + params: { + message: 'Hourly\nRule {{context.rule.name}} generated {{state.signals_count}} alerts', + }, + }; // update a simple rule's name const updatedRule = getSimpleRuleUpdate('rule-1'); updatedRule.rule_id = createRuleBody.rule_id; updatedRule.name = 'some other name'; + updatedRule.actions = [action1]; + updatedRule.throttle = '1m'; delete updatedRule.id; const { body } = await supertest diff --git a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/update_rules_bulk.ts b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/update_rules_bulk.ts index 217debca079d..b165258237b4 100644 --- a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/update_rules_bulk.ts +++ b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/update_rules_bulk.ts @@ -6,6 +6,7 @@ */ import expect from '@kbn/expect'; +import { FullResponseSchema } from '../../../../plugins/security_solution/common/detection_engine/schemas/request'; import { DETECTION_ENGINE_RULES_URL } from '../../../../plugins/security_solution/common/constants'; import { FtrProviderContext } from '../../common/ftr_provider_context'; @@ -97,42 +98,50 @@ export default ({ getService }: FtrProviderContext) => { }); it('should update two rule properties of name using the two rules rule_id and migrate actions', async () => { - const [connector, rule1, rule2] = await Promise.all([ - supertest - .post(`/api/actions/connector`) - .set('kbn-xsrf', 'foo') - .send({ - name: 'My action', - connector_type_id: '.slack', - secrets: { - webhookUrl: 'http://localhost:1234', - }, - }), - createRule(supertest, log, getSimpleRule('rule-1')), - createRule(supertest, log, getSimpleRule('rule-2')), + const connector = await supertest + .post(`/api/actions/connector`) + .set('kbn-xsrf', 'foo') + .send({ + name: 'My action', + connector_type_id: '.slack', + secrets: { + webhookUrl: 'http://localhost:1234', + }, + }); + const action1 = { + group: 'default', + id: connector.body.id, + action_type_id: connector.body.connector_type_id, + params: { + message: 'Hourly\nRule {{context.rule.name}} generated {{state.signals_count}} alerts', + }, + }; + const [rule1, rule2] = await Promise.all([ + createRule(supertest, log, { ...getSimpleRule('rule-1'), actions: [action1] }), + createRule(supertest, log, { ...getSimpleRule('rule-2'), actions: [action1] }), ]); await Promise.all([ createLegacyRuleAction(supertest, rule1.id, connector.body.id), createLegacyRuleAction(supertest, rule2.id, connector.body.id), ]); - expect(rule1.actions).to.eql([]); - expect(rule2.actions).to.eql([]); - const updatedRule1 = getSimpleRuleUpdate('rule-1'); updatedRule1.name = 'some other name'; + updatedRule1.actions = [action1]; + updatedRule1.throttle = '1m'; const updatedRule2 = getSimpleRuleUpdate('rule-2'); updatedRule2.name = 'some other name'; + updatedRule2.actions = [action1]; + updatedRule2.throttle = '1m'; // update both rule names - const { body } = await supertest + const { body }: { body: FullResponseSchema[] } = await supertest .put(`${DETECTION_ENGINE_RULES_URL}/_bulk_update`) .set('kbn-xsrf', 'true') .send([updatedRule1, updatedRule2]) .expect(200); - // @ts-expect-error body.forEach((response) => { const outputRule = getSimpleRuleOutput(response.rule_id); outputRule.name = 'some other name'; @@ -154,6 +163,58 @@ export default ({ getService }: FtrProviderContext) => { }); }); + it('should update two rule properties of name using the two rules rule_id and remove actions', async () => { + const connector = await supertest + .post(`/api/actions/connector`) + .set('kbn-xsrf', 'foo') + .send({ + name: 'My action', + connector_type_id: '.slack', + secrets: { + webhookUrl: 'http://localhost:1234', + }, + }); + const action1 = { + group: 'default', + id: connector.body.id, + action_type_id: connector.body.connector_type_id, + params: { + message: 'message', + }, + }; + const [rule1, rule2] = await Promise.all([ + createRule(supertest, log, { ...getSimpleRule('rule-1'), actions: [action1] }), + createRule(supertest, log, { ...getSimpleRule('rule-2'), actions: [action1] }), + ]); + await Promise.all([ + createLegacyRuleAction(supertest, rule1.id, connector.body.id), + createLegacyRuleAction(supertest, rule2.id, connector.body.id), + ]); + + const updatedRule1 = getSimpleRuleUpdate('rule-1'); + updatedRule1.name = 'some other name'; + + const updatedRule2 = getSimpleRuleUpdate('rule-2'); + updatedRule2.name = 'some other name'; + + // update both rule names + const { body }: { body: FullResponseSchema[] } = await supertest + .put(`${DETECTION_ENGINE_RULES_URL}/_bulk_update`) + .set('kbn-xsrf', 'true') + .send([updatedRule1, updatedRule2]) + .expect(200); + + body.forEach((response) => { + const outputRule = getSimpleRuleOutput(response.rule_id); + outputRule.name = 'some other name'; + outputRule.version = 2; + outputRule.actions = []; + outputRule.throttle = 'no_actions'; + const bodyToCompare = removeServerGeneratedProperties(response); + expect(bodyToCompare).to.eql(outputRule); + }); + }); + it('should update a single rule property of name using an id', async () => { const createRuleBody = await createRule(supertest, log, getSimpleRule('rule-1')); diff --git a/x-pack/test/fleet_api_integration/apis/epm/setup.ts b/x-pack/test/fleet_api_integration/apis/epm/setup.ts index ce967160f33e..0b669c96bb0e 100644 --- a/x-pack/test/fleet_api_integration/apis/epm/setup.ts +++ b/x-pack/test/fleet_api_integration/apis/epm/setup.ts @@ -24,8 +24,10 @@ export default function (providerContext: FtrProviderContext) { describe('setup performs upgrades', async () => { const oldEndpointVersion = '0.13.0'; beforeEach(async () => { + const url = '/api/fleet/epm/packages/endpoint'; + await supertest.delete(url).set('kbn-xsrf', 'xxxx').send({ force: true }).expect(200); await supertest - .post(`/api/fleet/epm/packages/endpoint-${oldEndpointVersion}`) + .post(`${url}-${oldEndpointVersion}`) .set('kbn-xsrf', 'xxxx') .send({ force: true }) .expect(200); diff --git a/x-pack/test/fleet_api_integration/apis/package_policy/create.ts b/x-pack/test/fleet_api_integration/apis/package_policy/create.ts index 6817289d389f..d568e7224fd2 100644 --- a/x-pack/test/fleet_api_integration/apis/package_policy/create.ts +++ b/x-pack/test/fleet_api_integration/apis/package_policy/create.ts @@ -199,7 +199,8 @@ export default function (providerContext: FtrProviderContext) { .expect(400); }); - it('should not allow multiple limited packages on the same agent policy', async function () { + // https://github.com/elastic/kibana/issues/118257 + it.skip('should not allow multiple limited packages on the same agent policy', async function () { await supertest .post(`/api/fleet/package_policies`) .set('kbn-xsrf', 'xxxx') diff --git a/x-pack/test/fleet_api_integration/config.ts b/x-pack/test/fleet_api_integration/config.ts index d2b61a3f5c32..308c4ab66f15 100644 --- a/x-pack/test/fleet_api_integration/config.ts +++ b/x-pack/test/fleet_api_integration/config.ts @@ -15,7 +15,7 @@ import { defineDockerServersConfig } from '@kbn/test'; // example: https://beats-ci.elastic.co/blue/organizations/jenkins/Ingest-manager%2Fpackage-storage/detail/snapshot/74/pipeline/257#step-302-log-1. // It should be updated any time there is a new Docker image published for the Snapshot Distribution of the Package Registry. export const dockerImage = - 'docker.elastic.co/package-registry/distribution@sha256:42dbdbb7fbc7ea61d0c38c0df6dad977ca2ad9cf01e247543054377aef33d377'; + 'docker.elastic.co/package-registry/distribution@sha256:13d9996dd24161624784704e080f5f5b7f0ef34ff0d9259f8f05010ccae00058'; export default async function ({ readConfigFile }: FtrConfigProviderContext) { const xPackAPITestsConfig = await readConfigFile(require.resolve('../api_integration/config.ts')); diff --git a/x-pack/test/functional/apps/infra/home_page.ts b/x-pack/test/functional/apps/infra/home_page.ts index c0bcee5f7896..ff27b5fe4e37 100644 --- a/x-pack/test/functional/apps/infra/home_page.ts +++ b/x-pack/test/functional/apps/infra/home_page.ts @@ -5,6 +5,7 @@ * 2.0. */ +import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; import { DATES } from './constants'; @@ -44,15 +45,86 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await esArchiver.unload('x-pack/test/functional/es_archives/infra/metrics_and_logs') ); + it('renders an empty data prompt for dates with no data', async () => { + await pageObjects.infraHome.goToTime(DATE_WITHOUT_DATA); + await pageObjects.infraHome.getNoMetricsDataPrompt(); + }); + it('renders the waffle map and tooltips for dates with data', async () => { await pageObjects.infraHome.goToTime(DATE_WITH_DATA); await pageObjects.infraHome.getWaffleMap(); await pageObjects.infraHome.getWaffleMapTooltips(); }); - it('renders an empty data prompt for dates with no data', async () => { - await pageObjects.infraHome.goToTime(DATE_WITHOUT_DATA); - await pageObjects.infraHome.getNoMetricsDataPrompt(); + it('sort nodes by descending value', async () => { + await pageObjects.infraHome.goToTime(DATE_WITH_DATA); + await pageObjects.infraHome.getWaffleMap(); + await pageObjects.infraHome.sortNodesBy('value'); + const nodesWithValue = await pageObjects.infraHome.getNodesWithValues(); + expect(nodesWithValue).to.eql([ + { name: 'demo-stack-apache-01', value: 1.4, color: '#6092c0' }, + { name: 'demo-stack-mysql-01', value: 1.2, color: '#82a7cd' }, + { name: 'demo-stack-nginx-01', value: 1.1, color: '#93b1d3' }, + { name: 'demo-stack-redis-01', value: 1, color: '#a2bcd9' }, + { name: 'demo-stack-haproxy-01', value: 0.8, color: '#c2d2e6' }, + { name: 'demo-stack-client-01', value: 0.6, color: '#f0f4f9' }, + ]); + }); + + it('sort nodes by ascending value', async () => { + await pageObjects.infraHome.goToTime(DATE_WITH_DATA); + await pageObjects.infraHome.getWaffleMap(); + await pageObjects.infraHome.sortNodesBy('value'); + await pageObjects.infraHome.toggleReverseSort(); + const nodesWithValue = await pageObjects.infraHome.getNodesWithValues(); + expect(nodesWithValue).to.eql([ + { name: 'demo-stack-client-01', value: 0.6, color: '#f0f4f9' }, + { name: 'demo-stack-haproxy-01', value: 0.8, color: '#c2d2e6' }, + { name: 'demo-stack-redis-01', value: 1, color: '#a2bcd9' }, + { name: 'demo-stack-nginx-01', value: 1.1, color: '#93b1d3' }, + { name: 'demo-stack-mysql-01', value: 1.2, color: '#82a7cd' }, + { name: 'demo-stack-apache-01', value: 1.4, color: '#6092c0' }, + ]); + }); + + it('group nodes by custom field', async () => { + await pageObjects.infraHome.goToTime(DATE_WITH_DATA); + await pageObjects.infraHome.getWaffleMap(); + const groups = await pageObjects.infraHome.groupByCustomField('host.os.platform'); + expect(groups).to.eql(['ubuntu']); + }); + + it('filter nodes by search term', async () => { + await pageObjects.infraHome.goToTime(DATE_WITH_DATA); + await pageObjects.infraHome.getWaffleMap(); + await pageObjects.infraHome.enterSearchTerm('host.name: "demo-stack-apache-01"'); + const nodesWithValue = await pageObjects.infraHome.getNodesWithValues(); + expect(nodesWithValue).to.eql([ + { name: 'demo-stack-apache-01', value: 1.4, color: '#6092c0' }, + ]); + await pageObjects.infraHome.clearSearchTerm(); + }); + + it('change color palette', async () => { + await pageObjects.infraHome.openLegendControls(); + await pageObjects.infraHome.changePalette('temperature'); + await pageObjects.infraHome.applyLegendControls(); + const nodesWithValue = await pageObjects.infraHome.getNodesWithValues(); + expect(nodesWithValue).to.eql([ + { name: 'demo-stack-client-01', value: 0.6, color: '#6092c0' }, + { name: 'demo-stack-haproxy-01', value: 0.8, color: '#b5c9df' }, + { name: 'demo-stack-redis-01', value: 1, color: '#f1d9b9' }, + { name: 'demo-stack-nginx-01', value: 1.1, color: '#eec096' }, + { name: 'demo-stack-mysql-01', value: 1.2, color: '#eba47a' }, + { name: 'demo-stack-apache-01', value: 1.4, color: '#e7664c' }, + ]); + }); + + it('toggle the timeline', async () => { + await pageObjects.infraHome.goToTime(DATE_WITH_DATA); + await pageObjects.infraHome.getWaffleMap(); + await pageObjects.infraHome.openTimeline(); + await pageObjects.infraHome.closeTimeline(); }); }); diff --git a/x-pack/test/functional/apps/lens/dashboard.ts b/x-pack/test/functional/apps/lens/dashboard.ts index e5ae900b4ed3..b67e2da4f4ec 100644 --- a/x-pack/test/functional/apps/lens/dashboard.ts +++ b/x-pack/test/functional/apps/lens/dashboard.ts @@ -34,8 +34,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await browser.getActions().move({ x, y, origin: el._webElement }).click().perform(); } - // FLAKY: https://github.com/elastic/kibana/issues/117770 - describe.skip('lens dashboard tests', () => { + describe('lens dashboard tests', () => { before(async () => { await PageObjects.common.navigateToApp('dashboard'); await security.testUser.setRoles( @@ -70,7 +69,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await find.clickByButtonText('lnsXYvis'); await dashboardAddPanel.closeAddPanel(); await PageObjects.lens.goToTimeRange(); - await clickInChart(6, 5); // hardcoded position of bar, depends heavy on data and charts implementation + await retry.try(async () => { + await clickInChart(6, 5); // hardcoded position of bar, depends heavy on data and charts implementation + await testSubjects.existOrFail('applyFiltersPopoverButton', { timeout: 2500 }); + }); await retry.try(async () => { await testSubjects.click('applyFiltersPopoverButton'); diff --git a/x-pack/test/functional/apps/lens/index.ts b/x-pack/test/functional/apps/lens/index.ts index 79f9b8f645c1..26fb100adf13 100644 --- a/x-pack/test/functional/apps/lens/index.ts +++ b/x-pack/test/functional/apps/lens/index.ts @@ -70,6 +70,7 @@ export default function ({ getService, loadTestFile, getPageObjects }: FtrProvid this.tags(['ciGroup16', 'skipFirefox']); loadTestFile(require.resolve('./add_to_dashboard')); + loadTestFile(require.resolve('./table_dashboard')); loadTestFile(require.resolve('./table')); loadTestFile(require.resolve('./runtime_fields')); loadTestFile(require.resolve('./dashboard')); diff --git a/x-pack/test/functional/apps/lens/table_dashboard.ts b/x-pack/test/functional/apps/lens/table_dashboard.ts new file mode 100644 index 000000000000..6e76d816fa6a --- /dev/null +++ b/x-pack/test/functional/apps/lens/table_dashboard.ts @@ -0,0 +1,55 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import expect from '@kbn/expect'; +import { FtrProviderContext } from '../../ftr_provider_context'; + +export default function ({ getService, getPageObjects }: FtrProviderContext) { + const PageObjects = getPageObjects(['lens', 'visualize', 'dashboard']); + const listingTable = getService('listingTable'); + const retry = getService('retry'); + + const checkTableSorting = async () => { + // Sort by number + await PageObjects.lens.changeTableSortingBy(2, 'ascending'); + await PageObjects.lens.waitForVisualization(); + expect(await PageObjects.lens.getDatatableCellText(0, 2)).to.eql('17,246'); + // Now sort by IP + await PageObjects.lens.changeTableSortingBy(0, 'ascending'); + await PageObjects.lens.waitForVisualization(); + expect(await PageObjects.lens.getDatatableCellText(0, 0)).to.eql('78.83.247.30'); + // Change the sorting + await PageObjects.lens.changeTableSortingBy(0, 'descending'); + await PageObjects.lens.waitForVisualization(); + expect(await PageObjects.lens.getDatatableCellText(0, 0)).to.eql('169.228.188.120'); + // Remove the sorting + await retry.try(async () => { + await PageObjects.lens.changeTableSortingBy(0, 'none'); + await PageObjects.lens.waitForVisualization(); + expect(await PageObjects.lens.isDatatableHeaderSorted(0)).to.eql(false); + }); + }; + + describe('lens table on dashboard', () => { + it('should sort a table by column in dashboard edit mode', async () => { + await PageObjects.visualize.gotoVisualizationLandingPage(); + await listingTable.searchForItemWithName('lnsXYvis'); + await PageObjects.lens.clickVisualizeListItemTitle('lnsXYvis'); + await PageObjects.lens.goToTimeRange(); + await PageObjects.lens.switchToVisualization('lnsDatatable'); + await PageObjects.lens.save('New Table', true, false, false, 'new'); + + await checkTableSorting(); + }); + + it('should sort a table by column in dashboard view mode', async () => { + await PageObjects.dashboard.saveDashboard('Dashboard with a Lens Table'); + + await checkTableSorting(); + }); + }); +} diff --git a/x-pack/test/functional/apps/ml/anomaly_detection/single_metric_job.ts b/x-pack/test/functional/apps/ml/anomaly_detection/single_metric_job.ts index 97b340c08195..3c3d27ebd524 100644 --- a/x-pack/test/functional/apps/ml/anomaly_detection/single_metric_job.ts +++ b/x-pack/test/functional/apps/ml/anomaly_detection/single_metric_job.ts @@ -10,6 +10,7 @@ import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const ml = getService('ml'); + const browser = getService('browser'); const jobId = `fq_single_1_${Date.now()}`; const jobIdClone = `${jobId}_clone`; @@ -201,7 +202,26 @@ export default function ({ getService }: FtrProviderContext) { await ml.api.assertDetectorResultsExist(jobId, 0); }); + it('job cloning fails in the single metric wizard if a matching data view does not exist', async () => { + await ml.testExecution.logTestStep('delete data view used by job'); + await ml.testResources.deleteIndexPatternByTitle('ft_farequote'); + + // Refresh page to ensure page has correct cache of data views + await browser.refresh(); + + await ml.testExecution.logTestStep( + 'job cloning clicks the clone action and displays an error toast' + ); + await ml.jobTable.clickCloneJobActionWhenNoDataViewExists(jobId); + }); + it('job cloning opens the existing job in the single metric wizard', async () => { + await ml.testExecution.logTestStep('recreate data view used by job'); + await ml.testResources.createIndexPatternIfNeeded('ft_farequote', '@timestamp'); + + // Refresh page to ensure page has correct cache of data views + await browser.refresh(); + await ml.testExecution.logTestStep( 'job cloning clicks the clone action and loads the single metric wizard' ); diff --git a/x-pack/test/functional/apps/ml/data_visualizer/index_data_visualizer_grid_in_dashboard.ts b/x-pack/test/functional/apps/ml/data_visualizer/index_data_visualizer_grid_in_dashboard.ts index 97c6c06bc322..5684c2acd5ba 100644 --- a/x-pack/test/functional/apps/ml/data_visualizer/index_data_visualizer_grid_in_dashboard.ts +++ b/x-pack/test/functional/apps/ml/data_visualizer/index_data_visualizer_grid_in_dashboard.ts @@ -12,7 +12,14 @@ import { farequoteLuceneFiltersSearchTestData } from './index_test_data'; const SHOW_FIELD_STATISTICS = 'discover:showFieldStatistics'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const esArchiver = getService('esArchiver'); - const PageObjects = getPageObjects(['common', 'discover', 'timePicker', 'settings', 'dashboard']); + const PageObjects = getPageObjects([ + 'common', + 'discover', + 'timePicker', + 'settings', + 'dashboard', + 'header', + ]); const ml = getService('ml'); const retry = getService('retry'); const dashboardAddPanel = getService('dashboardAddPanel'); @@ -55,10 +62,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.dashboard.clickNewDashboard(); await dashboardAddPanel.addSavedSearch(savedSearchTitle); - await PageObjects.dashboard.waitForRenderComplete(); + await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.timePicker.setAbsoluteRange(startTime, endTime); - await PageObjects.dashboard.waitForRenderComplete(); + await PageObjects.header.waitUntilLoadingHasFinished(); for (const fieldRow of testData.expected.metricFields as Array< Required @@ -91,13 +98,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.gotoDashboardEditMode(dashboardTitle); - await PageObjects.dashboard.waitForRenderComplete(); + await PageObjects.header.waitUntilLoadingHasFinished(); await dashboardAddPanel.addSavedSearch(savedSearchTitle); - await PageObjects.dashboard.waitForRenderComplete(); + await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.timePicker.setAbsoluteRange(startTime, endTime); - await PageObjects.dashboard.waitForRenderComplete(); + await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.discover.assertFieldStatsTableNotExists(); await PageObjects.dashboard.saveDashboard(dashboardTitle); diff --git a/x-pack/test/functional/apps/monitoring/elasticsearch/nodes_mb.js b/x-pack/test/functional/apps/monitoring/elasticsearch/nodes_mb.js index a031b828e263..ed94a9132717 100644 --- a/x-pack/test/functional/apps/monitoring/elasticsearch/nodes_mb.js +++ b/x-pack/test/functional/apps/monitoring/elasticsearch/nodes_mb.js @@ -53,7 +53,8 @@ export default function ({ getService, getPageObjects }) { }); }); - describe('skipCloud', function () { + // FLAKY: https://github.com/elastic/kibana/issues/116065 + describe.skip('skipCloud', function () { // TODO: https://github.com/elastic/stack-monitoring/issues/31 this.tags(['skipCloud']); diff --git a/x-pack/test/functional/apps/reporting_management/report_listing.ts b/x-pack/test/functional/apps/reporting_management/report_listing.ts index 1291fb686d8b..54320e431d33 100644 --- a/x-pack/test/functional/apps/reporting_management/report_listing.ts +++ b/x-pack/test/functional/apps/reporting_management/report_listing.ts @@ -83,63 +83,63 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { Array [ Object { "actions": "", - "createdAt": "2021-07-19 @ 10:29 PMtest_user", - "report": "Automated reportsearch", - "status": "Completed at 2021-07-19 @ 10:29 PM See report info for warnings. This is a deprecated export type. Automation of this report will need to be re-created for compatibility with future versions of Kibana.", + "createdAt": "2021-07-19 @ 10:29 PM", + "report": "Automated report", + "status": "Done, warnings detected", }, Object { "actions": "", - "createdAt": "2021-07-19 @ 06:47 PMtest_user", - "report": "Discover search [2021-07-19T11:47:35.995-07:00]search", - "status": "Completed at 2021-07-19 @ 06:47 PM", + "createdAt": "2021-07-19 @ 06:47 PM", + "report": "Discover search [2021-07-19T11:47:35.995-07:00]", + "status": "Done", }, Object { "actions": "", - "createdAt": "2021-07-19 @ 06:46 PMtest_user", - "report": "Discover search [2021-07-19T11:46:00.132-07:00]search", - "status": "Completed at 2021-07-19 @ 06:46 PM See report info for warnings.", + "createdAt": "2021-07-19 @ 06:46 PM", + "report": "Discover search [2021-07-19T11:46:00.132-07:00]", + "status": "Done, warnings detected", }, Object { "actions": "", - "createdAt": "2021-07-19 @ 06:44 PMtest_user", - "report": "Discover search [2021-07-19T11:44:48.670-07:00]search", - "status": "Completed at 2021-07-19 @ 06:44 PM See report info for warnings.", + "createdAt": "2021-07-19 @ 06:44 PM", + "report": "Discover search [2021-07-19T11:44:48.670-07:00]", + "status": "Done, warnings detected", }, Object { "actions": "", - "createdAt": "2021-07-19 @ 06:41 PMtest_user", - "report": "[Flights] Global Flight Dashboarddashboard", - "status": "Pending at 2021-07-19 @ 06:41 PM Waiting for job to process.", + "createdAt": "2021-07-19 @ 06:41 PM", + "report": "[Flights] Global Flight Dashboard", + "status": "Pending", }, Object { "actions": "", - "createdAt": "2021-07-19 @ 06:41 PMtest_user", - "report": "[Flights] Global Flight Dashboarddashboard", - "status": "Failed at 2021-07-19 @ 06:43 PM See report info for error details.", + "createdAt": "2021-07-19 @ 06:41 PM", + "report": "[Flights] Global Flight Dashboard", + "status": "Failed", }, Object { "actions": "", - "createdAt": "2021-07-19 @ 06:41 PMtest_user", - "report": "[Flights] Global Flight Dashboarddashboard", - "status": "Completed at 2021-07-19 @ 06:41 PM See report info for warnings.", + "createdAt": "2021-07-19 @ 06:41 PM", + "report": "[Flights] Global Flight Dashboard", + "status": "Done, warnings detected", }, Object { "actions": "", - "createdAt": "2021-07-19 @ 06:38 PMtest_user", - "report": "[Flights] Global Flight Dashboarddashboard", - "status": "Completed at 2021-07-19 @ 06:39 PM See report info for warnings.", + "createdAt": "2021-07-19 @ 06:38 PM", + "report": "[Flights] Global Flight Dashboard", + "status": "Done, warnings detected", }, Object { "actions": "", - "createdAt": "2021-07-19 @ 06:38 PMtest_user", - "report": "[Flights] Global Flight Dashboarddashboard", - "status": "Completed at 2021-07-19 @ 06:39 PM", + "createdAt": "2021-07-19 @ 06:38 PM", + "report": "[Flights] Global Flight Dashboard", + "status": "Done", }, Object { "actions": "", - "createdAt": "2021-07-19 @ 06:38 PMtest_user", - "report": "[Flights] Global Flight Dashboarddashboard", - "status": "Completed at 2021-07-19 @ 06:38 PM", + "createdAt": "2021-07-19 @ 06:38 PM", + "report": "[Flights] Global Flight Dashboard", + "status": "Done", }, ] `); diff --git a/x-pack/test/functional/apps/spaces/enter_space.ts b/x-pack/test/functional/apps/spaces/enter_space.ts index d58a5c0f19f3..7a3ffc50a482 100644 --- a/x-pack/test/functional/apps/spaces/enter_space.ts +++ b/x-pack/test/functional/apps/spaces/enter_space.ts @@ -14,7 +14,8 @@ export default function enterSpaceFunctonalTests({ const esArchiver = getService('esArchiver'); const PageObjects = getPageObjects(['security', 'spaceSelector']); - describe('Enter Space', function () { + // FLAKY: https://github.com/elastic/kibana/issues/100570 + describe.skip('Enter Space', function () { this.tags('includeFirefox'); before(async () => { await esArchiver.load('x-pack/test/functional/es_archives/spaces/enter_space'); diff --git a/x-pack/test/functional/apps/uptime/ping_redirects.ts b/x-pack/test/functional/apps/uptime/ping_redirects.ts index 03185ac9f146..06352d37ada2 100644 --- a/x-pack/test/functional/apps/uptime/ping_redirects.ts +++ b/x-pack/test/functional/apps/uptime/ping_redirects.ts @@ -19,7 +19,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { const monitor = () => uptime.monitor; - describe('Ping redirects', () => { + // FLAKY: https://github.com/elastic/kibana/issues/118476 + describe.skip('Ping redirects', () => { const start = '~ 15 minutes ago'; const end = 'now'; diff --git a/x-pack/test/functional/es_archives/ml/module_apm_transaction/data.json.gz b/x-pack/test/functional/es_archives/ml/module_apm_transaction/data.json.gz new file mode 100644 index 000000000000..56c3e0ebc5e1 Binary files /dev/null and b/x-pack/test/functional/es_archives/ml/module_apm_transaction/data.json.gz differ diff --git a/x-pack/test/functional/es_archives/ml/module_apm_transaction/mappings.json b/x-pack/test/functional/es_archives/ml/module_apm_transaction/mappings.json new file mode 100644 index 000000000000..92c1fcdb3ed4 --- /dev/null +++ b/x-pack/test/functional/es_archives/ml/module_apm_transaction/mappings.json @@ -0,0 +1,501 @@ +{ + "type": "index", + "value": { + "aliases": { + }, + "index": "ft_module_apm_transaction", + "mappings": { + "properties": { + "@timestamp": { + "type": "date" + }, + "agent": { + "properties": { + "name": { + "fields": { + "keyword": { + "ignore_above": 256, + "type": "keyword" + } + }, + "type": "text" + } + } + }, + "ecs": { + "properties": { + "version": { + "fields": { + "keyword": { + "ignore_above": 256, + "type": "keyword" + } + }, + "type": "text" + } + } + }, + "event": { + "properties": { + "action": { + "ignore_above": 1024, + "type": "keyword" + }, + "category": { + "ignore_above": 1024, + "type": "keyword" + }, + "code": { + "ignore_above": 1024, + "type": "keyword" + }, + "created": { + "type": "date" + }, + "dataset": { + "ignore_above": 1024, + "type": "keyword" + }, + "duration": { + "type": "long" + }, + "end": { + "type": "date" + }, + "hash": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "ingested": { + "type": "date" + }, + "kind": { + "ignore_above": 1024, + "type": "keyword" + }, + "module": { + "ignore_above": 1024, + "type": "keyword" + }, + "original": { + "ignore_above": 1024, + "index": false, + "type": "keyword" + }, + "outcome": { + "ignore_above": 1024, + "type": "keyword" + }, + "provider": { + "ignore_above": 1024, + "type": "keyword" + }, + "reason": { + "ignore_above": 1024, + "type": "keyword" + }, + "reference": { + "ignore_above": 1024, + "type": "keyword" + }, + "risk_score": { + "type": "float" + }, + "risk_score_norm": { + "type": "float" + }, + "sequence": { + "type": "long" + }, + "severity": { + "type": "long" + }, + "start": { + "type": "date" + }, + "timezone": { + "ignore_above": 1024, + "type": "keyword" + }, + "type": { + "ignore_above": 1024, + "type": "keyword" + }, + "url": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "host": { + "properties": { + "hostname": { + "fields": { + "keyword": { + "ignore_above": 256, + "type": "keyword" + } + }, + "type": "text" + }, + "name": { + "fields": { + "keyword": { + "ignore_above": 256, + "type": "keyword" + } + }, + "type": "text" + } + } + }, + "metricset": { + "properties": { + "name": { + "fields": { + "keyword": { + "ignore_above": 256, + "type": "keyword" + } + }, + "type": "text" + } + } + }, + "observer": { + "properties": { + "ephemeral_id": { + "fields": { + "keyword": { + "ignore_above": 256, + "type": "keyword" + } + }, + "type": "text" + }, + "hostname": { + "fields": { + "keyword": { + "ignore_above": 256, + "type": "keyword" + } + }, + "type": "text" + }, + "id": { + "fields": { + "keyword": { + "ignore_above": 256, + "type": "keyword" + } + }, + "type": "text" + }, + "name": { + "fields": { + "keyword": { + "ignore_above": 256, + "type": "keyword" + } + }, + "type": "text" + }, + "type": { + "fields": { + "keyword": { + "ignore_above": 256, + "type": "keyword" + } + }, + "type": "text" + }, + "version": { + "fields": { + "keyword": { + "ignore_above": 256, + "type": "keyword" + } + }, + "type": "text" + }, + "version_major": { + "type": "long" + } + } + }, + "processor": { + "properties": { + "event": { + "fields": { + "keyword": { + "ignore_above": 256, + "type": "keyword" + } + }, + "type": "text" + }, + "name": { + "fields": { + "keyword": { + "ignore_above": 256, + "type": "keyword" + } + }, + "type": "text" + } + } + }, + "service": { + "dynamic": "false", + "properties": { + "environment": { + "ignore_above": 1024, + "type": "keyword" + }, + "ephemeral_id": { + "ignore_above": 1024, + "type": "keyword" + }, + "framework": { + "properties": { + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "version": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "language": { + "properties": { + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "version": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "node": { + "properties": { + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "runtime": { + "properties": { + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "version": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "state": { + "ignore_above": 1024, + "type": "keyword" + }, + "type": { + "ignore_above": 1024, + "type": "keyword" + }, + "version": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "timeseries": { + "properties": { + "instance": { + "fields": { + "keyword": { + "ignore_above": 256, + "type": "keyword" + } + }, + "type": "text" + } + } + }, + "transaction": { + "properties": { + "breakdown": { + "properties": { + "count": { + "type": "long" + } + } + }, + "duration": { + "properties": { + "count": { + "type": "long" + }, + "histogram": { + "type": "histogram" + }, + "sum": { + "properties": { + "us": { + "meta": { + "unit": "micros" + }, + "type": "long" + } + } + }, + "us": { + "type": "long" + } + } + }, + "experience": { + "properties": { + "cls": { + "scaling_factor": 1000000, + "type": "scaled_float" + }, + "fid": { + "scaling_factor": 1000000, + "type": "scaled_float" + }, + "longtask": { + "properties": { + "count": { + "type": "long" + }, + "max": { + "scaling_factor": 1000000, + "type": "scaled_float" + }, + "sum": { + "scaling_factor": 1000000, + "type": "scaled_float" + } + } + }, + "tbt": { + "scaling_factor": 1000000, + "type": "scaled_float" + } + } + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "marks": { + "dynamic": "true", + "properties": { + "*": { + "properties": { + "*": { + "dynamic": "true", + "type": "object" + } + } + } + } + }, + "message": { + "dynamic": "false", + "properties": { + "age": { + "properties": { + "ms": { + "type": "long" + } + } + }, + "queue": { + "properties": { + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + } + } + }, + "name": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + }, + "result": { + "ignore_above": 1024, + "type": "keyword" + }, + "root": { + "type": "boolean" + }, + "sampled": { + "type": "boolean" + }, + "self_time": { + "properties": { + "count": { + "type": "long" + }, + "sum": { + "properties": { + "us": { + "meta": { + "unit": "micros" + }, + "type": "long" + } + } + } + } + }, + "span_count": { + "properties": { + "dropped": { + "type": "long" + } + } + }, + "type": { + "ignore_above": 1024, + "type": "keyword" + } + } + } + } + }, + "settings": { + "index": { + "number_of_replicas": "1", + "number_of_shards": "1" + } + } + } +} \ No newline at end of file diff --git a/x-pack/test/functional/es_archives/rules_scheduled_task_id/data.json b/x-pack/test/functional/es_archives/rules_scheduled_task_id/data.json new file mode 100644 index 000000000000..159380a281de --- /dev/null +++ b/x-pack/test/functional/es_archives/rules_scheduled_task_id/data.json @@ -0,0 +1,74 @@ +{ + "type": "doc", + "value": { + "id": "alert:74f3e6d7-b7bb-477d-ac28-92ee22728e6e", + "index": ".kibana_1", + "source": { + "alert": { + "actions": [ + ], + "alertTypeId": "example.always-firing", + "apiKey": "QIUT8u0/kbOakEHSj50jDpVR90MrqOxanEscboYOoa8PxQvcA5jfHash+fqH3b+KNjJ1LpnBcisGuPkufY9j1e32gKzwGZV5Bfys87imHvygJvIM8uKiFF8bQ8Y4NTaxOJO9fAmZPrFy07ZcQMCAQz+DUTgBFqs=", + "apiKeyOwner": "elastic", + "consumer": "alerts", + "createdAt": "2020-06-17T15:35:38.497Z", + "createdBy": "elastic", + "enabled": true, + "muteAll": false, + "mutedInstanceIds": [ + ], + "name": "always-firing-alert", + "params": { + }, + "schedule": { + "interval": "1m" + }, + "scheduledTaskId": "329798f0-b0b0-11ea-9510-fdf248d5f2a4", + "tags": [ + ], + "throttle": null, + "updatedBy": "elastic" + }, + "migrationVersion": { + "alert": "7.16.0" + }, + "references": [ + ], + "type": "alert", + "updated_at": "2020-06-17T15:35:39.839Z" + } + } +} + +{ + "type": "doc", + "value": { + "id": "task:329798f0-b0b0-11ea-9510-fdf248d5f2a4", + "index": ".kibana_task_manager_1", + "source": { + "migrationVersion": { + "task": "7.16.0" + }, + "task": { + "attempts": 0, + "ownerId": null, + "params": "{\"alertId\":\"74f3e6d7-b7bb-477d-ac28-92ee22728e6e\",\"spaceId\":\"default\"}", + "retryAt": null, + "runAt": "2021-11-05T16:21:52.148Z", + "schedule": { + "interval": "1m" + }, + "scheduledAt": "2021-11-05T15:28:42.055Z", + "scope": [ + "alerting" + ], + "startedAt": null, + "status": "idle", + "taskType": "alerting:example.always-firing" + }, + "references": [], + "type": "task", + "updated_at": "2021-11-05T16:21:37.629Z" + } + } +} \ No newline at end of file diff --git a/x-pack/test/functional/es_archives/rules_scheduled_task_id/mappings.json b/x-pack/test/functional/es_archives/rules_scheduled_task_id/mappings.json new file mode 100644 index 000000000000..45adfd491a09 --- /dev/null +++ b/x-pack/test/functional/es_archives/rules_scheduled_task_id/mappings.json @@ -0,0 +1,460 @@ +{ + "type": "index", + "value": { + "aliases": { + ".kibana": { + } + }, + "index": ".kibana_1", + "mappings": { + "_meta": { + "migrationMappingPropertyHashes": { + "action": "6e96ac5e648f57523879661ea72525b7", + "action_task_params": "a9d49f184ee89641044be0ca2950fa3a", + "alert": "7b44fba6773e37c806ce290ea9b7024e", + "apm-indices": "9bb9b2bf1fa636ed8619cbab5ce6a1dd", + "apm-telemetry": "3525d7c22c42bc80f5e6e9cb3f2b26a2", + "application_usage_totals": "c897e4310c5f24b07caaff3db53ae2c1", + "application_usage_transactional": "965839e75f809fefe04f92dc4d99722a", + "canvas-element": "7390014e1091044523666d97247392fc", + "canvas-workpad": "b0a1706d356228dbdcb4a17e6b9eb231", + "cases": "32aa96a6d3855ddda53010ae2048ac22", + "cases-comments": "c2061fb929f585df57425102fa928b4b", + "cases-configure": "42711cbb311976c0687853f4c1354572", + "cases-user-actions": "32277330ec6b721abe3b846cfd939a71", + "config": "ae24d22d5986d04124cc6568f771066f", + "dashboard": "d00f614b29a80360e1190193fd333bab", + "file-upload-telemetry": "0ed4d3e1983d1217a30982630897092e", + "graph-workspace": "cd7ba1330e6682e9cc00b78850874be1", + "index-pattern": "66eccb05066c5a89924f48a9e9736499", + "infrastructure-ui-source": "ddc0ecb18383f6b26101a2fadb2dab0c", + "inventory-view": "88fc7e12fd1b45b6f0787323ce4f18d2", + "kql-telemetry": "d12a98a6f19a2d273696597547e064ee", + "lens": "d33c68a69ff1e78c9888dedd2164ac22", + "lens-ui-telemetry": "509bfa5978586998e05f9e303c07a327", + "map": "23d7aa4a720d4938ccde3983f87bd58d", + "maps-telemetry": "bfd39d88aadadb4be597ea984d433dbe", + "metrics-explorer-view": "428e319af3e822c80a84cf87123ca35c", + "migrationVersion": "4a1746014a75ade3a714e1db5763276f", + "ml-telemetry": "257fd1d4b4fdbb9cb4b8a3b27da201e9", + "namespace": "2f4316de49999235636386fe51dc06c1", + "namespaces": "2f4316de49999235636386fe51dc06c1", + "query": "11aaeb7f5f7fa5bb43f25e18ce26e7d9", + "references": "7997cf5a56cc02bdc9c93361bde732b0", + "sample-data-telemetry": "7d3cfeb915303c9641c59681967ffeb4", + "search": "181661168bbadd1eff5902361e2a0d5c", + "space": "c5ca8acafa0beaa4d08d014a97b6bc6b", + "telemetry": "36a616f7026dfa617d6655df850fe16d", + "todo": "082a2cc96a590268344d5cd74c159ac4", + "tsvb-validation-telemetry": "3a37ef6c8700ae6fc97d5c7da00e9215", + "type": "2f4316de49999235636386fe51dc06c1", + "ui-metric": "0d409297dc5ebe1e3a1da691c6ee32e3", + "updated_at": "00da57df13e94e9d98437d13ace4bfe0", + "upgrade-assistant-reindex-operation": "296a89039fc4260292be36b1b005d8f2", + "upgrade-assistant-telemetry": "56702cec857e0a9dacfb696655b4ff7b", + "uptime-dynamic-settings": "fcdb453a30092f022f2642db29523d80", + "url": "b675c3be8d76ecf029294d51dc7ec65d", + "visualization": "52d7a13ad68a150c4525b292d23e12cc" + } + }, + "dynamic": "strict", + "properties": { + "action": { + "properties": { + "actionTypeId": { + "type": "keyword" + }, + "config": { + "enabled": false, + "type": "object" + }, + "name": { + "fields": { + "keyword": { + "type": "keyword" + } + }, + "type": "text" + }, + "secrets": { + "type": "binary" + } + } + }, + "action_task_params": { + "properties": { + "actionId": { + "type": "keyword" + }, + "apiKey": { + "type": "binary" + }, + "params": { + "enabled": false, + "type": "object" + } + } + }, + "alert": { + "properties": { + "actions": { + "properties": { + "actionRef": { + "type": "keyword" + }, + "actionTypeId": { + "type": "keyword" + }, + "group": { + "type": "keyword" + }, + "params": { + "enabled": false, + "type": "object" + } + }, + "type": "nested" + }, + "alertTypeId": { + "type": "keyword" + }, + "apiKey": { + "type": "binary" + }, + "apiKeyOwner": { + "type": "keyword" + }, + "consumer": { + "type": "keyword" + }, + "createdAt": { + "type": "date" + }, + "createdBy": { + "type": "keyword" + }, + "enabled": { + "type": "boolean" + }, + "muteAll": { + "type": "boolean" + }, + "mutedInstanceIds": { + "type": "keyword" + }, + "name": { + "fields": { + "keyword": { + "type": "keyword" + } + }, + "type": "text" + }, + "params": { + "enabled": false, + "type": "object" + }, + "schedule": { + "properties": { + "interval": { + "type": "keyword" + } + } + }, + "scheduledTaskId": { + "type": "keyword" + }, + "tags": { + "type": "keyword" + }, + "throttle": { + "type": "keyword" + }, + "updatedBy": { + "type": "keyword" + } + } + }, + "config": { + "dynamic": "true", + "properties": { + "buildNum": { + "type": "keyword" + } + } + }, + "migrationVersion": { + "dynamic": "true", + "properties": { + "alert": { + "fields": { + "keyword": { + "ignore_above": 256, + "type": "keyword" + } + }, + "type": "text" + }, + "config": { + "fields": { + "keyword": { + "ignore_above": 256, + "type": "keyword" + } + }, + "type": "text" + }, + "space": { + "fields": { + "keyword": { + "ignore_above": 256, + "type": "keyword" + } + }, + "type": "text" + } + } + }, + "namespace": { + "type": "keyword" + }, + "namespaces": { + "type": "keyword" + }, + "query": { + "properties": { + "description": { + "type": "text" + }, + "filters": { + "enabled": false, + "type": "object" + }, + "query": { + "properties": { + "language": { + "type": "keyword" + }, + "query": { + "index": false, + "type": "keyword" + } + } + }, + "timefilter": { + "enabled": false, + "type": "object" + }, + "title": { + "type": "text" + } + } + }, + "references": { + "properties": { + "id": { + "type": "keyword" + }, + "name": { + "type": "keyword" + }, + "type": { + "type": "keyword" + } + }, + "type": "nested" + }, + "search": { + "properties": { + "columns": { + "type": "keyword" + }, + "description": { + "type": "text" + }, + "hits": { + "type": "integer" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" + } + } + }, + "sort": { + "type": "keyword" + }, + "title": { + "type": "text" + }, + "version": { + "type": "integer" + } + } + }, + "space": { + "properties": { + "_reserved": { + "type": "boolean" + }, + "color": { + "type": "keyword" + }, + "description": { + "type": "text" + }, + "disabledFeatures": { + "type": "keyword" + }, + "imageUrl": { + "index": false, + "type": "text" + }, + "initials": { + "type": "keyword" + }, + "name": { + "fields": { + "keyword": { + "ignore_above": 2048, + "type": "keyword" + } + }, + "type": "text" + } + } + }, + "type": { + "type": "keyword" + }, + "updated_at": { + "type": "date" + } + } + }, + "settings": { + "index": { + "auto_expand_replicas": "0-1", + "number_of_replicas": "1", + "number_of_shards": "1" + } + } + } +} + +{ + "type": "index", + "value": { + "aliases": { + ".kibana_task_manager": { + } + }, + "index": ".kibana_task_manager_1", + "mappings": { + "_meta": { + "migrationMappingPropertyHashes": { + "migrationVersion": "4a1746014a75ade3a714e1db5763276f", + "namespace": "2f4316de49999235636386fe51dc06c1", + "namespaces": "2f4316de49999235636386fe51dc06c1", + "originId": "2f4316de49999235636386fe51dc06c1", + "references": "7997cf5a56cc02bdc9c93361bde732b0", + "task": "235412e52d09e7165fac8a67a43ad6b4", + "type": "2f4316de49999235636386fe51dc06c1", + "updated_at": "00da57df13e94e9d98437d13ace4bfe0" + } + }, + "dynamic": "strict", + "properties": { + "migrationVersion": { + "dynamic": "true", + "properties": { + "task": { + "fields": { + "keyword": { + "ignore_above": 256, + "type": "keyword" + } + }, + "type": "text" + } + } + }, + "references": { + "properties": { + "id": { + "type": "keyword" + }, + "name": { + "type": "keyword" + }, + "type": { + "type": "keyword" + } + }, + "type": "nested" + }, + "task": { + "properties": { + "attempts": { + "type": "integer" + }, + "ownerId": { + "type": "keyword" + }, + "params": { + "type": "text" + }, + "retryAt": { + "type": "date" + }, + "runAt": { + "type": "date" + }, + "schedule": { + "properties": { + "interval": { + "type": "keyword" + } + } + }, + "scheduledAt": { + "type": "date" + }, + "scope": { + "type": "keyword" + }, + "startedAt": { + "type": "date" + }, + "state": { + "type": "text" + }, + "status": { + "type": "keyword" + }, + "taskType": { + "type": "keyword" + }, + "user": { + "type": "keyword" + } + } + }, + "type": { + "type": "keyword" + }, + "updated_at": { + "type": "date" + } + } + }, + "settings": { + "index": { + "auto_expand_replicas": "0-1", + "number_of_replicas": "0", + "number_of_shards": "1" + } + } + } +} diff --git a/x-pack/test/functional/page_objects/infra_home_page.ts b/x-pack/test/functional/page_objects/infra_home_page.ts index 726668e3b1b0..2f2c1407fc04 100644 --- a/x-pack/test/functional/page_objects/infra_home_page.ts +++ b/x-pack/test/functional/page_objects/infra_home_page.ts @@ -16,6 +16,7 @@ export function InfraHomePageProvider({ getService, getPageObjects }: FtrProvide const find = getService('find'); const browser = getService('browser'); const pageObjects = getPageObjects(['common']); + const comboBox = getService('comboBox'); return { async goToTime(time: string) { @@ -65,6 +66,85 @@ export function InfraHomePageProvider({ getService, getPageObjects }: FtrProvide expect(await values2[3].getVisibleText()).to.be('255.1kbit/s'); }, + async getNodesWithValues() { + const nodes = await testSubjects.findAll('nodeContainer'); + const promises = nodes.map(async (node) => { + const nodeName = await node.findByTestSubject('nodeName'); + const name = await nodeName.getVisibleText(); + const nodeValue = await node.findByTestSubject('nodeValue'); + const value = await nodeValue.getVisibleText(); + const color = await nodeValue.getAttribute('color'); + return { name, value: parseFloat(value), color }; + }); + return await Promise.all(promises); + }, + + async sortNodesBy(sort: string) { + await testSubjects.click('waffleSortByDropdown'); + if (sort === 'value') { + await testSubjects.find('waffleSortByValue'); + await testSubjects.click('waffleSortByValue'); + } else { + await testSubjects.find('waffleSortByName'); + await testSubjects.click('waffleSortByName'); + } + }, + + async groupByCustomField(field: string) { + await testSubjects.click('waffleGroupByDropdown'); + const contextMenu = await testSubjects.find('groupByContextMenu'); + const menuItems = await contextMenu.findAllByCssSelector('button.euiContextMenuItem'); + await menuItems[0].click(); + const groupByCustomField = await testSubjects.find('groupByCustomField'); + await comboBox.setElement(groupByCustomField, field); + await testSubjects.click('groupByCustomFieldAddButton'); + await this.waitForLoading(); + const groupNameLinks = await testSubjects.findAll('groupNameLink'); + return Promise.all(groupNameLinks.map(async (link) => link.getVisibleText())); + }, + + async enterSearchTerm(query: string) { + const input = await this.clearSearchTerm(); + await input.type([query, browser.keys.RETURN]); + await this.waitForLoading(); + }, + + async clearSearchTerm() { + const input = await testSubjects.find('infraSearchField'); + await input.clearValueWithKeyboard({ charByChar: true }); + return input; + }, + + async openLegendControls() { + await testSubjects.click('openLegendControlsButton'); + await testSubjects.find('legendControls'); + }, + + async changePalette(paletteId: string) { + await testSubjects.find('legendControlsPalette'); + await testSubjects.selectValue('legendControlsPalette', paletteId); + }, + + async applyLegendControls() { + await testSubjects.click('applyLegendControlsButton'); + }, + + async toggleReverseSort() { + await testSubjects.click('waffleSortByDropdown'); + await testSubjects.find('waffleSortByDirection'); + await testSubjects.click('waffleSortByDirection'); + }, + + async openTimeline() { + await testSubjects.click('toggleTimelineButton'); + await testSubjects.existOrFail('timelineContainerOpen'); + }, + + async closeTimeline() { + await testSubjects.click('toggleTimelineButton'); + await testSubjects.existOrFail('timelineContainerClosed'); + }, + async openInvenotrySwitcher() { await testSubjects.click('openInventorySwitcher'); return await testSubjects.find('goToHost'); diff --git a/x-pack/test/functional/page_objects/lens_page.ts b/x-pack/test/functional/page_objects/lens_page.ts index 247dc607c003..ca097ffe757c 100644 --- a/x-pack/test/functional/page_objects/lens_page.ts +++ b/x-pack/test/functional/page_objects/lens_page.ts @@ -6,7 +6,7 @@ */ import expect from '@kbn/expect'; -import { delay } from 'bluebird'; +import { setTimeout as setTimeoutAsync } from 'timers/promises'; import { FtrProviderContext } from '../ftr_provider_context'; import { logWrapper } from './log_wrapper'; @@ -20,6 +20,8 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont const browser = getService('browser'); const dashboardAddPanel = getService('dashboardAddPanel'); + const FORMULA_TAB_HEIGHT = 40; + const PageObjects = getPageObjects([ 'common', 'header', @@ -129,9 +131,18 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont const operationSelector = opts.isPreviousIncompatible ? `lns-indexPatternDimension-${opts.operation} incompatible` : `lns-indexPatternDimension-${opts.operation}`; - await retry.try(async () => { - await testSubjects.exists(operationSelector); - await testSubjects.click(operationSelector); + async function getAriaPressed() { + const operationSelectorContainer = await testSubjects.find(operationSelector); + await testSubjects.click(operationSelector, undefined, FORMULA_TAB_HEIGHT); + const ariaPressed = await operationSelectorContainer.getAttribute('aria-pressed'); + return ariaPressed; + } + + // adding retry here as it seems that there is a flakiness of the operation click + // it seems that the aria-pressed attribute is updated to true when the button is clicked + await retry.waitFor('aria pressed to be true', async () => { + const ariaPressedStatus = await getAriaPressed(); + return ariaPressedStatus === 'true'; }); } if (opts.field) { @@ -1094,7 +1105,7 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont draggedOver, dropTarget ); - await delay(150); + await setTimeoutAsync(150); }, /** diff --git a/x-pack/test/functional/page_objects/rollup_page.ts b/x-pack/test/functional/page_objects/rollup_page.ts index 0740a8f015da..28ad65f60a49 100644 --- a/x-pack/test/functional/page_objects/rollup_page.ts +++ b/x-pack/test/functional/page_objects/rollup_page.ts @@ -6,7 +6,6 @@ */ import expect from '@kbn/expect'; -import { map as mapAsync } from 'bluebird'; import { FtrService } from '../ftr_provider_context'; export class RollupPageObject extends FtrService { @@ -111,26 +110,32 @@ export class RollupPageObject extends FtrService { async getJobList() { const jobs = await this.testSubjects.findAll('jobTableRow'); - return mapAsync(jobs, async (job) => { - const jobNameElement = await job.findByTestSubject('jobTableCell-id'); - const jobStatusElement = await job.findByTestSubject('jobTableCell-status'); - const jobIndexPatternElement = await job.findByTestSubject('jobTableCell-indexPattern'); - const jobRollUpIndexPatternElement = await job.findByTestSubject('jobTableCell-rollupIndex'); - const jobDelayElement = await job.findByTestSubject('jobTableCell-rollupDelay'); - const jobIntervalElement = await job.findByTestSubject('jobTableCell-dateHistogramInterval'); - const jobGroupElement = await job.findByTestSubject('jobTableCell-groups'); - const jobMetricsElement = await job.findByTestSubject('jobTableCell-metrics'); - - return { - jobName: await jobNameElement.getVisibleText(), - jobStatus: await jobStatusElement.getVisibleText(), - jobIndexPattern: await jobIndexPatternElement.getVisibleText(), - jobRollUpIndexPattern: await jobRollUpIndexPatternElement.getVisibleText(), - jobDelayElement: await jobDelayElement.getVisibleText(), - jobInterval: await jobIntervalElement.getVisibleText(), - jobGroup: await jobGroupElement.getVisibleText(), - jobMetrics: await jobMetricsElement.getVisibleText(), - }; - }); + return await Promise.all( + jobs.map(async (job) => { + const jobNameElement = await job.findByTestSubject('jobTableCell-id'); + const jobStatusElement = await job.findByTestSubject('jobTableCell-status'); + const jobIndexPatternElement = await job.findByTestSubject('jobTableCell-indexPattern'); + const jobRollUpIndexPatternElement = await job.findByTestSubject( + 'jobTableCell-rollupIndex' + ); + const jobDelayElement = await job.findByTestSubject('jobTableCell-rollupDelay'); + const jobIntervalElement = await job.findByTestSubject( + 'jobTableCell-dateHistogramInterval' + ); + const jobGroupElement = await job.findByTestSubject('jobTableCell-groups'); + const jobMetricsElement = await job.findByTestSubject('jobTableCell-metrics'); + + return { + jobName: await jobNameElement.getVisibleText(), + jobStatus: await jobStatusElement.getVisibleText(), + jobIndexPattern: await jobIndexPatternElement.getVisibleText(), + jobRollUpIndexPattern: await jobRollUpIndexPatternElement.getVisibleText(), + jobDelayElement: await jobDelayElement.getVisibleText(), + jobInterval: await jobIntervalElement.getVisibleText(), + jobGroup: await jobGroupElement.getVisibleText(), + jobMetrics: await jobMetricsElement.getVisibleText(), + }; + }) + ); } } diff --git a/x-pack/test/functional/page_objects/watcher_page.ts b/x-pack/test/functional/page_objects/watcher_page.ts index 5aeaddffff58..ad5153a93346 100644 --- a/x-pack/test/functional/page_objects/watcher_page.ts +++ b/x-pack/test/functional/page_objects/watcher_page.ts @@ -5,7 +5,6 @@ * 2.0. */ -import { map as mapAsync } from 'bluebird'; import { FtrService } from '../ftr_provider_context'; export class WatcherPageObject extends FtrService { @@ -51,16 +50,18 @@ export class WatcherPageObject extends FtrService { // get all the watches in the list async getWatches() { const watches = await this.find.allByCssSelector('.euiTableRow'); - return mapAsync(watches, async (watch) => { - const checkBox = await watch.findByCssSelector('td:nth-child(1)'); - const id = await watch.findByCssSelector('td:nth-child(2)'); - const name = await watch.findByCssSelector('td:nth-child(3)'); + return await Promise.all( + watches.map(async (watch) => { + const checkBox = await watch.findByCssSelector('td:nth-child(1)'); + const id = await watch.findByCssSelector('td:nth-child(2)'); + const name = await watch.findByCssSelector('td:nth-child(3)'); - return { - checkBox: (await checkBox.getAttribute('innerHTML')).includes('input'), - id: await id.getVisibleText(), - name: (await name.getVisibleText()).split(',').map((role) => role.trim()), - }; - }); + return { + checkBox: (await checkBox.getAttribute('innerHTML')).includes('input'), + id: await id.getVisibleText(), + name: (await name.getVisibleText()).split(',').map((role) => role.trim()), + }; + }) + ); } } diff --git a/x-pack/test/functional/services/ace_editor.js b/x-pack/test/functional/services/ace_editor.js index 589f05695e06..2b2adde74ecc 100644 --- a/x-pack/test/functional/services/ace_editor.js +++ b/x-pack/test/functional/services/ace_editor.js @@ -5,8 +5,6 @@ * 2.0. */ -import { map as mapAsync } from 'bluebird'; - export function AceEditorProvider({ getService }) { const testSubjects = getService('testSubjects'); const find = getService('find'); @@ -35,7 +33,7 @@ export function AceEditorProvider({ getService }) { return await retry.try(async () => { const editor = await testSubjects.find(testSubjectSelector); const lines = await editor.findAllByClassName('ace_line'); - const linesText = await mapAsync(lines, (line) => line.getVisibleText()); + const linesText = await Promise.all(lines.map((line) => line.getVisibleText())); return linesText.join('\n'); }); } diff --git a/x-pack/test/functional/services/ml/data_frame_analytics_table.ts b/x-pack/test/functional/services/ml/data_frame_analytics_table.ts index 0bfb37c6c94f..18e3c4d898bd 100644 --- a/x-pack/test/functional/services/ml/data_frame_analytics_table.ts +++ b/x-pack/test/functional/services/ml/data_frame_analytics_table.ts @@ -163,9 +163,11 @@ export function MachineLearningDataFrameAnalyticsTableProvider({ getService }: F } public async openMapView(analyticsId: string) { - await this.assertJobRowMapButtonExists(analyticsId); - await testSubjects.click(this.rowSelector(analyticsId, 'mlAnalyticsJobMapButton')); - await testSubjects.existOrFail('mlPageDataFrameAnalyticsMap', { timeout: 20 * 1000 }); + await retry.tryForTime(20 * 1000, async () => { + await this.assertJobRowMapButtonExists(analyticsId); + await testSubjects.click(this.rowSelector(analyticsId, 'mlAnalyticsJobMapButton')); + await testSubjects.existOrFail('mlPageDataFrameAnalyticsMap', { timeout: 5 * 1000 }); + }); } public async assertAnalyticsSearchInputValue(expectedSearchValue: string) { diff --git a/x-pack/test/functional/services/ml/job_table.ts b/x-pack/test/functional/services/ml/job_table.ts index 67488d88aa12..e2d50c52c55b 100644 --- a/x-pack/test/functional/services/ml/job_table.ts +++ b/x-pack/test/functional/services/ml/job_table.ts @@ -373,6 +373,16 @@ export function MachineLearningJobTableProvider( await testSubjects.existOrFail('~mlPageJobWizard'); } + public async clickCloneJobActionWhenNoDataViewExists(jobId: string) { + await this.ensureJobActionsMenuOpen(jobId); + await testSubjects.click('mlActionButtonCloneJob'); + await this.assertNoDataViewForCloneJobWarningToastExist(); + } + + public async assertNoDataViewForCloneJobWarningToastExist() { + await testSubjects.existOrFail('mlCloneJobNoDataViewExistsWarningToast', { timeout: 5000 }); + } + public async clickEditJobAction(jobId: string) { await this.ensureJobActionsMenuOpen(jobId); await testSubjects.click('mlActionButtonEditJob'); diff --git a/x-pack/test/functional/services/monitoring/cluster_alerts.js b/x-pack/test/functional/services/monitoring/cluster_alerts.js index cbeb537b0801..4f70903bda1c 100644 --- a/x-pack/test/functional/services/monitoring/cluster_alerts.js +++ b/x-pack/test/functional/services/monitoring/cluster_alerts.js @@ -6,7 +6,6 @@ */ import { range } from 'lodash'; -import { map as mapAsync } from 'bluebird'; export function MonitoringClusterAlertsProvider({ getService, getPageObjects }) { const testSubjects = getService('testSubjects'); @@ -61,9 +60,11 @@ export function MonitoringClusterAlertsProvider({ getService, getPageObjects }) const listingRows = await this.getOverviewAlerts(); const alertIcons = await retry.try(async () => { const elements = await find.allByCssSelector(SUBJ_OVERVIEW_ICONS); - return await mapAsync(elements, async (element) => { - return await element.getVisibleText(); - }); + return await Promise.all( + elements.map(async (element) => { + return await element.getVisibleText(); + }) + ); }); return await this._getAlertSetAll({ diff --git a/x-pack/test/functional/services/observability/alerts/bulk_actions.ts b/x-pack/test/functional/services/observability/alerts/bulk_actions.ts new file mode 100644 index 000000000000..1fa411a2f4fb --- /dev/null +++ b/x-pack/test/functional/services/observability/alerts/bulk_actions.ts @@ -0,0 +1,52 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { FtrProviderContext } from '../../../ftr_provider_context'; +const CHECKBOX_SELECTOR = 'select-event'; +const CHECKBOX_PRODUCER_SELECTOR = 'select-event-rule-producer'; +const BULK_ACTIONS_CONTAINER = 'bulk-actions-button-container'; +const SELECTED_BULK_ACTIONS_BUTTON = 'selectedShowBulkActionsButton'; + +export function ObservabilityAlertsBulkActionsProvider({ getService }: FtrProviderContext) { + const find = getService('find'); + const testSubjects = getService('testSubjects'); + + const getCheckboxSelector = async () => { + return await find.allByCssSelector(testSubjects.getCssSelector(`~${CHECKBOX_SELECTOR}`)); + }; + + const missingCheckboxSelectorOrFail = async () => { + return await testSubjects.missingOrFail(`~${CHECKBOX_SELECTOR}`); + }; + + const getCheckboxSelectorPerProducer = async (producer: string) => { + return await find.allByCssSelector( + testSubjects.getCssSelector(`~${CHECKBOX_PRODUCER_SELECTOR}-${producer}`) + ); + }; + + const getBulkActionsContainer = async () => { + return await testSubjects.find(BULK_ACTIONS_CONTAINER); + }; + + const getBulkActionsContainerOrFail = async () => { + return await testSubjects.existOrFail(BULK_ACTIONS_CONTAINER); + }; + + const getBulkActionsButton = async () => { + return await testSubjects.find(SELECTED_BULK_ACTIONS_BUTTON); + }; + + return { + getCheckboxSelector, + getCheckboxSelectorPerProducer, + missingCheckboxSelectorOrFail, + getBulkActionsContainer, + getBulkActionsContainerOrFail, + getBulkActionsButton, + }; +} diff --git a/x-pack/test/functional/services/observability/alerts/index.ts b/x-pack/test/functional/services/observability/alerts/index.ts index f2b5173dfe5b..b28738885652 100644 --- a/x-pack/test/functional/services/observability/alerts/index.ts +++ b/x-pack/test/functional/services/observability/alerts/index.ts @@ -8,6 +8,7 @@ import { ObservabilityAlertsPaginationProvider } from './pagination'; import { ObservabilityAlertsCommonProvider } from './common'; import { ObservabilityAlertsAddToCaseProvider } from './add_to_case'; +import { ObservabilityAlertsBulkActionsProvider } from './bulk_actions'; import { FtrProviderContext } from '../../../ftr_provider_context'; @@ -15,9 +16,12 @@ export function ObservabilityAlertsProvider(context: FtrProviderContext) { const common = ObservabilityAlertsCommonProvider(context); const pagination = ObservabilityAlertsPaginationProvider(context); const addToCase = ObservabilityAlertsAddToCaseProvider(context); + const bulkActions = ObservabilityAlertsBulkActionsProvider(context); + return { common, pagination, addToCase, + bulkActions, }; } diff --git a/x-pack/test/functional/services/observability/users.ts b/x-pack/test/functional/services/observability/users.ts index 78e8b3346cc6..7cb98603548b 100644 --- a/x-pack/test/functional/services/observability/users.ts +++ b/x-pack/test/functional/services/observability/users.ts @@ -72,7 +72,20 @@ const defineBasicObservabilityRole = ( ...((features.infrastructure?.length ?? 0) > 0 ? [{ names: ['metricbeat-*', 'metrics-*'], privileges: ['all'] }] : []), - ...((features.apm?.length ?? 0) > 0 ? [{ names: ['apm-*'], privileges: ['all'] }] : []), + ...((features.apm?.length ?? 0) > 0 + ? [ + { + names: [ + 'apm-*', + 'logs-apm*', + 'metrics-apm*', + 'traces-apm*', + 'observability-annotations', + ], + privileges: ['read', 'view_index_metadata'], + }, + ] + : []), ...((features.uptime?.length ?? 0) > 0 ? [{ names: ['heartbeat-*,synthetics-*'], privileges: ['all'] }] : []), diff --git a/x-pack/test/functional/services/pipeline_editor.js b/x-pack/test/functional/services/pipeline_editor.js index ece7ec5b3ecb..bb1f122b988b 100644 --- a/x-pack/test/functional/services/pipeline_editor.js +++ b/x-pack/test/functional/services/pipeline_editor.js @@ -6,7 +6,6 @@ */ import expect from '@kbn/expect'; -import { props as propsAsync } from 'bluebird'; export function PipelineEditorProvider({ getService }) { const retry = getService('retry'); @@ -125,20 +124,27 @@ export function PipelineEditorProvider({ getService }) { * @return {Promise} */ async assertInputs(expectedValues) { - const values = await propsAsync({ - id: testSubjects.getAttribute(SUBJ_INPUT_ID, 'value'), - description: testSubjects.getAttribute(SUBJ_INPUT_DESCRIPTION, 'value'), - pipeline: aceEditor.getValue(SUBJ_UI_ACE_PIPELINE), - workers: testSubjects.getAttribute(SUBJ_INPUT_WORKERS, 'value'), - batchSize: testSubjects.getAttribute(SUBJ_INPUT_BATCH_SIZE, 'value'), - queueType: testSubjects.getAttribute(SUBJ_SELECT_QUEUE_TYPE, 'value'), - queueMaxBytesNumber: testSubjects.getAttribute(SUBJ_INPUT_QUEUE_MAX_BYTES_NUMBER, 'value'), - queueMaxBytesUnits: testSubjects.getAttribute(SUBJ_SELECT_QUEUE_MAX_BYTES_UNITS, 'value'), - queueCheckpointWrites: testSubjects.getAttribute( - SUBJ_INPUT_QUEUE_CHECKPOINT_WRITES, - 'value' - ), - }); + const values = await Promise.all([ + testSubjects.getAttribute(SUBJ_INPUT_ID, 'value'), + testSubjects.getAttribute(SUBJ_INPUT_DESCRIPTION, 'value'), + aceEditor.getValue(SUBJ_UI_ACE_PIPELINE), + testSubjects.getAttribute(SUBJ_INPUT_WORKERS, 'value'), + testSubjects.getAttribute(SUBJ_INPUT_BATCH_SIZE, 'value'), + testSubjects.getAttribute(SUBJ_SELECT_QUEUE_TYPE, 'value'), + testSubjects.getAttribute(SUBJ_INPUT_QUEUE_MAX_BYTES_NUMBER, 'value'), + testSubjects.getAttribute(SUBJ_SELECT_QUEUE_MAX_BYTES_UNITS, 'value'), + testSubjects.getAttribute(SUBJ_INPUT_QUEUE_CHECKPOINT_WRITES, 'value'), + ]).then((values) => ({ + id: values[0], + description: values[1], + pipeline: values[2], + workers: values[3], + batchSize: values[4], + queueType: values[5], + queueMaxBytesNumber: values[6], + queueMaxBytesUnits: values[7], + queueCheckpointWrites: values[8], + })); expect(values).to.eql(expectedValues); } diff --git a/x-pack/test/functional_execution_context/config.ts b/x-pack/test/functional_execution_context/config.ts index f841e8957cde..456d31b586ad 100644 --- a/x-pack/test/functional_execution_context/config.ts +++ b/x-pack/test/functional_execution_context/config.ts @@ -42,6 +42,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { `--elasticsearch.hosts=${servers.elasticsearch.protocol}://${servers.elasticsearch.hostname}:${servers.elasticsearch.port}`, `--elasticsearch.ssl.certificateAuthorities=${CA_CERT_PATH}`, + '--server.requestId.allowFromAnyIp=true', '--execution_context.enabled=true', '--logging.appenders.file.type=file', `--logging.appenders.file.fileName=${logFilePath}`, diff --git a/x-pack/test/functional_execution_context/fixtures/plugins/alerts/server/ensure_apm_started.ts b/x-pack/test/functional_execution_context/fixtures/plugins/alerts/server/ensure_apm_started.ts new file mode 100644 index 000000000000..8581ebe5183c --- /dev/null +++ b/x-pack/test/functional_execution_context/fixtures/plugins/alerts/server/ensure_apm_started.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import apmAgent from 'elastic-apm-node'; +import { initApm } from '@kbn/apm-config-loader'; +import { REPO_ROOT } from '@kbn/utils'; + +if (!apmAgent.isStarted()) { + initApm(process.argv, REPO_ROOT, false, 'test-plugin'); +} diff --git a/x-pack/test/functional_execution_context/fixtures/plugins/alerts/server/index.ts b/x-pack/test/functional_execution_context/fixtures/plugins/alerts/server/index.ts index 700aee6bfd49..dbd04e32e860 100644 --- a/x-pack/test/functional_execution_context/fixtures/plugins/alerts/server/index.ts +++ b/x-pack/test/functional_execution_context/fixtures/plugins/alerts/server/index.ts @@ -5,6 +5,7 @@ * 2.0. */ +import './ensure_apm_started'; import { FixturePlugin } from './plugin'; export const plugin = () => new FixturePlugin(); diff --git a/x-pack/test/functional_execution_context/fixtures/plugins/alerts/server/plugin.ts b/x-pack/test/functional_execution_context/fixtures/plugins/alerts/server/plugin.ts index 47a9e4edc30f..ec4e3ef99c6d 100644 --- a/x-pack/test/functional_execution_context/fixtures/plugins/alerts/server/plugin.ts +++ b/x-pack/test/functional_execution_context/fixtures/plugins/alerts/server/plugin.ts @@ -4,6 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ +import apmAgent from 'elastic-apm-node'; import { Plugin, CoreSetup } from 'kibana/server'; import { PluginSetupContract as AlertingPluginSetup } from '../../../../../../plugins/alerting/server/plugin'; @@ -81,6 +82,32 @@ export class FixturePlugin implements Plugin { + const transaction = apmAgent.startTransaction(); + const subscription = req.events.completed$.subscribe(() => { + transaction?.end(); + subscription.unsubscribe(); + }); + + await ctx.core.elasticsearch.client.asInternalUser.ping(); + + return res.ok({ + body: { + traceId: apmAgent.currentTraceIds['trace.id'], + }, + }); + } + ); } public start() {} diff --git a/x-pack/test/functional_execution_context/tests/index.ts b/x-pack/test/functional_execution_context/tests/index.ts index 6d74a9460867..c092be9bd8bd 100644 --- a/x-pack/test/functional_execution_context/tests/index.ts +++ b/x-pack/test/functional_execution_context/tests/index.ts @@ -12,5 +12,6 @@ export default function ({ loadTestFile }: FtrProviderContext) { this.tags('ciGroup1'); loadTestFile(require.resolve('./browser')); loadTestFile(require.resolve('./server')); + loadTestFile(require.resolve('./log_correlation')); }); } diff --git a/x-pack/test/functional_execution_context/tests/log_correlation.ts b/x-pack/test/functional_execution_context/tests/log_correlation.ts new file mode 100644 index 000000000000..80bb2285a665 --- /dev/null +++ b/x-pack/test/functional_execution_context/tests/log_correlation.ts @@ -0,0 +1,38 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import expect from '@kbn/expect'; +import type { FtrProviderContext } from '../ftr_provider_context'; +import { assertLogContains } from '../test_utils'; + +export default function ({ getService }: FtrProviderContext) { + const retry = getService('retry'); + const supertest = getService('supertest'); + + describe('Log Correlation', () => { + it('Emits "trace.id" into the logs', async () => { + const response1 = await supertest + .get('/emit_log_with_trace_id') + .set('x-opaque-id', 'myheader1'); + + expect(response1.body.traceId).to.be.a('string'); + + const response2 = await supertest.get('/emit_log_with_trace_id'); + expect(response1.body.traceId).to.be.a('string'); + + expect(response2.body.traceId).not.to.be(response1.body.traceId); + + await assertLogContains({ + description: 'traceId included in the Kibana logs', + predicate: (record) => + // we don't check trace.id value since trace.id in the test plugin and Kibana are different on CI. + // because different 'elastic-apm-node' instaces are imported + Boolean(record.http?.request?.id?.includes('myheader1') && record.trace?.id), + retry, + }); + }); + }); +} diff --git a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/alert_create_flyout.ts b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/alert_create_flyout.ts index 1140f9c17a9f..b208826ec7aa 100644 --- a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/alert_create_flyout.ts +++ b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/alert_create_flyout.ts @@ -296,7 +296,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { it('should show all rule types on click euiFormControlLayoutClearButton', async () => { await pageObjects.triggersActionsUI.clickCreateAlertButton(); await testSubjects.setValue('alertNameInput', 'alertName'); - const ruleTypeSearchBox = await find.byCssSelector('.alertSearchField'); + const ruleTypeSearchBox = await find.byCssSelector('[data-test-subj="alertSearchField"]'); await ruleTypeSearchBox.type('notexisting rule type'); await ruleTypeSearchBox.pressKeys(browser.keys.ENTER); diff --git a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/alerts_list.ts b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/alerts_list.ts index eb4c0fbe425c..04b9b1b45b63 100644 --- a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/alerts_list.ts +++ b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/alerts_list.ts @@ -479,6 +479,13 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { expect(filterWithSlackOnlyResults[0].interval).to.equal('1 min'); expect(filterWithSlackOnlyResults[0].duration).to.match(/\d{2}:\d{2}:\d{2}.\d{3}/); }); + await testSubjects.click('alertTypeFilterButton'); + + // de-select action type filter + await testSubjects.click('actionTypeFilterButton'); + await testSubjects.click('actionType.slackFilterOption'); + + await testSubjects.missingOrFail('centerJustifiedSpinner'); }); }); }; diff --git a/x-pack/test/functional_with_es_ssl/apps/uptime/alert_flyout.ts b/x-pack/test/functional_with_es_ssl/apps/uptime/alert_flyout.ts index f08867b445f7..d657db443e4e 100644 --- a/x-pack/test/functional_with_es_ssl/apps/uptime/alert_flyout.ts +++ b/x-pack/test/functional_with_es_ssl/apps/uptime/alert_flyout.ts @@ -6,7 +6,7 @@ */ import expect from '@kbn/expect'; -import { delay } from 'bluebird'; +import { setTimeout as setTimeoutAsync } from 'timers/promises'; import { FtrProviderContext } from '../../ftr_provider_context'; @@ -99,7 +99,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { let alert: any; await retry.tryForTime(60 * 1000, async () => { // add a delay before next call to not overload the server - await delay(1500); + await setTimeoutAsync(1500); const apiResponse = await supertest.get('/api/alerts/_find?search=uptime-test'); const alertsFromThisTest = apiResponse.body.data.filter( ({ name }: { name: string }) => name === 'uptime-test' diff --git a/x-pack/test/load/runner.ts b/x-pack/test/load/runner.ts index c48a8e33d6ee..e9750bd19881 100644 --- a/x-pack/test/load/runner.ts +++ b/x-pack/test/load/runner.ts @@ -10,7 +10,7 @@ import { resolve } from 'path'; import { REPO_ROOT } from '@kbn/utils'; import Fs from 'fs'; import { createFlagError } from '@kbn/dev-utils'; -import { delay } from 'bluebird'; +import { setTimeout as setTimeoutAsync } from 'timers/promises'; import { FtrProviderContext } from './../functional/ftr_provider_context'; const baseSimulationPath = 'src/test/scala/org/kibanaLoadTest/simulation'; @@ -82,7 +82,7 @@ export async function GatlingTestRunner({ getService }: FtrProviderContext) { }); // wait a minute between simulations, skip for the last one if (i < simulationClasses.length - 1) { - await delay(60 * 1000); + await setTimeoutAsync(60 * 1000); } } }); diff --git a/x-pack/test/observability_functional/apps/observability/alerts/bulk_actions.ts b/x-pack/test/observability_functional/apps/observability/alerts/bulk_actions.ts new file mode 100644 index 000000000000..749324a39ba2 --- /dev/null +++ b/x-pack/test/observability_functional/apps/observability/alerts/bulk_actions.ts @@ -0,0 +1,203 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import expect from '@kbn/expect'; +import { FtrProviderContext } from '../../../ftr_provider_context'; + +async function asyncForEach(array: T[], callback: (item: T, index: number) => void) { + for (let index = 0; index < array.length; index++) { + await callback(array[index], index); + } +} + +export default ({ getService, getPageObjects }: FtrProviderContext) => { + const esArchiver = getService('esArchiver'); + const observability = getService('observability'); + + const retry = getService('retry'); + + describe('Observability alerts / Bulk actions', function () { + this.tags('includeFirefox'); + before(async () => { + await esArchiver.load('x-pack/test/functional/es_archives/observability/alerts'); + await esArchiver.load('x-pack/test/functional/es_archives/infra/metrics_and_logs'); + await esArchiver.load( + 'x-pack/test/apm_api_integration/common/fixtures/es_archiver/apm_8.0.0' + ); + }); + + after(async () => { + await esArchiver.unload('x-pack/test/functional/es_archives/infra/metrics_and_logs'); + await esArchiver.unload('x-pack/test/functional/es_archives/observability/alerts'); + await esArchiver.unload( + 'x-pack/test/apm_api_integration/common/fixtures/es_archiver/apm_8.0.0' + ); + }); + + describe('When user has all priviledges for logs app', () => { + before(async () => { + await observability.users.setTestUserRole( + observability.users.defineBasicObservabilityRole({ + logs: ['all'], + }) + ); + await observability.alerts.common.navigateToTimeWithData(); + }); + + after(async () => { + await observability.users.restoreDefaultTestUserRole(); + }); + + it('logs checkboxes are enabled', async () => { + const logsCheckboxes = + await observability.alerts.bulkActions.getCheckboxSelectorPerProducer('logs'); + + await asyncForEach(logsCheckboxes, async (checkbox, index) => { + expect(await checkbox.isEnabled()).to.be(true); + }); + }); + + describe('when checkbox is clicked', async () => { + it('shows bulk actions container', async () => { + const logsCheckboxes = + await observability.alerts.bulkActions.getCheckboxSelectorPerProducer('logs'); + await logsCheckboxes[0].click(); + await observability.alerts.bulkActions.getBulkActionsContainerOrFail(); + }); + + describe('when selected bulk action button is clicked', async () => { + it('opens overflow menu with workflow status options', async () => { + await retry.try(async () => { + await (await observability.alerts.bulkActions.getBulkActionsButton()).click(); + }); + }); + }); + }); + }); + + describe('When user has all priviledges for apm app', () => { + before(async () => { + await observability.users.setTestUserRole( + observability.users.defineBasicObservabilityRole({ + apm: ['all'], + }) + ); + await observability.alerts.common.navigateToTimeWithData(); + }); + + after(async () => { + await observability.users.restoreDefaultTestUserRole(); + }); + + it('apm checkboxes are enabled', async () => { + const apmCheckboxes = await observability.alerts.bulkActions.getCheckboxSelectorPerProducer( + 'apm' + ); + + await asyncForEach(apmCheckboxes, async (checkbox, index) => { + expect(await checkbox.isEnabled()).to.be(true); + }); + }); + + describe('when checkbox is clicked', async () => { + it('shows bulk actions container', async () => { + const apmCheckboxes = + await observability.alerts.bulkActions.getCheckboxSelectorPerProducer('apm'); + await apmCheckboxes[0].click(); + await observability.alerts.bulkActions.getBulkActionsContainerOrFail(); + }); + + describe('when selected bulk action button is clicked', async () => { + it('opens overflow menu with workflow status options', async () => { + await retry.try(async () => { + await (await observability.alerts.bulkActions.getBulkActionsButton()).click(); + }); + }); + }); + }); + }); + + describe('When user has read permissions for logs', () => { + before(async () => { + await observability.users.setTestUserRole( + observability.users.defineBasicObservabilityRole({ + logs: ['read'], + }) + ); + await observability.alerts.common.navigateToTimeWithData(); + }); + + after(async () => { + await observability.users.restoreDefaultTestUserRole(); + }); + + it('checkbox is not visible', async () => { + await observability.alerts.bulkActions.missingCheckboxSelectorOrFail(); + }); + }); + + describe('When user has read permissions for apm', () => { + before(async () => { + await observability.users.setTestUserRole( + observability.users.defineBasicObservabilityRole({ + apm: ['read'], + }) + ); + await observability.alerts.common.navigateToTimeWithData(); + }); + + after(async () => { + await observability.users.restoreDefaultTestUserRole(); + }); + + it('checkbox is not displayed', async () => { + await observability.alerts.bulkActions.missingCheckboxSelectorOrFail(); + }); + }); + + describe('When user has mixed permissions for observability apps', () => { + before(async () => { + await observability.users.setTestUserRole( + observability.users.defineBasicObservabilityRole({ + logs: ['all'], + apm: ['read'], + observabilityCases: ['read'], + }) + ); + await observability.alerts.common.navigateToTimeWithData(); + }); + + after(async () => { + await observability.users.restoreDefaultTestUserRole(); + }); + + it('apm checkboxes are disabled', async () => { + const apmCheckboxes = await observability.alerts.bulkActions.getCheckboxSelectorPerProducer( + 'apm' + ); + + await asyncForEach(apmCheckboxes, async (checkbox, index) => { + expect(await checkbox.isEnabled()).to.be(false); + }); + }); + + it('logs checkboxes are enabled', async () => { + const logsCheckboxes = + await observability.alerts.bulkActions.getCheckboxSelectorPerProducer('logs'); + + await asyncForEach(logsCheckboxes, async (checkbox, index) => { + expect(await checkbox.isEnabled()).to.be(true); + }); + }); + }); + }); +}; diff --git a/x-pack/test/observability_functional/apps/observability/index.ts b/x-pack/test/observability_functional/apps/observability/index.ts index 898c7afb9a72..f2483e5f1401 100644 --- a/x-pack/test/observability_functional/apps/observability/index.ts +++ b/x-pack/test/observability_functional/apps/observability/index.ts @@ -18,5 +18,6 @@ export default function ({ loadTestFile }: FtrProviderContext) { loadTestFile(require.resolve('./alerts/pagination')); loadTestFile(require.resolve('./alerts/add_to_case')); loadTestFile(require.resolve('./alerts/state_synchronization')); + loadTestFile(require.resolve('./alerts/bulk_actions')); }); } diff --git a/x-pack/test/performance/config.ts b/x-pack/test/performance/config.ts index 89b7b52e2867..82586ee62ad8 100644 --- a/x-pack/test/performance/config.ts +++ b/x-pack/test/performance/config.ts @@ -32,6 +32,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { ...functionalConfig.get('kbnTestServer'), env: { ELASTIC_APM_ACTIVE: 'true', + ELASTIC_APM_CONTEXT_PROPAGATION_ONLY: 'false', ELASTIC_APM_ENVIRONMENT: process.env.CI ? 'ci' : 'development', ELASTIC_APM_TRANSACTION_SAMPLE_RATE: '1.0', ELASTIC_APM_SERVER_URL: APM_SERVER_URL, diff --git a/x-pack/test/reporting_functional/reporting_and_security/management.ts b/x-pack/test/reporting_functional/reporting_and_security/management.ts index 304c175f0cb5..4af6dbdac1a6 100644 --- a/x-pack/test/reporting_functional/reporting_and_security/management.ts +++ b/x-pack/test/reporting_functional/reporting_and_security/management.ts @@ -9,8 +9,9 @@ import { FtrProviderContext } from '../ftr_provider_context'; // eslint-disable-next-line import/no-default-export export default ({ getService, getPageObjects }: FtrProviderContext) => { - const PageObjects = getPageObjects(['common']); + const PageObjects = getPageObjects(['common', 'reporting', 'dashboard']); const testSubjects = getService('testSubjects'); + const browser = getService('browser'); const reportingFunctional = getService('reportingFunctional'); describe('Access to Management > Reporting', () => { @@ -32,5 +33,26 @@ export default ({ getService, getPageObjects }: FtrProviderContext) => { await PageObjects.common.navigateToApp('reporting'); await testSubjects.existOrFail('reportJobListing'); }); + + it('Allows users to navigate back to where a report was generated', async () => { + const dashboardTitle = 'Ecom Dashboard'; + await PageObjects.common.navigateToApp('dashboard'); + await PageObjects.dashboard.loadSavedDashboard(dashboardTitle); + + await PageObjects.reporting.openPdfReportingPanel(); + await PageObjects.reporting.clickGenerateReportButton(); + + await PageObjects.common.navigateToApp('reporting'); + await PageObjects.common.sleep(3000); // Wait an amount of time for auto-polling to refresh the jobs + + // We do not need to wait for the report to finish generating + await (await testSubjects.find('euiCollapsedItemActionsButton')).click(); + await (await testSubjects.find('reportOpenInKibanaApp')).click(); + + const [, dashboardWindowHandle] = await browser.getAllWindowHandles(); + await browser.switchToWindow(dashboardWindowHandle); + + await PageObjects.dashboard.expectOnDashboard(dashboardTitle); + }); }); }; diff --git a/x-pack/test/reporting_functional/reporting_without_security/management.ts b/x-pack/test/reporting_functional/reporting_without_security/management.ts index a97cb211b7c0..b0088ccb9a90 100644 --- a/x-pack/test/reporting_functional/reporting_without_security/management.ts +++ b/x-pack/test/reporting_functional/reporting_without_security/management.ts @@ -53,10 +53,9 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await PageObjects.common.sleep(3000); // Wait an amount of time for auto-polling to refresh the jobs - const tableElem = await testSubjects.find('reportJobListing'); - const tableRow = await tableElem.findByCssSelector('tbody tr td+td'); // find the title cell of the first row - const tableCellText = await tableRow.getVisibleText(); - expect(tableCellText).to.be(`Tiểu thuyết\nvisualization`); + const [firstTitleElem] = await testSubjects.findAll('reportingListItemObjectTitle'); + const tableCellText = await firstTitleElem.getVisibleText(); + expect(tableCellText).to.be(`Tiểu thuyết`); }); }); }; diff --git a/x-pack/test/security_api_integration/tests/kerberos/kerberos_login.ts b/x-pack/test/security_api_integration/tests/kerberos/kerberos_login.ts index ed1a1f3c16fc..84673c7b68f2 100644 --- a/x-pack/test/security_api_integration/tests/kerberos/kerberos_login.ts +++ b/x-pack/test/security_api_integration/tests/kerberos/kerberos_login.ts @@ -7,7 +7,7 @@ import expect from '@kbn/expect'; import { parse as parseCookie, Cookie } from 'tough-cookie'; -import { delay } from 'bluebird'; +import { setTimeout as setTimeoutAsync } from 'timers/promises'; import { adminTestUser } from '@kbn/test'; import { FtrProviderContext } from '../../ftr_provider_context'; import { @@ -319,7 +319,7 @@ export default function ({ getService }: FtrProviderContext) { // Access token expiration is set to 15s for API integration tests. // Let's wait for 20s to make sure token expires. - await delay(20000); + await setTimeoutAsync(20000); // This api call should succeed and automatically refresh token. Returned cookie will contain // the new access and refresh token pair. @@ -350,7 +350,7 @@ export default function ({ getService }: FtrProviderContext) { // Access token expiration is set to 15s for API integration tests. // Let's wait for 20s to make sure token expires. - await delay(20000); + await setTimeoutAsync(20000); // This request should succeed and automatically refresh token. Returned cookie will contain // the new access and refresh token pair. diff --git a/x-pack/test/security_api_integration/tests/oidc/authorization_code_flow/oidc_auth.ts b/x-pack/test/security_api_integration/tests/oidc/authorization_code_flow/oidc_auth.ts index a7a870289448..eb12d4240a37 100644 --- a/x-pack/test/security_api_integration/tests/oidc/authorization_code_flow/oidc_auth.ts +++ b/x-pack/test/security_api_integration/tests/oidc/authorization_code_flow/oidc_auth.ts @@ -8,7 +8,7 @@ import expect from '@kbn/expect'; import { parse as parseCookie, Cookie } from 'tough-cookie'; import url from 'url'; -import { delay } from 'bluebird'; +import { setTimeout as setTimeoutAsync } from 'timers/promises'; import { adminTestUser } from '@kbn/test'; import { getStateAndNonce } from '../../../fixtures/oidc/oidc_tools'; import { FtrProviderContext } from '../../../ftr_provider_context'; @@ -494,7 +494,7 @@ export default function ({ getService }: FtrProviderContext) { // Access token expiration is set to 15s for API integration tests. // Let's wait for 20s to make sure token expires. - await delay(20000); + await setTimeoutAsync(20000); // This api call should succeed and automatically refresh token. Returned cookie will contain // the new access and refresh token pair. diff --git a/x-pack/test/security_api_integration/tests/pki/pki_auth.ts b/x-pack/test/security_api_integration/tests/pki/pki_auth.ts index f857e5c149be..76e3cb224881 100644 --- a/x-pack/test/security_api_integration/tests/pki/pki_auth.ts +++ b/x-pack/test/security_api_integration/tests/pki/pki_auth.ts @@ -7,7 +7,7 @@ import expect from '@kbn/expect'; import { parse as parseCookie, Cookie } from 'tough-cookie'; -import { delay } from 'bluebird'; +import { setTimeout as setTimeoutAsync } from 'timers/promises'; import { readFileSync } from 'fs'; import { resolve } from 'path'; import { CA_CERT_PATH } from '@kbn/dev-utils'; @@ -358,7 +358,7 @@ export default function ({ getService }: FtrProviderContext) { // Access token expiration is set to 15s for API integration tests. // Let's wait for 20s to make sure token expires. - await delay(20000); + await setTimeoutAsync(20000); // This api call should succeed and automatically refresh token. Returned cookie will contain // the new access token. @@ -382,7 +382,7 @@ export default function ({ getService }: FtrProviderContext) { // Access token expiration is set to 15s for API integration tests. // Let's wait for 20s to make sure token expires. - await delay(20000); + await setTimeoutAsync(20000); // This request should succeed and automatically refresh token. Returned cookie will contain // the new access and refresh token pair. diff --git a/x-pack/test/security_api_integration/tests/saml/saml_login.ts b/x-pack/test/security_api_integration/tests/saml/saml_login.ts index 97fdcb77f4d6..c0ea296297fe 100644 --- a/x-pack/test/security_api_integration/tests/saml/saml_login.ts +++ b/x-pack/test/security_api_integration/tests/saml/saml_login.ts @@ -7,7 +7,7 @@ import { stringify } from 'query-string'; import url from 'url'; -import { delay } from 'bluebird'; +import { setTimeout as setTimeoutAsync } from 'timers/promises'; import expect from '@kbn/expect'; import { parse as parseCookie, Cookie } from 'tough-cookie'; import { adminTestUser } from '@kbn/test'; @@ -468,7 +468,7 @@ export default function ({ getService }: FtrProviderContext) { // Access token expiration is set to 15s for API integration tests. // Let's wait for 20s to make sure token expires. - await delay(20000); + await setTimeoutAsync(20000); }); const expectNewSessionCookie = (cookie: Cookie) => { @@ -639,7 +639,7 @@ export default function ({ getService }: FtrProviderContext) { ['when access token is valid', async () => {}], // Scenario when active cookie has an expired access token. Access token expiration is set // to 15s for API integration tests so we need to wait for 20s to make sure token expires. - ['when access token is expired', async () => await delay(20000)], + ['when access token is expired', async () => await setTimeoutAsync(20000)], // Scenario when active cookie references to access/refresh token pair that were already // removed from Elasticsearch (to simulate 24h when expired tokens are removed). [ diff --git a/x-pack/test/security_api_integration/tests/session_idle/cleanup.ts b/x-pack/test/security_api_integration/tests/session_idle/cleanup.ts index beb7bdfbdfcc..39231df307a9 100644 --- a/x-pack/test/security_api_integration/tests/session_idle/cleanup.ts +++ b/x-pack/test/security_api_integration/tests/session_idle/cleanup.ts @@ -6,7 +6,7 @@ */ import { parse as parseCookie, Cookie } from 'tough-cookie'; -import { delay } from 'bluebird'; +import { setTimeout as setTimeoutAsync } from 'timers/promises'; import expect from '@kbn/expect'; import { adminTestUser } from '@kbn/test'; import type { AuthenticationProvider } from '../../../../plugins/security/common/model'; @@ -101,7 +101,7 @@ export default function ({ getService }: FtrProviderContext) { // Cleanup routine runs every 10s, and idle timeout threshold is three times larger than 5s // idle timeout, let's wait for 40s to make sure cleanup routine runs when idle timeout // threshold is exceeded. - await delay(40000); + await setTimeoutAsync(40000); // Session info is removed from the index and cookie isn't valid anymore expect(await getNumberOfSessionDocuments()).to.be(0); @@ -143,7 +143,7 @@ export default function ({ getService }: FtrProviderContext) { // Cleanup routine runs every 10s, and idle timeout threshold is three times larger than 5s // idle timeout, let's wait for 40s to make sure cleanup routine runs when idle timeout // threshold is exceeded. - await delay(40000); + await setTimeoutAsync(40000); // Session for basic and SAML that used global session settings should not be valid anymore. expect(await getNumberOfSessionDocuments()).to.be(2); @@ -191,7 +191,7 @@ export default function ({ getService }: FtrProviderContext) { // least twice. for (const counter of [...Array(20).keys()]) { // Session idle timeout is 15s, let's wait 10s and make a new request that would extend the session. - await delay(1500); + await setTimeoutAsync(1500); sessionCookie = (await checkSessionCookie(sessionCookie, basicUsername, { type: 'basic', diff --git a/x-pack/test/security_api_integration/tests/session_lifespan/cleanup.ts b/x-pack/test/security_api_integration/tests/session_lifespan/cleanup.ts index 6b5308f62380..32222794ac23 100644 --- a/x-pack/test/security_api_integration/tests/session_lifespan/cleanup.ts +++ b/x-pack/test/security_api_integration/tests/session_lifespan/cleanup.ts @@ -6,7 +6,7 @@ */ import { parse as parseCookie, Cookie } from 'tough-cookie'; -import { delay } from 'bluebird'; +import { setTimeout as setTimeoutAsync } from 'timers/promises'; import expect from '@kbn/expect'; import { adminTestUser } from '@kbn/test'; import type { AuthenticationProvider } from '../../../../plugins/security/common/model'; @@ -98,7 +98,7 @@ export default function ({ getService }: FtrProviderContext) { // Cleanup routine runs every 10s, let's wait for 40s to make sure it runs multiple times and // when lifespan is exceeded. - await delay(40000); + await setTimeoutAsync(40000); // Session info is removed from the index and cookie isn't valid anymore expect(await getNumberOfSessionDocuments()).to.be(0); @@ -138,7 +138,7 @@ export default function ({ getService }: FtrProviderContext) { // Cleanup routine runs every 10s, let's wait for 40s to make sure it runs multiple times and // when lifespan is exceeded. - await delay(40000); + await setTimeoutAsync(40000); // Session for basic and SAML that used global session settings should not be valid anymore. expect(await getNumberOfSessionDocuments()).to.be(2); diff --git a/x-pack/test/security_solution_endpoint/apps/endpoint/index.ts b/x-pack/test/security_solution_endpoint/apps/endpoint/index.ts index d1cfddbca3a9..70d60ba5c1b6 100644 --- a/x-pack/test/security_solution_endpoint/apps/endpoint/index.ts +++ b/x-pack/test/security_solution_endpoint/apps/endpoint/index.ts @@ -15,8 +15,7 @@ import { export default function (providerContext: FtrProviderContext) { const { loadTestFile, getService } = providerContext; - // FAILING: https://github.com/elastic/kibana/issues/72874 - describe.skip('endpoint', function () { + describe('endpoint', function () { const ingestManager = getService('ingestManager'); const log = getService('log'); const endpointTestResources = getService('endpointTestResources'); diff --git a/x-pack/test/security_solution_endpoint/apps/endpoint/policy_details.ts b/x-pack/test/security_solution_endpoint/apps/endpoint/policy_details.ts index 02c08b1d7a91..88462a2872fe 100644 --- a/x-pack/test/security_solution_endpoint/apps/endpoint/policy_details.ts +++ b/x-pack/test/security_solution_endpoint/apps/endpoint/policy_details.ts @@ -402,6 +402,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { expect(agentFullPolicy.inputs).to.eql([ getExpectedAgentPolicyEndpointInput({ id: policyInfo.packagePolicy.id, + name: policyInfo.packagePolicy.name, meta: { package: { version: policyInfo.packageInfo.version, @@ -448,6 +449,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { expect(agentFullPolicy.inputs).to.eql([ getExpectedAgentPolicyEndpointInput({ id: policyInfo.packagePolicy.id, + name: policyInfo.packagePolicy.name, meta: { package: { version: policyInfo.packageInfo.version, @@ -486,6 +488,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { expect(agentFullPolicyUpdated.inputs).to.eql([ getExpectedAgentPolicyEndpointInput({ id: policyInfo.packagePolicy.id, + name: policyInfo.packagePolicy.name, revision: 3, meta: { package: { diff --git a/x-pack/test/security_solution_endpoint/services/endpoint_policy.ts b/x-pack/test/security_solution_endpoint/services/endpoint_policy.ts index 26b6c5c0b554..f718390dc291 100644 --- a/x-pack/test/security_solution_endpoint/services/endpoint_policy.ts +++ b/x-pack/test/security_solution_endpoint/services/endpoint_policy.ts @@ -5,6 +5,7 @@ * 2.0. */ +import uuid from 'uuid'; import { FtrProviderContext } from '../ftr_provider_context'; import { CreateAgentPolicyRequest, @@ -161,7 +162,7 @@ export function EndpointPolicyTestResourcesProvider({ getService }: FtrProviderC let agentPolicy: CreateAgentPolicyResponse['item']; try { const newAgentPolicyData: CreateAgentPolicyRequest['body'] = { - name: 'East Coast', + name: `East Coast ${uuid.v4()}`, description: 'East Coast call center', namespace: 'default', }; @@ -182,7 +183,7 @@ export function EndpointPolicyTestResourcesProvider({ getService }: FtrProviderC let packagePolicy: CreatePackagePolicyResponse['item']; try { const newPackagePolicyData: CreatePackagePolicyRequest['body'] = { - name: 'Protect East Coast', + name: `Protect East Coast ${uuid.v4()}`, description: 'Protect the worlds data - but in the East Coast', policy_id: agentPolicy!.id, enabled: true, diff --git a/x-pack/test/security_solution_endpoint_api_int/apis/data_stream_helper.ts b/x-pack/test/security_solution_endpoint_api_int/apis/data_stream_helper.ts index f848d4bf418e..dc4b4113c6b1 100644 --- a/x-pack/test/security_solution_endpoint_api_int/apis/data_stream_helper.ts +++ b/x-pack/test/security_solution_endpoint_api_int/apis/data_stream_helper.ts @@ -6,6 +6,7 @@ */ import { Client } from '@elastic/elasticsearch'; +import { AGENTS_INDEX } from '../../../plugins/fleet/common'; import { metadataIndexPattern, eventsIndexPattern, @@ -14,6 +15,7 @@ import { metadataCurrentIndexPattern, telemetryIndexPattern, METADATA_UNITED_INDEX, + METADATA_DATASTREAM, } from '../../../plugins/security_solution/common/endpoint/constants'; export function deleteDataStream(getService: (serviceName: 'es') => Client, index: string) { @@ -41,7 +43,7 @@ export async function deleteAllDocsFromIndex( match_all: {}, }, }, - index: `${index}`, + index, wait_for_completion: true, refresh: true, }, @@ -60,8 +62,10 @@ export async function deleteMetadataStream(getService: (serviceName: 'es') => Cl await deleteDataStream(getService, metadataIndexPattern); } -export async function deleteAllDocsFromMetadataIndex(getService: (serviceName: 'es') => Client) { - await deleteAllDocsFromIndex(getService, metadataIndexPattern); +export async function deleteAllDocsFromMetadataDatastream( + getService: (serviceName: 'es') => Client +) { + await deleteAllDocsFromIndex(getService, METADATA_DATASTREAM); } export async function deleteAllDocsFromMetadataCurrentIndex( @@ -92,6 +96,10 @@ export async function deleteTelemetryStream(getService: (serviceName: 'es') => C await deleteDataStream(getService, telemetryIndexPattern); } +export function deleteAllDocsFromFleetAgents(getService: (serviceName: 'es') => Client) { + return deleteAllDocsFromIndex(getService, AGENTS_INDEX); +} + export function stopTransform(getService: (serviceName: 'es') => Client, transformId: string) { const client = getService('es'); const stopRequest = { @@ -102,3 +110,32 @@ export function stopTransform(getService: (serviceName: 'es') => Client, transfo }; return client.transform.stopTransform(stopRequest); } + +export async function startTransform( + getService: (serviceName: 'es') => Client, + transformId: string +) { + const client = getService('es'); + const transformsResponse = await client.transform.getTransform({ + transform_id: `${transformId}*`, + }); + return transformsResponse.transforms.map((transform) => { + const t = transform as unknown as { id: string }; + return client.transform.startTransform({ transform_id: t.id }); + }); +} + +export function bulkIndex( + getService: (serviceName: 'es') => Client, + index: string, + docs: unknown[] +) { + const body = docs.flatMap((doc) => [{ create: { _index: index } }, doc]); + const client = getService('es'); + + return client.bulk({ + index, + refresh: true, + body, + }); +} diff --git a/x-pack/test/security_solution_endpoint_api_int/apis/metadata.fixtures.ts b/x-pack/test/security_solution_endpoint_api_int/apis/metadata.fixtures.ts new file mode 100644 index 000000000000..281ba95d8e0c --- /dev/null +++ b/x-pack/test/security_solution_endpoint_api_int/apis/metadata.fixtures.ts @@ -0,0 +1,571 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export function generateAgentDocs(timestamp: number, policyId: string) { + return [ + { + access_api_key_id: 'w4zJBHwBfQcM6aSYIRjO', + action_seq_no: [-1], + active: true, + agent: { + id: '963b081e-60d1-482c-befd-a5815fa8290f', + version: '8.0.0', + }, + enrolled_at: timestamp, + local_metadata: { + elastic: { + agent: { + 'build.original': + '8.0.0-SNAPSHOT (build: 0ee910f4df6653dc9557090946b392533621c2a3 at 2021-09-15 04:59:01 +0000 UTC)', + id: '963b081e-60d1-482c-befd-a5815fa8290f', + log_level: 'info', + snapshot: true, + upgradeable: false, + version: '8.0.0', + }, + }, + host: { + architecture: 'x86_64', + hostname: 'cf83e321af8a', + id: 'e57bde2886b8bb9f91f9143c3b123e98', + ip: ['127.0.0.1/8', '172.17.0.2/16'], + mac: ['02:42:ac:11:00:02'], + name: 'cf83e321af8a', + }, + os: { + family: 'redhat', + full: 'CentOS Linux Core(7 (Core))', + kernel: '5.10.47-linuxkit', + name: 'CentOS Linux', + platform: 'centos', + version: '7 (Core)', + }, + }, + policy_id: policyId, + type: 'PERMANENT', + default_api_key: 'x4zJBHwBfQcM6aSYYxiY:hhIFN3vSTGWFft7z0MbAhQ', + policy_output_permissions_hash: + 'cf54971b4d01d194757802052525463fe2f52ffaaf37755c9ab94fdd43c76e9c', + default_api_key_id: 'x4zJBHwBfQcM6aSYYxiY', + policy_revision_idx: 1, + policy_coordinator_idx: 1, + updated_at: timestamp, + last_checkin_status: 'online', + last_checkin: timestamp, + }, + { + access_api_key_id: 'w4zJBHwBfQcM6aSYIRjO', + action_seq_no: [-1], + active: true, + agent: { + id: '3838df35-a095-4af4-8fce-0b6d78793f2e', + version: '8.0.0', + }, + enrolled_at: timestamp, + local_metadata: { + elastic: { + agent: { + 'build.original': + '8.0.0-SNAPSHOT (build: 0ee910f4df6653dc9557090946b392533621c2a3 at 2021-09-15 04:59:01 +0000 UTC)', + id: '3838df35-a095-4af4-8fce-0b6d78793f2e', + log_level: 'info', + snapshot: true, + upgradeable: false, + version: '8.0.0', + }, + }, + host: { + architecture: 'x86_64', + hostname: 'cf83e321af8a', + id: 'e57bde2886b8bb9f91f9143c3b123e98', + ip: ['127.0.0.1/8', '172.17.0.2/16'], + mac: ['02:42:ac:11:00:02'], + name: 'cf83e321af8a', + }, + os: { + family: 'Windows', + full: 'Windows Server 2016', + kernel: '5.10.47-linuxkit', + name: 'windows 10.0', + platform: 'Windows', + version: '10.0', + }, + }, + policy_id: policyId, + type: 'PERMANENT', + default_api_key: 'x4zJBHwBfQcM6aSYYxiY:hhIFN3vSTGWFft7z0MbAhQ', + policy_output_permissions_hash: + 'cf54971b4d01d194757802052525463fe2f52ffaaf37755c9ab94fdd43c76e9c', + default_api_key_id: 'x4zJBHwBfQcM6aSYYxiY', + policy_revision_idx: 1, + policy_coordinator_idx: 1, + updated_at: timestamp, + last_checkin_status: 'online', + last_checkin: timestamp, + }, + ]; +} + +export function generateMetadataDocs(timestamp: number) { + return [ + { + '@timestamp': timestamp, + agent: { + id: '963b081e-60d1-482c-befd-a5815fa8290f', + version: '6.6.1', + name: 'Elastic Endpoint', + }, + elastic: { + agent: { + id: '11488bae-880b-4e7b-8d28-aac2aa9de816', + }, + }, + Endpoint: { + status: 'enrolled', + policy: { + applied: { + name: 'Default', + id: 'C2A9093E-E289-4C0A-AA44-8C32A414FA7A', + status: 'failure', + }, + }, + }, + event: { + created: timestamp, + id: '32f5fda2-48e4-4fae-b89e-a18038294d14', + kind: 'metric', + category: ['host'], + type: ['info'], + module: 'endpoint', + action: 'endpoint_metadata', + dataset: 'endpoint.metadata', + }, + host: { + architecture: 'x86', + hostname: 'cadmann-4.example.com', + name: 'cadmann-4.example.com', + id: '1fb3e58f-6ab0-4406-9d2a-91911207a712', + ip: ['10.192.213.130', '10.70.28.129'], + mac: ['a9-71-6a-cc-93-85', 'f7-31-84-d3-21-68', '2-95-12-39-ca-71'], + os: { + full: 'Windows 10', + name: 'windows 10.0', + platform: 'Windows', + family: 'Windows', + version: '10.0', + Ext: { + variant: 'Windows Pro', + }, + }, + }, + }, + { + '@timestamp': timestamp, + agent: { + id: 'b3412d6f-b022-4448-8fee-21cc936ea86b', + version: '6.0.0', + name: 'Elastic Endpoint', + }, + elastic: { + agent: { + id: '92ac1ce0-e1f7-409e-8af6-f17e97b1fc71', + }, + }, + Endpoint: { + status: 'enrolled', + policy: { + applied: { + name: 'Default', + id: 'C2A9093E-E289-4C0A-AA44-8C32A414FA7A', + status: 'success', + }, + }, + }, + event: { + created: timestamp, + id: '32f5fda2-48e4-4fae-b89e-a18038294d15', + kind: 'metric', + category: ['host'], + type: ['info'], + module: 'endpoint', + action: 'endpoint_metadata', + dataset: 'endpoint.metadata', + }, + host: { + architecture: 'x86_64', + hostname: 'thurlow-9.example.com', + name: 'thurlow-9.example.com', + id: '2f735e3d-be14-483b-9822-bad06e9045ca', + ip: ['10.46.229.234'], + mac: ['30-8c-45-55-69-b8', 'e5-36-7e-8f-a3-84', '39-a1-37-20-18-74'], + os: { + full: 'Windows Server 2016', + name: 'windows 10.0', + platform: 'Windows', + family: 'Windows', + version: '10.0', + Ext: { + variant: 'Windows Server', + }, + }, + }, + }, + { + '@timestamp': timestamp, + agent: { + id: '3838df35-a095-4af4-8fce-0b6d78793f2e', + version: '6.8.0', + name: 'Elastic Endpoint', + }, + elastic: { + agent: { + id: '023fa40c-411d-4188-a941-4147bfadd095', + }, + }, + Endpoint: { + status: 'enrolled', + policy: { + applied: { + name: 'Default', + id: '00000000-0000-0000-0000-000000000000', + status: 'failure', + }, + }, + }, + event: { + created: timestamp, + id: '32f5fda2-48e4-4fae-b89e-a18038294d16', + kind: 'metric', + category: ['host'], + type: ['info'], + module: 'endpoint', + action: 'endpoint_metadata', + dataset: 'endpoint.metadata', + }, + host: { + hostname: 'rezzani-7.example.com', + name: 'rezzani-7.example.com', + id: 'fc0ff548-feba-41b6-8367-65e8790d0eaf', + ip: ['10.101.149.26', '2606:a000:ffc0:39:11ef:37b9:3371:578c'], + mac: ['e2-6d-f9-0-46-2e'], + os: { + full: 'Windows 10', + name: 'windows 10.0', + platform: 'Windows', + family: 'Windows', + version: '10.0', + Ext: { + variant: 'Windows Pro', + }, + }, + }, + }, + { + '@timestamp': timestamp, + agent: { + id: '963b081e-60d1-482c-befd-a5815fa8290f', + version: '6.6.1', + name: 'Elastic Endpoint', + }, + elastic: { + agent: { + id: '11488bae-880b-4e7b-8d28-aac2aa9de816', + }, + }, + Endpoint: { + status: 'enrolled', + policy: { + applied: { + name: 'Default', + id: 'C2A9093E-E289-4C0A-AA44-8C32A414FA7A', + status: 'failure', + }, + }, + }, + event: { + created: timestamp, + id: '32f5fda2-48e4-4fae-b89e-a18038294d18', + kind: 'metric', + category: ['host'], + type: ['info'], + module: 'endpoint', + action: 'endpoint_metadata', + dataset: 'endpoint.metadata', + }, + host: { + architecture: 'x86', + hostname: 'cadmann-4.example.com', + name: 'cadmann-4.example.com', + id: '1fb3e58f-6ab0-4406-9d2a-91911207a712', + ip: ['10.192.213.130', '10.70.28.129'], + mac: ['a9-71-6a-cc-93-85', 'f7-31-84-d3-21-68', '2-95-12-39-ca-71'], + os: { + full: 'Windows Server 2016', + name: 'windows 10.0', + platform: 'Windows', + family: 'Windows', + version: '10.0', + Ext: { + variant: 'Windows Server 2016', + }, + }, + }, + }, + { + '@timestamp': timestamp, + agent: { + id: 'b3412d6f-b022-4448-8fee-21cc936ea86b', + version: '6.0.0', + name: 'Elastic Endpoint', + }, + elastic: { + agent: { + id: '92ac1ce0-e1f7-409e-8af6-f17e97b1fc71', + }, + }, + Endpoint: { + status: 'enrolled', + policy: { + applied: { + name: 'Default', + id: 'C2A9093E-E289-4C0A-AA44-8C32A414FA7A', + status: 'success', + }, + }, + }, + event: { + created: timestamp, + id: '32f5fda2-48e4-4fae-b89e-a18038294d19', + kind: 'metric', + category: ['host'], + type: ['info'], + module: 'endpoint', + action: 'endpoint_metadata', + dataset: 'endpoint.metadata', + }, + host: { + hostname: 'thurlow-9.example.com', + name: 'thurlow-9.example.com', + id: '2f735e3d-be14-483b-9822-bad06e9045ca', + ip: ['10.46.229.234'], + mac: ['30-8c-45-55-69-b8', 'e5-36-7e-8f-a3-84', '39-a1-37-20-18-74'], + os: { + full: 'Windows Server 2012', + name: 'windows 6.2', + platform: 'Windows', + family: 'Windows', + version: '6.2', + Ext: { + variant: 'Windows Server 2012', + }, + }, + }, + }, + { + '@timestamp': timestamp, + agent: { + id: '3838df35-a095-4af4-8fce-0b6d78793f2e', + version: '6.8.0', + name: 'Elastic Endpoint', + }, + elastic: { + agent: { + id: '023fa40c-411d-4188-a941-4147bfadd095', + }, + }, + Endpoint: { + status: 'enrolled', + policy: { + applied: { + name: 'With Eventing', + id: '00000000-0000-0000-0000-000000000000', + status: 'failure', + }, + }, + }, + event: { + created: timestamp, + id: '32f5fda2-48e4-4fae-b89e-a18038294d39', + kind: 'metric', + category: ['host'], + type: ['info'], + module: 'endpoint', + action: 'endpoint_metadata', + dataset: 'endpoint.metadata', + }, + host: { + architecture: 'x86', + hostname: 'rezzani-7.example.com', + name: 'rezzani-7.example.com', + id: 'fc0ff548-feba-41b6-8367-65e8790d0eaf', + ip: ['10.101.149.26', '2606:a000:ffc0:39:11ef:37b9:3371:578c'], + mac: ['e2-6d-f9-0-46-2e'], + os: { + full: 'Windows Server 2012', + name: 'windows 6.2', + platform: 'Windows', + family: 'Windows', + version: '6.2', + Ext: { + variant: 'Windows Server 2012', + }, + }, + }, + }, + { + '@timestamp': timestamp, + agent: { + id: '963b081e-60d1-482c-befd-a5815fa8290f', + version: '6.6.1', + name: 'Elastic Endpoint', + }, + elastic: { + agent: { + id: '11488bae-880b-4e7b-8d28-aac2aa9de816', + }, + }, + Endpoint: { + status: 'enrolled', + policy: { + applied: { + name: 'With Eventing', + id: '00000000-0000-0000-0000-000000000000', + status: 'failure', + }, + }, + }, + event: { + created: timestamp, + id: '32f5fda2-48e4-4fae-b89e-a18038294d31', + kind: 'metric', + category: ['host'], + type: ['info'], + module: 'endpoint', + action: 'endpoint_metadata', + dataset: 'endpoint.metadata', + }, + host: { + hostname: 'cadmann-4.example.com', + name: 'cadmann-4.example.com', + id: '1fb3e58f-6ab0-4406-9d2a-91911207a712', + ip: ['10.192.213.130', '10.70.28.129'], + mac: ['a9-71-6a-cc-93-85', 'f7-31-84-d3-21-68', '2-95-12-39-ca-71'], + os: { + full: 'Windows Server 2012R2', + name: 'windows 6.3', + platform: 'Windows', + family: 'Windows', + version: '6.3', + Ext: { + variant: 'Windows Server 2012 R2', + }, + }, + }, + }, + { + '@timestamp': timestamp, + agent: { + id: 'b3412d6f-b022-4448-8fee-21cc936ea86b', + version: '6.0.0', + name: 'Elastic Endpoint', + }, + elastic: { + agent: { + id: '92ac1ce0-e1f7-409e-8af6-f17e97b1fc71', + }, + }, + Endpoint: { + status: 'enrolled', + policy: { + applied: { + name: 'Default', + id: 'C2A9093E-E289-4C0A-AA44-8C32A414FA7A', + status: 'success', + }, + }, + }, + event: { + created: timestamp, + id: '32f5fda2-48e4-4fae-b89e-a18038294d23', + kind: 'metric', + category: ['host'], + type: ['info'], + module: 'endpoint', + action: 'endpoint_metadata', + dataset: 'endpoint.metadata', + }, + host: { + hostname: 'thurlow-9.example.com', + name: 'thurlow-9.example.com', + id: '2f735e3d-be14-483b-9822-bad06e9045ca', + ip: ['10.46.229.234'], + mac: ['30-8c-45-55-69-b8', 'e5-36-7e-8f-a3-84', '39-a1-37-20-18-74'], + os: { + full: 'Windows Server 2012R2', + name: 'windows 6.3', + platform: 'Windows', + family: 'Windows', + version: '6.3', + Ext: { + variant: 'Windows Server 2012 R2', + }, + }, + }, + }, + { + '@timestamp': timestamp, + agent: { + id: '3838df35-a095-4af4-8fce-0b6d78793f2e', + version: '6.8.0', + name: 'Elastic Endpoint', + }, + elastic: { + agent: { + id: '023fa40c-411d-4188-a941-4147bfadd095', + }, + }, + Endpoint: { + status: 'enrolled', + policy: { + applied: { + name: 'With Eventing', + id: '00000000-0000-0000-0000-000000000000', + status: 'success', + }, + }, + }, + event: { + created: timestamp, + id: '32f5fda2-48e4-4fae-b89e-a18038294d35', + kind: 'metric', + category: ['host'], + type: ['info'], + module: 'endpoint', + action: 'endpoint_metadata', + dataset: 'endpoint.metadata', + }, + host: { + architecture: 'x86', + hostname: 'rezzani-7.example.com', + name: 'rezzani-7.example.com', + id: 'fc0ff548-feba-41b6-8367-65e8790d0eaf', + ip: ['10.101.149.26', '2606:a000:ffc0:39:11ef:37b9:3371:578c'], + mac: ['e2-6d-f9-0-46-2e'], + os: { + full: 'Windows Server 2012', + name: 'windows 6.2', + version: '6.2', + platform: 'Windows', + family: 'Windows', + Ext: { + variant: 'Windows Server 2012', + }, + }, + }, + }, + ]; +} diff --git a/x-pack/test/security_solution_endpoint_api_int/apis/metadata.ts b/x-pack/test/security_solution_endpoint_api_int/apis/metadata.ts index afdc364ffd97..35e316f309d7 100644 --- a/x-pack/test/security_solution_endpoint_api_int/apis/metadata.ts +++ b/x-pack/test/security_solution_endpoint_api_int/apis/metadata.ts @@ -9,25 +9,289 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../ftr_provider_context'; import { deleteAllDocsFromMetadataCurrentIndex, - deleteAllDocsFromMetadataIndex, + deleteAllDocsFromMetadataDatastream, deleteMetadataStream, deleteIndex, stopTransform, + startTransform, + deleteAllDocsFromFleetAgents, + deleteAllDocsFromIndex, + bulkIndex, } from './data_stream_helper'; import { + METADATA_DATASTREAM, HOST_METADATA_LIST_ROUTE, METADATA_UNITED_INDEX, METADATA_UNITED_TRANSFORM, } from '../../../plugins/security_solution/common/endpoint/constants'; +import { AGENTS_INDEX } from '../../../plugins/fleet/common'; +import { generateAgentDocs, generateMetadataDocs } from './metadata.fixtures'; +import { indexFleetEndpointPolicy } from '../../../plugins/security_solution/common/endpoint/data_loaders/index_fleet_endpoint_policy'; export default function ({ getService }: FtrProviderContext) { - const esArchiver = getService('esArchiver'); const supertest = getService('supertest'); describe('test metadata api', () => { - // TODO add this after endpoint package changes are merged and in snapshot - // describe('with .metrics-endpoint.metadata_united_default index', () => { - // }); + describe('with .metrics-endpoint.metadata_united_default index', () => { + const numberOfHostsInFixture = 2; + + before(async () => { + await stopTransform(getService, `${METADATA_UNITED_TRANSFORM}*`); + await deleteAllDocsFromFleetAgents(getService); + await deleteAllDocsFromMetadataDatastream(getService); + await deleteAllDocsFromMetadataCurrentIndex(getService); + await deleteAllDocsFromIndex(getService, METADATA_UNITED_INDEX); + + // generate an endpoint policy and attach id to agents since + // metadata list api filters down to endpoint policies only + const policy = await indexFleetEndpointPolicy( + getService('kibanaServer'), + 'Default', + '1.1.1' + ); + const policyId = policy.integrationPolicies[0].policy_id; + const currentTime = new Date().getTime(); + + await Promise.all([ + bulkIndex(getService, AGENTS_INDEX, generateAgentDocs(currentTime, policyId)), + bulkIndex(getService, METADATA_DATASTREAM, generateMetadataDocs(currentTime)), + ]); + + // wait for latest metadata transform to run + await new Promise((r) => setTimeout(r, 30000)); + await startTransform(getService, METADATA_UNITED_TRANSFORM); + + // wait for united metadata transform to run + await new Promise((r) => setTimeout(r, 15000)); + }); + + after(async () => { + await deleteAllDocsFromFleetAgents(getService); + await deleteAllDocsFromMetadataDatastream(getService); + await deleteAllDocsFromMetadataCurrentIndex(getService); + await stopTransform(getService, `${METADATA_UNITED_TRANSFORM}*`); + await deleteAllDocsFromIndex(getService, METADATA_UNITED_INDEX); + }); + + it('should return one entry for each host with default paging', async () => { + const res = await supertest + .post(HOST_METADATA_LIST_ROUTE) + .set('kbn-xsrf', 'xxx') + .send() + .expect(200); + const { body } = res; + expect(body.total).to.eql(numberOfHostsInFixture); + expect(body.hosts.length).to.eql(numberOfHostsInFixture); + expect(body.request_page_size).to.eql(10); + expect(body.request_page_index).to.eql(0); + }); + + it('metadata api should return page based on paging properties passed.', async () => { + const { body } = await supertest + .post(HOST_METADATA_LIST_ROUTE) + .set('kbn-xsrf', 'xxx') + .send({ + paging_properties: [ + { + page_size: 1, + }, + { + page_index: 1, + }, + ], + }) + .expect(200); + expect(body.total).to.eql(numberOfHostsInFixture); + expect(body.hosts.length).to.eql(1); + expect(body.request_page_size).to.eql(1); + expect(body.request_page_index).to.eql(1); + }); + + it('metadata api should return accurate total metadata if page index produces no result', async () => { + const { body } = await supertest + .post(HOST_METADATA_LIST_ROUTE) + .set('kbn-xsrf', 'xxx') + .send({ + paging_properties: [ + { + page_size: 10, + }, + { + page_index: 3, + }, + ], + }) + .expect(200); + expect(body.total).to.eql(numberOfHostsInFixture); + expect(body.hosts.length).to.eql(0); + expect(body.request_page_size).to.eql(10); + expect(body.request_page_index).to.eql(30); + }); + + it('metadata api should return 400 when pagingProperties is below boundaries.', async () => { + const { body } = await supertest + .post(HOST_METADATA_LIST_ROUTE) + .set('kbn-xsrf', 'xxx') + .send({ + paging_properties: [ + { + page_size: 0, + }, + { + page_index: 1, + }, + ], + }) + .expect(400); + expect(body.message).to.contain('Value must be equal to or greater than [1]'); + }); + + it('metadata api should return page based on filters passed.', async () => { + const { body } = await supertest + .post(HOST_METADATA_LIST_ROUTE) + .set('kbn-xsrf', 'xxx') + .send({ + filters: { + kql: 'not (united.endpoint.host.ip:10.101.149.26)', + }, + }) + .expect(200); + expect(body.total).to.eql(1); + expect(body.hosts.length).to.eql(1); + expect(body.request_page_size).to.eql(10); + expect(body.request_page_index).to.eql(0); + }); + + it('metadata api should return page based on filters and paging passed.', async () => { + const notIncludedIp = '10.101.149.26'; + const { body } = await supertest + .post(HOST_METADATA_LIST_ROUTE) + .set('kbn-xsrf', 'xxx') + .send({ + paging_properties: [ + { + page_size: 10, + }, + { + page_index: 0, + }, + ], + filters: { + kql: `not (united.endpoint.host.ip:${notIncludedIp})`, + }, + }) + .expect(200); + expect(body.total).to.eql(1); + const resultIps: string[] = [].concat( + ...body.hosts.map((hostInfo: Record) => hostInfo.metadata.host.ip) + ); + expect(resultIps.sort()).to.eql(['10.192.213.130', '10.70.28.129'].sort()); + expect(resultIps).not.include.eql(notIncludedIp); + expect(body.hosts.length).to.eql(1); + expect(body.request_page_size).to.eql(10); + expect(body.request_page_index).to.eql(0); + }); + + it('metadata api should return page based on host.os.Ext.variant filter.', async () => { + const variantValue = 'Windows Pro'; + const { body } = await supertest + .post(HOST_METADATA_LIST_ROUTE) + .set('kbn-xsrf', 'xxx') + .send({ + filters: { + kql: `united.endpoint.host.os.Ext.variant:${variantValue}`, + }, + }) + .expect(200); + expect(body.total).to.eql(2); + const resultOsVariantValue: Set = new Set( + body.hosts.map((hostInfo: Record) => hostInfo.metadata.host.os.Ext.variant) + ); + expect(Array.from(resultOsVariantValue)).to.eql([variantValue]); + expect(body.hosts.length).to.eql(2); + expect(body.request_page_size).to.eql(10); + expect(body.request_page_index).to.eql(0); + }); + + it('metadata api should return the latest event for all the events for an endpoint', async () => { + const targetEndpointIp = '10.101.149.26'; + const { body } = await supertest + .post(HOST_METADATA_LIST_ROUTE) + .set('kbn-xsrf', 'xxx') + .send({ + filters: { + kql: `united.endpoint.host.ip:${targetEndpointIp}`, + }, + }) + .expect(200); + expect(body.total).to.eql(1); + const resultIp: string = body.hosts[0].metadata.host.ip.filter( + (ip: string) => ip === targetEndpointIp + ); + expect(resultIp).to.eql([targetEndpointIp]); + expect(body.hosts.length).to.eql(1); + expect(body.request_page_size).to.eql(10); + expect(body.request_page_index).to.eql(0); + }); + + it('metadata api should return the latest event for all the events where policy status is not success', async () => { + const { body } = await supertest + .post(HOST_METADATA_LIST_ROUTE) + .set('kbn-xsrf', 'xxx') + .send({ + filters: { + kql: `not (united.endpoint.Endpoint.policy.applied.status:success)`, + }, + }) + .expect(200); + const statuses: Set = new Set( + body.hosts.map( + (hostInfo: Record) => hostInfo.metadata.Endpoint.policy.applied.status + ) + ); + expect(statuses.size).to.eql(1); + expect(Array.from(statuses)).to.eql(['failure']); + }); + + it('metadata api should return the endpoint based on the elastic agent id, and status should be healthy', async () => { + const targetEndpointId = 'fc0ff548-feba-41b6-8367-65e8790d0eaf'; + const targetElasticAgentId = '023fa40c-411d-4188-a941-4147bfadd095'; + const { body } = await supertest + .post(HOST_METADATA_LIST_ROUTE) + .set('kbn-xsrf', 'xxx') + .send({ + filters: { + kql: `united.endpoint.elastic.agent.id:${targetElasticAgentId}`, + }, + }) + .expect(200); + expect(body.total).to.eql(1); + const resultHostId: string = body.hosts[0].metadata.host.id; + const resultElasticAgentId: string = body.hosts[0].metadata.elastic.agent.id; + expect(resultHostId).to.eql(targetEndpointId); + expect(resultElasticAgentId).to.eql(targetElasticAgentId); + expect(body.hosts[0].host_status).to.eql('healthy'); + expect(body.hosts.length).to.eql(1); + expect(body.request_page_size).to.eql(10); + expect(body.request_page_index).to.eql(0); + }); + + it('metadata api should return all hosts when filter is empty string', async () => { + const { body } = await supertest + .post(HOST_METADATA_LIST_ROUTE) + .set('kbn-xsrf', 'xxx') + .send({ + filters: { + kql: '', + }, + }) + .expect(200); + expect(body.total).to.eql(numberOfHostsInFixture); + expect(body.hosts.length).to.eql(numberOfHostsInFixture); + expect(body.request_page_size).to.eql(10); + expect(body.request_page_index).to.eql(0); + }); + }); describe('with metrics-endpoint.metadata_current_default index', () => { /** @@ -40,10 +304,10 @@ export default function ({ getService }: FtrProviderContext) { await stopTransform(getService, `${METADATA_UNITED_TRANSFORM}*`); await deleteIndex(getService, METADATA_UNITED_INDEX); await deleteMetadataStream(getService); - await deleteAllDocsFromMetadataIndex(getService); + await deleteAllDocsFromMetadataDatastream(getService); await deleteAllDocsFromMetadataCurrentIndex(getService); const { body } = await supertest - .post(`${HOST_METADATA_LIST_ROUTE}`) + .post(HOST_METADATA_LIST_ROUTE) .set('kbn-xsrf', 'xxx') .send() .expect(200); @@ -55,30 +319,26 @@ export default function ({ getService }: FtrProviderContext) { }); describe(`POST ${HOST_METADATA_LIST_ROUTE} when index is not empty`, () => { + const timestamp = new Date().getTime(); before(async () => { // stop the united transform and delete the index // otherwise it won't hit metrics-endpoint.metadata_current_default index await stopTransform(getService, `${METADATA_UNITED_TRANSFORM}*`); await deleteIndex(getService, METADATA_UNITED_INDEX); - await esArchiver.load( - 'x-pack/test/functional/es_archives/endpoint/metadata/api_feature', - { - useCreate: true, - } - ); + await bulkIndex(getService, METADATA_DATASTREAM, generateMetadataDocs(timestamp)); // wait for transform - await new Promise((r) => setTimeout(r, 120000)); + await new Promise((r) => setTimeout(r, 60000)); }); // the endpoint uses data streams and es archiver does not support deleting them at the moment so we need // to do it manually after(async () => { await deleteMetadataStream(getService); - await deleteAllDocsFromMetadataIndex(getService); + await deleteAllDocsFromMetadataDatastream(getService); await deleteAllDocsFromMetadataCurrentIndex(getService); }); it('metadata api should return one entry for each host with default paging', async () => { const { body } = await supertest - .post(`${HOST_METADATA_LIST_ROUTE}`) + .post(HOST_METADATA_LIST_ROUTE) .set('kbn-xsrf', 'xxx') .send() .expect(200); @@ -90,7 +350,7 @@ export default function ({ getService }: FtrProviderContext) { it('metadata api should return page based on paging properties passed.', async () => { const { body } = await supertest - .post(`${HOST_METADATA_LIST_ROUTE}`) + .post(HOST_METADATA_LIST_ROUTE) .set('kbn-xsrf', 'xxx') .send({ paging_properties: [ @@ -114,7 +374,7 @@ export default function ({ getService }: FtrProviderContext) { */ it('metadata api should return accurate total metadata if page index produces no result', async () => { const { body } = await supertest - .post(`${HOST_METADATA_LIST_ROUTE}`) + .post(HOST_METADATA_LIST_ROUTE) .set('kbn-xsrf', 'xxx') .send({ paging_properties: [ @@ -135,7 +395,7 @@ export default function ({ getService }: FtrProviderContext) { it('metadata api should return 400 when pagingProperties is below boundaries.', async () => { const { body } = await supertest - .post(`${HOST_METADATA_LIST_ROUTE}`) + .post(HOST_METADATA_LIST_ROUTE) .set('kbn-xsrf', 'xxx') .send({ paging_properties: [ @@ -153,7 +413,7 @@ export default function ({ getService }: FtrProviderContext) { it('metadata api should return page based on filters passed.', async () => { const { body } = await supertest - .post(`${HOST_METADATA_LIST_ROUTE}`) + .post(HOST_METADATA_LIST_ROUTE) .set('kbn-xsrf', 'xxx') .send({ filters: { @@ -170,7 +430,7 @@ export default function ({ getService }: FtrProviderContext) { it('metadata api should return page based on filters and paging passed.', async () => { const notIncludedIp = '10.46.229.234'; const { body } = await supertest - .post(`${HOST_METADATA_LIST_ROUTE}`) + .post(HOST_METADATA_LIST_ROUTE) .set('kbn-xsrf', 'xxx') .send({ paging_properties: [ @@ -207,7 +467,7 @@ export default function ({ getService }: FtrProviderContext) { it('metadata api should return page based on host.os.Ext.variant filter.', async () => { const variantValue = 'Windows Pro'; const { body } = await supertest - .post(`${HOST_METADATA_LIST_ROUTE}`) + .post(HOST_METADATA_LIST_ROUTE) .set('kbn-xsrf', 'xxx') .send({ filters: { @@ -228,7 +488,7 @@ export default function ({ getService }: FtrProviderContext) { it('metadata api should return the latest event for all the events for an endpoint', async () => { const targetEndpointIp = '10.46.229.234'; const { body } = await supertest - .post(`${HOST_METADATA_LIST_ROUTE}`) + .post(HOST_METADATA_LIST_ROUTE) .set('kbn-xsrf', 'xxx') .send({ filters: { @@ -241,7 +501,7 @@ export default function ({ getService }: FtrProviderContext) { (ip: string) => ip === targetEndpointIp ); expect(resultIp).to.eql([targetEndpointIp]); - expect(body.hosts[0].metadata.event.created).to.eql(1634656952181); + expect(body.hosts[0].metadata.event.created).to.eql(timestamp); expect(body.hosts.length).to.eql(1); expect(body.request_page_size).to.eql(10); expect(body.request_page_index).to.eql(0); @@ -249,7 +509,7 @@ export default function ({ getService }: FtrProviderContext) { it('metadata api should return the latest event for all the events where policy status is not success', async () => { const { body } = await supertest - .post(`${HOST_METADATA_LIST_ROUTE}`) + .post(HOST_METADATA_LIST_ROUTE) .set('kbn-xsrf', 'xxx') .send({ filters: { @@ -270,7 +530,7 @@ export default function ({ getService }: FtrProviderContext) { const targetEndpointId = 'fc0ff548-feba-41b6-8367-65e8790d0eaf'; const targetElasticAgentId = '023fa40c-411d-4188-a941-4147bfadd095'; const { body } = await supertest - .post(`${HOST_METADATA_LIST_ROUTE}`) + .post(HOST_METADATA_LIST_ROUTE) .set('kbn-xsrf', 'xxx') .send({ filters: { @@ -283,7 +543,7 @@ export default function ({ getService }: FtrProviderContext) { const resultElasticAgentId: string = body.hosts[0].metadata.elastic.agent.id; expect(resultHostId).to.eql(targetEndpointId); expect(resultElasticAgentId).to.eql(targetElasticAgentId); - expect(body.hosts[0].metadata.event.created).to.eql(1634656952181); + expect(body.hosts[0].metadata.event.created).to.eql(timestamp); expect(body.hosts[0].host_status).to.eql('unhealthy'); expect(body.hosts.length).to.eql(1); expect(body.request_page_size).to.eql(10); @@ -292,7 +552,7 @@ export default function ({ getService }: FtrProviderContext) { it('metadata api should return all hosts when filter is empty string', async () => { const { body } = await supertest - .post(`${HOST_METADATA_LIST_ROUTE}`) + .post(HOST_METADATA_LIST_ROUTE) .set('kbn-xsrf', 'xxx') .send({ filters: { diff --git a/yarn.lock b/yarn.lock index 7c2f64a0983b..7a66ff2bf412 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4204,68 +4204,60 @@ resolved "https://registry.yarnpkg.com/@mdx-js/util/-/util-1.6.22.tgz#219dfd89ae5b97a8801f015323ffa4b62f45718b" integrity sha512-H1rQc1ZOHANWBvPcW+JpGwr+juXSxM8Q8YCkm3GhZd8REu1fHR3z99CErO1p9pkcfcxZnMdIZdIsXkOHY0NilA== -"@microsoft/api-documenter@7.7.2": - version "7.7.2" - resolved "https://registry.yarnpkg.com/@microsoft/api-documenter/-/api-documenter-7.7.2.tgz#b6897f052ad447d6bb74f806287e8846c64691da" - integrity sha512-4mWE5G3grYd4PX5D6awiKa3B3GOXumkyGspgeTwlOBxrmj0FuVFRNPVZxGU0NqYnaw/bW4cg4ftUnSDzycrW+A== - dependencies: - "@microsoft/api-extractor-model" "7.7.0" - "@microsoft/node-core-library" "3.18.0" - "@microsoft/ts-command-line" "4.3.5" - "@microsoft/tsdoc" "0.12.14" +"@microsoft/api-documenter@7.13.68": + version "7.13.68" + resolved "https://registry.yarnpkg.com/@microsoft/api-documenter/-/api-documenter-7.13.68.tgz#c1e144764cac0684adefe78fd848d78c3f374681" + integrity sha512-cRjwK1TDyGxFGgCsRG8G0Yi3Z4akvfWgw1pWAxKFbm7ajlQQGZcHPnb+n4lKlSeQ5g/cxc7hcdw54Mvisne9Bg== + dependencies: + "@microsoft/api-extractor-model" "7.13.16" + "@microsoft/tsdoc" "0.13.2" + "@rushstack/node-core-library" "3.43.2" + "@rushstack/ts-command-line" "4.10.4" colors "~1.2.1" js-yaml "~3.13.1" - resolve "1.8.1" - -"@microsoft/api-extractor-model@7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.7.0.tgz#a5e86a638fa3fea283aeebc4785d8150652f30c6" - integrity sha512-9yrSr9LpdNnx7X8bXVb/YbcQopizsr43McAG7Xno5CMNFzbSkmIr8FJL0L+WGfrSWSTms9Bngfz7d1ScP6zbWQ== - dependencies: - "@microsoft/node-core-library" "3.18.0" - "@microsoft/tsdoc" "0.12.14" - -"@microsoft/api-extractor@7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.7.0.tgz#1550a5b88ca927d57e9c9698356a2f9375c5984c" - integrity sha512-1ngy95VA1s7GTE+bkS7QoYTg/TZs54CdJ46uAhl6HlyDJut4p/aH46W70g2XQs9VniIymW1Qe6fqNmcQUx5CVg== - dependencies: - "@microsoft/api-extractor-model" "7.7.0" - "@microsoft/node-core-library" "3.18.0" - "@microsoft/ts-command-line" "4.3.5" - "@microsoft/tsdoc" "0.12.14" + resolve "~1.17.0" + +"@microsoft/api-extractor-model@7.13.16": + version "7.13.16" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.13.16.tgz#1d67541ebbcea32672c5fdd9392dc1579b2fc23a" + integrity sha512-ttdxVXsTWL5dd26W1YNLe3LgDsE0EE273aZlcLe58W0opymBybCYU1Mn+OHQM8BuErrdvdN8LdpWAAbkiOEN/Q== + dependencies: + "@microsoft/tsdoc" "0.13.2" + "@microsoft/tsdoc-config" "~0.15.2" + "@rushstack/node-core-library" "3.43.2" + +"@microsoft/api-extractor@7.18.19": + version "7.18.19" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.18.19.tgz#f09afc1c210aa67e2f3f34b0a68281a12f144541" + integrity sha512-aY+/XR7PtQXtnqNPFRs3/+iVRlQJpo6uLTjO2g7PqmnMywl3GBU3bCgAlV/khZtAQbIs6Le57XxmSE6rOqbcfg== + dependencies: + "@microsoft/api-extractor-model" "7.13.16" + "@microsoft/tsdoc" "0.13.2" + "@microsoft/tsdoc-config" "~0.15.2" + "@rushstack/node-core-library" "3.43.2" + "@rushstack/rig-package" "0.3.5" + "@rushstack/ts-command-line" "4.10.4" colors "~1.2.1" lodash "~4.17.15" - resolve "1.8.1" + resolve "~1.17.0" + semver "~7.3.0" source-map "~0.6.1" - typescript "~3.7.2" + typescript "~4.4.2" -"@microsoft/node-core-library@3.18.0": - version "3.18.0" - resolved "https://registry.yarnpkg.com/@microsoft/node-core-library/-/node-core-library-3.18.0.tgz#9a9123354b3e067bb8a975ba791959ffee1322ed" - integrity sha512-VzzSHtcwgHVW1xbHqpngfn+OS1trAZ1Tw3XXBlMsEKe7Wz7FF2gLr0hZa6x9Pemk5pkd4tu4+GTSOJjCKGjrgg== +"@microsoft/tsdoc-config@~0.15.2": + version "0.15.2" + resolved "https://registry.yarnpkg.com/@microsoft/tsdoc-config/-/tsdoc-config-0.15.2.tgz#eb353c93f3b62ab74bdc9ab6f4a82bcf80140f14" + integrity sha512-mK19b2wJHSdNf8znXSMYVShAHktVr/ib0Ck2FA3lsVBSEhSI/TfXT7DJQkAYgcztTuwazGcg58ZjYdk0hTCVrA== dependencies: - "@types/node" "8.10.54" - colors "~1.2.1" - fs-extra "~7.0.1" + "@microsoft/tsdoc" "0.13.2" + ajv "~6.12.6" jju "~1.4.0" - semver "~5.3.0" - timsort "~0.3.0" - z-schema "~3.18.3" - -"@microsoft/ts-command-line@4.3.5": - version "4.3.5" - resolved "https://registry.yarnpkg.com/@microsoft/ts-command-line/-/ts-command-line-4.3.5.tgz#78026d20244f39978d3397849ac8c40c0c2d4079" - integrity sha512-CN3j86apNOmllUmeJ0AyRfTYA2BP2xlnfgmnyp1HWLqcJmR/zLe/fk/+gohGnNt7o5/qHta3681LQhO2Yy3GFw== - dependencies: - "@types/argparse" "1.0.33" - argparse "~1.0.9" - colors "~1.2.1" + resolve "~1.19.0" -"@microsoft/tsdoc@0.12.14": - version "0.12.14" - resolved "https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.12.14.tgz#0e0810a0a174e50e22dfe8edb30599840712f22d" - integrity sha512-518yewjSga1jLdiLrcmpMFlaba5P+50b0TWNFUpC+SL9Yzf0kMi57qw+bMl+rQ08cGqH1vLx4eg9YFUbZXgZ0Q== +"@microsoft/tsdoc@0.13.2": + version "0.13.2" + resolved "https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.13.2.tgz#3b0efb6d3903bd49edb073696f60e90df08efb26" + integrity sha512-WrHvO8PDL8wd8T2+zBGKrMwVL5IyzR3ryWUsl0PXgEV0QHup4mTLi0QcATefGI6Gx9Anu7vthPyyyLpY0EpiQg== "@mrmlnc/readdir-enhanced@^2.2.1": version "2.2.1" @@ -4786,6 +4778,39 @@ redux-thunk "^2.3.0" reselect "^4.0.0" +"@rushstack/node-core-library@3.43.2": + version "3.43.2" + resolved "https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-3.43.2.tgz#f067371a94fd92ed8f9d9aa8201c5e9e17a19f0f" + integrity sha512-b7AEhSf6CvZgvuDcWMFDeKx2mQSn9AVnMQVyxNxFeHCtLz3gJicqCOlw2GOXM8HKh6PInLdil/NVCDcstwSrIw== + dependencies: + "@types/node" "12.20.24" + colors "~1.2.1" + fs-extra "~7.0.1" + import-lazy "~4.0.0" + jju "~1.4.0" + resolve "~1.17.0" + semver "~7.3.0" + timsort "~0.3.0" + z-schema "~3.18.3" + +"@rushstack/rig-package@0.3.5": + version "0.3.5" + resolved "https://registry.yarnpkg.com/@rushstack/rig-package/-/rig-package-0.3.5.tgz#7ddab0994647837bab8fdef26f990f1774d82e78" + integrity sha512-CvqWw+E81U5lRBN/lUj7Ngr/XQa/PPb2jAS5QcLP7WL+IMUl+3+Cc2qYrsDoB4zke81kz+usWGmBQpBzGMLmAA== + dependencies: + resolve "~1.17.0" + strip-json-comments "~3.1.1" + +"@rushstack/ts-command-line@4.10.4": + version "4.10.4" + resolved "https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.10.4.tgz#05142b74e5cb207d3dd9b935c82f80d7fcb68042" + integrity sha512-4T5ao4UgDb6LmiRj4GumvG3VT/p6RSMgl7TN7S58ifaAGN2GeTNBajFCDdJs9QQP0d/4tA5p0SFzT7Ps5Byirg== + dependencies: + "@types/argparse" "1.0.38" + argparse "~1.0.9" + colors "~1.2.1" + string-argv "~0.3.1" + "@samverschueren/stream-to-observable@^0.3.0": version "0.3.0" resolved "https://registry.yarnpkg.com/@samverschueren/stream-to-observable/-/stream-to-observable-0.3.0.tgz#ecdf48d532c58ea477acfcab80348424f8d0662f" @@ -5846,10 +5871,10 @@ dependencies: "@types/glob" "*" -"@types/argparse@1.0.33": - version "1.0.33" - resolved "https://registry.yarnpkg.com/@types/argparse/-/argparse-1.0.33.tgz#2728669427cdd74a99e53c9f457ca2866a37c52d" - integrity sha512-VQgHxyPMTj3hIlq9SY1mctqx+Jj8kpQfoLvDlVSDNOyuYs8JYfkuY3OW/4+dO657yPmNhHpePRx0/Tje5ImNVQ== +"@types/argparse@1.0.38": + version "1.0.38" + resolved "https://registry.yarnpkg.com/@types/argparse/-/argparse-1.0.38.tgz#a81fd8606d481f873a3800c6ebae4f1d768a56a9" + integrity sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA== "@types/aria-query@^4.2.0": version "4.2.0" @@ -5905,11 +5930,6 @@ resolved "https://registry.yarnpkg.com/@types/base64-js/-/base64-js-1.2.5.tgz#582b2476169a6cba460a214d476c744441d873d5" integrity sha1-WCskdhaabLpGCiFNR2x0REHYc9U= -"@types/bluebird@^3.1.1": - version "3.5.30" - resolved "https://registry.yarnpkg.com/@types/bluebird/-/bluebird-3.5.30.tgz#ee034a0eeea8b84ed868b1aa60d690b08a6cfbc5" - integrity sha512-8LhzvcjIoqoi1TghEkRMkbbmM+jhHnBokPGkJWjclMK+Ks0MxEBow3/p2/iFTZ+OIbJHQDSfpgdZEb+af3gfVw== - "@types/braces@*": version "3.0.0" resolved "https://registry.yarnpkg.com/@types/braces/-/braces-3.0.0.tgz#7da1c0d44ff1c7eb660a36ec078ea61ba7eb42cb" @@ -6679,7 +6699,7 @@ dependencies: "@types/node" "*" -"@types/node@*", "@types/node@16.10.2", "@types/node@8.10.54", "@types/node@>= 8", "@types/node@>=8.9.0", "@types/node@^10.1.0", "@types/node@^14.14.31": +"@types/node@*", "@types/node@12.20.24", "@types/node@16.10.2", "@types/node@>= 8", "@types/node@>=8.9.0", "@types/node@^10.1.0", "@types/node@^14.14.31": version "16.10.2" resolved "https://registry.yarnpkg.com/@types/node/-/node-16.10.2.tgz#5764ca9aa94470adb4e1185fe2e9f19458992b2e" integrity sha512-zCclL4/rx+W5SQTzFs9wyvvyCwoK9QtBpratqz2IYJ3O8Umrn0m3nsTv0wQBk9sRGpvUe9CwPDrQFB10f1FIjQ== @@ -7906,7 +7926,7 @@ ajv@^6.1.0, ajv@^6.10.0, ajv@^6.10.2, ajv@^6.12.2, ajv@^6.12.4, ajv@^6.5.5: json-schema-traverse "^0.4.1" uri-js "^4.2.2" -ajv@^6.11.0, ajv@^6.12.5: +ajv@^6.11.0, ajv@^6.12.5, ajv@~6.12.6: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -9422,11 +9442,6 @@ bluebird@3.5.3: resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.3.tgz#7d01c6f9616c9a51ab0f8c549a79dfe6ec33efa7" integrity sha512-/qKPUQlaW1OyR51WeCPBvRnAlnZFUJkCSG5HzGnuIqhgyJtF+T94lFnn33eiazjRm2LAHVy2guNnaq48X9SJuw== -bluebird@3.5.5: - version "3.5.5" - resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.5.tgz#a8d0afd73251effbbd5fe384a77d73003c17a71f" - integrity sha512-5am6HnnfN+urzt4yfg7IgTbotDjIT/u8AJpEt0sIU9FtXfVeezXAPKswrG+xKUCOYAINpSdgZVDU6QFh+cuH3w== - bluebird@3.7.2, bluebird@^3.3.5, bluebird@^3.4.1, bluebird@^3.5.0, bluebird@^3.5.1, bluebird@^3.5.5, bluebird@^3.7.1, bluebird@^3.7.2: version "3.7.2" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" @@ -13225,10 +13240,10 @@ ejs@^3.1.2, ejs@^3.1.6: dependencies: jake "^10.6.1" -elastic-apm-http-client@^10.1.0: - version "10.1.0" - resolved "https://registry.yarnpkg.com/elastic-apm-http-client/-/elastic-apm-http-client-10.1.0.tgz#8fbfa3f026f40d82b22b77bf4ed539cc20623edb" - integrity sha512-G+UsOQS8+kTyjbZ9PBXgbN8RGgeTe3FfbVljiwuN+eIf0UwpSR8k5Oh+Z2BELTTVwTcit7NCH4+B4MPayYx1mw== +elastic-apm-http-client@^10.3.0: + version "10.3.0" + resolved "https://registry.yarnpkg.com/elastic-apm-http-client/-/elastic-apm-http-client-10.3.0.tgz#12b95dc190a755cd1a8ce2c296cd28ef50f16aa4" + integrity sha512-BAqB7k5JA/x09L8BVj04WRoknRptmW2rLAoHQVrPvPhUm/IgNz63wPfiBuhWVE//Hl7xEpURO5pMV6az0UArkA== dependencies: breadth-filter "^2.0.0" container-info "^1.0.1" @@ -13239,10 +13254,10 @@ elastic-apm-http-client@^10.1.0: readable-stream "^3.4.0" stream-chopper "^3.0.1" -elastic-apm-node@^3.23.0: - version "3.23.0" - resolved "https://registry.yarnpkg.com/elastic-apm-node/-/elastic-apm-node-3.23.0.tgz#e842aa505d576003579803e45fe91f572db74a72" - integrity sha512-yzdO/MwAcjT+TbcBQBKWbDb4beDVmmrIaFCu9VA+z6Ow9GKlQv7QaD9/cQjuN8/KI6ASiJfQI8cPgqy1SgSUuA== +elastic-apm-node@3.24.0: + version "3.24.0" + resolved "https://registry.yarnpkg.com/elastic-apm-node/-/elastic-apm-node-3.24.0.tgz#d7acb3352f928a23c28ebabab2bd30098562814e" + integrity sha512-Fmj/W2chWQa2zb1FfMYK2ypLB4TcnKNX+1klaJFbytRYDLgeSfo0EC7egvI3a+bLPZSRL5053PXOp7slVTPO6Q== dependencies: "@elastic/ecs-pino-format" "^1.2.0" after-all-results "^2.0.0" @@ -13251,7 +13266,7 @@ elastic-apm-node@^3.23.0: basic-auth "^2.0.1" cookie "^0.4.0" core-util-is "^1.0.2" - elastic-apm-http-client "^10.1.0" + elastic-apm-http-client "^10.3.0" end-of-stream "^1.4.4" error-callsites "^2.0.4" error-stack-parser "^2.0.6" @@ -16827,7 +16842,7 @@ import-lazy@^2.1.0: resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-2.1.0.tgz#05698e3d45c88e8d7e9d92cb0584e77f096f3e43" integrity sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM= -import-lazy@^4.0.0: +import-lazy@^4.0.0, import-lazy@~4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-4.0.0.tgz#e8eb627483a0a43da3c03f3e35548be5cb0cc153" integrity sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw== @@ -17201,7 +17216,7 @@ is-color-stop@^1.0.0: rgb-regex "^1.0.1" rgba-regex "^1.0.0" -is-core-module@^2.2.0: +is-core-module@^2.1.0, is-core-module@^2.2.0: version "2.7.0" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.7.0.tgz#3c0ef7d31b4acfc574f80c58409d568a836848e3" integrity sha512-ByY+tjCciCr+9nLryBYcSD50EOGWt95c7tIsKTG1J2ixKKXPvF7Ej3AVd+UfDydAJom3biBGDBALaO79ktwgEQ== @@ -22295,7 +22310,7 @@ path-key@^3.0.0, path-key@^3.1.0: resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.0.tgz#99a10d870a803bdd5ee6f0470e58dfcd2f9a54d3" integrity sha512-8cChqz0RP6SHJkMt48FW0A7+qUOn+OsnOsVtzI59tZ8m+5bCSk7hzwET0pulwOM2YMn9J1efb07KB9l9f30SGg== -path-parse@^1.0.5, path-parse@^1.0.6: +path-parse@^1.0.6: version "1.0.7" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== @@ -25352,13 +25367,6 @@ resolve@1.1.7: resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= -resolve@1.8.1: - version "1.8.1" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.8.1.tgz#82f1ec19a423ac1fbd080b0bab06ba36e84a7a26" - integrity sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA== - dependencies: - path-parse "^1.0.5" - resolve@^1.1.10, resolve@^1.1.4, resolve@^1.1.5, resolve@^1.1.6, resolve@^1.1.7, resolve@^1.10.0, resolve@^1.10.1, resolve@^1.12.0, resolve@^1.14.2, resolve@^1.17.0, resolve@^1.18.1, resolve@^1.20.0, resolve@^1.3.2, resolve@^1.3.3, resolve@^1.4.0, resolve@^1.7.1, resolve@^1.8.1: version "1.20.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975" @@ -25382,6 +25390,21 @@ resolve@~1.10.1: dependencies: path-parse "^1.0.6" +resolve@~1.17.0: + version "1.17.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444" + integrity sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w== + dependencies: + path-parse "^1.0.6" + +resolve@~1.19.0: + version "1.19.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.19.0.tgz#1af5bf630409734a067cae29318aac7fa29a267c" + integrity sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg== + dependencies: + is-core-module "^2.1.0" + path-parse "^1.0.6" + responselike@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/responselike/-/responselike-1.0.2.tgz#918720ef3b631c5642be068f15ade5a46f4ba1e7" @@ -25850,18 +25873,13 @@ semver@^7.2.1, semver@^7.3.2, semver@~7.3.2: resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938" integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ== -semver@^7.3.4, semver@^7.3.5: +semver@^7.3.4, semver@^7.3.5, semver@~7.3.0: version "7.3.5" resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== dependencies: lru-cache "^6.0.0" -semver@~5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" - integrity sha1-myzl094C0XxgEq0yaqa00M9U+U8= - send@0.17.1: version "0.17.1" resolved "https://registry.yarnpkg.com/send/-/send-0.17.1.tgz#c1d8b059f7900f7466dd4938bdc44e11ddb376c8" @@ -26900,6 +26918,11 @@ string-argv@0.0.2: resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.0.2.tgz#dac30408690c21f3c3630a3ff3a05877bdcbd736" integrity sha1-2sMECGkMIfPDYwo/86BYd73L1zY= +string-argv@~0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.1.tgz#95e2fbec0427ae19184935f816d74aaa4c5c19da" + integrity sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg== + string-length@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/string-length/-/string-length-1.0.1.tgz#56970fb1c38558e9e70b728bf3de269ac45adfac" @@ -27126,7 +27149,7 @@ strip-indent@^3.0.0: dependencies: min-indent "^1.0.0" -strip-json-comments@3.1.1, strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: +strip-json-comments@3.1.1, strip-json-comments@^3.1.0, strip-json-comments@^3.1.1, strip-json-comments@~3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== @@ -28478,7 +28501,7 @@ typescript-tuple@^2.2.1: dependencies: typescript-compare "^0.0.2" -typescript@4.1.3, typescript@^3.3.3333, typescript@^3.5.3, typescript@^4.3.5, typescript@~3.7.2, typescript@~4.1.2: +typescript@4.1.3, typescript@^3.3.3333, typescript@^3.5.3, typescript@^4.3.5, typescript@~4.1.2, typescript@~4.4.2: version "4.1.3" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.3.tgz#519d582bd94cba0cf8934c7d8e8467e473f53bb7" integrity sha512-B3ZIOf1IKeH2ixgHhj6la6xdwR9QrLC5d1VKeCSY4tvkqhF2eqd9O7txNlS0PO3GrBAFIdr3L1ndNwteUbZLYg==